summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-10-05 20:53:32 +0200
committerAndrey Andreev <narf@bofh.bg>2012-10-05 20:53:32 +0200
commitdbad54e09a39a77c7404dee9ca1a6b34299469d0 (patch)
treee90140151d77959165c2f8177dd2d7fb3e001ee0 /system
parent6775a79ffdb4501ae8a3d88968d9531607ccab14 (diff)
Fix issue #1765
Diffstat (limited to 'system')
-rw-r--r--system/database/drivers/mysqli/mysqli_driver.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index 453ddcc3f..14949ecda 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -66,8 +66,8 @@ class CI_DB_mysqli_driver extends CI_DB {
{
$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 @@ class CI_DB_mysqli_driver extends CI_DB {
*/
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);
}