diff --git a/ChangeLog b/ChangeLog index f5c2b798e..aa541ce35 100755 --- a/ChangeLog +++ b/ChangeLog @@ -6,8 +6,8 @@ $Id$ $Source$ 2001-08-20 Marc Delisle - * config.inc.php3: $cfgProtectBlob is now TRUE by default, to help - against the blob data corruption of some browsers + * config.inc.php3: $cfgProtectBlob is now TRUE by default, to help against + the blob data corruption of some browsers. 2001-08-20 Loïc Chapeaux * db_details.php3; tbl_properties.php3; tbl_dump.php3; lib.inc.php3; @@ -16,6 +16,8 @@ $Source$ choice (because we know Excel does not support in data). Thanks to François . - added an extended inserts option for dumps of data. + * lib.inc.php3; sql.php3: optimized a bit and started to work on feature + #444767 (Other cases for display=simple). 2001-08-19 Olivier Müller * db_readdump.php3: if file contains mutiple queries, only show this line: diff --git a/lib.inc.php3 b/lib.inc.php3 index f57e0ddb3..d3033be2d 100755 --- a/lib.inc.php3 +++ b/lib.inc.php3 @@ -539,12 +539,16 @@ window.parent.frames['nav'].location.replace(''); echo ' ' . $query_base; // If a 'LIMIT' clause has been programatically added to the query // displays it - $is_append_limit = (isset($GLOBALS['pos']) - && eregi('^SELECT', $GLOBALS['sql_query']) - && !eregi('LIMIT[ 0-9,]+$', $GLOBALS['sql_query'])); - if ($is_append_limit) { - echo ' LIMIT ' . $GLOBALS['pos'] . ', ' . $GLOBALS['cfgMaxRows']; + if (!empty($GLOBALS['sql_limit_to_append'])) { + echo $GLOBALS['sql_limit_to_append']; } + // loic1 : this was far to be optimal + // $is_append_limit = (isset($GLOBALS['pos']) + // && (eregi('^SELECT', $GLOBALS['sql_query']) && !eregi('^SELECT COUNT\((.*\.+)?\*\) FROM ', $GLOBALS['sql_query'])) + // && !eregi('LIMIT[ 0-9,]+$', $GLOBALS['sql_query'])); + // if ($is_append_limit) { + // echo ' LIMIT ' . $GLOBALS['pos'] . ', ' . $GLOBALS['cfgMaxRows']; + // } echo "\n"; ?> @@ -939,7 +943,7 @@ var errorMsg2 = '


'; + echo "\n" . '

' . "\n"; } // Displays the results diff --git a/sql.php3 b/sql.php3 index 181cd1f90..2050dee8e 100755 --- a/sql.php3 +++ b/sql.php3 @@ -116,10 +116,12 @@ else { if (isset($sessionMaxRows)) { $cfgMaxRows = $sessionMaxRows; } - $sql_limit_to_append = (isset($pos) && $is_select && !eregi(' LIMIT[ 0-9,]+$', $sql_query)) + $sql_limit_to_append = (isset($pos) + && ($is_select && !eregi('^SELECT COUNT\((.*\.+)?\*\) FROM ', $sql_query)) + && !eregi(' LIMIT[ 0-9,]+$', $sql_query)) ? " 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]; } else { $full_sql_query = $sql_query . $sql_limit_to_append; @@ -199,6 +201,10 @@ else { $display = 'bkmOnly'; } } + if ($display != 'simple' + && (isset($SelectNumRows) && $SelectNumRows <= $cfgMaxRows)) { + $display = 'simple'; + } // Displays the results in a table display_table($result, ($display == 'simple' || $display == 'bkmOnly'));