improved the fix against the bug #469416 (Dumps with binary data dont work mysql)
This commit is contained in:
@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
|
|||||||
$Id$
|
$Id$
|
||||||
$Source$
|
$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>
|
2001-10-13 Lo<4C>c Chapeaux <lolo@phpheaven.net>
|
||||||
* Documentation.html, lines 504-506: added some words about requirement for
|
* Documentation.html, lines 504-506: added some words about requirement for
|
||||||
table sizes.
|
table sizes.
|
||||||
|
@@ -200,7 +200,7 @@ if (!defined('__LIB_BUILD_DUMP__')){
|
|||||||
}
|
}
|
||||||
|
|
||||||
$search = array("\x00", "\x0a", "\x0d", "\x1a"); //\x08\\x09, not required
|
$search = array("\x00", "\x0a", "\x0d", "\x1a"); //\x08\\x09, not required
|
||||||
$replace = array("\\0", "\\n", "\\r", "\Z");
|
$replace = array('\0', '\n', '\r', '\Z');
|
||||||
$isFirstRow = TRUE;
|
$isFirstRow = TRUE;
|
||||||
|
|
||||||
@set_time_limit(1200); // 20 Minutes
|
@set_time_limit(1200); // 20 Minutes
|
||||||
@@ -226,15 +226,15 @@ if (!defined('__LIB_BUILD_DUMP__')){
|
|||||||
// Extended inserts case
|
// Extended inserts case
|
||||||
if (isset($GLOBALS['extended_ins'])) {
|
if (isset($GLOBALS['extended_ins'])) {
|
||||||
if ($isFirstRow) {
|
if ($isFirstRow) {
|
||||||
$insert_line = $schema_insert . implode(',', $values) . ')';
|
$insert_line = $schema_insert . implode(', ', $values) . ')';
|
||||||
$isFirstRow = FALSE;
|
$isFirstRow = FALSE;
|
||||||
} else {
|
} else {
|
||||||
$insert_line = '(' . implode(',', $values) . ')';
|
$insert_line = '(' . implode(', ', $values) . ')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Other inserts case
|
// Other inserts case
|
||||||
else {
|
else {
|
||||||
$insert_line = $schema_insert . implode(',', $values) . ')';
|
$insert_line = $schema_insert . implode(', ', $values) . ')';
|
||||||
}
|
}
|
||||||
unset($values);
|
unset($values);
|
||||||
|
|
||||||
@@ -316,27 +316,36 @@ if (!defined('__LIB_BUILD_DUMP__')){
|
|||||||
if (!isset($row[$j])) {
|
if (!isset($row[$j])) {
|
||||||
$schema_insert .= ' NULL,';
|
$schema_insert .= ' NULL,';
|
||||||
} else if ($row[$j] != '') {
|
} else if ($row[$j] != '') {
|
||||||
$dummy = '';
|
$type = mysql_field_type($result, $j);
|
||||||
$srcstr = $row[$j];
|
// a number
|
||||||
for ($xx = 0; $xx < strlen($srcstr); $xx++) {
|
if ($type == 'tinyint' || $type == 'smallint' || $type == 'mediumint' || $type == 'int' ||
|
||||||
$yy = strlen($dummy);
|
$type == 'bigint' ||$type == 'timestamp') {
|
||||||
if ($srcstr[$xx] == "\\") $dummy .= "\\\\";
|
$schema_insert .= $row[$j] . ', ';
|
||||||
if ($srcstr[$xx] == "'") $dummy .= "\\'";
|
}
|
||||||
if ($srcstr[$xx] == "\"") $dummy .= "\\\"";
|
// a string
|
||||||
if ($srcstr[$xx] == "\x00") $dummy .= "\\0";
|
else {
|
||||||
if ($srcstr[$xx] == "\x0a") $dummy .= "\\n";
|
$dummy = '';
|
||||||
if ($srcstr[$xx] == "\x0d") $dummy .= "\\r";
|
$srcstr = $row[$j];
|
||||||
if ($srcstr[$xx] == "\x08") $dummy .= "\\b";
|
for ($xx = 0; $xx < strlen($srcstr); $xx++) {
|
||||||
if ($srcstr[$xx] == "\t") $dummy .= "\\t";
|
$yy = strlen($dummy);
|
||||||
if ($srcstr[$xx] == "\x1a") $dummy .= "\\Z";
|
if ($srcstr[$xx] == '\\') $dummy .= '\\\\';
|
||||||
if (strlen($dummy) == $yy) $dummy .= $srcstr[$xx];
|
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 . "', ";
|
||||||
}
|
}
|
||||||
$schema_insert .= " '" . $dummy . "',";
|
|
||||||
} else {
|
} else {
|
||||||
$schema_insert .= " '',";
|
$schema_insert .= "'', ";
|
||||||
} // end if
|
} // end if
|
||||||
} // end for
|
} // end for
|
||||||
$schema_insert = ereg_replace(',$', '', $schema_insert);
|
$schema_insert = ereg_replace(', $', '', $schema_insert);
|
||||||
$schema_insert .= ')';
|
$schema_insert .= ')';
|
||||||
$handler(trim($schema_insert));
|
$handler(trim($schema_insert));
|
||||||
++$i;
|
++$i;
|
||||||
|
Reference in New Issue
Block a user