--- includes/database.mysqli.inc +++ includes/database.mysqli.inc @@ -76,8 +76,7 @@ $url['host'] = urldecode($url['host']); $url['path'] = urldecode($url['path']); - $connection = mysqli_init(); - @mysqli_real_connect($connection, $url['host'], $url['user'], $url['pass'], substr($url['path'], 1), $url['port'], NULL, MYSQLI_CLIENT_FOUND_ROWS); + $connection = new mysqli($url['host'], $url['user'], $url['pass'], substr($url['path'], 1), $url['port'], NULL); // Find all database connection errors and error 1045 for access denied for user account if (mysqli_connect_errno() >= 2000 || mysqli_connect_errno() == 1045) { @@ -113,7 +112,7 @@ } /* Force UTF-8 */ - mysqli_query($connection, 'SET NAMES "utf8"'); + $connection->query('SET NAMES "utf8"'); return $connection; } @@ -128,8 +127,13 @@ list($usec, $sec) = explode(' ', microtime()); $timer = (float)$usec + (float)$sec; } - - $result = mysqli_query($active_db, $query); + + global $QUERY_CACHE; + if($QUERY_CACHE){ + $result = runquery($query); + } else { + $result = $active_db->query($query); + } if (variable_get('dev_query', 0)) { $bt = debug_backtrace(); @@ -144,7 +148,7 @@ print '

query: '. $query .'
error:'. mysqli_error($active_db) .'

'; } - if (!mysqli_errno($active_db)) { + if (!$active_db->errno) { return $result; } else { @@ -164,7 +168,8 @@ */ function db_fetch_object($result) { if ($result) { - return mysqli_fetch_object($result); + $object = $result->fetch_object(); + return $object; } } @@ -180,7 +185,7 @@ */ function db_fetch_array($result) { if ($result) { - return mysqli_fetch_array($result, MYSQLI_ASSOC); + return $result->fetch_array(MYSQLI_ASSOC); } } @@ -194,7 +199,7 @@ */ function db_num_rows($result) { if ($result) { - return mysqli_num_rows($result); + return $result->num_rows; } } @@ -213,7 +218,7 @@ */ function db_result($result, $row = 0) { if ($result && mysqli_num_rows($result) > $row) { - $array = mysqli_fetch_array($result, MYSQLI_NUM); + $array = $result->fetch_array(MYSQLI_NUM); return $array[0]; } return FALSE;