summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/mysqli/mysqli_driver.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-03-28 13:44:35 +0200
committerAndrey Andreev <narf@bofh.bg>2012-03-28 13:44:35 +0200
commit26c708514e3ca04a1c373efd166b5c17c31e3796 (patch)
tree8c2241630f236733da08770bcbcf9d17461a0f78 /system/database/drivers/mysqli/mysqli_driver.php
parented1aa21dcd5312b2884f140be8c0d2ee94379423 (diff)
parent8f50b6b36cb743be8b70809279e501c20b8e38e2 (diff)
Merge branch 'develop' of github.com:EllisLab/CodeIgniter into develop-db-driver
Diffstat (limited to 'system/database/drivers/mysqli/mysqli_driver.php')
-rw-r--r--system/database/drivers/mysqli/mysqli_driver.php30
1 files changed, 15 insertions, 15 deletions
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index 4c5d52127..47b0449d6 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -72,8 +72,8 @@ class CI_DB_mysqli_driver extends CI_DB {
public function db_connect()
{
return ($this->port != '')
- ? @mysqli_connect($this->hostname, $this->username, $this->password, $this->database, $this->port)
- : @mysqli_connect($this->hostname, $this->username, $this->password, $this->database);
+ ? @new mysqli($this->hostname, $this->username, $this->password, $this->database, $this->port)
+ : @new mysqli($this->hostname, $this->username, $this->password, $this->database);
}
// --------------------------------------------------------------------
@@ -92,8 +92,8 @@ class CI_DB_mysqli_driver extends CI_DB {
}
return ($this->port != '')
- ? @mysqli_connect('p:'.$this->hostname, $this->username, $this->password, $this->database, $this->port)
- : @mysqli_connect('p:'.$this->hostname, $this->username, $this->password, $this->database);
+ ? @new mysqli('p:'.$this->hostname, $this->username, $this->password, $this->database, $this->port)
+ : @new mysqli('p:'.$this->hostname, $this->username, $this->password, $this->database);
}
// --------------------------------------------------------------------
@@ -108,7 +108,7 @@ class CI_DB_mysqli_driver extends CI_DB {
*/
public function reconnect()
{
- if (mysqli_ping($this->conn_id) === FALSE)
+ if ($this->conn_id !== FALSE && $this->conn_id->ping() === FALSE)
{
$this->conn_id = FALSE;
}
@@ -129,7 +129,7 @@ class CI_DB_mysqli_driver extends CI_DB {
$database = $this->database;
}
- if (@mysqli_select_db($this->conn_id, $database))
+ if (@$this->conn_id->select_db($database))
{
$this->database = $database;
return TRUE;
@@ -148,7 +148,7 @@ class CI_DB_mysqli_driver extends CI_DB {
*/
protected function _db_set_charset($charset)
{
- return @mysqli_set_charset($this->conn_id, $charset);
+ return @$this->conn_id->set_charset($charset);
}
// --------------------------------------------------------------------
@@ -162,7 +162,7 @@ class CI_DB_mysqli_driver extends CI_DB {
{
return isset($this->data_cache['version'])
? $this->data_cache['version']
- : $this->data_cache['version'] = @mysqli_get_server_info($this->conn_id);
+ : $this->data_cache['version'] = $this->conn_id->server_info;
}
// --------------------------------------------------------------------
@@ -175,7 +175,7 @@ class CI_DB_mysqli_driver extends CI_DB {
*/
protected function _execute($sql)
{
- return @mysqli_query($this->conn_id, $this->_prep_query($sql));
+ return @$this->conn_id->query($this->_prep_query($sql));
}
// --------------------------------------------------------------------
@@ -286,7 +286,7 @@ class CI_DB_mysqli_driver extends CI_DB {
return $str;
}
- $str = is_object($this->conn_id) ? mysqli_real_escape_string($this->conn_id, $str) : addslashes($str);
+ $str = is_object($this->conn_id) ? $this->conn_id->real_escape_string($str) : addslashes($str);
// escape LIKE condition wildcards
if ($like === TRUE)
@@ -306,7 +306,7 @@ class CI_DB_mysqli_driver extends CI_DB {
*/
public function affected_rows()
{
- return @mysqli_affected_rows($this->conn_id);
+ return $this->conn_id->affected_rows;
}
// --------------------------------------------------------------------
@@ -318,7 +318,7 @@ class CI_DB_mysqli_driver extends CI_DB {
*/
public function insert_id()
{
- return @mysqli_insert_id($this->conn_id);
+ return $this->conn_id->insert_id;
}
// --------------------------------------------------------------------
@@ -357,7 +357,6 @@ class CI_DB_mysqli_driver extends CI_DB {
*
* Generates a platform-specific query string so that the table names can be fetched
*
- * @access private
* @param bool
* @return string
*/
@@ -434,7 +433,7 @@ class CI_DB_mysqli_driver extends CI_DB {
*/
public function error()
{
- return array('code' => mysqli_errno($this->conn_id), 'message' => mysqli_error($this->conn_id));
+ return array('code' => $this->conn_id->errno, 'message' => $this->conn_id->error);
}
// --------------------------------------------------------------------
@@ -691,7 +690,8 @@ class CI_DB_mysqli_driver extends CI_DB {
*/
protected function _close($conn_id)
{
- @mysqli_close($conn_id);
+ $this->conn_id->close();
+ $this->conn_id = FALSE;
}
}