Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403]

Database driver test class for testing moodle_read_slave_trait

Copyright: 2018 Srdjan Janković, Catalyst IT
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 76 lines (3 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 2 files
 lib/dml/tests/fixtures/read_slave_moodle_recordset_special.php
 lib/dml/tests/fixtures/read_slave_moodle_database.php

Defines 1 class

read_slave_moodle_database_special:: (3 methods):
  get_records_sql()
  get_recordset_sql()
  count_records()


Class: read_slave_moodle_database_special  - X-Ref

Database driver mock test class that uses read_slave_moodle_recordset_special

get_records_sql($sql, array $params = null, $limitfrom = 0, $limitnum = 0)   X-Ref
Returns empty array

param: string $sql the SQL select query to execute.
param: array $params array of sql parameters
param: int $limitfrom return a subset of records, starting at this point (optional).
param: int $limitnum return a subset comprising this many records (optional, required if $limitfrom is set).
return: string $handle handle property

get_recordset_sql($sql, array $params = null, $limitfrom = 0, $limitnum = 0)   X-Ref
Returns fake recordset

param: string $sql
param: array $params
param: int $limitfrom
param: int $limitnum
return: bool true

count_records($table, array $conditions = null)   X-Ref
Count the records in a table where all the given conditions met.

param: string $table The table to query.
param: array $conditions optional array $fieldname=>requestedvalue with AND in between
return: int The count of records returned from the specified criteria.