]> git.joonet.de Git - adminer.git/commitdiff
Recognize current_timestamp() in edit (bug #638)
authorJakub Vrana <jakub@vrana.cz>
Sat, 27 Oct 2018 16:06:20 +0000 (18:06 +0200)
committerJakub Vrana <jakub@vrana.cz>
Sat, 27 Oct 2018 16:06:20 +0000 (18:06 +0200)
adminer/include/functions.inc.php
changes.txt

index 9e98e9330c7d8b02aeda659c8dbcd17ad4976524..1cfdeaac26e40dbaa48757be484726172ba35b6d 100644 (file)
@@ -1021,7 +1021,7 @@ function process_input($field) {
                return null;
        }
        if ($function == "orig") {
-               return ($field["on_update"] == "CURRENT_TIMESTAMP" ? idf_escape($field["field"]) : false);
+               return (preg_match('~^CURRENT_TIMESTAMP~i', $field["on_update"]) ? idf_escape($field["field"]) : false);
        }
        if ($function == "NULL") {
                return "NULL";
@@ -1445,12 +1445,12 @@ function edit_form($TABLE, $fields, $row, $update) {
                        }
                        $function = ($_POST["save"]
                                ? (string) $_POST["function"][$name]
-                               : ($update && $field["on_update"] == "CURRENT_TIMESTAMP"
+                               : ($update && preg_match('~^CURRENT_TIMESTAMP~i', $field["on_update"])
                                        ? "now"
                                        : ($value === false ? null : ($value !== null ? '' : 'NULL'))
                                )
                        );
-                       if (preg_match("~time~", $field["type"]) && $value == "CURRENT_TIMESTAMP") {
+                       if (preg_match("~time~", $field["type"]) && preg_match('~^CURRENT_TIMESTAMP~i', $value)) {
                                $value = "";
                                $function = "now";
                        }
index b1d6b71e5eaa4d05f2dda555e534038ba35df949..cebc64eb9901f6f203b9fe76fa02afa9fd5c4987 100644 (file)
@@ -8,7 +8,7 @@ Fix function change with set data type
 Increase username maxlength to 80 (bug #623)
 Make maxlength in all fields a soft limit
 MySQL: Support foreign keys created with ANSI quotes (bug #620)
-MySQL: Recognize ON UPDATE current_timestamp() (bug #632)
+MySQL: Recognize ON UPDATE current_timestamp() (bug #632, bug #638)
 PostgreSQL: Quote array values in export (bug #621)
 MSSQL: Pass database when connecting
 ClickHouse: Connect, databases list, tables list, select, SQL command