From e9add6d985446171b762d09dd921ef54fd512f3d Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Thu, 1 Feb 2018 11:43:44 +0100 Subject: [PATCH] Return string from warnings() --- adminer/drivers/mysql.inc.php | 7 ++++++- adminer/include/adminer.inc.php | 15 +++++---------- adminer/include/driver.inc.php | 4 ++-- adminer/sql.inc.php | 12 ++++-------- 4 files changed, 17 insertions(+), 21 deletions(-) diff --git a/adminer/drivers/mysql.inc.php b/adminer/drivers/mysql.inc.php index 8eba872c..890a6aaa 100644 --- a/adminer/drivers/mysql.inc.php +++ b/adminer/drivers/mysql.inc.php @@ -278,7 +278,12 @@ if (!defined("DRIVER")) { } 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(); + } } } diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php index 0d66ac48..c28881e9 100644 --- a/adminer/include/adminer.inc.php +++ b/adminer/include/adminer.inc.php @@ -212,12 +212,10 @@ class Adminer { ; $print = "

\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 .= ", " . lang('Warnings') . "" . script("qsl('a').onclick = partial(toggle, '$id');", "") - . "$print\n" + . "$print\n" ; } else { $return .= $print; @@ -629,16 +627,13 @@ class Adminer { $return = " " . @date("H:i:s") . ""; // @ - time zone may be not set $warnings = $driver->warnings(); $print = ""; - if ($warnings && $warnings->num_rows) { + if ($warnings) { $id = "warnings-" . count($history[$_GET["db"]]); $return .= " " . lang('Warnings') . ","; - ob_start(); - select($warnings); // select() usually needs to print a big table progressively - $print = "\n"; + $print = "\n"; } $id = "sql-" . count($history[$_GET["db"]]); - return $return - . " " . lang('SQL command') . "" + return "$return " . lang('SQL command') . "" . $print . "