From 780e876f8db78328c342a2ac63e2f99290ca7036 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sat, 26 Sep 2009 11:22:19 +0000 Subject: [PATCH] bug #2537766 [import] Comments are stripped when editing store procedures --- ChangeLog | 1 + libraries/import/sql.php | 16 ++++------------ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 64800aadd..5c05c34ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -47,6 +47,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA - patch #2859788 [parser] Double-character delimiters (bug #2846239), thanks to Thomas Pulickal - jemajoign - 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) - bug #2825293 [structure] Default value for a BIT column diff --git a/libraries/import/sql.php b/libraries/import/sql.php index 7192d3d10..e41259ec3 100644 --- a/libraries/import/sql.php +++ b/libraries/import/sql.php @@ -220,7 +220,7 @@ while (!($GLOBALS['finished'] && $i >= $len) && !$error && !$timeout_passed) { $sql .= substr($buffer, $start_pos, $i - $start_pos); } // Skip the rest - $j = $i; + $start_of_comment = $i; // do not use PHP_EOL here instead of "\n", because the export // file might have been produced on a different system $i = strpos($buffer, $ch == '/' ? '*/' : "\n", $i); @@ -234,21 +234,13 @@ while (!($GLOBALS['finished'] && $i >= $len) && !$error && !$timeout_passed) { } // 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 $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 $start_pos = $i; // Aren't we at the end?