From e3346fb0bcafda6053ce0256e7ef387b9905629e Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Thu, 1 Feb 2018 09:21:50 +0100 Subject: [PATCH] Display warnings in messages --- adminer/include/adminer.inc.php | 17 ++++++++++++++--- adminer/static/default.css | 1 + changes.txt | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php index 77f05c30..0d66ac48 100644 --- a/adminer/include/adminer.inc.php +++ b/adminer/include/adminer.inc.php @@ -616,19 +616,30 @@ class Adminer { * @return string */ function messageQuery($query, $time) { - global $jush; + global $jush, $driver; restart_session(); $history = &get_session("queries"); if (!$history[$_GET["db"]]) { $history[$_GET["db"]] = array(); } - $id = "sql-" . count($history[$_GET["db"]]); 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(), $time); // not DB - $_GET["db"] is changed in database.inc.php //! respect $_GET["ns"] - return " " . @date("H:i:s") . "" // @ - time zone may be not set + $return = " " . @date("H:i:s") . ""; // @ - time zone may be not set + $warnings = $driver->warnings(); + $print = ""; + if ($warnings && $warnings->num_rows) { + $id = "warnings-" . count($history[$_GET["db"]]); + $return .= " " . lang('Warnings') . ","; + ob_start(); + select($warnings); // select() usually needs to print a big table progressively + $print = "\n"; + } + $id = "sql-" . count($history[$_GET["db"]]); + return $return . " " . lang('SQL command') . "" + . $print . "