- Added the improved db_query() function with timings from Marco's sandbox.
parent
08b82913d4
commit
d1b2125be4
|
@ -40,11 +40,19 @@ function _db_query($query, $debug = 0) {
|
|||
global $queries;
|
||||
|
||||
if (variable_get("dev_query", 0)) {
|
||||
$queries[] = $query;
|
||||
list($usec, $sec) = explode(" ", microtime());
|
||||
$timer = (float)$usec + (float)$sec;
|
||||
}
|
||||
|
||||
$result = mysql_query($query);
|
||||
|
||||
if (variable_get("dev_query", 0)) {
|
||||
list($usec, $sec) = explode(" ", microtime());
|
||||
$stop = (float)$usec + (float)$sec;
|
||||
$diff = $stop - $timer;
|
||||
$queries[] = array($query, $diff);
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
print "<p>query: $query<br />error:". mysql_error() ."</p>";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue