Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
ADOdbLoadBalancerConnection Class Reference

Class ADOdbLoadBalancerConnection. More...

Public Member Functions

 __construct ( $driver, $type='write', $weight=1, $persistent_connection=false, $argHostname='', $argUsername='', $argPassword='', $argDatabaseName='')
 ADOdbLoadBalancerConnection constructor to setup the ADODB object.
 
 getADOdbObject ()
 Returns the ADODB object for this connection.
 
 getConnectionTestCallback ()
 
 setConnectionTestCallback ($callback)
 Anonymous function that is called and must return TRUE for the connection to be usable.
 

Public Attributes

string $database = ''
 Database connection database name.
 
string $host = ''
 Database connection host.
 
string $password = ''
 Database connection password.
 
bool $persistent_connection = false
 Determines if the connection persistent.
 
string $type = 'write'
 Type of connection, either 'write' capable or 'readonly'.
 
string $user = ''
 Database connection user.
 
int $weight = 1
 Weight of connection, lower receives less queries, higher receives more queries.
 

Protected Attributes

bool $adodb_obj = false
 ADODB object.
 
callable $connection_test_callback = NULL
 Closure.
 
bool $driver = false
 ADOdb drive name.
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ADOdbLoadBalancerConnection::__construct ( $driver,
$type = 'write',
$weight = 1,
$persistent_connection = false,
$argHostname = '',
$argUsername = '',
$argPassword = '',
$argDatabaseName = '' )

ADOdbLoadBalancerConnection constructor to setup the ADODB object.

Parameters
$driver
string$type
int$weight
bool$persistent_connection
string$argHostname
string$argUsername
string$argPassword
string$argDatabaseName

Member Function Documentation

◆ getADOdbObject()

ADOdbLoadBalancerConnection::getADOdbObject ( )

Returns the ADODB object for this connection.

Return values
bool

◆ getConnectionTestCallback()

ADOdbLoadBalancerConnection::getConnectionTestCallback ( )
Return values
callable|null

◆ setConnectionTestCallback()

ADOdbLoadBalancerConnection::setConnectionTestCallback ( $callback)

Anonymous function that is called and must return TRUE for the connection to be usable.

  • The first argument is the type of connection to test. Useful to check things like replication lag.
    Parameters
    callable$callback
    Return values
    void

The documentation for this class was generated from the following file: