mirror of
https://github.com/vrana/adminer.git
synced 2025-08-14 10:34:01 +02:00
MariaDB: Don't display NULL as default value
This commit is contained in:
@@ -602,20 +602,20 @@ if (!defined('Adminer\DRIVER')) {
|
|||||||
preg_match('~^(VIRTUAL|PERSISTENT|STORED)~', $extra, $generated);
|
preg_match('~^(VIRTUAL|PERSISTENT|STORED)~', $extra, $generated);
|
||||||
preg_match('~^([^( ]+)(?:\((.+)\))?( unsigned)?( zerofill)?$~', $type, $match_type);
|
preg_match('~^([^( ]+)(?:\((.+)\))?( unsigned)?( zerofill)?$~', $type, $match_type);
|
||||||
$default = $row["COLUMN_DEFAULT"];
|
$default = $row["COLUMN_DEFAULT"];
|
||||||
$is_text = preg_match('~text~', $match_type[1]);
|
if ($default != "") {
|
||||||
if (!$maria && $is_text) {
|
$is_text = preg_match('~text~', $match_type[1]);
|
||||||
// default value a'b of text column is stored as _utf8mb4\'a\\\'b\' in MySQL
|
if (!$maria && $is_text) {
|
||||||
$default = preg_replace("~^(_\w+)?('.*')$~", '\2', stripslashes($default));
|
// default value a'b of text column is stored as _utf8mb4\'a\\\'b\' in MySQL
|
||||||
}
|
$default = preg_replace("~^(_\w+)?('.*')$~", '\2', stripslashes($default));
|
||||||
if ($maria || $is_text) {
|
}
|
||||||
$default = preg_replace_callback("~^'(.*)'$~", function ($match) {
|
if ($maria || $is_text) {
|
||||||
return stripslashes(str_replace("''", "'", $match[1]));
|
$default = ($default == "NULL" ? null : preg_replace_callback("~^'(.*)'$~", function ($match) {
|
||||||
}, $default);
|
return stripslashes(str_replace("''", "'", $match[1]));
|
||||||
}
|
}, $default));
|
||||||
if (!$maria && preg_match('~binary~', $match_type[1]) && preg_match('~^0x(\w*)$~', $default, $match)) {
|
}
|
||||||
$default = preg_replace_callback('~..~', function ($match) {
|
if (!$maria && preg_match('~binary~', $match_type[1]) && preg_match('~^0x(\w*)$~', $default, $match)) {
|
||||||
return chr(hexdec($match[0]));
|
$default = pack("H*", $match[1]);
|
||||||
}, $match[1]);
|
}
|
||||||
}
|
}
|
||||||
$return[$field] = array(
|
$return[$field] = array(
|
||||||
"field" => $field,
|
"field" => $field,
|
||||||
@@ -625,7 +625,7 @@ if (!defined('Adminer\DRIVER')) {
|
|||||||
"unsigned" => ltrim($match_type[3] . $match_type[4]),
|
"unsigned" => ltrim($match_type[3] . $match_type[4]),
|
||||||
"default" => ($generated
|
"default" => ($generated
|
||||||
? ($maria ? $generation : stripslashes($generation))
|
? ($maria ? $generation : stripslashes($generation))
|
||||||
: ($default != "" || preg_match("~char|set~", $match_type[1]) ? $default : null)
|
: $default
|
||||||
),
|
),
|
||||||
"null" => ($row["IS_NULLABLE"] == "YES"),
|
"null" => ($row["IS_NULLABLE"] == "YES"),
|
||||||
"auto_increment" => ($extra == "auto_increment"),
|
"auto_increment" => ($extra == "auto_increment"),
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
Adminer dev:
|
Adminer dev:
|
||||||
MySQL: Display default values of binary columns
|
MySQL: Display default values of binary columns
|
||||||
|
MariaDB: Don't display NULL as default value (regression from 5.0.0)
|
||||||
PostgreSQL PDO: Escape bytea values (bug #218)
|
PostgreSQL PDO: Escape bytea values (bug #218)
|
||||||
|
|
||||||
Adminer 5.0.4 (released 2025-03-11):
|
Adminer 5.0.4 (released 2025-03-11):
|
||||||
@@ -85,7 +86,7 @@ SQLite: Show all supported pragmas in Variables
|
|||||||
MS SQL: Allow altering table in non-default schema (bug #405)
|
MS SQL: Allow altering table in non-default schema (bug #405)
|
||||||
MS SQL: Fix default values (bug #732, bug #733)
|
MS SQL: Fix default values (bug #732, bug #733)
|
||||||
MS SQL: Fix length of nvarchar columns
|
MS SQL: Fix length of nvarchar columns
|
||||||
Editor: PDO: Select value of foreign key in edit (bug #847)
|
Editor PDO: Select value of foreign key in edit (bug #847)
|
||||||
Mobile devices: Use device width
|
Mobile devices: Use device width
|
||||||
|
|
||||||
Adminer 4.16.0 (released 2025-02-20):
|
Adminer 4.16.0 (released 2025-02-20):
|
||||||
|
Reference in New Issue
Block a user