From: stronk7 Date: Fri, 1 Sep 2006 18:33:19 +0000 (+0000) Subject: Now record_exists_sql() uses the cross-db limit implementation. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=d32d63b6e00a82e8560efc618ddd974d29ba05d2;p=moodle.git Now record_exists_sql() uses the cross-db limit implementation. --- diff --git a/lib/dmllib.php b/lib/dmllib.php index 24324d56d3..8c1dd99fa0 100644 --- a/lib/dmllib.php +++ b/lib/dmllib.php @@ -248,7 +248,7 @@ function record_exists($table, $field1='', $value1='', $field2='', $value2='', $ $select = where_clause($field1, $value1, $field2, $value2, $field3, $value3); - return record_exists_sql('SELECT * FROM '. $CFG->prefix . $table .' '. $select .' LIMIT 1'); + return record_exists_sql('SELECT * FROM '. $CFG->prefix . $table .' '. $select); } /** @@ -280,7 +280,11 @@ function record_exists_select($table, $select='') { * @return bool true if the SQL executes without errors and returns at least one record. */ function record_exists_sql($sql) { - $rs = get_recordset_sql($sql); + + $limitfrom = 0; /// Number of records to skip + $limitnum = 1; /// Number of records to retrieve + + $rs = get_recordset_sql($sql, $limitfrom, $limitnum); if ($rs && $rs->RecordCount() > 0) { return true;