Skip to content
Browse files

Fix issue #1765

  • Loading branch information...
1 parent 6775a79 commit dbad54e09a39a77c7404dee9ca1a6b34299469d0 @narfbg narfbg committed
Showing with 11 additions and 2 deletions.
  1. +10 −2 system/database/drivers/mysqli/mysqli_driver.php
  2. +1 −0 user_guide_src/source/changelog.rst
View
12 system/database/drivers/mysqli/mysqli_driver.php
@@ -66,8 +66,8 @@ public function db_connect()
{
$port = empty($this->port) ? NULL : $this->port;
- $mysqli = mysqli_init();
- $mysqli->real_connect($this->hostname, $this->username, $this->password, $this->database, $port, NULL, MYSQLI_CLIENT_COMPRESS);
+ $mysqli = new mysqli();
+ @$mysqli->real_connect($this->hostname, $this->username, $this->password, $this->database, $port, NULL, MYSQLI_CLIENT_COMPRESS);
return $mysqli;
}
@@ -418,6 +418,14 @@ public function field_data($table = '')
*/
public function error()
{
+ if ( ! empty($this->conn_id->connect_errno))
+ {
+ return array(
+ 'code' => $this->conn_id->connect_errno,
+ 'message' => is_php('5.2.9') ? $this->conn_id->connect_error : mysqli_connect_error()
+ );
+ }
+
return array('code' => $this->conn_id->errno, 'message' => $this->conn_id->error);
}
View
1 user_guide_src/source/changelog.rst
@@ -355,6 +355,7 @@ Bug fixes for 3.0
- Fixed a bug (#395) - :doc:`Unit Testing Library <libraries/unit_testing>` method ``result()`` didn't properly check array result columns when called from ``report()``.
- Fixed a bug (#1692) - :doc:`Database Library <database/index>` method ``display_error()`` didn't properly trace the possible error source on Windows systems.
- Fixed a bug (#1745) - ``is_write_type()`` method in the :doc:`Database Library <database/index>` didn't return TRUE for LOAD queries.
+- Fixed a bug (#1765) - :doc:`Database Library <database/index>` didn't properly detect connection errors for MySQLi.
Version 2.1.2
=============

0 comments on commit dbad54e

Please sign in to comment.
Something went wrong with that request. Please try again.