improved the fix against the bug #469416 (Dumps with binary data dont work mysql)

This commit is contained in:
Loïc Chapeaux
2001-10-14 08:32:50 +00:00
parent e8b51f0297
commit 2b93605e65
2 changed files with 34 additions and 21 deletions

View File

@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
$Id$
$Source$
2001-10-14 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* libraries/build_dump.lib.php3, lines 202-203: improved the fix against
the bug #469416 (Dumps with binary data dont work mysql).
2001-10-13 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* Documentation.html, lines 504-506: added some words about requirement for
table sizes.

View File

@@ -200,7 +200,7 @@ if (!defined('__LIB_BUILD_DUMP__')){
}
$search = array("\x00", "\x0a", "\x0d", "\x1a"); //\x08\\x09, not required
$replace = array("\\0", "\\n", "\\r", "\Z");
$replace = array('\0', '\n', '\r', '\Z');
$isFirstRow = TRUE;
@set_time_limit(1200); // 20 Minutes
@@ -316,22 +316,31 @@ if (!defined('__LIB_BUILD_DUMP__')){
if (!isset($row[$j])) {
$schema_insert .= ' NULL,';
} else if ($row[$j] != '') {
$type = mysql_field_type($result, $j);
// a number
if ($type == 'tinyint' || $type == 'smallint' || $type == 'mediumint' || $type == 'int' ||
$type == 'bigint' ||$type == 'timestamp') {
$schema_insert .= $row[$j] . ', ';
}
// a string
else {
$dummy = '';
$srcstr = $row[$j];
for ($xx = 0; $xx < strlen($srcstr); $xx++) {
$yy = strlen($dummy);
if ($srcstr[$xx] == "\\") $dummy .= "\\\\";
if ($srcstr[$xx] == "'") $dummy .= "\\'";
if ($srcstr[$xx] == "\"") $dummy .= "\\\"";
if ($srcstr[$xx] == "\x00") $dummy .= "\\0";
if ($srcstr[$xx] == "\x0a") $dummy .= "\\n";
if ($srcstr[$xx] == "\x0d") $dummy .= "\\r";
if ($srcstr[$xx] == "\x08") $dummy .= "\\b";
if ($srcstr[$xx] == "\t") $dummy .= "\\t";
if ($srcstr[$xx] == "\x1a") $dummy .= "\\Z";
if ($srcstr[$xx] == '\\') $dummy .= '\\\\';
if ($srcstr[$xx] == '\'') $dummy .= '\\\'';
// if ($srcstr[$xx] == '"') $dummy .= '\\"';
if ($srcstr[$xx] == "\x00") $dummy .= '\0';
if ($srcstr[$xx] == "\x0a") $dummy .= '\n';
if ($srcstr[$xx] == "\x0d") $dummy .= '\r';
// if ($srcstr[$xx] == "\x08") $dummy .= '\b';
// if ($srcstr[$xx] == "\t") $dummy .= '\t';
if ($srcstr[$xx] == "\x1a") $dummy .= '\Z';
if (strlen($dummy) == $yy) $dummy .= $srcstr[$xx];
}
$schema_insert .= "'" . $dummy . "', ";
}
} else {
$schema_insert .= "'', ";
} // end if