Added brackets around database name in MS SQL driver when selecting the database, in the event that reserved characters are used in the name (bug report: 4915)
diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php
index fbc0701..6130bf4 100644
--- a/system/database/drivers/mssql/mssql_driver.php
+++ b/system/database/drivers/mssql/mssql_driver.php
@@ -76,7 +76,9 @@
*/
function db_select()
{
- return @mssql_select_db($this->database, $this->conn_id);
+ // Note: The brackets are required in the event that the DB name
+ // contains reserved characters
+ return @mssql_select_db('['.$this->database.']', $this->conn_id);
}
// --------------------------------------------------------------------