diff --git a/ChangeLog b/ChangeLog index 212bfa6f1..0c35e1f35 100755 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,8 @@ $Source$ 2002-06-30 Alexander M. Turek * user_details.php3: Added a tooltip for the new documenation link. + * sql.php3: Fixed bug #574855 (wrong counted rows with many functions) + thanks to Svetlozar Kovachev (svetlio). 2002-06-29 Marc Delisle * tbl_qbe.php3: show upper links diff --git a/sql.php3 b/sql.php3 index b02ecbc2b..5dc013335 100755 --- a/sql.php3 +++ b/sql.php3 @@ -91,7 +91,7 @@ $sql_query = PMA_sqlFormat($sql_query); // (todo: check for embedded comments...) // (todo: if there are more than one table name in the Select: -// - do not extract the first table name +// - do not extract the first table name // - do not show a table name in the page header // - do not display the sub-pages links) @@ -223,8 +223,9 @@ else { * $is_count is changed for more correct "LIMIT" clause appending * in queries like 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 = FALSE; + $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 76 + $is_func = !$is_group && (eregi("( SUM\s*\(| AVG\s*\(| STD\s*\(| STDDEV\s*\(| MIN\s*\(| MAX\s*\(| BIT_OR\s*\(| BIT_AND\s*\()", $sql_query)); $is_group = eregi("( GROUP BY | HAVING | SELECT DISTINCT )", $sql_query); $is_count = !$is_group && (eregi('^SELECT[[:space:]]+COUNT\((.*\.+)?.*\)', $sql_query)); $is_export = (eregi('[[:space:]]+INTO[[:space:]]+OUTFILE[[:space:]]+', $sql_query)); @@ -249,7 +250,7 @@ else { if (isset($pos) && (!$cfg['ShowAll'] || $session_max_rows != 'all') && $is_select - && !($is_count || $is_export) + && !($is_count || $is_export || $is_func) && eregi('[[:space:]]FROM[[:space:]]', $sql_query) && !eregi('[[:space:]]LIMIT[[:space:]0-9,]+$', $sql_query)) {