]> git.joonet.de Git - adminer.git/commitdiff
Compatibility with MySQL 5.6
authorJakub Vrana <jakub@vrana.cz>
Wed, 20 Feb 2013 00:57:04 +0000 (16:57 -0800)
committerJakub Vrana <jakub@vrana.cz>
Wed, 20 Feb 2013 11:40:20 +0000 (03:40 -0800)
adminer/edit.inc.php
adminer/include/editing.inc.php
adminer/include/functions.inc.php
adminer/indexes.inc.php
changes.txt

index 1c8c982211b4bfcbfd4ca38cb42680dc7040919a..b3f9d301ba3dcef5dc4523971d5a332ba43f946f 100644 (file)
@@ -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";
                }
index 21de175ab49194ccd62d9672ad989068cfb89b14..e31d590870d0fe80a5709a4f655724444c01bee6 100644 (file)
@@ -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),
index 876318d7fef183c9587f1361a92c871d25480ed0..d0557b1d13f11a0f2179aec71f64e7538f204e36 100644 (file)
@@ -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 "<td class='function'>";
        $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 "<input" . (ereg('int', $field["type"]) ? " type='number'" : "") . " value='" . h($value) . "'" . ($maxlength ? " maxlength='$maxlength'" : "") . (ereg('char|binary', $field["type"]) && $maxlength > 20 ? " size='40'" : "") . "$attrs>";
                }
index 097b6077ff6b5bd0debb1aa9247fea7791db8cc8..11d6ea8aef07d99709f49c4dd47b2a2ce88a91d6 100644 (file)
@@ -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);
index e68575f5f083b192eb139538bbb6457837871663..551c0845a0c49f37ca50567515bb7381fea7593f 100644 (file)
@@ -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