function query($SQL, $method = null, $error = true) { $originalSQL = $SQL; if ($this->dbpre != 'pw_') { $SQL = str_replace(array(' pw_', '`pw_', " 'pw_"), array(" {$this->dbpre}", "`{$this->dbpre}", " '{$this->dbpre}"), $SQL); } $GLOBALS['db_debug'] && (list($begintime, $begintime_sec) = explode(" ", microtime())); if ($method && function_exists('mysql_unbuffered_query')) { $query = @mysql_unbuffered_query($SQL, $this->sql); } else { $query = @mysql_query($SQL, $this->sql); } if (in_array(mysql_errno($this->sql), array(2006, 2013)) && empty($query) && $this->pconnect == 0 && !defined('QUERY')) { define('QUERY', true); @mysql_close($this->sql); sleep(2); $this->connect(); $query = $this->query($SQL); } $GLOBALS['db_debug'] && (list($endtime, $endtime_sec) = explode(" ", microtime())); $method != 'U' && $this->query_num++; if ($GLOBALS['db_debug']) { $usetime = $endtime + $endtime_sec - $begintime - $begintime_sec; $this->arr_query .= $SQL . "\t\ttime:" . $usetime . "\r\n\r\n"; $this->totaltime += $usetime; } !$query && $error && $this->halt('Query Error: ' . $SQL); require_once R_P . 'aCloud/aCloud.php'; ACloud_App_Guiding::collectSql($originalSQL); return $query; }
function query($SQL, $method = null, $error = true) { $originalSQL = $SQL; if ($this->dbpre != 'pw_') { $SQL = str_replace(array(' pw_', '`pw_', " 'pw_"), array(" {$this->dbpre}", "`{$this->dbpre}", " '{$this->dbpre}"), $SQL); } $query = @mysqli_query($this->sql, $SQL, $method ? MYSQLI_USE_RESULT : MYSQLI_STORE_RESULT); if (in_array(mysqli_errno($this->sql), array(2006, 2013)) && empty($query) && !defined('QUERY')) { define('QUERY', true); @mysqli_close($this->sql); sleep(2); $this->connect(); $query = $this->query($SQL); } $method != 'U' && $this->query_num++; !$query && $error && $this->halt('Query Error: ' . $SQL); require_once R_P . 'aCloud/aCloud.php'; ACloud_App_Guiding::collectSql($originalSQL); return $query; }