Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Functions | Variables
moodle_read_slave_trait.php File Reference

Trait that adds read-only slave connection capability. More...

Functions

 can_use_readonly (int $type, string $sql)
 Check if The query qualifies for readonly connection execution Logging queries are exempt, those are write operations that circumvent standard query_start/query_end paths. More...
 
 commit_delegated_transaction (moodle_transaction $transaction)
 Indicates delegated transaction finished successfully. More...
 
 connect ($dbhost, $dbuser, $dbpass, $dbname, $prefix, array $dboptions=null)
 Connect to db The connection parameters processor that sets up stage for master write and slave readonly handles. More...
 
 get_db_handle ()
 Gets db handle currently used with queries. More...
 
 perf_get_reads_slave ()
 Returns the number of reads done by the read only database. More...
 
 query_start ($sql, array $params=null, $type, $extrainfo=null)
 Called before each db query. More...
 
 raw_connect (string $dbhost, string $dbuser, string $dbpass, string $dbname, $prefix, array $dboptions=null)
 Connect to db The real connection establisment, called from connect() and set_dbhwrite() More...
 
 select_db_handle (int $type, string $sql)
 Select appropriate db handle - readwrite or readonly. More...
 
 set_db_handle ($dbh)
 Sets db handle to be used with subsequent queries. More...
 
 start_delegated_transaction ()
 On DBs that support it, switch to transaction mode and begin a transaction. More...
 
 table_names (string $sql)
 Parse table names from query. More...
 
 want_read_slave ()
 Returns whether we want to connect to slave database for read queries. More...
 

Variables

resource $dbhreadonly
 slave read only database handle
 
trait moodle_read_slave_trait
 Trait to wrap connect() method of database driver classes that gives ability to use read only slave instances for SELECT queries. More...
 

Detailed Description

Trait that adds read-only slave connection capability.