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 /system/database | |
parent | 825fab7370a28b6c05da126842dd8df25e51e026 (diff) |
[ci skip] Fix 'sqlsrv' connect failure endless loop
Reported via the forums: http://forum.codeigniter.com/thread-61494.html
Diffstat (limited to 'system/database')
-rw-r--r-- | system/database/drivers/sqlsrv/sqlsrv_driver.php | 15 |
1 files changed, 8 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; } |