Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Delisle <marc@infomarc.info>2008-01-18 21:29:17 +0300
committerMarc Delisle <marc@infomarc.info>2008-01-18 21:29:17 +0300
commit2c87a4715e4c5cbeb3f0899730904be9123d9953 (patch)
tree1d5222e0642ae194cfcd15a4faebe4df7475eaaf /tbl_export.php
parent6b53e86f605a1b1c02b32a886f286eff23b2d469 (diff)
bug #1873110 [export] Problem exporting with a LIMIT clause
Diffstat (limited to 'tbl_export.php')
-rw-r--r--tbl_export.php39
1 files changed, 2 insertions, 37 deletions
diff --git a/tbl_export.php b/tbl_export.php
index 0faedcb815..d86942eeb4 100644
--- a/tbl_export.php
+++ b/tbl_export.php
@@ -27,12 +27,12 @@ $export_page_title = $strViewDump;
if (! empty($sql_query)) {
// Parse query so we can work with tokens
$parsed_sql = PMA_SQP_parse($sql_query);
+ $analyzed_sql = PMA_SQP_analyze($parsed_sql);
// Need to generate WHERE clause?
if (isset($primary_key)) {
// Yes => rebuild query from scracts, this doesn't work with nested
// selects :-(
- $analyzed_sql = PMA_SQP_analyze($parsed_sql);
$sql_query = 'SELECT ';
if (isset($analyzed_sql[0]['queryflags']['distinct'])) {
@@ -71,42 +71,7 @@ if (! empty($sql_query)) {
}
} else {
// Just crop LIMIT clause
- $inside_bracket = FALSE;
- for ($i = $parsed_sql['len'] - 1; $i >= 0; $i--) {
- if ($parsed_sql[$i]['type'] == 'punct_bracket_close_round') {
- $inside_bracket = TRUE;
- continue;
- }
- if ($parsed_sql[$i]['type'] == 'punct_bracket_open_round') {
- $inside_bracket = FALSE;
- continue;
- }
- if (!$inside_bracket && $parsed_sql[$i]['type'] == 'alpha_reservedWord' && strtoupper($parsed_sql[$i]['data']) == 'LIMIT') {
- // We found LIMIT to remove
-
- $sql_query = '';
-
- // Concatenate parts before
- for ($j = 0; $j < $i; $j++) {
- $sql_query .= $parsed_sql[$j]['data'] . ' ';
- }
-
- // Skip LIMIT
- $i++;
- while ($i < $parsed_sql['len'] &&
- ($parsed_sql[$i]['type'] != 'alpha_reservedWord' ||
- ($parsed_sql[$i]['type'] == 'alpha_reservedWord' && $parsed_sql[$i]['data'] == 'OFFSET'))) {
- $i++;
- }
-
- // Add remaining parts
- while ($i < $parsed_sql['len']) {
- $sql_query .= $parsed_sql[$i]['data'] . ' ';
- $i++;
- }
- break;
- }
- }
+ $sql_query = $analyzed_sql[0]['section_before_limit'] . $analyzed_sql[0]['section_after_limit'];
}
$message = PMA_Message::success();
}