summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/config/config.php2
-rw-r--r--system/database/DB_driver.php14
-rw-r--r--system/database/drivers/mssql/mssql_driver.php12
-rw-r--r--system/database/drivers/mysql/mysql_driver.php16
-rw-r--r--user_guide_src/source/changelog.rst1
-rw-r--r--user_guide_src/source/helpers/url_helper.rst2
6 files changed, 30 insertions, 17 deletions
diff --git a/application/config/config.php b/application/config/config.php
index bd4aad73d..415474e06 100644
--- a/application/config/config.php
+++ b/application/config/config.php
@@ -421,4 +421,4 @@ $config['proxy_ips'] = '';
/* End of file config.php */
-/* Location: ./application/config/config.php */
+/* Location: ./application/config/config.php */ \ No newline at end of file
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index 26791398a..35ac8e870 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -428,20 +428,6 @@ abstract class CI_DB_driver {
}
}
- // ----------------------------------------------------------------
-
- // Select the DB... assuming a database name is specified in the config file
- if ($this->database !== '' && ! $this->db_select())
- {
- log_message('error', 'Unable to select database: '.$this->database);
-
- if ($this->db_debug)
- {
- $this->display_error('db_unable_to_select', $this->database);
- }
- return FALSE;
- }
-
// Now we set the character set and that's all
return $this->db_set_charset($this->char_set);
}
diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php
index f60071ed9..0836fa802 100644
--- a/system/database/drivers/mssql/mssql_driver.php
+++ b/system/database/drivers/mssql/mssql_driver.php
@@ -106,6 +106,18 @@ class CI_DB_mssql_driver extends CI_DB {
return FALSE;
}
+ // ----------------------------------------------------------------
+
+ // Select the DB... assuming a database name is specified in the config file
+ if ($this->database !== '' && ! $this->db_select())
+ {
+ log_message('error', 'Unable to select database: '.$this->database);
+
+ return ($this->db_debug === TRUE)
+ ? $this->display_error('db_unable_to_select', $this->database)
+ : FALSE;
+ }
+
// Determine how identifiers are escaped
$query = $this->query('SELECT CASE WHEN (@@OPTIONS | 256) = @@OPTIONS THEN 1 ELSE 0 END AS qi');
$query = $query->row_array();
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index 492b07861..95003f648 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -110,9 +110,23 @@ class CI_DB_mysql_driver extends CI_DB {
$client_flags = $client_flags | MYSQL_CLIENT_SSL;
}
- return ($persistent === TRUE)
+ $this->conn_id = ($persistent === TRUE)
? @mysql_pconnect($this->hostname, $this->username, $this->password, $client_flags)
: @mysql_connect($this->hostname, $this->username, $this->password, TRUE, $client_flags);
+
+ // ----------------------------------------------------------------
+
+ // Select the DB... assuming a database name is specified in the config file
+ if ($this->database !== '' && ! $this->db_select())
+ {
+ log_message('error', 'Unable to select database: '.$this->database);
+
+ return ($this->db_debug === TRUE)
+ ? $this->display_error('db_unable_to_select', $this->database)
+ : FALSE;
+ }
+
+ return $this->conn_id;
}
// --------------------------------------------------------------------
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index f6dad07b3..8b9ec2539 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -112,6 +112,7 @@ Release Date: Not Released
- Updated ``escape_identifiers()`` to accept an array of fields as well as strings.
- MySQL and MySQLi drivers now require at least MySQL version 5.1.
- ``db_set_charset()`` now only requires one parameter (collation was only needed due to legacy support for MySQL versions prior to 5.1).
+ - ``db_select()`` will now always (if required by the driver) be called by ``db_connect()`` / ``db_pconnect()`` instead of only when initializing.
- Replaced the ``_error_message()`` and ``_error_number()`` methods with ``error()``, which returns an array containing the last database error code and message.
- Improved ``version()`` implementation so that drivers that have a native function to get the version number don't have to be defined in the core ``DB_driver`` class.
- Added capability for packages to hold *config/database.php* config files.
diff --git a/user_guide_src/source/helpers/url_helper.rst b/user_guide_src/source/helpers/url_helper.rst
index 0afa7efd8..8b5361f94 100644
--- a/user_guide_src/source/helpers/url_helper.rst
+++ b/user_guide_src/source/helpers/url_helper.rst
@@ -380,4 +380,4 @@ engine purposes. The default Response Code is 302. The third parameter is
will *automatically* be selected when the page is currently accessed
via POST and HTTP/1.1 is used.
-.. important:: This function will terminate script execution.
+.. important:: This function will terminate script execution. \ No newline at end of file