diff --git a/adminer/call.inc.php b/adminer/call.inc.php index 3f639a0c..69d963be 100644 --- a/adminer/call.inc.php +++ b/adminer/call.inc.php @@ -32,7 +32,7 @@ if (!$error && $_POST) { $query = (isset($_GET["callf"]) ? "SELECT" : "CALL") . " " . table($PROCEDURE) . "(" . implode(", ", $call) . ")"; $start = microtime(true); $result = $connection->multi_query($query); - echo $adminer->selectQuery($query, $start); + echo $adminer->selectQuery($query, $start, !$result); if (!$result) { echo "

" . error() . "\n"; diff --git a/adminer/drivers/elastic.inc.php b/adminer/drivers/elastic.inc.php index 00be4325..5bb600f9 100644 --- a/adminer/drivers/elastic.inc.php +++ b/adminer/drivers/elastic.inc.php @@ -148,7 +148,7 @@ if (isset($_GET["elastic"])) { $start = microtime(true); $search = $this->_conn->query($query, $data); if ($print) { - echo $adminer->selectQuery("$query: " . print_r($data, true), $start); + echo $adminer->selectQuery("$query: " . print_r($data, true), $start, !$search); } if (!$search) { return false; diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php index 519a526a..82918d00 100644 --- a/adminer/include/adminer.inc.php +++ b/adminer/include/adminer.inc.php @@ -203,13 +203,13 @@ class Adminer { /** Query printed in select before execution * @param string query to be executed * @param float start time of the query + * @param bool * @return string */ - function selectQuery($query, $start) { + function selectQuery($query, $start, $failed = false) { global $jush, $driver; $return = "

\n"; // required for IE9 inline edit - $warnings = $driver->warnings(); - if ($warnings) { + if (!$failed && ($warnings = $driver->warnings())) { $id = "warnings"; $return = ", " . lang('Warnings') . "" . script("qsl('a').onclick = partial(toggle, '$id');", "") . "$return\n" @@ -609,9 +609,10 @@ class Adminer { /** Query printed after execution in the message * @param string executed query * @param string elapsed time + * @param bool * @return string */ - function messageQuery($query, $time) { + function messageQuery($query, $time, $failed = false) { global $jush, $driver; restart_session(); $history = &get_session("queries"); @@ -624,8 +625,7 @@ class Adminer { $history[$_GET["db"]][] = array($query, time(), $time); // not DB - $_GET["db"] is changed in database.inc.php //! respect $_GET["ns"] $sql_id = "sql-" . count($history[$_GET["db"]]); $return = "" . lang('SQL command') . "\n"; - $warnings = $driver->warnings(); - if ($warnings) { + if (!$failed && ($warnings = $driver->warnings())) { $id = "warnings-" . count($history[$_GET["db"]]); $return = "" . lang('Warnings') . ", $return\n"; } diff --git a/adminer/include/driver.inc.php b/adminer/include/driver.inc.php index 1963390a..543894bb 100644 --- a/adminer/include/driver.inc.php +++ b/adminer/include/driver.inc.php @@ -37,7 +37,7 @@ $start = microtime(true); $return = $this->_conn->query($query); if ($print) { - echo $adminer->selectQuery($query, $start); + echo $adminer->selectQuery($query, $start, !$return); } return $return; } diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index 30eb1e91..9f78c205 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -647,7 +647,7 @@ function query_redirect($query, $location, $message, $redirect = true, $execute } $sql = ""; if ($query) { - $sql = $adminer->messageQuery($query, $time); + $sql = $adminer->messageQuery($query, $time, $failed); } if ($failed) { $error = error() . $sql . script("messagesPrint();"); diff --git a/editor/include/adminer.inc.php b/editor/include/adminer.inc.php index 4fec8a90..535c7943 100644 --- a/editor/include/adminer.inc.php +++ b/editor/include/adminer.inc.php @@ -140,7 +140,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5 } } - function selectQuery($query, $start) { + function selectQuery($query, $start, $failed = false) { return "\n"; } @@ -440,7 +440,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5 return ""; } - function messageQuery($query, $time) { + function messageQuery($query, $time, $failed = false) { return " " . @date("H:i:s") . ""; } diff --git a/plugins/master-slave.php b/plugins/master-slave.php index 7b3adbbd..4798c65c 100644 --- a/plugins/master-slave.php +++ b/plugins/master-slave.php @@ -30,7 +30,7 @@ class AdminerMasterSlave { } } - function messageQuery($query, $time) { + function messageQuery($query, $time, $failed = false) { //! doesn't work with sql.inc.php $connection = connection(); $result = $connection->query('SHOW MASTER STATUS'); diff --git a/plugins/plugin.php b/plugins/plugin.php index 9617fe5b..fec581e3 100644 --- a/plugins/plugin.php +++ b/plugins/plugin.php @@ -182,7 +182,7 @@ class AdminerPlugin extends Adminer { return $this->_applyPlugin(__FUNCTION__, $args); } - function selectQuery($query, $start) { + function selectQuery($query, $start, $failed = false) { $args = func_get_args(); return $this->_applyPlugin(__FUNCTION__, $args); } @@ -307,7 +307,7 @@ class AdminerPlugin extends Adminer { return $this->_applyPlugin(__FUNCTION__, $args); } - function messageQuery($query, $time) { + function messageQuery($query, $time, $failed = false) { $args = func_get_args(); return $this->_applyPlugin(__FUNCTION__, $args); } diff --git a/plugins/sql-log.php b/plugins/sql-log.php index 778fb9ee..584fe3ef 100644 --- a/plugins/sql-log.php +++ b/plugins/sql-log.php @@ -17,7 +17,7 @@ class AdminerSqlLog { $this->filename = $filename; } - function messageQuery($query, $time) { + function messageQuery($query, $time, $failed = false) { $this->_log($query); }