/** * Constructor * * @param util.cmd.ParamString args */ public function __construct(\util\cmd\ParamString $args) { $dsn = new DSN($args->value(0)); $this->adapter = self::$adapters[$dsn->getDriver()]->newInstance(DriverManager::getInstance()->getConnection($dsn->dsn)); $this->package = $args->value('package', 'p', 'db'); $this->host = $args->value('host', 'h', $dsn->getHost()); $this->naming = $args->value('nstrategy', 'n', ''); if ('' != $this->naming) { DBXMLNamingContext::setStrategy(XPClass::forName($this->naming)->newInstance()); } $this->prefix = $args->value('prefix', 'pv', ''); $this->ptargets = explode('|', $args->value('ptargets', 'pt', '')); $this->pexclude = $args->value('pexclude', 'pe', false); // Setup generator $this->processor = new DomXSLProcessor(); $this->processor->setXSLBuf($this->getClass()->getPackage()->getResource($args->value('lang', 'l', 'xp5.php') . '.xsl')); $this->processor->setParam('package', $this->package); if ($this->prefix) { $this->processor->setParam('prefix', $this->prefix); $this->processor->setParam($this->pexclude ? 'exprefix' : 'incprefix', implode(',', $this->ptargets)); } }
public function withoutPassword() { $dsn = new DSN('mysql://*****:*****@localhost/'); $clean = $dsn->withoutPassword(); $this->assertNull($clean->getPassword()); }
/** * Queue a connection string for registering on demand. * * @param string dsn The connection's DSN * @return rdbms.DSN * @param string hostAlias default NULL * @param string userAlias default NULL */ public function queue($str, $hostAlias = null, $userAlias = null) { $dsn = new DSN($str); $host = null == $hostAlias ? $dsn->getHost() : $hostAlias; $user = null == $userAlias ? $dsn->getUser() : $userAlias; $this->pool[$user . '@' . $host] = $str; return $dsn; }