bug 506558 qbe unlimited rows

This commit is contained in:
Marc Delisle
2002-01-25 03:49:50 +00:00
parent df4a2a24b2
commit 049434f99f
2 changed files with 14 additions and 3 deletions

View File

@@ -9,6 +9,7 @@ $Source$
* merge patch 507338, thanks to Adam Ashley (fruitcak) * merge patch 507338, thanks to Adam Ashley (fruitcak)
* galician updates, thanks to Xos<6F> Calvo. * galician updates, thanks to Xos<6F> Calvo.
* czech* updates, thanks to Michal Cihar (nijel) * czech* updates, thanks to Michal Cihar (nijel)
* sql.php3: bug 506558 (QBE returns unlimited rows)
2002-01-23 Olivier M<>ller <om@omnis.ch> 2002-01-23 Olivier M<>ller <om@omnis.ch>
* translated the last german words * translated the last german words

View File

@@ -198,8 +198,11 @@ else {
// Do append a "LIMIT" clause? // Do append a "LIMIT" clause?
if (isset($pos) if (isset($pos)
&& (!$cfgShowAll || $session_max_rows != 'all') && (!$cfgShowAll || $session_max_rows != 'all')
&& ($is_select && !($is_count || $is_export) && eregi(' FROM ', $sql_query)) && $is_select
&& !eregi(' LIMIT[ 0-9,]+$', $sql_query)) { && !($is_count || $is_export)
&& eregi('[[:space:]]FROM[[:space:]]', $sql_query)
&& !eregi('[[:space:]]LIMIT[ 0-9,]+$', $sql_query)) {
$sql_limit_to_append = " LIMIT $pos, $cfgMaxRows"; $sql_limit_to_append = " LIMIT $pos, $cfgMaxRows";
if (eregi('(.*)( PROCEDURE (.*)| FOR UPDATE| LOCK IN SHARE MODE)$', $sql_query, $regs)) { if (eregi('(.*)( PROCEDURE (.*)| FOR UPDATE| LOCK IN SHARE MODE)$', $sql_query, $regs)) {
$full_sql_query = $regs[1] . $sql_limit_to_append . $regs[2]; $full_sql_query = $regs[1] . $sql_limit_to_append . $regs[2];
@@ -254,7 +257,14 @@ else {
} }
else if ($is_select) { else if ($is_select) {
// reads only the from-part of the query... // reads only the from-part of the query...
$array = split(' from | FROM | order | ORDER | having | HAVING | limit | LIMIT | group by | GROUP BY', $sql_query); $sp='[[:space:]]';
$array = split(
$sp . 'from' . $sp .'|' . $sp . 'FROM' .$sp .
'|' . $sp .'order' . $sp . '|' . $sp . 'ORDER' . $sp .
'|' . $sp .'having' . $sp . '|' . $sp . 'HAVING' . $sp .
'|' . $sp .'limit' . $sp . '|' . $sp . 'LIMIT' . $sp .
'|' . $sp .'group' . $sp . 'by'. $sp .
'|' . $sp . 'GROUP' . $sp . 'BY' . $sp, $sql_query);
if (!empty($array[1])) { if (!empty($array[1])) {
// ... and makes a count(*) to count the entries // ... and makes a count(*) to count the entries
$count_query = 'SELECT COUNT(*) AS count FROM ' . $array[1]; $count_query = 'SELECT COUNT(*) AS count FROM ' . $array[1];