MediaWiki master
DBAccessObjectUtils Class Reference

Helper class for DAO classes. More...

Inherits IDBAccessObject.

Collaboration diagram for DBAccessObjectUtils:

Static Public Member Functions

static getDBFromIndex (IConnectionProvider $dbProvider, int $index)
 Takes $index from ::getDBOptions() and return proper Database object.
 
static getDBFromRecency (IConnectionProvider $dbProvider, int $recency)
 
static getDBOptions ( $bitfield)
 Get an appropriate DB index and options.
 
static hasFlags ( $bitfield, $flags)
 

Additional Inherited Members

- Public Attributes inherited from IDBAccessObject
const READ_NONE = -1
 Constants for object loading bitfield flags (higher => higher QoS)
 

Detailed Description

Helper class for DAO classes.

Since
1.26

Definition at line 32 of file DBAccessObjectUtils.php.

Member Function Documentation

◆ getDBFromIndex()

static DBAccessObjectUtils::getDBFromIndex ( IConnectionProvider $dbProvider,
int $index )
static

Takes $index from ::getDBOptions() and return proper Database object.

Deprecated
since 1.42
Parameters
IConnectionProvider$dbProvider
int$indexeither DB_REPLICA or DB_PRIMARY
Returns
IReadableDatabase

Definition at line 78 of file DBAccessObjectUtils.php.

References Wikimedia\Rdbms\IConnectionProvider\getPrimaryDatabase().

◆ getDBFromRecency()

static DBAccessObjectUtils::getDBFromRecency ( IConnectionProvider $dbProvider,
int $recency )
static
Parameters
IConnectionProvider$dbProvider
int$recencyIDBAccessObject::READ_* constant
Returns
IReadableDatabase
Since
1.42

Definition at line 95 of file DBAccessObjectUtils.php.

References Wikimedia\Rdbms\IConnectionProvider\getPrimaryDatabase().

◆ getDBOptions()

static DBAccessObjectUtils::getDBOptions ( $bitfield)
static

Get an appropriate DB index and options.

Parameters
int$bitfieldBitfield of IDBAccessObject::READ_* constants
Returns
array List of DB indexes and options in this order:
  • DB_PRIMARY or DB_REPLICA constant for the initial query
  • SELECT options array for the initial query

Definition at line 50 of file DBAccessObjectUtils.php.

References DB_PRIMARY, and DB_REPLICA.

◆ hasFlags()

static DBAccessObjectUtils::hasFlags ( $bitfield,
$flags )
static
Parameters
int$bitfield
int$flagsIDBAccessObject::READ_* constant
Returns
bool Bitfield has flag $flag set

Definition at line 38 of file DBAccessObjectUtils.php.


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