From 795c20c3d1362ad8ee7cb96350fd3d0f43f34e6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 24 Jun 2004 10:09:47 +0000 Subject: [PATCH] Ignore comments for SQL splitting, otherwise unmatched quotes cause problems (bug #978113). --- ChangeLog | 2 ++ libraries/read_dump.lib.php | 16 ++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index bc5451c6f..45b6392ee 100755 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,8 @@ $Source$ 2004-06-24 Michal Čihař * 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 * many files: remove references to older /images, and diff --git a/libraries/read_dump.lib.php b/libraries/read_dump.lib.php index 6c6b8994b..5f43342f5 100644 --- a/libraries/read_dump.lib.php +++ b/libraries/read_dump.lib.php @@ -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) {