bug #1710144 [parser] space after COUNT breaks Export but not Query

This commit is contained in:
Marc Delisle
2007-12-20 12:47:43 +00:00
parent e96049f8b1
commit 2ced7be900
2 changed files with 14 additions and 21 deletions

View File

@@ -44,6 +44,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
- bug #1764182 [cookies] Suhosin cookie encryption breaks phpMyAdmin - bug #1764182 [cookies] Suhosin cookie encryption breaks phpMyAdmin
- bug #1798786 [import] Wrong error when a string contains semicolon - bug #1798786 [import] Wrong error when a string contains semicolon
- bug #1813508 [login] Missing parameter: field after re-login - bug #1813508 [login] Missing parameter: field after re-login
- bug #1710144 [parser] space after COUNT breaks Export but not Query
2.11.3.0 (2007-12-08) 2.11.3.0 (2007-12-08)
- patch #1818389 to remove a notice (failed to flush buffer), thanks to - patch #1818389 to remove a notice (failed to flush buffer), thanks to

View File

@@ -53,18 +53,21 @@ if (! defined('PMA_MINIMUM_COMMON')) {
} }
if (!defined('DEBUG_TIMING')) { if (!defined('DEBUG_TIMING')) {
function PMA_SQP_arrayAdd(&$arr, $type, $data, &$arrsize) // currently we don't need the $pos (token position in query)
// for other purposes than LIMIT clause verification,
// so many calls to this function do not include the 4th parameter
function PMA_SQP_arrayAdd(&$arr, $type, $data, &$arrsize, $pos = 0)
{ {
$arr[] = array('type' => $type, 'data' => $data); $arr[] = array('type' => $type, 'data' => $data, 'pos' => $pos);
$arrsize++; $arrsize++;
} // end of the "PMA_SQP_arrayAdd()" function } // end of the "PMA_SQP_arrayAdd()" function
} else { } else {
function PMA_SQP_arrayAdd(&$arr, $type, $data, &$arrsize) function PMA_SQP_arrayAdd(&$arr, $type, $data, &$arrsize, $pos = 0)
{ {
global $timer; global $timer;
$t = $timer; $t = $timer;
$arr[] = array('type' => $type, 'data' => $data, 'time' => $t); $arr[] = array('type' => $type, 'data' => $data, 'pos' => $pos, 'time' => $t);
$timer = microtime(); $timer = microtime();
$arrsize++; $arrsize++;
} // end of the "PMA_SQP_arrayAdd()" function } // end of the "PMA_SQP_arrayAdd()" function
@@ -529,7 +532,7 @@ if (! defined('PMA_MINIMUM_COMMON')) {
} else { } else {
$type = 'alpha'; $type = 'alpha';
} // end if... else.... } // end if... else....
PMA_SQP_arrayAdd($sql_array, $type, $str, $arraysize); PMA_SQP_arrayAdd($sql_array, $type, $str, $arraysize, $count2);
continue; continue;
} }
@@ -1421,7 +1424,7 @@ if (! defined('PMA_MINIMUM_COMMON')) {
} }
$section_before_limit = ''; $section_before_limit = '';
$section_after_limit = ''; $section_after_limit = ''; // truly the section after the limit clause
$seen_reserved_word = FALSE; $seen_reserved_word = FALSE;
$seen_group = FALSE; $seen_group = FALSE;
$seen_order = FALSE; $seen_order = FALSE;
@@ -1431,7 +1434,6 @@ if (! defined('PMA_MINIMUM_COMMON')) {
$in_select_expr = FALSE; // true when we are inside the select expr clause $in_select_expr = FALSE; // true when we are inside the select expr clause
$in_where = FALSE; // true when we are inside the WHERE clause $in_where = FALSE; // true when we are inside the WHERE clause
$in_limit = FALSE; // true when we are inside the LIMIT clause $in_limit = FALSE; // true when we are inside the LIMIT clause
$before_limit = TRUE; // true when we are before the LIMIT clause
$after_limit = FALSE; // true when we are after the LIMIT clause $after_limit = FALSE; // true when we are after the LIMIT clause
$in_from = FALSE; // true when we are in the FROM clause $in_from = FALSE; // true when we are in the FROM clause
$in_group_concat = FALSE; $in_group_concat = FALSE;
@@ -1454,15 +1456,6 @@ if (! defined('PMA_MINIMUM_COMMON')) {
// //
// this code is not used for confirmations coming from functions.js // this code is not used for confirmations coming from functions.js
/**
* @todo check for punct_queryend
* @todo verify C-style comments?
*/
if ($arr[$i]['type'] == 'comment_ansi') {
$before_limit = FALSE;
$after_limit = FALSE;
}
if ($arr[$i]['type'] == 'alpha_reservedWord') { if ($arr[$i]['type'] == 'alpha_reservedWord') {
$upper_data = strtoupper($arr[$i]['data']); $upper_data = strtoupper($arr[$i]['data']);
if (!$seen_reserved_word) { if (!$seen_reserved_word) {
@@ -1489,9 +1482,9 @@ if (! defined('PMA_MINIMUM_COMMON')) {
} }
if ($upper_data == 'LIMIT') { if ($upper_data == 'LIMIT') {
$section_before_limit = substr($arr['raw'], 0, $arr[$i]['pos'] - 5);
$in_limit = TRUE; $in_limit = TRUE;
$limit_clause = ''; $limit_clause = '';
$before_limit = FALSE;
$in_order_by = FALSE; // @todo maybe others to set FALSE $in_order_by = FALSE; // @todo maybe others to set FALSE
} }
@@ -1694,9 +1687,6 @@ if (! defined('PMA_MINIMUM_COMMON')) {
$limit_clause .= $sep; $limit_clause .= $sep;
} }
} }
if (! $in_limit && $before_limit && $arr[$i]['type'] != 'punct_queryend') {
$section_before_limit .= $arr[$i]['data'] . $sep;
}
if ($after_limit) { if ($after_limit) {
$section_after_limit .= $arr[$i]['data'] . $sep; $section_after_limit .= $arr[$i]['data'] . $sep;
} }
@@ -1704,7 +1694,9 @@ if (! defined('PMA_MINIMUM_COMMON')) {
// clear $upper_data for next iteration // clear $upper_data for next iteration
$upper_data=''; $upper_data='';
} // end for $i (loop #2) } // end for $i (loop #2)
if (empty($section_before_limit)) {
$section_before_limit = $arr['raw'];
}
// ----------------------------------------------------- // -----------------------------------------------------
// loop #3: foreign keys and MySQL 4.1.2+ TIMESTAMP options // loop #3: foreign keys and MySQL 4.1.2+ TIMESTAMP options