bug 642319

This commit is contained in:
Marc Delisle
2002-11-22 19:49:00 +00:00
parent 54a30da611
commit eb577f4a0d
4 changed files with 13 additions and 7 deletions

View File

@@ -7,6 +7,8 @@ $Source$
2002-11-22 Marc Delisle <lem9@users.sourceforge.net>
* libraries/display_tbl.lib.php3: numeric foreign keys used as alias
* sql.php3, libraries/sqlparser.lib.php3: bug 642319, navigation
and GROUP BY
2002-11-22 Alexander M. Turek <rabus@users.sourceforge.net>
* scripts/create-release.sh: The script should now work at the SF shell

View File

@@ -166,6 +166,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
// displayed but there is only one row, change these settings to
// false
if ($do_display['nav_bar'] == '1' || $do_display['sort_lnk'] == '1') {
if (isset($unlim_num_rows) && $unlim_num_rows < 2) {
$do_display['nav_bar'] = (string) '0';
$do_display['sort_lnk'] = (string) '0';

View File

@@ -2,7 +2,6 @@
/* $Id$ */
// vim: expandtab sw=4 ts=4 sts=4:
error_reporting(E_ALL);
/** SQL Parser Functions for phpMyAdmin
*
* Copyright 2002 Robin Johnson <robbat2@users.sourceforge.net>
@@ -1186,12 +1185,13 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
}
break;
case 'alpha_reservedWord':
$upper = $arr[$i]['data'];
//$upper = $arr[$i]['data'];
$arr[$i]['data'] = strtoupper($arr[$i]['data']);
if ((($typearr[1] != 'alpha_reservedWord')
|| (($typearr[1] == 'alpha_reservedWord')
&& PMA_STR_binarySearchInArr(strtoupper($arr[$i - 1]['data']), $keywords_no_newline, $keywords_no_newline_cnt)))
&& ($typearr[1] != 'punct_level_plus')
&& (!PMA_STR_binarySearchInArr($upper, $keywords_no_newline, $keywords_no_newline_cnt))) {
&& (!PMA_STR_binarySearchInArr($arr[$i]['data'], $keywords_no_newline, $keywords_no_newline_cnt))) {
// do not put a space before the first token, because
// we use a lot of eregi() checking for the first
// reserved word at beginning of query
@@ -1202,7 +1202,7 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
$before .= ' ';
}
switch ($upper) {
switch ($arr[$i]['data']) {
case 'CREATE':
$space_punct_listsep = $html_line_break;
$space_alpha_reserved_word = ' ';
@@ -1236,7 +1236,7 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
break;
default:
break;
} // end switch ($upper)
} // end switch ($arr[$i]['data'])
$after .= ' ';
break;

View File

@@ -82,10 +82,12 @@ if (isset($btnDrop) || isset($navig)) {
*/
$parsed_sql = PMA_SQP_parse((get_magic_quotes_gpc() ? stripslashes($sql_query) : $sql_query));
$is_select = eregi('^SELECT[[:space:]]+', $sql_query);
$analyzed_sql = PMA_SQP_analyze($parsed_sql);
$sql_query = PMA_SQP_formatHtml($parsed_sql, 'query_only');
// here we are sure that SELECT is uppercase
$is_select = eregi('^SELECT[[:space:]]+', $sql_query);
// If the query is a Select, extract the db and table names and modify
// $db and $table, to have correct page headers, links and left frame.
// db and table name may be enclosed with backquotes, db is optionnal,
@@ -232,7 +234,8 @@ else {
// "SELECT COUNT(...) FROM ... GROUP BY ..."
$is_explain = $is_count = $is_export = $is_delete = $is_insert = $is_affected = $is_show = $is_maint = $is_analyse = $is_group = $is_func = FALSE;
if ($is_select) { // see line 141
$is_group = eregi('[[:space:]]+(GROUP BY|HAVING|SELECT[[:space:]]+DISTINCT)[[:space:]]+', $sql_query);
$is_group = eregi('[[:space:]]+(GROUP[[:space:]]+BY|HAVING|SELECT[[:space:]]+DISTINCT)[[:space:]]+', $sql_query);
$is_func = !$is_group && (eregi('[[:space:]]+(SUM|AVG|STD|STDDEV|MIN|MAX|BIT_OR|BIT_AND)\s*\(', $sql_query));
$is_count = !$is_group && (eregi('^SELECT[[:space:]]+COUNT\((.*\.+)?.*\)', $sql_query));
$is_export = (eregi('[[:space:]]+INTO[[:space:]]+OUTFILE[[:space:]]+', $sql_query));