}
function warnings() {
- return $this->_conn->query("SHOW WARNINGS");
+ $result = $this->_conn->query("SHOW WARNINGS");
+ if ($result && $result->num_rows) {
+ ob_start();
+ select($result); // select() usually needs to print a big table progressively
+ return ob_get_clean();
+ }
}
}
;
$print = "</p>\n"; // required for IE9 inline edit
$warnings = $driver->warnings();
- if ($warnings && $warnings->num_rows) {
+ if ($warnings) {
$id = "warnings";
- ob_start();
- select($warnings); // select() usually needs to print a big table progressively
$return .= ", <a href='#$id'>" . lang('Warnings') . "</a>" . script("qsl('a').onclick = partial(toggle, '$id');", "")
- . "$print<div id='$id' class='hidden'>\n" . ob_get_clean() . "</div>\n"
+ . "$print<div id='$id' class='hidden'>\n$warnings</div>\n"
;
} else {
$return .= $print;
$return = " <span class='time'>" . @date("H:i:s") . "</span>"; // @ - time zone may be not set
$warnings = $driver->warnings();
$print = "";
- if ($warnings && $warnings->num_rows) {
+ if ($warnings) {
$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";
+ $print = "<div id='$id' class='hidden'>\n$warnings</div>\n";
}
$id = "sql-" . count($history[$_GET["db"]]);
- return $return
- . " <a href='#$id' class='toggle'>" . lang('SQL command') . "</a>"
+ return "$return <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>'
. ($time ? " <span class='time'>($time)</span>" : '')
$time = " <span class='time'>(" . format_time($start) . ")</span>"
. (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
;
- $warnings = $driver->warnings();
- $warnings_id = "warnings-$commands";
- if ($warnings && $warnings->num_rows) {
+ $warnings = ($_POST["only_errors"] ? "" : $driver->warnings());
+ if ($warnings) {
+ $warnings_id = "warnings-$commands";
$time .= ", <a href='#$warnings_id'>" . lang('Warnings') . "</a>" . script("qsl('a').onclick = partial(toggle, '$warnings_id');", "");
}
$explain = null;
echo "<p class='message' title='" . h($connection->info) . "'>" . lang('Query executed OK, %d row(s) affected.', $connection->affected_rows) . "$time\n";
}
}
- if ($warnings && $warnings->num_rows && !$_POST["only_errors"]) {
- echo "<div id='$warnings_id' class='hidden'>\n";
- select($warnings);
- echo "</div>\n";
- }
+ echo ($warnings ? "<div id='$warnings_id' class='hidden'>\n$warnings</div>\n" : "");
if ($explain) {
echo "<div id='$explain_id' class='hidden'>\n";
select($explain, $connection2, $orgtables);