Fix query parsing when there is comment or string at the end.
This commit is contained in:
@@ -64,6 +64,8 @@ $Source$
|
|||||||
times.
|
times.
|
||||||
* libraries/relation.lib.php: Do not try to restore database as control
|
* libraries/relation.lib.php: Do not try to restore database as control
|
||||||
user, it has to fail.
|
user, it has to fail.
|
||||||
|
* libraries/import/sql.php: Fix query parsing when there is comment or
|
||||||
|
string at the end.
|
||||||
|
|
||||||
2005-10-07 Marc Delisle <lem9@users.sourceforge.net>
|
2005-10-07 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
* libraries/check_user_privileges.lib.php: bug #1313821, dbname containing a
|
* libraries/check_user_privileges.lib.php: bug #1313821, dbname containing a
|
||||||
|
@@ -88,7 +88,12 @@ if (isset($import_list)) {
|
|||||||
}
|
}
|
||||||
if (!$endq) break;
|
if (!$endq) break;
|
||||||
$i++;
|
$i++;
|
||||||
continue;
|
// Aren't we at the end?
|
||||||
|
if ($i == $len) {
|
||||||
|
$i--;
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not enough data to decide
|
// Not enough data to decide
|
||||||
@@ -110,18 +115,32 @@ if (isset($import_list)) {
|
|||||||
// Skip the rest
|
// Skip the rest
|
||||||
$i = strpos($buffer, $ch == '/' ? '*/' : "\n", $i);
|
$i = strpos($buffer, $ch == '/' ? '*/' : "\n", $i);
|
||||||
// didn't we hit end of string?
|
// didn't we hit end of string?
|
||||||
if ($i === FALSE) break;
|
if ($i === FALSE) {
|
||||||
|
if ($finished) {
|
||||||
|
$i = $len - 1;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
// Skip *
|
// Skip *
|
||||||
if ($ch == '/') $i++;
|
if ($ch == '/') $i++;
|
||||||
// Skip last char
|
// Skip last char
|
||||||
$i++;
|
$i++;
|
||||||
// Next query part will start here
|
// Next query part will start here
|
||||||
$start_pos = $i;
|
$start_pos = $i;
|
||||||
|
// Aren't we at the end?
|
||||||
|
if ($i == $len) {
|
||||||
|
$i--;
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// End of SQL
|
// End of SQL
|
||||||
if ($ch == ';' || ($finished && ($i == $len - 1))) {
|
if ($ch == ';' || ($finished && ($i == $len - 1))) {
|
||||||
$sql .= substr($buffer, $start_pos, $i - $start_pos + 1);
|
if ($start_pos < $len) {
|
||||||
|
$sql .= substr($buffer, $start_pos, $i - $start_pos + 1);
|
||||||
|
}
|
||||||
PMA_importRunQuery($sql, substr($buffer, 0, $i + 1));
|
PMA_importRunQuery($sql, substr($buffer, 0, $i + 1));
|
||||||
$buffer = substr($buffer, $i + 1);
|
$buffer = substr($buffer, $i + 1);
|
||||||
// Reset parser:
|
// Reset parser:
|
||||||
|
Reference in New Issue
Block a user