Don't display warnings for failed queries
This commit is contained in:
parent
51a574926d
commit
ae91088cb3
|
@ -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 "<p class='error'>" . error() . "\n";
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 = "</p>\n"; // required for IE9 inline edit
|
||||
$warnings = $driver->warnings();
|
||||
if ($warnings) {
|
||||
if (!$failed && ($warnings = $driver->warnings())) {
|
||||
$id = "warnings";
|
||||
$return = ", <a href='#$id'>" . lang('Warnings') . "</a>" . script("qsl('a').onclick = partial(toggle, '$id');", "")
|
||||
. "$return<div id='$id' class='hidden'>\n$warnings</div>\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 = "<a href='#$sql_id' class='toggle'>" . lang('SQL command') . "</a>\n";
|
||||
$warnings = $driver->warnings();
|
||||
if ($warnings) {
|
||||
if (!$failed && ($warnings = $driver->warnings())) {
|
||||
$id = "warnings-" . count($history[$_GET["db"]]);
|
||||
$return = "<a href='#$id' class='toggle'>" . lang('Warnings') . "</a>, $return<div id='$id' class='hidden'>\n$warnings</div>\n";
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();");
|
||||
|
|
|
@ -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" . str_replace("--", "--><!-- ", $query) . "\n(" . format_time($start) . ")\n-->\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 " <span class='time'>" . @date("H:i:s") . "</span><!--\n" . str_replace("--", "--><!-- ", $query) . "\n" . ($time ? "($time)\n" : "") . "-->";
|
||||
}
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ class AdminerSqlLog {
|
|||
$this->filename = $filename;
|
||||
}
|
||||
|
||||
function messageQuery($query, $time) {
|
||||
function messageQuery($query, $time, $failed = false) {
|
||||
$this->_log($query);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue