From f96a5db1c431876d21d17bddca78e453713b7dc1 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Mon, 23 Oct 2006 07:46:10 +0000 Subject: [PATCH] strip "old" harcoded "limit" clauses from the sql passed and debug about them. MDL-7173 Merged from MOODLE_17_STABLE --- lib/dmllib.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/dmllib.php b/lib/dmllib.php index 2907fc658e..e9e4a1b65c 100644 --- a/lib/dmllib.php +++ b/lib/dmllib.php @@ -894,6 +894,13 @@ function get_field_select($table, $return, $select) { function get_field_sql($sql) { global $CFG; +/// Strip potential LIMIT uses arriving here, debugging them (MDL-7173) + $newsql = preg_replace('/ LIMIT [0-9, ]+$/is', '', $sql); + if ($newsql != $sql) { + debugging('Incorrect use of LIMIT clause (not cross-db) in call to get_field_sql(): ' . $sql, DEBUG_DEVELOPER); + $sql = $newsql; + } + $rs = get_recordset_sql($sql, 0, 1); if ($rs && $rs->RecordCount() == 1) { -- 2.39.5