bug #1783620 [parser] Subquery results without "as" are ignored

This commit is contained in:
Marc Delisle
2007-12-21 18:18:44 +00:00
parent 2ced7be900
commit e98b21d75e
2 changed files with 7 additions and 2 deletions

View File

@@ -44,7 +44,8 @@ $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 - bug #1710144 [parser] Space after COUNT breaks Export but not Query
- bug #1783620 [parser] Subquery results without "as" are ignored
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

@@ -827,6 +827,7 @@ if (! defined('PMA_MINIMUM_COMMON')) {
$number_of_brackets = 0; $number_of_brackets = 0;
$in_subquery = false; $in_subquery = false;
$seen_subquery = false;
// for SELECT EXTRACT(YEAR_MONTH FROM CURDATE()) // for SELECT EXTRACT(YEAR_MONTH FROM CURDATE())
// we must not use CURDATE as a table_ref // we must not use CURDATE as a table_ref
@@ -1098,6 +1099,7 @@ if (! defined('PMA_MINIMUM_COMMON')) {
if ($upper_data == 'SELECT') { if ($upper_data == 'SELECT') {
if ($number_of_brackets > 0) { if ($number_of_brackets > 0) {
$in_subquery = true; $in_subquery = true;
$seen_subquery = true;
// this is a subquery so do not analyze inside it // this is a subquery so do not analyze inside it
continue; continue;
} }
@@ -1146,7 +1148,9 @@ if (! defined('PMA_MINIMUM_COMMON')) {
break; break;
} // end switch } // end switch
if ($subresult['querytype'] == 'SELECT' && !$in_group_concat) { if ($subresult['querytype'] == 'SELECT'
&& ! $in_group_concat
&& ! ($seen_subquery && $arr[$i - 1]['type'] == 'punct_bracket_close_round')) {
if (!$seen_from) { if (!$seen_from) {
if ($previous_was_identifier && isset($chain)) { if ($previous_was_identifier && isset($chain)) {
// found alias for this select_expr, save it // found alias for this select_expr, save it