Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 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: 133 lines (4 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 1 file
 lib/dml/tests/fixtures/read_slave_moodle_database.php

Defines 2 classes

read_slave_moodle_database_special:: (4 methods):
  get_records_sql()
  get_records_sql_p()
  get_recordset_sql()
  count_records()

read_slave_moodle_recordset_special:: (5 methods):
  close()
  current()
  next()
  key()
  valid()


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

return: string $handle handle property
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).

get_records_sql_p($sql, array $params = null, $limitfrom = 0, $limitnum = 0)   X-Ref
Returns read_slave_moodle_database::get_records_sql()
For the tests where we need both fake result and dbhandle info.

return: string $handle handle property
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).

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

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

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

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

Class: read_slave_moodle_recordset_special  - X-Ref

Database recordset mock test class

close()   X-Ref
Iterator interface

return: void

current()   X-Ref
Iterator interface

return: stdClass

next()   X-Ref
Iterator interface

return: void

key()   X-Ref
Iterator interface

return: mixed

valid()   X-Ref
Iterator interface

return: bool