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 310 and 311] [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403] [Versions 39 and 311]

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

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

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

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

get_dbhwrite()   X-Ref
get_dbhwrite()

return: string $dbhwrite handle property

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

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

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

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

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

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

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

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

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

get_db_handle()   X-Ref
Gets handle property

return: string $handle handle property

set_db_handle($dbh)   X-Ref
Sets handle property

param: string $dbh
return: void

add_temptable($temptable)   X-Ref
Add temptable

param: string $temptable
return: void

delete_temptable($temptable)   X-Ref
Remove temptable

param: string $temptable
return: void

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

return: bool