]> git.joonet.de Git - adminer.git/commitdiff
Quote dates in default value
authorJakub Vrana <jakub@vrana.cz>
Tue, 30 Jan 2018 16:00:34 +0000 (17:00 +0100)
committerJakub Vrana <jakub@vrana.cz>
Tue, 30 Jan 2018 16:00:34 +0000 (17:00 +0100)
adminer/include/editing.inc.php

index 3f62132b729dae1518b69ca0ba921dfe12f40f0b..f689224804808321b3a2737c425dc0629edc50dd 100644 (file)
@@ -198,7 +198,7 @@ function process_field($field, $type_field) {
                idf_escape(trim($field["field"])),
                process_type($type_field),
                ($field["null"] ? " NULL" : " NOT NULL"), // NULL for timestamp
-               (isset($default) ? " DEFAULT " . (preg_match('~char|binary|text|enum|set~', $field["type"]) && !preg_match('~^\\d*\\.?\\d+$~', $default) ? q($default) : $default) : ""),
+               (isset($default) ? " DEFAULT " . (preg_match('~char|binary|text|enum|set~', $field["type"]) || preg_match('~^[\\d.]+[^\\d.]~', $default) ? q($default) : $default) : ""),
                (preg_match('~timestamp|datetime~', $field["type"]) && $field["on_update"] ? " ON UPDATE $field[on_update]" : ""),
                (support("comment") && $field["comment"] != "" ? " COMMENT " . q($field["comment"]) : ""),
                ($field["auto_increment"] ? auto_increment() : null),