Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit 5acd5a2afb484608eaed1853108a2e1ce51ec59e 1 parent dd882b1
jakubvrana authored
View
2  adminer/call.inc.php
@@ -57,7 +57,7 @@
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";
View
3  adminer/edit.inc.php
@@ -78,7 +78,8 @@
? (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
View
4 adminer/include/functions.inc.php
@@ -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>' : "&nbsp;") . '<td>';
+ echo (count($options) > 1 || isset($_GET["select"]) ? '<select name="function[' . $name . ']">' . (isset($_GET["select"]) ? '<option value="orig">' . lang('original') : '') . optionlist($options, $function) . '</select>' : "&nbsp;") . '<td>';
if ($field["type"] == "set") { //! 64 bits
preg_match_all("~'((?:[^']+|'')*)'~", $field["length"], $matches);
foreach ($matches[1] as $i => $val) {
View
1  adminer/include/mysql.inc.php
@@ -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"],
Please sign in to comment.
Something went wrong with that request. Please try again.