diff --git a/ChangeLog b/ChangeLog index f661877f4..8f0116097 100755 --- a/ChangeLog +++ b/ChangeLog @@ -67,6 +67,7 @@ $Source$ * libraries/import/sql.php: Fix query parsing when there is comment or string at the end. * import.php: Reenable LIMIT appending (bug #1318624). + * sql.php: Fix appending LIMIT when there are comments. 2005-10-07 Marc Delisle * libraries/check_user_privileges.lib.php: bug #1313821, dbname containing a diff --git a/sql.php b/sql.php index 4078cc740..71f37a35c 100644 --- a/sql.php +++ b/sql.php @@ -331,7 +331,7 @@ else { && !preg_match('@[[:space:]]LIMIT[[:space:]0-9,-]+$@i', $sql_query)) { $sql_limit_to_append = " LIMIT $pos, ".$cfg['MaxRows'] . " "; - $full_sql_query = $analyzed_sql[0]['section_before_limit'] . $sql_limit_to_append . $analyzed_sql[0]['section_after_limit']; + $full_sql_query = $analyzed_sql[0]['section_before_limit'] . "\n" . $sql_limit_to_append . $analyzed_sql[0]['section_after_limit']; // FIXME: pretty printing of this modified query if (isset($display_query)) { @@ -341,7 +341,7 @@ else { if (!empty($analyzed_sql[0]['section_after_limit'])) { $analyzed_display_query = PMA_SQP_analyze(PMA_SQP_parse($display_query)); - $display_query = $analyzed_display_query[0]['section_before_limit'] . $sql_limit_to_append . $analyzed_display_query[0]['section_after_limit']; + $display_query = $analyzed_display_query[0]['section_before_limit'] . "\n" . $sql_limit_to_append . $analyzed_display_query[0]['section_after_limit']; } }