with $GLOBALS['cfg']['DBG']['enable'] = true display executed queries and there times in the main footer
This commit is contained in:
@@ -126,13 +126,33 @@ function PMA_DBI_try_query($query, $link = null, $options = 0)
|
||||
}
|
||||
}
|
||||
|
||||
if ($options == ($options | PMA_DBI_QUERY_STORE)) {
|
||||
return @mysql_query($query, $link);
|
||||
} elseif ($options == ($options | PMA_DBI_QUERY_UNBUFFERED)) {
|
||||
return @mysql_unbuffered_query($query, $link);
|
||||
} else {
|
||||
return @mysql_query($query, $link);
|
||||
if ($GLOBALS['cfg']['DBG']['enable']) {
|
||||
$time = microtime(true);
|
||||
}
|
||||
if ($options == ($options | PMA_DBI_QUERY_STORE)) {
|
||||
$r = mysql_query($query, $link);
|
||||
} elseif ($options == ($options | PMA_DBI_QUERY_UNBUFFERED)) {
|
||||
$r = mysql_unbuffered_query($query, $link);
|
||||
} else {
|
||||
$r = mysql_query($query, $link);
|
||||
}
|
||||
|
||||
if ($GLOBALS['cfg']['DBG']['enable']) {
|
||||
$time = microtime(true) - $time;
|
||||
|
||||
$hash = md5($query);
|
||||
|
||||
if (isset($_SESSION['debug']['queries'][$hash])) {
|
||||
$_SESSION['debug']['queries'][$hash]['count']++;
|
||||
} else {
|
||||
$_SESSION['debug']['queries'][$hash] = array();
|
||||
$_SESSION['debug']['queries'][$hash]['count'] = 1;
|
||||
$_SESSION['debug']['queries'][$hash]['query'] = $query;
|
||||
$_SESSION['debug']['queries'][$hash]['time'] = $time;
|
||||
}
|
||||
}
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -174,7 +174,27 @@ function PMA_DBI_try_query($query, $link = null, $options = 0)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return mysqli_query($link, $query, $method);
|
||||
|
||||
if ($GLOBALS['cfg']['DBG']['enable']) {
|
||||
$time = microtime(true);
|
||||
}
|
||||
$r = mysqli_query($link, $query, $method);
|
||||
if ($GLOBALS['cfg']['DBG']['enable']) {
|
||||
$time = microtime(true) - $time;
|
||||
|
||||
$hash = md5($query);
|
||||
|
||||
if (isset($_SESSION['debug']['queries'][$hash])) {
|
||||
$_SESSION['debug']['queries'][$hash]['count']++;
|
||||
} else {
|
||||
$_SESSION['debug']['queries'][$hash] = array();
|
||||
$_SESSION['debug']['queries'][$hash]['count'] = 1;
|
||||
$_SESSION['debug']['queries'][$hash]['query'] = $query;
|
||||
$_SESSION['debug']['queries'][$hash]['time'] = $time;
|
||||
}
|
||||
}
|
||||
|
||||
return $r;
|
||||
|
||||
// From the PHP manual:
|
||||
// "note: returns true on success or false on failure. For SELECT,
|
||||
|
@@ -72,6 +72,13 @@ if (count($GLOBALS['footnotes'])) {
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
if (! empty($_SESSION['debug'])) {
|
||||
echo '<pre>';
|
||||
print_r($_SESSION['debug']);
|
||||
echo '</pre>';
|
||||
$_SESSION['debug'] = array();
|
||||
}
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
Reference in New Issue
Block a user