added the "escaped by" option for exporting CSV files so default values for importing/exporting dumps are the same.
This commit is contained in:
@@ -30,10 +30,11 @@ $Source$
|
|||||||
* tbl_copy.php3; tbl_properties.php3: re-enabled the ability to copy a
|
* tbl_copy.php3; tbl_properties.php3: re-enabled the ability to copy a
|
||||||
table to another database (bug #456434). Need to be tested with
|
table to another database (bug #456434). Need to be tested with
|
||||||
MySQL < 3.23 releases.
|
MySQL < 3.23 releases.
|
||||||
* lib.inc.php3, lines 1154-1170: added an option to display the whole value
|
|
||||||
of a text field in a javascript alert box thanks to "Opi" <opi@volny.cz>.
|
|
||||||
* lang/english.inc.php3: re-sorted and fixed some typos.
|
* lang/english.inc.php3: re-sorted and fixed some typos.
|
||||||
* left.php3: fixed a js error with NS.
|
* left.php3: fixed a js error with NS.
|
||||||
|
* lib.inc.php3; tbl_properties.php3; tbl.dump.php3: added the "escaped by"
|
||||||
|
option for exporting CSV files so default values for importing/exporting
|
||||||
|
dumps are the same.
|
||||||
|
|
||||||
2001-08-28 Lo<4C>c Chapeaux <lolo@phpheaven.net>
|
2001-08-28 Lo<4C>c Chapeaux <lolo@phpheaven.net>
|
||||||
* lang/galician.inc.php3, select_lang.inc.php3: new Galician lang thanks to
|
* lang/galician.inc.php3, select_lang.inc.php3: new Galician lang thanks to
|
||||||
|
28
lib.inc.php3
28
lib.inc.php3
@@ -1152,20 +1152,11 @@ var errorMsg2 = '<?php echo(str_replace('\'', '\\\'', $GLOBALS['strNotValidNumbe
|
|||||||
echo ' <td align="center">[BLOB]</td>' . "\n";
|
echo ' <td align="center">[BLOB]</td>' . "\n";
|
||||||
} else {
|
} else {
|
||||||
if (strlen($row[$i]) > $GLOBALS['cfgLimitChars']) {
|
if (strlen($row[$i]) > $GLOBALS['cfgLimitChars']) {
|
||||||
// loic1: added a link to display the whole text
|
$row[$i] = substr($row[$i], 0, $GLOBALS['cfgLimitChars']) . '...';
|
||||||
// field in a js alert box
|
|
||||||
$alert = '';
|
|
||||||
$tmp = explode("\n", str_replace("\r", ' ', $row[$i]));
|
|
||||||
for ($j = 0; $j < count($tmp); $j++) {
|
|
||||||
$alert .= addslashes(str_replace('"', '"', trim($tmp[$j]))) . '\n';
|
|
||||||
}
|
|
||||||
unset($tmp);
|
|
||||||
$row[$i] = ereg_replace("((\015\012)|(\015)|(\012))+", '<br />', htmlspecialchars($row[$i]));
|
|
||||||
$row[$i] = substr($row[$i], 0, $GLOBALS['cfgLimitChars'])
|
|
||||||
. '... '
|
|
||||||
. '[<a href="#" onclick="alert(\''. $alert . '\'); return false">+</a>]';
|
|
||||||
}
|
}
|
||||||
|
// loic1 : displays <cr>/<lf>
|
||||||
if ($row[$i] != '') {
|
if ($row[$i] != '') {
|
||||||
|
$row[$i] = ereg_replace("((\015\012)|(\015)|(\012))+", '<br />', htmlspecialchars($row[$i]));
|
||||||
echo ' <td>' . $row[$i] . '</td>' . "\n";
|
echo ' <td>' . $row[$i] . '</td>' . "\n";
|
||||||
} else {
|
} else {
|
||||||
echo ' <td> </td>' . "\n";
|
echo ' <td> </td>' . "\n";
|
||||||
@@ -1607,7 +1598,7 @@ var errorMsg2 = '<?php echo(str_replace('\'', '\\\'', $GLOBALS['strNotValidNumbe
|
|||||||
*
|
*
|
||||||
* @return boolean always true
|
* @return boolean always true
|
||||||
*/
|
*/
|
||||||
function get_table_csv($db, $table, $limit_from = 0, $limit_to = 0, $sep, $enc_by, $handler)
|
function get_table_csv($db, $table, $limit_from = 0, $limit_to = 0, $sep, $enc_by, $esc_by, $handler)
|
||||||
{
|
{
|
||||||
global $what;
|
global $what;
|
||||||
|
|
||||||
@@ -1630,6 +1621,15 @@ var errorMsg2 = '<?php echo(str_replace('\'', '\\\'', $GLOBALS['strNotValidNumbe
|
|||||||
}
|
}
|
||||||
$enc_by = str_replace('"', '"', $enc_by);
|
$enc_by = str_replace('"', '"', $enc_by);
|
||||||
}
|
}
|
||||||
|
if (empty($esc_by) || $what == 'excel') {
|
||||||
|
// double the "enclosed by" character
|
||||||
|
$esc_by = $enc_by;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (get_magic_quotes_gpc()) {
|
||||||
|
$esc_by = stripslashes($esc_by);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Defines the offsets to use
|
// Defines the offsets to use
|
||||||
if ($limit_from > 0) {
|
if ($limit_from > 0) {
|
||||||
@@ -1663,7 +1663,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]);
|
||||||
}
|
}
|
||||||
$schema_insert .= $enc_by
|
$schema_insert .= $enc_by
|
||||||
. str_replace($enc_by, $enc_by . $enc_by, $row[$j])
|
. str_replace($enc_by, $esc_by . $enc_by, $row[$j])
|
||||||
. $enc_by;
|
. $enc_by;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@@ -224,7 +224,7 @@ else {
|
|||||||
} // end if
|
} // 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, $escaped, 'my_csvhandler');
|
||||||
$dump_buffer .= $tmp_buffer;
|
$dump_buffer .= $tmp_buffer;
|
||||||
} // end 'csv case
|
} // end 'csv case
|
||||||
} // end building the dump
|
} // end building the dump
|
||||||
|
@@ -695,10 +695,12 @@ echo "\n";
|
|||||||
<?php echo $strStrucExcelCSV; ?> <br />
|
<?php echo $strStrucExcelCSV; ?> <br />
|
||||||
<input type="radio" name="what" value="csv" />
|
<input type="radio" name="what" value="csv" />
|
||||||
<?php echo $strStrucCSV;?> :<br />
|
<?php echo $strStrucCSV;?> :<br />
|
||||||
<?php echo $strFields . ' '. $strEnclosedBy; ?>
|
|
||||||
<input type="text" name="enclosed" size="1" value=""" /> <br />
|
|
||||||
<?php echo $strFields . ' '. $strTerminatedBy; ?>
|
<?php echo $strFields . ' '. $strTerminatedBy; ?>
|
||||||
<input type="text" name="separator" size="2" value=";" /> <br />
|
<input type="text" name="separator" size="2" value=";" /> <br />
|
||||||
|
<?php echo $strFields . ' '. $strEnclosedBy; ?>
|
||||||
|
<input type="text" name="enclosed" size="1" value=""" /> <br />
|
||||||
|
<?php echo $strFields . ' '. $strEscapedBy; ?>
|
||||||
|
<input type="text" name="escaped" size="2" value="\" /> <br />
|
||||||
<?php echo $strLines . ' '. $strTerminatedBy; ?>
|
<?php echo $strLines . ' '. $strTerminatedBy; ?>
|
||||||
<input type="text" name="add_character" size="2" value="<?php echo ((which_crlf() == "\n") ? '\n' : '\r\n'); ?>" />
|
<input type="text" name="add_character" size="2" value="<?php echo ((which_crlf() == "\n") ? '\n' : '\r\n'); ?>" />
|
||||||
</td>
|
</td>
|
||||||
|
Reference in New Issue
Block a user