mirror of
https://github.com/vrana/adminer.git
synced 2025-08-15 02:54:28 +02:00
Print elapsed time in HTML instead of SQL command comment
This commit is contained in:
@@ -177,11 +177,12 @@ username.form['auth[driver]'].onchange();
|
||||
|
||||
/** Query printed in select before execution
|
||||
* @param string query to be executed
|
||||
* @param string elapsed time
|
||||
* @return string
|
||||
*/
|
||||
function selectQuery($query) {
|
||||
function selectQuery($query, $time) {
|
||||
global $jush;
|
||||
return "<p><code class='jush-$jush'>" . h(str_replace("\n", " ", $query)) . "</code>"
|
||||
return "<p><code class='jush-$jush'>" . h(str_replace("\n", " ", $query)) . "</code> <span class='time'>($time)</span>"
|
||||
. (support("sql") ? " <a href='" . h(ME) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a>" : "")
|
||||
. "</p>" // </p> - required for IE9 inline edit
|
||||
;
|
||||
@@ -500,9 +501,10 @@ username.form['auth[driver]'].onchange();
|
||||
|
||||
/** Query printed after execution in the message
|
||||
* @param string executed query
|
||||
* @param string elapsed time
|
||||
* @return string
|
||||
*/
|
||||
function messageQuery($query) {
|
||||
function messageQuery($query, $time) {
|
||||
global $jush;
|
||||
restart_session();
|
||||
$history = &get_session("queries");
|
||||
@@ -510,9 +512,10 @@ username.form['auth[driver]'].onchange();
|
||||
if (strlen($query) > 1e6) {
|
||||
$query = preg_replace('~[\x80-\xFF]+$~', '', substr($query, 0, 1e6)) . "\n..."; // [\x80-\xFF] - valid UTF-8, \n - can end by one-line comment
|
||||
}
|
||||
$history[$_GET["db"]][] = array($query, time()); // not DB - $_GET["db"] is changed in database.inc.php //! respect $_GET["ns"]
|
||||
$history[$_GET["db"]][] = array($query, time(), $time); // not DB - $_GET["db"] is changed in database.inc.php //! respect $_GET["ns"]
|
||||
return " <span class='time'>" . @date("H:i:s") . "</span> <a href='#$id' onclick=\"return !toggle('$id');\">" . lang('SQL command') . "</a>" // @ - time zone may be not set
|
||||
. "<div id='$id' class='hidden'><pre><code class='jush-$jush'>" . shorten_utf8($query, 1000) . '</code></pre>'
|
||||
. ($time ? " <span class='time'>($time)</span>" : '')
|
||||
. (support("sql") ? '<p><a href="' . h(str_replace("db=" . urlencode(DB), "db=" . urlencode($_GET["db"]), ME) . 'sql=&history=' . (count($history[$_GET["db"]]) - 1)) . '">' . lang('Edit') . '</a>' : '')
|
||||
. '</div>'
|
||||
;
|
||||
|
Reference in New Issue
Block a user