Optimized a bit and started to work on feature #444767 (Other cases for display=simple)

This commit is contained in:
Loïc Chapeaux
2001-08-20 14:22:06 +00:00
parent 7b5e0de828
commit 75e7497367
3 changed files with 22 additions and 10 deletions

View File

@@ -6,8 +6,8 @@ $Id$
$Source$ $Source$
2001-08-20 Marc Delisle <lem9@users.sourceforge.net> 2001-08-20 Marc Delisle <lem9@users.sourceforge.net>
* config.inc.php3: $cfgProtectBlob is now TRUE by default, to help * config.inc.php3: $cfgProtectBlob is now TRUE by default, to help against
against the blob data corruption of some browsers the blob data corruption of some browsers.
2001-08-20 Lo<4C>c Chapeaux <lolo@phpheaven.net> 2001-08-20 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* db_details.php3; tbl_properties.php3; tbl_dump.php3; lib.inc.php3; * 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 <cr> in data). Thanks to choice (because we know Excel does not support <cr> in data). Thanks to
Fran<61>ois <outils@altern.org>. Fran<61>ois <outils@altern.org>.
- added an extended inserts option for dumps of data. - 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 <om@omnis.ch> 2001-08-19 Olivier M<>ller <om@omnis.ch>
* db_readdump.php3: if file contains mutiple queries, only show this line: * db_readdump.php3: if file contains mutiple queries, only show this line:

View File

@@ -539,12 +539,16 @@ window.parent.frames['nav'].location.replace('<?php echo $reload_url; ?>');
echo ' ' . $query_base; echo ' ' . $query_base;
// If a 'LIMIT' clause has been programatically added to the query // If a 'LIMIT' clause has been programatically added to the query
// displays it // displays it
$is_append_limit = (isset($GLOBALS['pos']) if (!empty($GLOBALS['sql_limit_to_append'])) {
&& eregi('^SELECT', $GLOBALS['sql_query']) echo $GLOBALS['sql_limit_to_append'];
&& !eregi('LIMIT[ 0-9,]+$', $GLOBALS['sql_query']));
if ($is_append_limit) {
echo ' LIMIT ' . $GLOBALS['pos'] . ', ' . $GLOBALS['cfgMaxRows'];
} }
// 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"; echo "\n";
?> ?>
</td> </td>
@@ -939,7 +943,7 @@ var errorMsg2 = '<?php echo(str_replace('\'', '\\\'', $GLOBALS['strNotValidNumbe
if (!$is_simple) { if (!$is_simple) {
show_table_navigation($pos_next, $pos_prev, $dt_result); show_table_navigation($pos_next, $pos_prev, $dt_result);
} else { } else {
echo '<br /><br /><br /><br />'; echo "\n" . '<br /><br />' . "\n";
} }
// Displays the results // Displays the results

View File

@@ -116,10 +116,12 @@ else {
if (isset($sessionMaxRows)) { if (isset($sessionMaxRows)) {
$cfgMaxRows = $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" ? " 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];
} else { } else {
$full_sql_query = $sql_query . $sql_limit_to_append; $full_sql_query = $sql_query . $sql_limit_to_append;
@@ -199,6 +201,10 @@ else {
$display = 'bkmOnly'; $display = 'bkmOnly';
} }
} }
if ($display != 'simple'
&& (isset($SelectNumRows) && $SelectNumRows <= $cfgMaxRows)) {
$display = 'simple';
}
// Displays the results in a table // Displays the results in a table
display_table($result, ($display == 'simple' || $display == 'bkmOnly')); display_table($result, ($display == 'simple' || $display == 'bkmOnly'));