From e160ad27cbff1ea3809c211eda717ad8bd8939fb Mon Sep 17 00:00:00 2001 From: jakubvrana Date: Thu, 2 Apr 2009 09:46:42 +0000 Subject: [PATCH] max_allowed_packet doesn't work git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@570 7c3ca157-0c34-0410-bff1-cbf682f78f5c --- dump.inc.php | 3 +-- export.inc.php | 13 +------------ 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/dump.inc.php b/dump.inc.php index a07e3a0d..78644013 100644 --- a/dump.inc.php +++ b/dump.inc.php @@ -12,11 +12,10 @@ function tar_file($filename, $contents) { if ($_POST) { $ext = dump_headers((strlen($_GET["dump"]) ? $_GET["dump"] : $_GET["db"]), (!strlen($_GET["db"]) || count(array_filter((array) $_POST["tables"]) + array_filter((array) $_POST["data"])) > 1)); if ($_POST["format"] != "csv") { - $max_packet = 16777216; + $max_packet = 1048576; // default, minimum is 1024 echo "SET NAMES utf8;\n"; echo "SET foreign_key_checks = 0;\n"; echo "SET time_zone = '" . $mysql->escape_string($mysql->result($mysql->query("SELECT @@time_zone"))) . "';\n"; - echo "SET max_allowed_packet = $max_packet;\n"; // ignored because of MySQL bug #22891 echo "\n"; } diff --git a/export.inc.php b/export.inc.php index 7787bfc9..b404add3 100644 --- a/export.inc.php +++ b/export.inc.php @@ -9,7 +9,7 @@ function dump_csv($row) { } function dump_table($table, $style, $is_view = false) { - global $mysql, $max_packet, $types; + global $mysql, $types; if ($_POST["format"] == "csv") { echo "\xef\xbb\xbf"; if ($style) { @@ -24,17 +24,6 @@ function dump_table($table, $style, $is_view = false) { $create = $mysql->result($result, 1); $result->free(); echo ($style != "CREATE, ALTER" ? $create : ($is_view ? substr_replace($create, " OR REPLACE", 6, 0) : substr_replace($create, " IF NOT EXISTS", 12, 0))) . ";\n\n"; - if ($max_packet < 1073741824) { // protocol limit - $row_size = 21 + strlen(idf_escape($table)); - foreach (fields($table) as $field) { - $type = $types[$field["type"]]; - $row_size += 5 + ($field["length"] ? (preg_match('~enum|set~', $field["type"]) ? strlen($field["length"]) : $field["length"]) : $type) * (preg_match('~char|text|enum|set~', $field["type"]) ? 3 : 1); // UTF-8 in MySQL uses up to 3 bytes - } - if ($row_size > $max_packet) { - $max_packet = min(1073741824, 1024 * ceil($row_size / 1024)); - echo "SET max_allowed_packet = $max_packet;\n"; - } - } } if ($mysql->server_info >= 5) { if ($style == "CREATE, ALTER" && !$is_view) {