Use $sql_query instead of $query to put query correctly to sql.php3.

This commit is contained in:
Michal Čihař
2003-03-21 11:58:49 +00:00
parent a329a2bfb4
commit 0fd92594b4
2 changed files with 20 additions and 16 deletions

View File

@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
$Id$ $Id$
$Source$ $Source$
2003-03-21 Michal Cihar <nijel@users.sourceforge.net>
* ldi_check.php3: Use $sql_query instead of $query to put query correctly
to sql.php3.
2003-03-20 Marc Delisle <lem9@users.sourceforge.net> 2003-03-20 Marc Delisle <lem9@users.sourceforge.net>
* lang/hebrew update, thanks to Yuval Sarna * lang/hebrew update, thanks to Yuval Sarna

View File

@@ -54,7 +54,7 @@ if (isset($btnLDI) && ($textfile != 'none')) {
chmod($textfile, 0777); chmod($textfile, 0777);
// Builds the query // Builds the query
$query = 'LOAD DATA'; $sql_query = 'LOAD DATA';
// for versions before 3.23.49, we use the LOCAL keyword, because // for versions before 3.23.49, we use the LOCAL keyword, because
// there was a version (cannot find which one, and it does not work // there was a version (cannot find which one, and it does not work
@@ -66,7 +66,7 @@ if (isset($btnLDI) && ($textfile != 'none')) {
// for speed // for speed
if (PMA_MYSQL_INT_VERSION < 32349) { if (PMA_MYSQL_INT_VERSION < 32349) {
$query .= ' LOCAL'; $sql_query .= ' LOCAL';
} }
if (PMA_MYSQL_INT_VERSION > 40003) { if (PMA_MYSQL_INT_VERSION > 40003) {
@@ -75,45 +75,45 @@ if (isset($btnLDI) && ($textfile != 'none')) {
if ($result != FALSE && mysql_num_rows($result) > 0) { if ($result != FALSE && mysql_num_rows($result) > 0) {
$tmp = PMA_mysql_fetch_row($result); $tmp = PMA_mysql_fetch_row($result);
if ($tmp[1] == 'ON') { if ($tmp[1] == 'ON') {
$query .= ' LOCAL'; $sql_query .= ' LOCAL';
} }
} }
mysql_free_result($result); mysql_free_result($result);
} }
$query .= ' INFILE \'' . $textfile . '\''; $sql_query .= ' INFILE \'' . $textfile . '\'';
if (!empty($replace)) { if (!empty($replace)) {
$query .= ' ' . $replace; $sql_query .= ' ' . $replace;
} }
$query .= ' INTO TABLE ' . PMA_backquote($into_table); $sql_query .= ' INTO TABLE ' . PMA_backquote($into_table);
if (isset($field_terminater)) { if (isset($field_terminater)) {
$query .= ' FIELDS TERMINATED BY \'' . $field_terminater . '\''; $sql_query .= ' FIELDS TERMINATED BY \'' . $field_terminater . '\'';
} }
if (isset($enclose_option) && strlen($enclose_option) > 0) { if (isset($enclose_option) && strlen($enclose_option) > 0) {
$query .= ' OPTIONALLY'; $sql_query .= ' OPTIONALLY';
} }
if (strlen($enclosed) > 0) { if (strlen($enclosed) > 0) {
$query .= ' ENCLOSED BY \'' . $enclosed . '\''; $sql_query .= ' ENCLOSED BY \'' . $enclosed . '\'';
} }
if (strlen($escaped) > 0) { if (strlen($escaped) > 0) {
$query .= ' ESCAPED BY \'' . $escaped . '\''; $sql_query .= ' ESCAPED BY \'' . $escaped . '\'';
} }
if (strlen($line_terminator) > 0){ if (strlen($line_terminator) > 0){
$query .= ' LINES TERMINATED BY \'' . $line_terminator . '\''; $sql_query .= ' LINES TERMINATED BY \'' . $line_terminator . '\'';
} }
if (strlen($column_name) > 0) { if (strlen($column_name) > 0) {
if (PMA_MYSQL_INT_VERSION >= 32306) { if (PMA_MYSQL_INT_VERSION >= 32306) {
$query .= ' ('; $sql_query .= ' (';
$tmp = split(',( ?)', $column_name); $tmp = split(',( ?)', $column_name);
for ($i = 0; $i < count($tmp); $i++) { for ($i = 0; $i < count($tmp); $i++) {
if ($i > 0) { if ($i > 0) {
$query .= ', '; $sql_query .= ', ';
} }
$query .= PMA_backquote(trim($tmp[$i])); $sql_query .= PMA_backquote(trim($tmp[$i]));
} // end for } // end for
$query .= ')'; $sql_query .= ')';
} else { } else {
$query .= ' (' . $column_name . ')'; $sql_query .= ' (' . $column_name . ')';
} }
} }