summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/mssql
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/mssql
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/mssql')
-rw-r--r--system/database/drivers/mssql/mssql_driver.php21
1 files changed, 16 insertions, 5 deletions
diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php
index 2a1098932..25a32f364 100644
--- a/system/database/drivers/mssql/mssql_driver.php
+++ b/system/database/drivers/mssql/mssql_driver.php
@@ -114,14 +114,25 @@ class CI_DB_mssql_driver extends CI_DB {
/**
* Select the database
*
- * @access private called by the base class
- * @return resource
+ * @param string database name
+ * @return bool
*/
- function db_select()
+ public function db_select($database = '')
{
+ if ($database === '')
+ {
+ $database = $this->database;
+ }
+
// Note: The brackets are required in the event that the DB name
// contains reserved characters
- return @mssql_select_db('['.$this->database.']', $this->conn_id);
+ if (@mssql_select_db('['.$database.']', $this->conn_id))
+ {
+ $this->database = $database;
+ return TRUE;
+ }
+
+ return FALSE;
}
// --------------------------------------------------------------------
@@ -676,4 +687,4 @@ class CI_DB_mssql_driver extends CI_DB {
/* End of file mssql_driver.php */
-/* Location: ./system/database/drivers/mssql/mssql_driver.php */ \ No newline at end of file
+/* Location: ./system/database/drivers/mssql/mssql_driver.php */