diff --git a/adminer/drivers/mysql.inc.php b/adminer/drivers/mysql.inc.php index cbeda2c8..8eba872c 100644 --- a/adminer/drivers/mysql.inc.php +++ b/adminer/drivers/mysql.inc.php @@ -276,6 +276,10 @@ if (!defined("DRIVER")) { } return queries($prefix . implode(",\n", $values) . $suffix); } + + function warnings() { + return $this->_conn->query("SHOW WARNINGS"); + } } diff --git a/adminer/include/driver.inc.php b/adminer/include/driver.inc.php index 3be05dff..37ef47e5 100644 --- a/adminer/include/driver.inc.php +++ b/adminer/include/driver.inc.php @@ -99,12 +99,25 @@ return queries("BEGIN"); } + /** Commit transaction + * @return bool + */ function commit() { return queries("COMMIT"); } + /** Rollback transaction + * @return bool + */ function rollback() { return queries("ROLLBACK"); } + /** Get warnings about the last command + * @return resource or false + */ + function warnings() { + return false; + } + } diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index 5bff85c5..30eb1e91 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -415,7 +415,7 @@ function get_key_vals($query, $connection2 = null, $timeout = 0, $set_keys = tru * @param string * @param Min_DB * @param string -* @return array associative +* @return array of associative arrays */ function get_rows($query, $connection2 = null, $error = "
") { global $connection; diff --git a/adminer/include/version.inc.php b/adminer/include/version.inc.php index e1a68694..d622ca07 100644 --- a/adminer/include/version.inc.php +++ b/adminer/include/version.inc.php @@ -1,2 +1,2 @@ array('Příkaz proběhl v pořádku, byl změněn %d záznam.', 'Příkaz proběhl v pořádku, byly změněny %d záznamy.', 'Příkaz proběhl v pořádku, bylo změněno %d záznamů.'), 'No commands to execute.' => 'Žádné příkazy k vykonání.', 'Error in query' => 'Chyba v dotazu', + 'Warnings' => 'Varování', 'ATTACH queries are not supported.' => 'Dotazy ATTACH nejsou podporované.', 'Execute' => 'Provést', 'Stop on error' => 'Zastavit při chybě', diff --git a/adminer/lang/xx.inc.php b/adminer/lang/xx.inc.php index cad1d58e..987e09cb 100644 --- a/adminer/lang/xx.inc.php +++ b/adminer/lang/xx.inc.php @@ -52,6 +52,7 @@ $translations = array( 'Query executed OK, %d row(s) affected.' => array('Xx, %d.', 'Xx, %d.'), 'No commands to execute.' => 'Xx.', 'Error in query' => 'Xx', + 'Warnings' => 'Xx', 'ATTACH queries are not supported.' => 'Xx.', 'Execute' => 'Xx', 'Stop on error' => 'Xx', diff --git a/adminer/sql.inc.php b/adminer/sql.inc.php index 408ac591..c7ca3d50 100644 --- a/adminer/sql.inc.php +++ b/adminer/sql.inc.php @@ -117,9 +117,6 @@ if (!$error && $_POST) { do { $result = $connection->store_result(); - $time = " (" . format_time($start) . ")" - . (strlen($q) < 1000 ? " " . lang('Edit') . "" : "") // 1000 - maximum length of encoded URL in IE is 2083 characters - ; if ($connection->error) { echo ($_POST["only_errors"] ? $print : ""); @@ -129,41 +126,56 @@ if (!$error && $_POST) { break 2; } - } elseif (is_object($result)) { - $limit = $_POST["limit"]; - $orgtables = select($result, $connection2, array(), $limit); - if (!$_POST["only_errors"]) { - echo "
\n"; - } - } else { - if (preg_match("~^$space*+(CREATE|DROP|ALTER)$space++(DATABASE|SCHEMA)\\b~i", $q)) { - restart_session(); - set_session("dbs", null); // clear cache - stop_session(); + $time = " (" . format_time($start) . ")" + . (strlen($q) < 1000 ? " " . lang('Edit') . "" : "") // 1000 - maximum length of encoded URL in IE is 2083 characters + ; + $warnings = $driver->warnings(); + $warnings_id = "warnings-$commands"; + if ($warnings && $warnings->num_rows) { + $time .= ", " . lang('Warnings') . "" . script("qsl('a').onclick = partial(toggle, '$warnings_id');", ""); } - if (!$_POST["only_errors"]) { - echo " \n"; + } + + } else { + if (preg_match("~^$space*+(CREATE|DROP|ALTER)$space++(DATABASE|SCHEMA)\\b~i", $q)) { + restart_session(); + set_session("dbs", null); // clear cache + stop_session(); + } + if (!$_POST["only_errors"]) { + echo "