mirror of
https://github.com/vrana/adminer.git
synced 2025-08-18 20:31:19 +02:00
MySQL: Use utf8mb4 in export only if required
This commit is contained in:
@@ -637,7 +637,7 @@ username.form['auth[driver]'].onchange();
|
||||
if ($style) {
|
||||
dump_csv(array_keys(fields($table)));
|
||||
}
|
||||
} elseif ($style) {
|
||||
} else {
|
||||
if ($is_view == 2) {
|
||||
$fields = array();
|
||||
foreach (fields($table) as $name => $field) {
|
||||
@@ -647,7 +647,8 @@ username.form['auth[driver]'].onchange();
|
||||
} else {
|
||||
$create = create_sql($table, $_POST["auto_increment"]);
|
||||
}
|
||||
if ($create) {
|
||||
set_utf8mb4($create);
|
||||
if ($style && $create) {
|
||||
if ($style == "DROP+CREATE" || $is_view == 1) {
|
||||
echo "DROP " . ($is_view == 2 ? "VIEW" : "TABLE") . " IF EXISTS " . table($table) . ";\n";
|
||||
}
|
||||
|
@@ -523,3 +523,15 @@ function db_size($db) {
|
||||
}
|
||||
return format_number($return);
|
||||
}
|
||||
|
||||
/** Print SET NAMES if utf8mb4 might be needed
|
||||
* @param string
|
||||
* @return null
|
||||
*/
|
||||
function set_utf8mb4($create) {
|
||||
static $set = false;
|
||||
if (!$set && preg_match('~\butf8mb4~i', $create)) { // possible false positive
|
||||
$set = true;
|
||||
echo "SET NAMES utf8mb4;\n\n";
|
||||
}
|
||||
}
|
||||
|
@@ -1,2 +1,2 @@
|
||||
<?php
|
||||
$VERSION = "4.2.0";
|
||||
$VERSION = "4.2.1-dev";
|
||||
|
Reference in New Issue
Block a user