public function __construct($params)
{
parent::__construct($params);
if (preg_match('/([^:]+):/', $this->dsn, $match) && count($match) === 2) {
// If there is a minimum valid dsn string pattern found, we're done
// This is for general PDO users, who tend to have a full DSN string.
$this->subdriver = $match[1];
return;
} elseif (preg_match('/([^:]+):/', $this->hostname, $match) && count($match) === 2) {
$this->dsn = $this->hostname;
$this->hostname = NULL;
$this->subdriver = $match[1];
return;
} elseif (in_array($this->subdriver, array('mssql', 'sybase'), TRUE)) {
$this->subdriver = 'dblib';
} elseif ($this->subdriver === '4D') {
$this->subdriver = '4d';
} elseif (!in_array($this->subdriver, array('4d', 'cubrid', 'dblib', 'firebird', 'ibm', 'informix', 'mysql', 'oci', 'odbc', 'pgsql', 'sqlite', 'sqlsrv'), TRUE)) {
log_message('error', 'PDO: Invalid or non-existent subdriver');
if ($this->db_debug) {
show_error('Invalid or non-existent PDO subdriver');
}
}
$this->dsn = NULL;
}