Fix import of queries containing `, fix import of queries not terminated by ;.

This commit is contained in:
Michal Čihař
2005-10-08 10:01:25 +00:00
parent 60e43c3e04
commit 9207ca3885
2 changed files with 8 additions and 2 deletions

View File

@@ -11,6 +11,8 @@ $Source$
* sql.php: Work even if no db set. * sql.php: Work even if no db set.
* server_status.php: Call sql.php directly, we don't need to care about * server_status.php: Call sql.php directly, we don't need to care about
query splitting done im read_dump. query splitting done im read_dump.
* libraries/import/sql.php: Fix import of queries containing `, fix import
of queries not terminated by ;.
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

View File

@@ -50,7 +50,9 @@ if (isset($import_list)) {
if ($p5 === FALSE) $p5 = 2147483647; if ($p5 === FALSE) $p5 = 2147483647;
$p6 = strpos($buffer, '/*', $i); $p6 = strpos($buffer, '/*', $i);
if ($p6 === FALSE) $p6 = 2147483647; if ($p6 === FALSE) $p6 = 2147483647;
$i = min ($p1, $p2, $p3, $p4, $p5, $p6); $p7 = strpos($buffer, '`', $i);
if ($p7 === FALSE) $p7 = 2147483647;
$i = min ($p1, $p2, $p3, $p4, $p5, $p6, $p7);
if ($i == 2147483647) { if ($i == 2147483647) {
$i = $oi; $i = $oi;
if (!$finished) break; if (!$finished) break;
@@ -60,6 +62,8 @@ if (isset($import_list)) {
$len = 0; $len = 0;
break; break;
} }
// We hit end of query, go there!
$i = strlen($buffer) - 1;
} }
// Grab current character // Grab current character
@@ -73,7 +77,7 @@ if (isset($import_list)) {
// Find next quote // Find next quote
$pos = strpos($buffer, $quote, $i + 1); $pos = strpos($buffer, $quote, $i + 1);
// No quote? Too short string // No quote? Too short string
if ($pos == FALSE) break; if ($pos === FALSE) break;
// Was not the quote escaped? // Was not the quote escaped?
$j = $pos - 1; $j = $pos - 1;
while ($buffer[$j] == '\\') $j--; while ($buffer[$j] == '\\') $j--;