Save bytes
This commit is contained in:
parent
0d427ad5a8
commit
0060c608d6
|
@ -118,12 +118,12 @@ function textarea($name, $value, $rows = 10, $cols = 80) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Format time difference
|
/** Format time difference
|
||||||
* @param array ($sec, $sec)
|
* @param string output of microtime()
|
||||||
* @param array ($sec, $sec)
|
* @param string output of microtime()
|
||||||
* @return string HTML code
|
* @return string HTML code
|
||||||
*/
|
*/
|
||||||
function format_time($start, $end) {
|
function format_time($start, $end) {
|
||||||
return " <span class='time'>(" . lang('%.3f s', max(0, $end[0] - $start[0] + $end[1] - $start[1])) . ")</span>";
|
return " <span class='time'>(" . lang('%.3f s', max(0, array_sum(explode(" ", $end)) - array_sum(explode(" ", $start)))) . ")</span>";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Print table columns for type edit
|
/** Print table columns for type edit
|
||||||
|
|
|
@ -52,7 +52,7 @@ if (!$error && $_POST) {
|
||||||
$commands = 0;
|
$commands = 0;
|
||||||
$errors = array();
|
$errors = array();
|
||||||
$parse = '[\'`"]' . ($jush == "pgsql" ? '|\\$[^$]*\\$' : ($jush == "mssql" || $jush == "sqlite" ? '|\\[' : '')) . '|/\\*|-- |#'; //! ` and # not everywhere
|
$parse = '[\'`"]' . ($jush == "pgsql" ? '|\\$[^$]*\\$' : ($jush == "mssql" || $jush == "sqlite" ? '|\\[' : '')) . '|/\\*|-- |#'; //! ` and # not everywhere
|
||||||
$total_start = explode(" ", microtime());
|
$total_start = microtime();
|
||||||
parse_str($_COOKIE["adminer_export"], $adminer_export);
|
parse_str($_COOKIE["adminer_export"], $adminer_export);
|
||||||
$dump_format = $adminer->dumpFormat();
|
$dump_format = $adminer->dumpFormat();
|
||||||
unset($dump_format["sql"]);
|
unset($dump_format["sql"]);
|
||||||
|
@ -90,14 +90,14 @@ if (!$error && $_POST) {
|
||||||
ob_flush();
|
ob_flush();
|
||||||
flush(); // can take a long time - show the running query
|
flush(); // can take a long time - show the running query
|
||||||
}
|
}
|
||||||
$start = explode(" ", microtime()); // microtime(true) is available since PHP 5
|
$start = microtime(); // microtime(true) is available since PHP 5
|
||||||
//! don't allow changing of character_set_results, convert encoding of displayed query
|
//! don't allow changing of character_set_results, convert encoding of displayed query
|
||||||
if ($connection->multi_query($q) && is_object($connection2) && preg_match("~^$space*USE\\b~isU", $q)) {
|
if ($connection->multi_query($q) && is_object($connection2) && preg_match("~^$space*USE\\b~isU", $q)) {
|
||||||
$connection2->query($q);
|
$connection2->query($q);
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
$result = $connection->store_result();
|
$result = $connection->store_result();
|
||||||
$end = explode(" ", microtime());
|
$end = microtime();
|
||||||
$time = format_time($start, $end) . (strlen($q) < 1000 ? " <a href='" . h(ME) . "sql=" . urlencode(trim($q)) . "'>" . lang('Edit') . "</a>" : ""); // 1000 - maximum length of encoded URL in IE is 2083 characters
|
$time = format_time($start, $end) . (strlen($q) < 1000 ? " <a href='" . h(ME) . "sql=" . urlencode(trim($q)) . "'>" . lang('Edit') . "</a>" : ""); // 1000 - maximum length of encoded URL in IE is 2083 characters
|
||||||
if ($connection->error) {
|
if ($connection->error) {
|
||||||
echo ($_POST["only_errors"] ? $print : "");
|
echo ($_POST["only_errors"] ? $print : "");
|
||||||
|
@ -150,7 +150,7 @@ if (!$error && $_POST) {
|
||||||
if ($empty) {
|
if ($empty) {
|
||||||
echo "<p class='message'>" . lang('No commands to execute.') . "\n";
|
echo "<p class='message'>" . lang('No commands to execute.') . "\n";
|
||||||
} elseif ($_POST["only_errors"]) {
|
} elseif ($_POST["only_errors"]) {
|
||||||
echo "<p class='message'>" . lang('%d query(s) executed OK.', $commands - count($errors)) . format_time($total_start, explode(" ", microtime())) . "\n";
|
echo "<p class='message'>" . lang('%d query(s) executed OK.', $commands - count($errors)) . format_time($total_start, microtime()) . "\n";
|
||||||
} elseif ($errors && $commands > 1) {
|
} elseif ($errors && $commands > 1) {
|
||||||
echo "<p class='error'>" . lang('Error in query') . ": " . implode("", $errors) . "\n";
|
echo "<p class='error'>" . lang('Error in query') . ": " . implode("", $errors) . "\n";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue