diff options
author | Andrey Andreev <narf@devilix.net> | 2015-08-19 10:16:52 +0200 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2015-08-19 10:16:52 +0200 |
commit | eb492589cb6ba0faaadadebe2a5cd333de80b6c4 (patch) | |
tree | b5fe060b9c70467300510ea15f361e4ddf08bff3 | |
parent | 825fab7370a28b6c05da126842dd8df25e51e026 (diff) |
[ci skip] Fix 'sqlsrv' connect failure endless loop
Reported via the forums: http://forum.codeigniter.com/thread-61494.html
-rw-r--r-- | system/database/drivers/sqlsrv/sqlsrv_driver.php | 15 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 1 |
2 files changed, 9 insertions, 7 deletions
diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php index 16f77fab2..8d383b274 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_driver.php +++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php @@ -141,13 +141,14 @@ class CI_DB_sqlsrv_driver extends CI_DB { unset($connection['UID'], $connection['PWD']); } - $this->conn_id = sqlsrv_connect($this->hostname, $connection); - - // 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(); - $this->_quoted_identifier = empty($query) ? FALSE : (bool) $query['qi']; - $this->_escape_char = ($this->_quoted_identifier) ? '"' : array('[', ']'); + if (FALSE !== ($this->conn_id = sqlsrv_connect($this->hostname, $connection))) + { + // 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(); + $this->_quoted_identifier = empty($query) ? FALSE : (bool) $query['qi']; + $this->_escape_char = ($this->_quoted_identifier) ? '"' : array('[', ']'); + } return $this->conn_id; } diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 2d000ad6f..a0a54c34b 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -18,6 +18,7 @@ Bug fixes for 3.0.2 - Fixed a bug (#2284) - :doc:`Database <database/index>` method ``protect_identifiers()`` breaks when :doc:`Query Builder <database/query_builder>` isn't enabled. - Fixed a bug (#4052) - :doc:`Routing <general/routing>` with anonymous functions didn't work for routes that don't use regular expressions. - Fixed a bug (#4056) - :doc:`Input Library <libraries/input>` method ``get_request_header()`` could not return a value unless ``request_headers()`` was called beforehand. +- Fixed a bug where the :doc:`Database Class <database/index>` entered an endless loop if it fails to connect with the 'sqlsrv' driver. Version 3.0.1 ============= |