Handle correctly all MySQL comments (-- can be followed with any control char) (patch #965106).

This commit is contained in:
Michal Čihař
2004-06-04 10:20:33 +00:00
parent 68ca109fe0
commit f63a765279
3 changed files with 7 additions and 33 deletions

View File

@@ -268,7 +268,7 @@ if ($is_minimum_common == FALSE) {
if (($c == '#')
|| (($count2 + 1 < $len) && ($c == '/') && (PMA_substr($sql, $count2 + 1, 1) == '*'))
|| (($count2 + 2 == $len) && ($c == '-') && (PMA_substr($sql, $count2 + 1, 1) == '-'))
|| (($count2 + 2 < $len) && ($c == '-') && (PMA_substr($sql, $count2 + 1, 1) == '-') && ((PMA_substr($sql, $count2 + 2, 1) == ' ') || (PMA_substr($sql, $count2 + 2, 1) == "\n")))) {
|| (($count2 + 2 < $len) && ($c == '-') && (PMA_substr($sql, $count2 + 1, 1) == '-') && ((PMA_substr($sql, $count2 + 2, 1) <= ' ')))) {
$count2++;
$pos = 0;
$type = 'bad';
@@ -422,13 +422,7 @@ if ($is_minimum_common == FALSE) {
if (($first == ',') || ($first == ';') || ($first == '.') || ($first == '*')) {
$count2 = $count1 + 1;
$punct_data = $first;
} else if (($last2 == '--') && $l == 2) {
// Nijel: probably broken ANSI comment here (bug #905066)
$debugstr = $GLOBALS['strSQPBugSyntaxError'] . ' @ ' . ($count1+1) . "\n"
. 'STR: ' . $punct_data;
PMA_SQP_throwError($debugstr, $sql);
return $sql;
} else if (($last2 == '/*') || ($last2 == '--')) {
} else if (($last2 == '/*') || (($last2 == '--') && ($count2 == $len || PMA_substr($sql, $count2, 1) <= ' ') )) {
$count2 -= 2;
$punct_data = PMA_substr($sql, $count1, $count2 - $count1);
} else if (($last == '-') || ($last == '+') || ($last == '!')) {