simpler comment skipping, handles comments at end of query

This commit is contained in:
Michal Čihař
2004-06-24 11:08:42 +00:00
parent 795c20c3d1
commit 1577c890f4

View File

@@ -70,14 +70,13 @@ function PMA_splitSqlFile(&$ret, $sql, $release)
} // end for } // end for
} // end if (in string) } // end if (in string)
// let's skip c style comments // lets skip comments (/*, -- and #)
else if ($char == '/' && $sql[$i + 1] == '*') { else if (($char == '-' && $sql[$i + 1] == '-' && $sql[$i + 2] <= ' ') || $char == '#' || ($char == '/' && $sql[$i + 1] == '*')) {
$i = strpos($sql, '*/', $i) + 1; $i = strpos($sql, $char == '/' ? '*/' : "\n", $i) + ($char == '/' ? 1 : 0);
} // didn't we hit end of string?
if ($i === FALSE) {
// lets skip ANSI comments break;
else if ($char == '-' && $sql[$i + 1] == '-' && $sql[$i + 2] <= ' ') { }
$i = strpos($sql, "\n", $i);
} }
// We are not in a string, first check for delimiter... // We are not in a string, first check for delimiter...