if a field value contains the "end of record" sequence, enclosed it in dump exportation

This commit is contained in:
Loïc Chapeaux
2001-08-22 00:21:11 +00:00
parent d4f677fcb6
commit 239d13d1b3
3 changed files with 17 additions and 15 deletions

View File

@@ -9,6 +9,8 @@ $Source$
* sql.php3: fixed a syntax error (is_defined is not a function). * sql.php3: fixed a syntax error (is_defined is not a function).
* lib.inc.php3: beautify a but the design of the table in browse mode. * lib.inc.php3: beautify a but the design of the table in browse mode.
* lang/english.inc.inc.php3: fixed a typo. * lang/english.inc.inc.php3: fixed a typo.
* tbl_dump.php3; lib.inc.php3: if a field value contains the
"end of record" sequence, enclosed it.
2001-08-21 Olivier M<>ller <om@omnis.ch> 2001-08-21 Olivier M<>ller <om@omnis.ch>
* db_stats.php3: added list of 20 biggest db's. * db_stats.php3: added list of 20 biggest db's.

View File

@@ -1675,7 +1675,7 @@ var errorMsg2 = '<?php echo(str_replace('\'', '\\\'', $GLOBALS['strNotValidNumbe
$row[$j] = ereg_replace("\015(\012)?", "\012", $row[$j]); $row[$j] = ereg_replace("\015(\012)?", "\012", $row[$j]);
$re_test = "$enc_by|$sep|\012"; $re_test = "$enc_by|$sep|\012";
} else { } else {
$re_test = "[$enc_by$sep]"; $re_test = "[$enc_by$sep]|" . $GLOBALS['add_character'];
} }
if (ereg($re_test, $row[$j])) { if (ereg($re_test, $row[$j])) {
$row[$j] = $enc_by . str_replace($enc_by, $enc_by . $enc_by, $row[$j]) . $enc_by; $row[$j] = $enc_by . str_replace($enc_by, $enc_by . $enc_by, $row[$j]) . $enc_by;

View File

@@ -45,20 +45,6 @@ function my_csvhandler($sql_insert)
global $add_character; global $add_character;
global $tmp_buffer; global $tmp_buffer;
// Handles the EOL character
if ($GLOBALS['what'] == 'excel') {
$add_character = "\r\n";
} else if (empty($add_character)) {
$add_character = $GLOBALS['crlf'];
} else {
if (get_magic_quotes_gpc()) {
$add_character = stripslashes($add_character);
}
$add_character = str_replace('\\r', "\015", $add_character);
$add_character = str_replace('\\n', "\012", $add_character);
$add_character = str_replace('\\t', "\011", $add_character);
} // end if
// Result will be displays on screen // Result will be displays on screen
if (empty($GLOBALS['asfile'])) { if (empty($GLOBALS['asfile'])) {
$tmp_buffer .= htmlspecialchars($sql_insert) . $add_character; $tmp_buffer .= htmlspecialchars($sql_insert) . $add_character;
@@ -219,6 +205,20 @@ else {
// 'csv' case // 'csv' case
else { else {
// Handles the EOL character
if ($GLOBALS['what'] == 'excel') {
$add_character = "\015\012";
} else if (empty($add_character)) {
$add_character = $GLOBALS['crlf'];
} else {
if (get_magic_quotes_gpc()) {
$add_character = stripslashes($add_character);
}
$add_character = str_replace('\\r', "\015", $add_character);
$add_character = str_replace('\\n', "\012", $add_character);
$add_character = str_replace('\\t', "\011", $add_character);
} // end if
$tmp_buffer = ''; $tmp_buffer = '';
get_table_csv($db, $table, $limit_from, $limit_to, $separator, $enclosed, 'my_csvhandler'); get_table_csv($db, $table, $limit_from, $limit_to, $separator, $enclosed, 'my_csvhandler');
$dump_buffer .= $tmp_buffer; $dump_buffer .= $tmp_buffer;