summaryrefslogtreecommitdiffstats
path: root/system/database
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-02-14 10:29:25 +0100
committerAndrey Andreev <narf@bofh.bg>2012-02-14 10:29:25 +0100
commit6ea0e1d3a21713e8c4bf254cb6b2c6209c7284d6 (patch)
tree179fb48a3b5c4e68f32062b731be7b39af254bd8 /system/database
parentfe4b4e9d5f5c19da77c8e675f33f030766019ac3 (diff)
parente35d6943d513b4f016b763eebe8b97a9f1c902e3 (diff)
Merge remote-tracking branch 'upstream/develop' into develop-db-cubrid
Diffstat (limited to 'system/database')
-rw-r--r--system/database/drivers/pdo/pdo_driver.php19
1 files changed, 12 insertions, 7 deletions
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index e84c1aaaf..de2b0abeb 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -116,12 +116,15 @@ class CI_DB_pdo_driver extends CI_DB {
// hostname generally would have this prototype
// $db['hostname'] = 'pdodriver:host(/Server(/DSN))=hostname(/DSN);';
// We need to get the prefix (pdodriver used by PDO).
- $this->dsn = $this->hostname;
- $split_dsn = explode(':', $this->hostname);
- $this->pdodriver = $split_dsn[0];
-
- // End this part of the dsn with a semicolon
- $this->dsn .= rtrim(';', $this->dsn) . ';';
+ $dsnarray = explode(':', $this->hostname);
+ $this->pdodriver = $dsnarray[0];
+
+ // End dsn with a semicolon for extra backward compability
+ // if database property was not empty.
+ if ( ! empty($this->database))
+ {
+ $this->dsn .= rtrim($this->hostname, ';').';';
+ }
}
else
{
@@ -136,7 +139,9 @@ class CI_DB_pdo_driver extends CI_DB {
$this->dsn = $this->pdodriver.':';
// Add hostname to the DSN for databases that need it
- if ( ! empty($this->hostname) && in_array($this->pdodriver, array('informix', 'mysql', 'pgsql', 'sybase', 'mssql', 'dblib', 'cubrid')))
+ if ( ! empty($this->hostname)
+ && strpos($this->hostname, ':') === FALSE
+ && in_array($this->pdodriver, array('informix', 'mysql', 'pgsql', 'sybase', 'mssql', 'dblib', 'cubrid')))
{
$this->dsn .= 'host='.$this->hostname.';';
}