summaryrefslogtreecommitdiffstats
path: root/system/database
diff options
context:
space:
mode:
Diffstat (limited to 'system/database')
-rw-r--r--system/database/drivers/mysqli/mysqli_driver.php31
-rw-r--r--system/database/drivers/mysqli/mysqli_result.php18
2 files changed, 25 insertions, 24 deletions
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index 041daf710..a6ac14f12 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;
}
// --------------------------------------------------------------------
@@ -433,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);
}
// --------------------------------------------------------------------
@@ -690,10 +690,11 @@ 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;
}
}
/* End of file mysqli_driver.php */
-/* Location: ./system/database/drivers/mysqli/mysqli_driver.php */ \ No newline at end of file
+/* Location: ./system/database/drivers/mysqli/mysqli_driver.php */
diff --git a/system/database/drivers/mysqli/mysqli_result.php b/system/database/drivers/mysqli/mysqli_result.php
index 83d88aae3..dc7d9a793 100644
--- a/system/database/drivers/mysqli/mysqli_result.php
+++ b/system/database/drivers/mysqli/mysqli_result.php
@@ -43,7 +43,7 @@ class CI_DB_mysqli_result extends CI_DB_result {
*/
public function num_rows()
{
- return @mysqli_num_rows($this->result_id);
+ return $this->result_id->num_rows;
}
// --------------------------------------------------------------------
@@ -55,7 +55,7 @@ class CI_DB_mysqli_result extends CI_DB_result {
*/
public function num_fields()
{
- return @mysqli_num_fields($this->result_id);
+ return $this->result_id->field_count;
}
// --------------------------------------------------------------------
@@ -70,7 +70,7 @@ class CI_DB_mysqli_result extends CI_DB_result {
public function list_fields()
{
$field_names = array();
- while ($field = mysqli_fetch_field($this->result_id))
+ while ($field = $this->result_id->fetch_field())
{
$field_names[] = $field->name;
}
@@ -90,7 +90,7 @@ class CI_DB_mysqli_result extends CI_DB_result {
public function field_data()
{
$retval = array();
- $field_data = mysqli_fetch_fields($this->result_id);
+ $field_data = $this->result_id->fetch_fields();
for ($i = 0, $c = count($field_data); $i < $c; $i++)
{
$retval[$i] = new stdClass();
@@ -115,7 +115,7 @@ class CI_DB_mysqli_result extends CI_DB_result {
{
if (is_object($this->result_id))
{
- mysqli_free_result($this->result_id);
+ $this->result_id->free();
$this->result_id = FALSE;
}
}
@@ -133,7 +133,7 @@ class CI_DB_mysqli_result extends CI_DB_result {
*/
protected function _data_seek($n = 0)
{
- return mysqli_data_seek($this->result_id, $n);
+ return $this->result_id->data_seek($n);
}
// --------------------------------------------------------------------
@@ -147,7 +147,7 @@ class CI_DB_mysqli_result extends CI_DB_result {
*/
protected function _fetch_assoc()
{
- return mysqli_fetch_assoc($this->result_id);
+ return $this->result_id->fetch_assoc();
}
// --------------------------------------------------------------------
@@ -161,10 +161,10 @@ class CI_DB_mysqli_result extends CI_DB_result {
*/
protected function _fetch_object()
{
- return mysqli_fetch_object($this->result_id);
+ return $this->result_id->fetch_object();
}
}
/* End of file mysqli_result.php */
-/* Location: ./system/database/drivers/mysqli/mysqli_result.php */ \ No newline at end of file
+/* Location: ./system/database/drivers/mysqli/mysqli_result.php */