Recognize current_timestamp() in edit (bug #638)

This commit is contained in:
Jakub Vrana 2018-10-27 18:06:20 +02:00
parent 150841e5d7
commit c8975a151c
2 changed files with 4 additions and 4 deletions

View 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";
}

View 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