Ignore comments for SQL splitting, otherwise unmatched quotes cause problems (bug #978113).

This commit is contained in:
Michal Čihař
2004-06-24 10:09:47 +00:00
parent 779fc0179f
commit 795c20c3d1
2 changed files with 12 additions and 6 deletions

View File

@@ -8,6 +8,8 @@ $Source$
2004-06-24 Michal Čihař <michal@cihar.com>
* main.php, changelog.php: Add headers to ChangeLog display.
* scripts/create_tables.sql: Add IF EXISTS.
* libraries/read_dump.lib.php: Ignore comments for SQL splitting,
otherwise unmatched quotes cause problems (bug #978113).
2004-06-23 Marc Delisle <lem9@users.sourceforge.net>
* many files: remove references to older /images, and

View File

@@ -69,6 +69,16 @@ function PMA_splitSqlFile(&$ret, $sql, $release)
} // end if...elseif...else
} // end for
} // end if (in string)
// let's skip c style comments
else if ($char == '/' && $sql[$i + 1] == '*') {
$i = strpos($sql, '*/', $i) + 1;
}
// lets skip ANSI comments
else if ($char == '-' && $sql[$i + 1] == '-' && $sql[$i + 2] <= ' ') {
$i = strpos($sql, "\n", $i);
}
// We are not in a string, first check for delimiter...
else if ($char == ';') {
@@ -90,12 +100,6 @@ function PMA_splitSqlFile(&$ret, $sql, $release)
$string_start = $char;
} // end else if (is start of string)
// ... and finally disactivate the "/*!...*/" syntax if MySQL < 3.22.07
else if ($release < 32270
&& ($char == '!' && $i > 1 && $sql[$i-2] . $sql[$i-1] == '/*')) {
$sql[$i] = ' ';
} // end else if
// loic1: send a fake header each 30 sec. to bypass browser timeout
$time1 = time();
if ($time1 >= $time0 + 30) {