if ($is_sql) {
echo "-- Adminer $VERSION " . $drivers[DRIVER] . " dump\n\n";
if ($jush == "sql") {
- echo "SET NAMES " . charset($connection) . ";
+ echo "SET NAMES utf8;
SET time_zone = '+00:00';
" . ($_POST["data_style"] ? "SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
$adminer->dumpDatabase($db);
if ($connection->select_db($db)) {
if ($is_sql && preg_match('~CREATE~', $style) && ($create = $connection->result("SHOW CREATE DATABASE " . idf_escape($db), 1))) {
+ set_utf8mb4($create);
if ($style == "DROP+CREATE") {
echo "DROP DATABASE IF EXISTS " . idf_escape($db) . ";\n";
}
if ($_POST["routines"]) {
foreach (array("FUNCTION", "PROCEDURE") as $routine) {
foreach (get_rows("SHOW $routine STATUS WHERE Db = " . q($db), null, "-- ") as $row) {
- $out .= ($style != 'DROP+CREATE' ? "DROP $routine IF EXISTS " . idf_escape($row["Name"]) . ";;\n" : "")
- . remove_definer($connection->result("SHOW CREATE $routine " . idf_escape($row["Name"]), 2)) . ";;\n\n";
+ $create = remove_definer($connection->result("SHOW CREATE $routine " . idf_escape($row["Name"]), 2));
+ set_utf8mb4($create);
+ $out .= ($style != 'DROP+CREATE' ? "DROP $routine IF EXISTS " . idf_escape($row["Name"]) . ";;\n" : "") . "$create;;\n\n";
}
}
}
if ($_POST["events"]) {
foreach (get_rows("SHOW EVENTS", null, "-- ") as $row) {
- $out .= ($style != 'DROP+CREATE' ? "DROP EVENT IF EXISTS " . idf_escape($row["Name"]) . ";;\n" : "")
- . remove_definer($connection->result("SHOW CREATE EVENT " . idf_escape($row["Name"]), 3)) . ";;\n\n";
+ $create = remove_definer($connection->result("SHOW CREATE EVENT " . idf_escape($row["Name"]), 3));
+ set_utf8mb4($create);
+ $out .= ($style != 'DROP+CREATE' ? "DROP EVENT IF EXISTS " . idf_escape($row["Name"]) . ";;\n" : "") . "$create;;\n\n";
}
}
if ($style) {
dump_csv(array_keys(fields($table)));
}
- } elseif ($style) {
+ } else {
if ($is_view == 2) {
$fields = array();
foreach (fields($table) as $name => $field) {
} 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";
}
}
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";
+ }
+}
-Adminer 4.2.0 (released 2015-02-07)
+Adminer 4.2.1-dev:
+MySQL: Use utf8mb4 in export only if required
+
+Adminer 4.2.0 (released 2015-02-07):
Fix XSS in login form (bug #436)
Allow limiting number of displayed rows in SQL command
Fix reading routine column collations
Firebird: Alpha version
Danish translation
-Adminer 4.1.0 (released 2014-04-18)
+Adminer 4.1.0 (released 2014-04-18):
Provide size of all databases in the overview
Prevent against brute force login attempts from the same IP address
Compute number of tables in the overview explicitly