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 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: 238 lines (7 kb)
Included or required: 2 times
Referenced: 0 times
Includes or requires: 2 files
 lib/dml/moodle_read_slave_trait.php
 lib/dml/tests/fixtures/test_moodle_database.php

Defines 1 class


Class: read_slave_moodle_database  - X-Ref

Database driver test class with moodle_read_slave_trait

raw_connect(string $dbhost, string $dbuser, string $dbpass, string $dbname, $prefix, array $dboptions = null)   X-Ref
Does not connect to the database. Sets handle property to $dbhost

return: bool true
param: string $dbhost
param: string $dbuser
param: string $dbpass
param: string $dbname
param: mixed $prefix
param: array $dboptions

begin_transaction()   X-Ref
Begin database transaction

return: void

commit_transaction()   X-Ref
Commit database transaction

return: void

rollback_transaction()   X-Ref
Abort database transaction

return: void

with_query_start_end($sql, ?array $params, $querytype, $callback = null)   X-Ref
Query wrapper that calls query_start() and query_end()

return: string $handle handle property
param: string $sql
param: array|null $params
param: int $querytype
param: ?callable $callback

get_dbhwrite()   X-Ref
get_dbhwrite()

return: string $dbhwrite handle property

execute($sql, array $params = null)   X-Ref
Calls with_query_start_end()

return: bool true
param: string $sql
param: array $params

get_records_sql($sql, array $params = null, $limitfrom = 0, $limitnum = 0)   X-Ref
get_records_sql() override, calls with_query_start_end()

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
Calls with_query_start_end()

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

insert_record_raw($table, $params, $returnid = true, $bulk = false, $customsequence = false)   X-Ref
Calls with_query_start_end()

return: string $handle handle property
param: string $table
param: array $params
param: bool $returnid
param: bool $bulk
param: bool $customsequence

update_record_raw($table, $params, $bulk = false)   X-Ref
Calls with_query_start_end()

return: string $handle handle property
param: string $table
param: array $params
param: bool $bulk

get_db_handle()   X-Ref
Gets handle property

return: string $handle handle property

set_db_handle($dbh)   X-Ref
Sets handle property

return: void
param: string $dbh

add_temptable($temptable)   X-Ref
Add temptable

return: void
param: string $temptable

delete_temptable($temptable)   X-Ref
Remove temptable

return: void
param: string $temptable

session_lock_supported()   X-Ref
Is session lock supported in this driver?

return: bool