本文整理汇总了PHP中CI_DB_pdo_driver::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP CI_DB_pdo_driver::__construct方法的具体用法?PHP CI_DB_pdo_driver::__construct怎么用?PHP CI_DB_pdo_driver::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CI_DB_pdo_driver
的用法示例。
在下文中一共展示了CI_DB_pdo_driver::__construct方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* Builds the DSN if not already set.
*
* @param array
* @return void
*/
public function __construct($params)
{
parent::__construct($params);
if (empty($this->dsn)) {
$this->dsn = 'sqlsrv:Server=' . (empty($this->hostname) ? '127.0.0.1' : $this->hostname);
empty($this->port) or $this->dsn .= ',' . $this->port;
empty($this->database) or $this->dsn .= ';Database=' . $this->database;
// Some custom options
if (isset($this->QuotedId)) {
$this->dsn .= ';QuotedId=' . $this->QuotedId;
$this->_quoted_identifier = (bool) $this->QuotedId;
}
if (isset($this->ConnectionPooling)) {
$this->dsn .= ';ConnectionPooling=' . $this->ConnectionPooling;
}
if (isset($this->Encrypt)) {
$this->dsn .= ';Encrypt=' . $this->Encrypt;
}
if (isset($this->TraceOn)) {
$this->dsn .= ';TraceOn=' . $this->TraceOn;
}
if (isset($this->TrustServerCertificate)) {
$this->dsn .= ';TrustServerCertificate=' . $this->TrustServerCertificate;
}
empty($this->APP) or $this->dsn .= ';APP=' . $this->APP;
empty($this->Failover_Partner) or $this->dsn .= ';Failover_Partner=' . $this->Failover_Partner;
empty($this->LoginTimeout) or $this->dsn .= ';LoginTimeout=' . $this->LoginTimeout;
empty($this->MultipleActiveResultSets) or $this->dsn .= ';MultipleActiveResultSets=' . $this->MultipleActiveResultSets;
empty($this->TraceFile) or $this->dsn .= ';TraceFile=' . $this->TraceFile;
empty($this->WSID) or $this->dsn .= ';WSID=' . $this->WSID;
} elseif (preg_match('/QuotedId=(0|1)/', $this->dsn, $match)) {
$this->_quoted_identifier = (bool) $match[1];
}
}
示例2: __construct
/**
* Class constructor
*
* Builds the DSN if not already set.
*
* @param array $params
* @return void
*/
public function __construct($params)
{
parent::__construct($params);
if (empty($this->dsn)) {
$this->dsn = 'informix:';
// Pre-defined DSN
if (empty($this->hostname) && empty($this->host) && empty($this->port) && empty($this->service)) {
if (isset($this->DSN)) {
$this->dsn .= 'DSN=' . $this->DSN;
} elseif (!empty($this->database)) {
$this->dsn .= 'DSN=' . $this->database;
}
return;
}
if (isset($this->host)) {
$this->dsn .= 'host=' . $this->host;
} else {
$this->dsn .= 'host=' . (empty($this->hostname) ? '127.0.0.1' : $this->hostname);
}
if (isset($this->service)) {
$this->dsn .= '; service=' . $this->service;
} elseif (!empty($this->port)) {
$this->dsn .= '; service=' . $this->port;
}
empty($this->database) or $this->dsn .= '; database=' . $this->database;
empty($this->server) or $this->dsn .= '; server=' . $this->server;
$this->dsn .= '; protocol=' . (isset($this->protocol) ? $this->protocol : 'onsoctcp') . '; EnableScrollableCursors=1';
}
}
示例3: __construct
/**
* Class constructor
*
* Builds the DSN if not already set.
*
* @param array $params
* @return void
*/
public function __construct($params)
{
parent::__construct($params);
if (empty($this->dsn)) {
$this->dsn = 'ibm:';
// Pre-defined DSN
if (empty($this->hostname) && empty($this->HOSTNAME) && empty($this->port) && empty($this->PORT)) {
if (isset($this->DSN)) {
$this->dsn .= 'DSN=' . $this->DSN;
} elseif (!empty($this->database)) {
$this->dsn .= 'DSN=' . $this->database;
}
return;
}
$this->dsn .= 'DRIVER=' . (isset($this->DRIVER) ? '{' . $this->DRIVER . '}' : '{IBM DB2 ODBC DRIVER}') . ';';
if (isset($this->DATABASE)) {
$this->dsn .= 'DATABASE=' . $this->DATABASE . ';';
} elseif (!empty($this->database)) {
$this->dsn .= 'DATABASE=' . $this->database . ';';
}
if (isset($this->HOSTNAME)) {
$this->dsn .= 'HOSTNAME=' . $this->HOSTNAME . ';';
} else {
$this->dsn .= 'HOSTNAME=' . (empty($this->hostname) ? '127.0.0.1;' : $this->hostname . ';');
}
if (isset($this->PORT)) {
$this->dsn .= 'PORT=' . $this->port . ';';
} elseif (!empty($this->port)) {
$this->dsn .= ';PORT=' . $this->port . ';';
}
$this->dsn .= 'PROTOCOL=' . (isset($this->PROTOCOL) ? $this->PROTOCOL . ';' : 'TCPIP;');
}
}
示例4: __construct
/**
* Class constructor
*
* Builds the DSN if not already set.
*
* @param array $params
* @return void
*/
public function __construct($params)
{
parent::__construct($params);
if (empty($this->dsn)) {
$this->dsn = 'pgsql:host=' . (empty($this->hostname) ? '127.0.0.1' : $this->hostname);
empty($this->port) or $this->dsn .= ';port=' . $this->port;
empty($this->database) or $this->dsn .= ';dbname=' . $this->database;
}
}
示例5: __construct
/**
* Class constructor
*
* Builds the DSN if not already set.
*
* @param array $params
* @return void
*/
public function __construct($params)
{
parent::__construct($params);
if (empty($this->dsn)) {
$this->dsn = 'sqlite:';
if (empty($this->database) && empty($this->hostname)) {
$this->database = ':memory:';
}
$this->database = empty($this->database) ? $this->hostname : $this->database;
}
}
示例6: __construct
/**
* Class constructor
*
* Builds the DSN if not already set.
*
* @param array $params
* @return void
*/
public function __construct($params)
{
parent::__construct($params);
if (empty($this->dsn)) {
$this->dsn = '4D:host=' . (empty($this->hostname) ? '127.0.0.1' : $this->hostname);
empty($this->port) or $this->dsn .= ';port=' . $this->port;
empty($this->database) or $this->dsn .= ';dbname=' . $this->database;
empty($this->char_set) or $this->dsn .= ';charset=' . $this->char_set;
} elseif (!empty($this->char_set) && strpos($this->dsn, 'charset=', 3) === FALSE) {
$this->dsn .= ';charset=' . $this->char_set;
}
}
示例7: __construct
/**
* Class constructor
*
* Builds the DSN if not already set.
*
* @param array $params
* @return void
*/
public function __construct($params)
{
parent::__construct($params);
if (empty($this->dsn)) {
$this->dsn = 'firebird:';
if (!empty($this->database)) {
$this->dsn .= 'dbname=' . $this->database;
} elseif (!empty($this->hostname)) {
$this->dsn .= 'dbname=' . $this->hostname;
}
empty($this->char_set) or $this->dsn .= ';charset=' . $this->char_set;
empty($this->role) or $this->dsn .= ';role=' . $this->role;
} elseif (!empty($this->char_set) && strpos($this->dsn, 'charset=', 9) === FALSE) {
$this->dsn .= ';charset=' . $this->char_set;
}
}
示例8: __construct
/**
* Class constructor
*
* Builds the DSN if not already set.
*
* @param array $params
* @return void
*/
public function __construct($params)
{
parent::__construct($params);
if (empty($this->dsn)) {
$this->dsn = $params['subdriver'] . ':host=' . (empty($this->hostname) ? '127.0.0.1' : $this->hostname);
if (!empty($this->port)) {
$this->dsn .= (DIRECTORY_SEPARATOR === '\\' ? ',' : ':') . $this->port;
}
empty($this->database) or $this->dsn .= ';dbname=' . $this->database;
empty($this->char_set) or $this->dsn .= ';charset=' . $this->char_set;
empty($this->appname) or $this->dsn .= ';appname=' . $this->appname;
} else {
if (!empty($this->char_set) && strpos($this->dsn, 'charset=', 6) === FALSE) {
$this->dsn .= ';charset=' . $this->char_set;
}
$this->subdriver = 'dblib';
}
}
示例9: __construct
/**
* Class constructor
*
* Builds the DSN if not already set.
*
* @param array $params
* @return void
*/
public function __construct($params)
{
parent::__construct($params);
if (empty($this->dsn)) {
$this->dsn = 'oci:dbname=';
// Oracle has a slightly different PDO DSN format (Easy Connect),
// which also supports pre-defined DSNs.
if (empty($this->hostname) && empty($this->port)) {
$this->dsn .= $this->database;
} else {
$this->dsn .= '//' . (empty($this->hostname) ? '127.0.0.1' : $this->hostname) . (empty($this->port) ? '' : ':' . $this->port) . '/';
empty($this->database) or $this->dsn .= $this->database;
}
empty($this->char_set) or $this->dsn .= ';charset=' . $this->char_set;
} elseif (!empty($this->char_set) && strpos($this->dsn, 'charset=', 4) === FALSE) {
$this->dsn .= ';charset=' . $this->char_set;
}
}
示例10: __construct
/**
* Class constructor
*
* Builds the DSN if not already set.
*
* @param array $params
* @return void
*/
public function __construct($params)
{
parent::__construct($params);
$this->_build_dsn();
}
示例11: __construct
/**
* Class constructor.
*
* Builds the DSN if not already set.
*
* @param array $params
*
* @return void
*/
public function __construct($params)
{
parent::__construct($params);
if (empty($this->dsn)) {
$this->dsn = 'mysql:host=' . (empty($this->hostname) ? '127.0.0.1' : $this->hostname);
empty($this->port) or $this->dsn .= ';port=' . $this->port;
empty($this->database) or $this->dsn .= ';dbname=' . $this->database;
empty($this->char_set) or $this->dsn .= ';charset=' . $this->char_set;
} elseif (!empty($this->char_set) && strpos($this->dsn, 'charset=', 6) === false && is_php('5.3.6')) {
$this->dsn .= ';charset=' . $this->char_set;
}
}