Display warnings in messages
This commit is contained in:
parent
ae2ea56681
commit
e3346fb0bc
|
@ -616,19 +616,30 @@ class Adminer {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function messageQuery($query, $time) {
|
function messageQuery($query, $time) {
|
||||||
global $jush;
|
global $jush, $driver;
|
||||||
restart_session();
|
restart_session();
|
||||||
$history = &get_session("queries");
|
$history = &get_session("queries");
|
||||||
if (!$history[$_GET["db"]]) {
|
if (!$history[$_GET["db"]]) {
|
||||||
$history[$_GET["db"]] = array();
|
$history[$_GET["db"]] = array();
|
||||||
}
|
}
|
||||||
$id = "sql-" . count($history[$_GET["db"]]);
|
|
||||||
if (strlen($query) > 1e6) {
|
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
|
$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"]
|
$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>" // @ - time zone may be not set
|
$return = " <span class='time'>" . @date("H:i:s") . "</span>"; // @ - time zone may be not set
|
||||||
|
$warnings = $driver->warnings();
|
||||||
|
$print = "";
|
||||||
|
if ($warnings && $warnings->num_rows) {
|
||||||
|
$id = "warnings-" . count($history[$_GET["db"]]);
|
||||||
|
$return .= " <a href='#$id' class='toggle'>" . lang('Warnings') . "</a>,";
|
||||||
|
ob_start();
|
||||||
|
select($warnings); // select() usually needs to print a big table progressively
|
||||||
|
$print = "<div id='$id' class='hidden'>\n" . ob_get_clean() . "</div>\n";
|
||||||
|
}
|
||||||
|
$id = "sql-" . count($history[$_GET["db"]]);
|
||||||
|
return $return
|
||||||
. " <a href='#$id' class='toggle'>" . lang('SQL command') . "</a>"
|
. " <a href='#$id' class='toggle'>" . lang('SQL command') . "</a>"
|
||||||
|
. $print
|
||||||
. "<div id='$id' class='hidden'><pre><code class='jush-$jush'>" . shorten_utf8($query, 1000) . '</code></pre>'
|
. "<div id='$id' class='hidden'><pre><code class='jush-$jush'>" . shorten_utf8($query, 1000) . '</code></pre>'
|
||||||
. ($time ? " <span class='time'>($time)</span>" : '')
|
. ($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>' : '')
|
. (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>' : '')
|
||||||
|
|
|
@ -37,6 +37,7 @@ input.wayoff { left: -1000px; position: absolute; }
|
||||||
.error { color: red; background: #fee; }
|
.error { color: red; background: #fee; }
|
||||||
.error b { background: #fff; font-weight: normal; }
|
.error b { background: #fff; font-weight: normal; }
|
||||||
.message { color: green; background: #efe; }
|
.message { color: green; background: #efe; }
|
||||||
|
.message table { color: #000; background: #fff; }
|
||||||
.error, .message { padding: .5em .8em; margin: 1em 20px 0 0; }
|
.error, .message { padding: .5em .8em; margin: 1em 20px 0 0; }
|
||||||
.char { color: #007F00; }
|
.char { color: #007F00; }
|
||||||
.date { color: #7F007F; }
|
.date { color: #7F007F; }
|
||||||
|
|
|
@ -4,7 +4,7 @@ PHP <5.3 compatibility even with Elasticsearch enabled
|
||||||
Fully support functions in default values
|
Fully support functions in default values
|
||||||
Stop redirecting links via adminer.org
|
Stop redirecting links via adminer.org
|
||||||
Support X-Forwarded-Prefix
|
Support X-Forwarded-Prefix
|
||||||
MySQL: Display warnings in SQL command and select
|
MySQL: Display warnings
|
||||||
MariaDB: Support JSON since MariaDB 10.2
|
MariaDB: Support JSON since MariaDB 10.2
|
||||||
PostgreSQL: Support functions
|
PostgreSQL: Support functions
|
||||||
PostgreSQL: Allow editing views with uppercase letters (bug #467)
|
PostgreSQL: Allow editing views with uppercase letters (bug #467)
|
||||||
|
|
Loading…
Reference in a new issue