]> git.joonet.de Git - adminer.git/commitdiff
Display ; in history (thanks to Jan Cerny)
authorJakub Vrana <jakub@vrana.cz>
Tue, 22 Mar 2011 14:34:34 +0000 (15:34 +0100)
committerJakub Vrana <jakub@vrana.cz>
Tue, 22 Mar 2011 14:37:40 +0000 (15:37 +0100)
adminer/include/editing.inc.php
adminer/include/functions.inc.php
adminer/sql.inc.php
changes.txt

index ccb2a95fc4c0379a9dd2331c0c8b19a3b241bce4..4d9daa6ac9a3e5f891eda21ea0714ea97ffe7085 100644 (file)
@@ -109,7 +109,7 @@ function textarea($name, $value, $rows = 10, $cols = 80) {
        echo "<textarea name='$name' rows='$rows' cols='$cols' class='sqlarea' spellcheck='false' wrap='off' onkeydown='return textareaKeydown(this, event);'>"; // spellcheck, wrap - not valid before HTML5
        if (is_array($value)) {
                foreach ($value as $val) { // not implode() to save memory
-                       echo h($val) . ";\n\n\n"; // rtrim(, ';') would possibly damage DELIMITER
+                       echo h($val) . "\n\n\n";
                }
        } else {
                echo h($value);
index 47ccdae358094b4f966d4d4c9a6e72256ffa2b30..d571bbc458ce7e2b6bec48701fb3f823cfa62fc7 100644 (file)
@@ -413,7 +413,7 @@ function query_redirect($query, $location, $message, $redirect = true, $execute
        }
        $sql = "";
        if ($query) {
-               $sql = $adminer->messageQuery($query);
+               $sql = $adminer->messageQuery("$query;");
        }
        if ($failed) {
                $error = error() . $sql;
@@ -434,9 +434,9 @@ function queries($query = null) {
        static $queries = array();
        if (!isset($query)) {
                // return executed queries without parameter
-               return implode("\n", $queries);
+               return implode(";\n", $queries);
        }
-       $queries[] = (ereg(';$', $query) ? "DELIMITER ;;\n$query;\nDELIMITER ;" : "$query;");
+       $queries[] = (ereg(';$', $query) ? "DELIMITER ;;\n$query;\nDELIMITER " : $query);
        return $connection->query($query);
 }
 
index 820a349aec4f4ff1211a82c1e13f16d3d7ce4513..5451f1591ffed898c111c75fc70cf42030f1b0fb 100644 (file)
@@ -32,8 +32,11 @@ if (!$error && $_POST) {
                if (function_exists('memory_get_usage')) {
                        @ini_set("memory_limit", 2 * strlen($query) + memory_get_usage() + 8e6); // @ - may be disabled, 2 - substr and trim, 8e6 - other variables
                }
-               if ($query != "" && strlen($query) < 1e6 && (!$history || end($history) != $query)) { // don't add repeated and big queries
-                       $history[] = $query;
+               if ($query != "" && strlen($query) < 1e6) { // don't add big queries
+                       $q = $query . (ereg(';$', $query) ? "" : ";"); //! doesn't work with DELIMITER |
+                       if (!$history || end($history) != $q) { // no repeated queries
+                               $history[] = $q;
+                       }
                }
                $space = "(\\s|/\\*.*\\*/|(#|-- )[^\n]*\n|--\n)";
                if (!ini_bool("session.use_cookies")) {
index dcc2dcbc18591a5b276c2ad5f0b0878dcf56b558..d78b00e8d34d65d67c921dcc0cad7ba341cbbdb1 100644 (file)
@@ -12,6 +12,7 @@ Show databases even with skip_show_database in MySQL 5 (thanks to Radoslaw Kowal
 Set MySQL time zone by PHP setting
 Disable maxlength with functions in edit
 Better placement of AJAX icon
+Display ; in history (thanks to Jan Cerny)
 Table header in CSV export (Editor)
 Time format hint (Editor)
 Respect order after search (Editor)