summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/pdo/pdo_driver.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-06-24 23:47:41 +0200
committerAndrey Andreev <narf@bofh.bg>2012-06-24 23:47:41 +0200
commit7151e80ea8653638b4729a6a6271f792aabdfe03 (patch)
tree3d9397a4b2c0f869495db7ace265502ee87c5d0e /system/database/drivers/pdo/pdo_driver.php
parentd42cc4686ef0c52157b7613810b50706dc057b98 (diff)
Add pdo_dblib subdriver
Diffstat (limited to 'system/database/drivers/pdo/pdo_driver.php')
-rw-r--r--system/database/drivers/pdo/pdo_driver.php21
1 files changed, 12 insertions, 9 deletions
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index 0029e1ebe..94a12100e 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -68,7 +68,7 @@ class CI_DB_pdo_driver extends CI_DB {
{
// 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 = end($match);
+ $this->subdriver = $match[1];
}
else
{
@@ -76,6 +76,11 @@ class CI_DB_pdo_driver extends CI_DB {
$this->_connect_string($params);
}
+ if (in_array($this->subdriver, array('mssql', 'sybase'), TRUE))
+ {
+ $this->subdriver = 'dblib';
+ }
+
// clause and character used for LIKE escape sequences
// this one depends on the driver being used
if ($this->subdriver === 'odbc')
@@ -124,9 +129,8 @@ class CI_DB_pdo_driver extends CI_DB {
$this->dsn = $this->subdriver.':';
// Add hostname to the DSN for databases that need it
- if ( ! empty($this->hostname)
- && strpos($this->hostname, ':') === FALSE
- && in_array($this->subdriver, array('informix', 'sybase', 'mssql', 'dblib', 'cubrid')))
+ if ( ! empty($this->hostname) && strpos($this->hostname, ':') === FALSE
+ && in_array($this->subdriver, array('informix', 'cubrid')))
{
$this->dsn .= 'host='.$this->hostname.';';
}
@@ -134,17 +138,16 @@ class CI_DB_pdo_driver extends CI_DB {
// Add a port to the DSN for databases that can use it
if ( ! empty($this->port) && in_array($this->subdriver, array('informix', 'ibm', 'cubrid')))
{
- $this->dsn .= 'port='.$this->port.';';
+ $this->dsn .= 'port='.$this->port.';';
}
}
// Add the database name to the DSN, if needed
- if (stripos($this->dsn, 'dbname') === FALSE
- && in_array($this->subdriver, array('4D', 'firebird', 'sybase', 'mssql', 'dblib', 'cubrid')))
+ if (stripos($this->dsn, 'dbname') === FALSE && in_array($this->subdriver, array('4D', 'firebird', 'cubrid')))
{
$this->dsn .= 'dbname='.$this->database.';';
}
- elseif (stripos($this->dsn, 'database') === FALSE && $this->subdriver === ibm')
+ elseif (stripos($this->dsn, 'database') === FALSE && $this->subdriver === 'ibm')
{
if (stripos($this->dsn, 'dsn') === FALSE)
{
@@ -153,7 +156,7 @@ class CI_DB_pdo_driver extends CI_DB {
}
// Add charset to the DSN, if needed
- if ( ! empty($this->char_set) && in_array($this->subdriver, array('4D', 'sybase', 'mssql', 'dblib')))
+ if ( ! empty($this->char_set) && $this->subdriver === '4D')
{
$this->dsn .= 'charset='.$this->char_set.';';
}