Use NOW for timestamp edit (thanks to paranoiq)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@814 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
dd882b153b
commit
5acd5a2afb
|
@ -57,7 +57,7 @@ if ($in) {
|
|||
if (strlen($value) && ($field["type"] == "enum" || $field["type"] == "set")) {
|
||||
$value = intval($value);
|
||||
}
|
||||
input($key, $field, $value); // param name can be empty
|
||||
input($key, $field, $value, (string) $_POST["function"][$name]); // param name can be empty
|
||||
echo "\n";
|
||||
}
|
||||
echo "</table>\n";
|
||||
|
|
|
@ -78,7 +78,8 @@ if ($fields) {
|
|||
? (strlen($row[$name]) && ($field["type"] == "enum" || $field["type"] == "set") ? intval($row[$name]) : $row[$name])
|
||||
: ($_POST["clone"] && $field["auto_increment"] ? "" : ($where ? $field["default"] : false))
|
||||
);
|
||||
input($name, $field, $value);
|
||||
$function = ($_POST["save"] ? (string) $_POST["function"][$name] : ($field[($where ? "on_update" : "default")] == "CURRENT_TIMESTAMP" ? "now" : ($value === false ? null : (isset($value) ? '' : 'NULL'))));
|
||||
input($name, $field, $value, $function);
|
||||
if (isset($_GET["default"]) && $field["type"] == "timestamp") {
|
||||
if (!isset($create) && !$_POST) {
|
||||
//! disable sql_mode NO_FIELD_OPTIONS
|
||||
|
|
|
@ -257,7 +257,7 @@ function hidden_fields($process, $ignore = array()) {
|
|||
}
|
||||
}
|
||||
|
||||
function input($name, $field, $value) {
|
||||
function input($name, $field, $value, $function) {
|
||||
global $types;
|
||||
$name = htmlspecialchars(bracket_escape($name));
|
||||
echo "<td class='function'>";
|
||||
|
@ -301,7 +301,7 @@ function input($name, $field, $value) {
|
|||
if ($field["null"] || isset($_GET["default"])) {
|
||||
array_unshift($options, "NULL");
|
||||
}
|
||||
echo (count($options) > 1 || isset($_GET["select"]) ? '<select name="function[' . $name . ']">' . (isset($_GET["select"]) ? '<option value="orig">' . lang('original') : '') . optionlist($options, ($value === false ? null : (isset($value) ? (string) $_POST["function"][$name] : 'NULL'))) . '</select>' : " ") . '<td>';
|
||||
echo (count($options) > 1 || isset($_GET["select"]) ? '<select name="function[' . $name . ']">' . (isset($_GET["select"]) ? '<option value="orig">' . lang('original') : '') . optionlist($options, $function) . '</select>' : " ") . '<td>';
|
||||
if ($field["type"] == "set") { //! 64 bits
|
||||
preg_match_all("~'((?:[^']+|'')*)'~", $field["length"], $matches);
|
||||
foreach ($matches[1] as $i => $val) {
|
||||
|
|
|
@ -262,6 +262,7 @@ function fields($table) {
|
|||
"default" => (strlen($row["Default"]) || ereg("char", $match[1]) ? $row["Default"] : null),
|
||||
"null" => ($row["Null"] == "YES"),
|
||||
"auto_increment" => ($row["Extra"] == "auto_increment"),
|
||||
"on_update" => (preg_match('~^on update (.+)~', $row["Extra"], $match) ? $match[1] : ""),
|
||||
"collation" => $row["Collation"],
|
||||
"privileges" => array_flip(explode(",", $row["Privileges"])),
|
||||
"comment" => $row["Comment"],
|
||||
|
|
Loading…
Reference in a new issue