Commit d1b2125b authored by Dries's avatar Dries

- Added the improved db_query() function with timings from Marco's sandbox.
parent 08b82913
......@@ -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>";
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment