diff --git a/adminer/sql.inc.php b/adminer/sql.inc.php index a900b449..40762058 100644 --- a/adminer/sql.inc.php +++ b/adminer/sql.inc.php @@ -92,57 +92,55 @@ if (!$error && $_POST) { } $start = explode(" ", microtime()); // microtime(true) is available since PHP 5 //! don't allow changing of character_set_results, convert encoding of displayed query - if ($connection->multi_query($q)) { - if (is_object($connection2) && preg_match("~^$space*USE\\b~isU", $q)) { - $connection2->query($q); - } - do { - $result = $connection->store_result(); - $end = explode(" ", microtime()); - $time = format_time($start, $end) . (strlen($q) < 1000 ? " " . lang('Edit') . "" : ""); // 1000 - maximum length of encoded URL in IE is 2083 characters - if (!is_object($result)) { - if (preg_match("~^$space*(CREATE|DROP|ALTER)$space+(DATABASE|SCHEMA)\\b~isU", $q)) { - restart_session(); - set_session("dbs", null); // clear cache - session_write_close(); - } - if (!$_POST["only_errors"]) { - echo "

" . lang('Query executed OK, %d row(s) affected.', $connection->affected_rows) . "$time\n"; - } - } else { - select($result, $connection2); - if (!$_POST["only_errors"]) { - echo "

\n"; - echo "

" . ($result->num_rows ? lang('%d row(s)', $result->num_rows) : "") . $time; - $id = "export-$commands"; - $export = ", " . lang('Export') . "" - ; - if ($connection2 && preg_match("~^($space|\\()*SELECT\\b~isU", $q) && ($explain = explain($connection2, $q))) { - $id = "explain-$commands"; - echo ", EXPLAIN$export\n"; - echo "

\n"; - } else { - echo "$export\n"; - } - echo "
\n"; - } - } - $start = $end; - } while ($connection->next_result()); - } elseif ($connection->error) { - echo ($_POST["only_errors"] ? $print : ""); - echo "

" . lang('Error in query') . ": " . error() . "\n"; - $errors[] = " $commands"; - if ($_POST["error_stops"]) { - break; - } + if ($connection->multi_query($q) && is_object($connection2) && preg_match("~^$space*USE\\b~isU", $q)) { + $connection2->query($q); } + do { + $result = $connection->store_result(); + $end = explode(" ", microtime()); + $time = format_time($start, $end) . (strlen($q) < 1000 ? " " . lang('Edit') . "" : ""); // 1000 - maximum length of encoded URL in IE is 2083 characters + if ($connection->error) { + echo ($_POST["only_errors"] ? $print : ""); + echo "

" . lang('Error in query') . ": " . error() . "\n"; + $errors[] = " $commands"; + if ($_POST["error_stops"]) { + break; + } + } elseif (is_object($result)) { + select($result, $connection2); + if (!$_POST["only_errors"]) { + echo "

\n"; + echo "

" . ($result->num_rows ? lang('%d row(s)', $result->num_rows) : "") . $time; + $id = "export-$commands"; + $export = ", " . lang('Export') . "" + ; + if ($connection2 && preg_match("~^($space|\\()*SELECT\\b~isU", $q) && ($explain = explain($connection2, $q))) { + $id = "explain-$commands"; + echo ", EXPLAIN$export\n"; + echo "

\n"; + } else { + echo "$export\n"; + } + echo "
\n"; + } + } else { + if (preg_match("~^$space*(CREATE|DROP|ALTER)$space+(DATABASE|SCHEMA)\\b~isU", $q)) { + restart_session(); + set_session("dbs", null); // clear cache + session_write_close(); + } + if (!$_POST["only_errors"]) { + echo "

" . lang('Query executed OK, %d row(s) affected.', $connection->affected_rows) . "$time\n"; + } + } + $start = $end; + } while ($connection->next_result()); $query = substr($query, $offset); $offset = 0; }