Compatibility with MySQL 5.6

This commit is contained in:
Jakub Vrana 2013-02-19 16:57:04 -08:00
parent 356cadf2b2
commit 2b2d6987ef
5 changed files with 8 additions and 4 deletions

View 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";
}

View 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),

View 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>";
}

View 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);

View 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