MDL-43395 dml: warn about invalid limit params
Help developers to find bugs by throwing a DEBUG_DEVELOPER message rather than ignoring this case completely.
This commit is contained in:
@@ -681,10 +681,9 @@ class pgsql_native_moodle_database extends moodle_database {
|
||||
* @throws dml_exception A DML specific exception is thrown for any errors.
|
||||
*/
|
||||
public function get_recordset_sql($sql, array $params=null, $limitfrom=0, $limitnum=0) {
|
||||
$limitfrom = (int)$limitfrom;
|
||||
$limitnum = (int)$limitnum;
|
||||
$limitfrom = ($limitfrom < 0) ? 0 : $limitfrom;
|
||||
$limitnum = ($limitnum < 0) ? 0 : $limitnum;
|
||||
|
||||
list($limitfrom, $limitnum) = $this->normalise_limit_from_num($limitfrom, $limitnum);
|
||||
|
||||
if ($limitfrom or $limitnum) {
|
||||
if ($limitnum < 1) {
|
||||
$limitnum = "ALL";
|
||||
@@ -724,10 +723,9 @@ class pgsql_native_moodle_database extends moodle_database {
|
||||
* @throws dml_exception A DML specific exception is thrown for any errors.
|
||||
*/
|
||||
public function get_records_sql($sql, array $params=null, $limitfrom=0, $limitnum=0) {
|
||||
$limitfrom = (int)$limitfrom;
|
||||
$limitnum = (int)$limitnum;
|
||||
$limitfrom = ($limitfrom < 0) ? 0 : $limitfrom;
|
||||
$limitnum = ($limitnum < 0) ? 0 : $limitnum;
|
||||
|
||||
list($limitfrom, $limitnum) = $this->normalise_limit_from_num($limitfrom, $limitnum);
|
||||
|
||||
if ($limitfrom or $limitnum) {
|
||||
if ($limitnum < 1) {
|
||||
$limitnum = "ALL";
|
||||
|
||||
Reference in New Issue
Block a user