summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/mysqli/mysqli_driver.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-02-24 10:50:49 +0100
committerAndrey Andreev <narf@bofh.bg>2012-02-24 10:50:49 +0100
commit5148029aaf204fb3e7e4f24a794bee781d0c218b (patch)
tree74e3a0ea7160f83f7ff1188f66e018b7490562a7 /system/database/drivers/mysqli/mysqli_driver.php
parente2675736f3a68b1f64e135d827f6a70e0ae892fb (diff)
parent024ba2dffd49e26f68468acd69feebd685f63f68 (diff)
Merge pull request #1069 from narfbg/develop-db-select
Add an optional database name parameter to db_select()
Diffstat (limited to 'system/database/drivers/mysqli/mysqli_driver.php')
-rw-r--r--system/database/drivers/mysqli/mysqli_driver.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index a79b2a4ad..dbba12e15 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -119,11 +119,23 @@ class CI_DB_mysqli_driver extends CI_DB {
/**
* Select the database
*
+ * @param string database name
* @return bool
*/
- public function db_select()
+ public function db_select($database = '')
{
- return @mysqli_select_db($this->conn_id, $this->database);
+ if ($database === '')
+ {
+ $database = $this->database;
+ }
+
+ if (@mysqli_select_db($this->conn_id, $database))
+ {
+ $this->database = $database;
+ return TRUE;
+ }
+
+ return FALSE;
}
// --------------------------------------------------------------------