summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaufan Aditya <toopay@taufanaditya.com>2012-02-13 15:15:56 +0100
committerTaufan Aditya <toopay@taufanaditya.com>2012-02-13 15:15:56 +0100
commit5dcdbc30649d8f8320953f3eb728a3eb5a7f7765 (patch)
tree549053ce88727bf78fa1e591cf10c884148d7320
parent9c2947a339f24e13aaf85f115bcea9f27fa10a83 (diff)
Semicolon automatically added if not exists after hostname, if only database was not empty
-rw-r--r--system/database/drivers/pdo/pdo_driver.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index 2138ed665..5991586c7 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -118,6 +118,13 @@ class CI_DB_pdo_driver extends CI_DB {
// We need to get the prefix (pdodriver used by PDO).
$this->dsn = $this->hostname;
$this->pdodriver = current(explode(':', $this->hostname));
+
+ // End dsn with a semicolon for extra backward compability
+ // if database property was not empty.
+ if ( ! empty($this->database))
+ {
+ $this->dsn .= rtrim($this->dsn, ';').';';
+ }
}
else
{
@@ -175,8 +182,6 @@ class CI_DB_pdo_driver extends CI_DB {
// Add charset to the DSN, if needed
if ( ! empty($this->char_set) && in_array($this->pdodriver, array('4D', 'mysql', 'sybase', 'mssql', 'dblib', 'oci')))
{
- // End dsn with a semicolon for extra backward compability
- $this->dsn .= rtrim($this->dsn, ';').';';
$this->dsn .= 'charset='.$this->char_set.';';
}
}