diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-12-21 20:05:27 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-12-21 20:05:27 -0800 |
commit | 9285c8c66c530196399eb05bb5561c3fa5538335 (patch) | |
tree | 7cec68583c01b5b365e7669fefc1adc6360e89a5 /system/libraries/Database_Mysqli.php | |
parent | 9c5df1d31bd214fab051b71d092c751a1da20ecc (diff) |
Updated Kohana to r4724
Diffstat (limited to 'system/libraries/Database_Mysqli.php')
-rw-r--r-- | system/libraries/Database_Mysqli.php | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/system/libraries/Database_Mysqli.php b/system/libraries/Database_Mysqli.php index 523fcb19..08ed99df 100644 --- a/system/libraries/Database_Mysqli.php +++ b/system/libraries/Database_Mysqli.php @@ -2,7 +2,7 @@ /** * MySQL database connection. * - * $Id: Database_Mysqli.php 4679 2009-11-10 01:45:52Z isaiah $ + * $Id: Database_Mysqli.php 4712 2009-12-10 21:47:09Z cbandy $ * * @package Kohana * @author Kohana Team @@ -29,29 +29,29 @@ class Database_Mysqli_Core extends Database_Mysql { $host = isset($host) ? $host : $socket; - if($this->connection = new mysqli($host, $user, $pass, $database, $port)) { + $mysqli = mysqli_init(); - if (isset($this->config['character_set'])) - { - // Set the character set - $this->set_charset($this->config['character_set']); - } + if ( ! $mysqli->real_connect($host, $user, $pass, $database, $port, $socket, $params)) + throw new Database_Exception('#:errno: :error', + array(':error' => $mysqli->connect_error, ':errno' => $mysqli->connect_errno)); - // Clear password after successful connect - $this->db_config['connection']['pass'] = NULL; + $this->connection = $mysqli; - return $this->connection; + if (isset($this->config['character_set'])) + { + // Set the character set + $this->set_charset($this->config['character_set']); } - - // Unable to connect to the database - throw new Database_Exception('#:errno: :error', - array(':error' => $this->connection->connect_error, - ':errno' => $this->connection->connect_errno)); } public function disconnect() { - return is_object($this->connection) and $this->connection->close(); + if (is_object($this->connection)) + { + $this->connection->close(); + } + + $this->connection = NULL; } public function set_charset($charset) |