bug #2537766 [import] Comments are stripped when editing store procedures

This commit is contained in:
Marc Delisle
2009-09-26 11:22:19 +00:00
parent 6268d5c52b
commit 780e876f8d
2 changed files with 5 additions and 12 deletions

View File

@@ -47,6 +47,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
- patch #2859788 [parser] Double-character delimiters (bug #2846239), - patch #2859788 [parser] Double-character delimiters (bug #2846239),
thanks to Thomas Pulickal - jemajoign thanks to Thomas Pulickal - jemajoign
- bug #2832600 [export] Slow export when having lots of databases - bug #2832600 [export] Slow export when having lots of databases
- bug #2537766 [import] Comments are stripped when editing store procedures
3.2.2.0 (2009-09-13) 3.2.2.0 (2009-09-13)
- bug #2825293 [structure] Default value for a BIT column - bug #2825293 [structure] Default value for a BIT column

View File

@@ -220,7 +220,7 @@ while (!($GLOBALS['finished'] && $i >= $len) && !$error && !$timeout_passed) {
$sql .= substr($buffer, $start_pos, $i - $start_pos); $sql .= substr($buffer, $start_pos, $i - $start_pos);
} }
// Skip the rest // Skip the rest
$j = $i; $start_of_comment = $i;
// do not use PHP_EOL here instead of "\n", because the export // do not use PHP_EOL here instead of "\n", because the export
// file might have been produced on a different system // file might have been produced on a different system
$i = strpos($buffer, $ch == '/' ? '*/' : "\n", $i); $i = strpos($buffer, $ch == '/' ? '*/' : "\n", $i);
@@ -234,21 +234,13 @@ while (!($GLOBALS['finished'] && $i >= $len) && !$error && !$timeout_passed) {
} }
// Skip * // Skip *
if ($ch == '/') { 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++; $i++;
} }
// Skip last char // Skip last char
$i++; $i++;
// We need to send the comment part in case we are defining
// a procedure or function and comments in it are valuable
$sql .= substr($buffer, $start_of_comment, $i - $start_of_comment);
// Next query part will start here // Next query part will start here
$start_pos = $i; $start_pos = $i;
// Aren't we at the end? // Aren't we at the end?