summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2015-04-14 14:59:54 +0200
committerAndrey Andreev <narf@devilix.net>2015-04-14 14:59:54 +0200
commit8af87468487101e14e69effb80a166870f1b79be (patch)
treeb12767afbe33649224b1eee5cc0d4b8091f99be9
parentaaca76cf4d9ea66249771b89a84c1bd436296b07 (diff)
Fix #3773
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php24
-rw-r--r--user_guide_src/source/changelog.rst1
2 files changed, 25 insertions, 0 deletions
diff --git a/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php b/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php
index 67dc5f5ec..206d83595 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php
@@ -157,6 +157,30 @@ class CI_DB_pdo_mysql_driver extends CI_DB_pdo_driver {
// --------------------------------------------------------------------
/**
+ * Select the database
+ *
+ * @param string $database
+ * @return bool
+ */
+ public function db_select($database = '')
+ {
+ if ($database === '')
+ {
+ $database = $this->database;
+ }
+
+ if (FALSE !== $this->simple_query('USE '.$this->escape_identifiers($database)))
+ {
+ $this->database = $database;
+ return TRUE;
+ }
+
+ return FALSE;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Show table query
*
* Generates a platform-specific query string so that the table names can be fetched
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 94a383294..596cd0faf 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -17,6 +17,7 @@ Bug fixes for 3.0.1
- Fixed a bug (#3733) - Autoloading of libraries with aliases didn't work, although it was advertised to.
- Fixed a bug (#3744) - Redis :doc:`Caching <libraries/caching>` driver didn't handle authentication failures properly.
- Fixed a bug (#3761) - :doc:`URL Helper <helpers/url_helper>` function :php:func:`anchor()` didn't work with array inputs.
+- Fixed a bug (#3773) - ``db_select()`` didn't work for MySQL with the PDO :doc:`Database <database/index>` driver.
Version 3.0.0
=============