diff --git a/adminer/lang/cs.inc.php b/adminer/lang/cs.inc.php index 8e17fab4..03e8f668 100644 --- a/adminer/lang/cs.inc.php +++ b/adminer/lang/cs.inc.php @@ -49,6 +49,7 @@ $translations = array( 'Query executed OK, %d row(s) affected.' => 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', + 'ATTACH queries are not supported.' => 'Dotazy ATTACH nejsou podporované.', 'Execute' => 'Provést', 'Stop on error' => 'Zastavit při chybě', 'Show only errors' => 'Zobrazit pouze chyby', diff --git a/adminer/lang/xx.inc.php b/adminer/lang/xx.inc.php index a8c57fb8..ddb7d74d 100644 --- a/adminer/lang/xx.inc.php +++ b/adminer/lang/xx.inc.php @@ -49,6 +49,7 @@ $translations = array( 'Query executed OK, %d row(s) affected.' => array('Xx.', 'Xx.'), 'No commands to execute.' => 'Xx.', 'Error in query' => 'Xx', + 'ATTACH queries are not supported.' => 'Xx.', 'Execute' => 'Xx', 'Stop on error' => 'Xx', 'Show only errors' => 'Xx', diff --git a/adminer/sql.inc.php b/adminer/sql.inc.php index a3fb5da8..6e366502 100644 --- a/adminer/sql.inc.php +++ b/adminer/sql.inc.php @@ -94,71 +94,81 @@ if (!$error && $_POST) { $q = substr($query, 0, $pos); $commands++; $print = "
" . shorten_utf8(trim($q), 1000) . "
\n"; - if (!$_POST["only_errors"]) { + if ($jush == "sqlite" && preg_match("~^$space*ATTACH\b~i", $q, $match)) { + // PHP doesn't support setting SQLITE_LIMIT_ATTACHED echo $print; - ob_flush(); - flush(); // can take a long time - show the running query - } - $start = microtime(true); - //! don't allow changing of character_set_results, convert encoding of displayed query - if ($connection->multi_query($q) && is_object($connection2) && preg_match("~^$space*USE\\b~isU", $q)) { - $connection2->query($q); - } - - 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 : ""); - echo "

" . lang('Error in query') . ($connection->errno ? " ($connection->errno)" : "") . ": " . error() . "\n"; - $errors[] = " $commands"; - if ($_POST["error_stops"]) { - break 2; - } - - } elseif (is_object($result)) { - $limit = $_POST["limit"]; - $orgtables = select($result, $connection2, array(), $limit); - if (!$_POST["only_errors"]) { - echo "

\n"; - $num_rows = $result->num_rows; - echo "

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

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

" . lang('Query executed OK, %d row(s) affected.', $connection->affected_rows) . "$time\n"; - } + echo "

" . lang('ATTACH queries are not supported.') . "\n"; + $errors[] = " $commands"; + if ($_POST["error_stops"]) { + break; + } + } else { + if (!$_POST["only_errors"]) { + echo $print; + ob_flush(); + flush(); // can take a long time - show the running query + } + $start = microtime(true); + //! don't allow changing of character_set_results, convert encoding of displayed query + if ($connection->multi_query($q) && is_object($connection2) && preg_match("~^$space*USE\\b~isU", $q)) { + $connection2->query($q); } - $start = microtime(true); - } while ($connection->next_result()); + 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 : ""); + echo "

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

\n"; + $num_rows = $result->num_rows; + echo "

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

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

" . lang('Query executed OK, %d row(s) affected.', $connection->affected_rows) . "$time\n"; + } + } + + $start = microtime(true); + } while ($connection->next_result()); + } $query = substr($query, $offset); $offset = 0; diff --git a/changes.txt b/changes.txt index 3b2f8fcf..b268eca9 100644 --- a/changes.txt +++ b/changes.txt @@ -1,4 +1,5 @@ Adminer 4.2.4-dev: +Fix remote execution in SQLite query MySQL: Support PHP 7 Bosnian translation Finnish translation