From c8975a151ccd33bff5a77a27683961816bef7ebb Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Sat, 27 Oct 2018 18:06:20 +0200 Subject: [PATCH] Recognize current_timestamp() in edit (bug #638) --- adminer/include/functions.inc.php | 6 +++--- changes.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index 9e98e933..1cfdeaac 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -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"; } diff --git a/changes.txt b/changes.txt index b1d6b71e..cebc64eb 100644 --- a/changes.txt +++ b/changes.txt @@ -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