Do not strip MySQL conditional statements in comments (patch #1459782, thanks to unconed - unconed).

This commit is contained in:
Michal Čihař
2006-04-27 10:05:04 +00:00
parent baac64a2e4
commit b60fcde9ad
2 changed files with 16 additions and 2 deletions

View File

@@ -19,6 +19,8 @@ $Source$
#1477500).
* libraries/display_tbl.lib.php: Do not check for VIEW if no table name
(eg. SELECT 1) (bug #1473484).
* libraries/import/sql.php: Do not strip MySQL conditional statements in
comments (patch #1459782, thanks to unconed - unconed).
2006-04-26 Michal Čihař <michal@cihar.com>
* libraries/plugin_interface.lib.php:

View File

@@ -155,6 +155,7 @@ if (isset($plugin_list)) {
$sql .= substr($buffer, $start_pos, $i - $start_pos);
}
// Skip the rest
$j = $i;
$i = strpos($buffer, $ch == '/' ? '*/' : "\n", $i);
// didn't we hit end of string?
if ($i === FALSE) {
@@ -166,6 +167,17 @@ if (isset($plugin_list)) {
}
// Skip *
if ($ch == '/') {
// Check for MySQL conditional comments and include them as-is
if ($buffer[$j + 2] == '!') {
$comment = substr($buffer, $j + 3, $i - $j - 3);
if (preg_match('/^[0-9]{5}/', $comment, $version)) {
if ($version[0] <= PMA_MYSQL_INT_VERSION) {
$sql .= substr($comment, 5);
}
} else {
$sql .= $comment;
}
}
$i++;
}
// Skip last char