bug [export] Exporting results of a query which contains a LIMIT clause inside a subquery

This commit is contained in:
Marc Delisle
2009-08-29 11:41:26 +00:00
parent 6e670cfccf
commit 2a1077ff43
2 changed files with 21 additions and 1 deletions

View File

@@ -41,6 +41,8 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
- bug #2813879 [export] Duplicate empty lines when exporting without comments
- bug #2825919 [export] Trigger export with database name
- bug #2823996 [data] Cannot edit row with no PK and a BIT field
- bug [export] Exporting results of a query which contains a LIMIT clause
inside a subquery
3.2.1.0 (2009-08-09)
- bug #2799009 Login with ipv6 IP address breaks redirect

View File

@@ -1455,6 +1455,8 @@ if (! defined('PMA_MINIMUM_COMMON')) {
$first_reserved_word = '';
$current_identifier = '';
$unsorted_query = $arr['raw']; // in case there is no ORDER BY
$number_of_brackets = 0;
$in_subquery = false;
for ($i = 0; $i < $size; $i++) {
//DEBUG echo "Loop2 <strong>" . $arr[$i]['data'] . "</strong> (" . $arr[$i]['type'] . ")<br />";
@@ -1471,8 +1473,24 @@ if (! defined('PMA_MINIMUM_COMMON')) {
//
// this code is not used for confirmations coming from functions.js
if ($arr[$i]['type'] == 'punct_bracket_open_round') {
$number_of_brackets++;
}
if ($arr[$i]['type'] == 'punct_bracket_close_round') {
$number_of_brackets--;
if ($number_of_brackets == 0) {
$in_subquery = false;
}
}
if ($arr[$i]['type'] == 'alpha_reservedWord') {
$upper_data = strtoupper($arr[$i]['data']);
if ($upper_data == 'SELECT' && $number_of_brackets > 0) {
$in_subquery = true;
}
if (!$seen_reserved_word) {
$first_reserved_word = $upper_data;
$subresult['querytype'] = $upper_data;
@@ -1496,7 +1514,7 @@ if (! defined('PMA_MINIMUM_COMMON')) {
}
}
if ($upper_data == 'LIMIT') {
if ($upper_data == 'LIMIT' && ! $in_subquery) {
$section_before_limit = substr($arr['raw'], 0, $arr[$i]['pos'] - 5);
$in_limit = TRUE;
$seen_limit = TRUE;