From 2959a052c46a2b9684327189adc827c615e4a996 Mon Sep 17 00:00:00 2001 From: jakubvrana Date: Fri, 21 Aug 2009 17:08:10 +0000 Subject: [PATCH] Use now function instead of CURRENT_TIMESTAMP git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@996 7c3ca157-0c34-0410-bff1-cbf682f78f5c --- adminer/edit.inc.php | 4 ++++ adminer/include/adminer.inc.php | 2 -- editor/include/adminer.inc.php | 2 -- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/adminer/edit.inc.php b/adminer/edit.inc.php index 951be334..a6334351 100644 --- a/adminer/edit.inc.php +++ b/adminer/edit.inc.php @@ -78,6 +78,10 @@ if ($fields) { $value = $adminer->editVal($value, $field); } $function = ($_POST["save"] ? (string) $_POST["function"][$name] : ($where && $field["on_update"] == "CURRENT_TIMESTAMP" ? "now" : ($value === false ? null : (isset($value) ? '' : 'NULL')))); + if ($field["type"] == "timestamp" && $value == "CURRENT_TIMESTAMP") { + $value = ""; + $function = "now"; + } input($field, $value, $function); echo "\n"; } diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php index 2cbfa2d1..a619a8f7 100644 --- a/adminer/include/adminer.inc.php +++ b/adminer/include/adminer.inc.php @@ -400,8 +400,6 @@ class Adminer { $return = "$function(" . idf_escape($name) . ", $return)"; } elseif (ereg('^(md5|sha1|password)$', $function)) { $return = "$function($return)"; - } elseif (ereg('date|time', $field["type"]) && $value == "CURRENT_TIMESTAMP") { - $return = $value; } return $return; } diff --git a/editor/include/adminer.inc.php b/editor/include/adminer.inc.php index b82cc2de..feb73935 100644 --- a/editor/include/adminer.inc.php +++ b/editor/include/adminer.inc.php @@ -331,8 +331,6 @@ ORDER BY ORDINAL_POSITION"); //! requires MySQL 5 ); if (!ereg('varchar|text', $field["type"]) && $field["full_type"] != "tinyint(1)" && !strlen($value)) { $return = "NULL"; - } elseif (ereg('date|time', $field["type"]) && $value == "CURRENT_TIMESTAMP") { - $return = $value; } return $return; }