diff --git a/ChangeLog b/ChangeLog index 935fec53b..49b70f0f5 100755 --- a/ChangeLog +++ b/ChangeLog @@ -7,7 +7,7 @@ $Source$ 2004-09-29 Marc Delisle * sql.php, libraries/common.lib.php: bug #1036678, incorrect appending - of LIMIT to queries + of LIMIT to queries, and bug #1037004, UPDATE statement not showing 2004-09-29 Michal Čihař * tbl_addfield.php, tbl_create.php, tbl_properties.inc.php, lang/*: Better diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 2e86524aa..1d897a0b2 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -1583,12 +1583,17 @@ if (typeof(document.getElementById) != 'undefined' // Here we append the LIMIT added for navigation, to // enable its display. Adding it higher in the code // to $local_query would create a problem when - // using the Refresh or Edit links + // using the Refresh or Edit links. + + // Only append it on SELECTs. // FIXME: what would be the best to do when someone // hits Refresh: use the current LIMITs ? - if (isset($GLOBALS['sql_limit_to_append'])) { + // TODO: use the parser instead of preg_match() + + if (preg_match('@^SELECT[[:space:]]+@i', $query_base) + && isset($GLOBALS['sql_limit_to_append'])) { $query_base .= $GLOBALS['sql_limit_to_append']; }