summaryrefslogtreecommitdiffstats
path: root/system/database
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-02-22 18:40:32 +0100
committerAndrey Andreev <narf@bofh.bg>2012-02-22 18:40:32 +0100
commite2675736f3a68b1f64e135d827f6a70e0ae892fb (patch)
tree9d62063940516483ac3c994faea683ca40c88f31 /system/database
parent7a2412cfe7f7d8db3eb845542609c476c52efc3d (diff)
parent82e8ac19d0ffeb3edd56b09d7a272d13903af7cc (diff)
Merge pull request #1072 from narfbg/develop-issue-1070
Fix issue #1070
Diffstat (limited to 'system/database')
-rw-r--r--system/database/DB_driver.php34
1 files changed, 10 insertions, 24 deletions
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index b829bbe46..271a70ec4 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -107,11 +107,9 @@ class CI_DB_driver {
/**
* Initialize Database Settings
*
- * @access private Called by the constructor
- * @param mixed
- * @return void
+ * @return bool
*/
- function initialize()
+ public function initialize()
{
// If an existing connection resource is available
// there is no need to connect and select the database
@@ -125,7 +123,7 @@ class CI_DB_driver {
// Connect to the database and set the connection ID
$this->conn_id = ($this->pconnect == FALSE) ? $this->db_connect() : $this->db_pconnect();
- // No connection resource? Check if there is a failover else throw an error
+ // No connection resource? Check if there is a failover else throw an error
if ( ! $this->conn_id)
{
// Check if there is a failover set
@@ -167,31 +165,19 @@ class CI_DB_driver {
// ----------------------------------------------------------------
// Select the DB... assuming a database name is specified in the config file
- if ($this->database != '')
+ if ($this->database !== '' && ! $this->db_select())
{
- if ( ! $this->db_select())
- {
- log_message('error', 'Unable to select database: '.$this->database);
+ log_message('error', 'Unable to select database: '.$this->database);
- if ($this->db_debug)
- {
- $this->display_error('db_unable_to_select', $this->database);
- }
- return FALSE;
- }
- else
+ if ($this->db_debug)
{
- // We've selected the DB. Now we set the character set
- if ( ! $this->db_set_charset($this->char_set, $this->dbcollat))
- {
- return FALSE;
- }
-
- return TRUE;
+ $this->display_error('db_unable_to_select', $this->database);
}
+ return FALSE;
}
- return TRUE;
+ // Now we set the character set and that's all
+ return $this->db_set_charset($this->char_set, $this->dbcollat);
}
// --------------------------------------------------------------------