Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 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.