diff --git a/adminer/edit.inc.php b/adminer/edit.inc.php index 1c8c9822..b3f9d301 100644 --- a/adminer/edit.inc.php +++ b/adminer/edit.inc.php @@ -92,7 +92,7 @@ if (!$fields) { $value = $adminer->editVal($value, $field); } $function = ($_POST["save"] ? (string) $_POST["function"][$name] : ($update && $field["on_update"] == "CURRENT_TIMESTAMP" ? "now" : ($value === false ? null : ($value !== null ? '' : 'NULL')))); - if ($field["type"] == "timestamp" && $value == "CURRENT_TIMESTAMP") { + if (ereg("time", $field["type"]) && $value == "CURRENT_TIMESTAMP") { $value = ""; $function = "now"; } diff --git a/adminer/include/editing.inc.php b/adminer/include/editing.inc.php index 21de175a..e31d5908 100644 --- a/adminer/include/editing.inc.php +++ b/adminer/include/editing.inc.php @@ -186,7 +186,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($field["default"]) ? " DEFAULT " . (($field["type"] == "timestamp" && eregi('^CURRENT_TIMESTAMP$', $field["default"])) || ($field["type"] == "bit" && ereg("^([0-9]+|b'[0-1]+')\$", $field["default"])) ? $field["default"] : q($field["default"])) : ""), + (isset($field["default"]) ? " DEFAULT " . ((ereg("time", $field["type"]) && eregi('^CURRENT_TIMESTAMP$', $field["default"])) || ($field["type"] == "bit" && ereg("^([0-9]+|b'[0-1]+')\$", $field["default"])) ? $field["default"] : q($field["default"])) : ""), ($field["on_update"] ? " ON UPDATE $field[on_update]" : ""), (support("comment") && $field["comment"] != "" ? " COMMENT " . q($field["comment"]) : ""), ($field["auto_increment"] ? auto_increment() : null), diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index 876318d7..d0557b1d 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -699,7 +699,7 @@ function enum_input($type, $attrs, $field, $value, $empty = null) { * @return null */ function input($field, $value, $function) { - global $types, $adminer, $jush; + global $connection, $types, $adminer, $jush; $name = h(bracket_escape($field["field"])); echo ""; $reset = ($jush == "mssql" && $field["auto_increment"]); @@ -744,6 +744,9 @@ function input($field, $value, $function) { } else { // int(3) is only a display hint $maxlength = (!ereg('int', $field["type"]) && preg_match('~^(\\d+)(,(\\d+))?$~', $field["length"], $match) ? ((ereg("binary", $field["type"]) ? 2 : 1) * $match[1] + ($match[3] ? 1 : 0) + ($match[2] && !$field["unsigned"] ? 1 : 0)) : ($types[$field["type"]] ? $types[$field["type"]] + ($field["unsigned"] ? 0 : 1) : 0)); + if ($connection->server_info >= 5.6 && ereg('time', $field["type"])) { + $maxlength += 7; // microtime + } // type='date' and type='time' display localized value which may be confusing, type='datetime' uses 'T' as date and time separator echo " 20 ? " size='40'" : "") . "$attrs>"; } diff --git a/adminer/indexes.inc.php b/adminer/indexes.inc.php index 097b6077..11d6ea8a 100644 --- a/adminer/indexes.inc.php +++ b/adminer/indexes.inc.php @@ -2,7 +2,7 @@ $TABLE = $_GET["indexes"]; $index_types = array("PRIMARY", "UNIQUE", "INDEX"); $table_status = table_status($TABLE); -if (eregi("MyISAM|M?aria", $table_status["Engine"])) { +if (eregi("MyISAM|M?aria" . ($connection->server_info >= 5.6 ? "|InnoDB" : ""), $table_status["Engine"])) { $index_types[] = "FULLTEXT"; } $indexes = indexes($TABLE); diff --git a/changes.txt b/changes.txt index e68575f5..551c0845 100644 --- a/changes.txt +++ b/changes.txt @@ -1,4 +1,5 @@ Adminer 3.6.4-dev: +Compatibility with MySQL 5.6 Recover original view, trigger, routine if creating fails Disable autocapitalize in identifiers Indeterminate state of select all checkboxes