12use InvalidArgumentException;
25publicstaticfunctionhasFlags( $bitfield, $flags ) {
26return ( $bitfield & $flags ) == $flags;
41 $index =
DB_REPLICA;
// override READ_LATEST if set 50 $lockingOptions[] =
'FOR UPDATE';
52 $lockingOptions[] =
'LOCK IN SHARE MODE';
55return [ $index, $lockingOptions ];
74thrownew InvalidArgumentException(
'$index must be either DB_REPLICA or DB_PRIMARY' );
93class_alias( DBAccessObjectUtils::class,
'DBAccessObjectUtils' );
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.
if(!defined('MW_SETUP_CALLBACK'))
Helper class for DAO classes.
static getDBFromIndex(IConnectionProvider $dbProvider, int $index)
Takes $index from ::getDBOptions() and return proper Database object.
static hasFlags( $bitfield, $flags)
static getDBOptions( $bitfield)
Get an appropriate DB index and options.
static getDBFromRecency(IConnectionProvider $dbProvider, int $recency)
Provide primary and replica IDatabase connections.
getReplicaDatabase(string|false $domain=false, $group=null)
Get connection to a replica database.
getPrimaryDatabase( $domain=false)
Get connection to the primary database.
Interface for database access objects.
const READ_LATEST
Read from the primary/quorum.
const READ_LOCKING
Read from the primary/quorum and lock out other writers.
const READ_LATEST_IMMUTABLE
Read from a replica DB or without a quorum, using the primary/quorum on miss.
const READ_EXCLUSIVE
Read from the primary/quorum and lock out other writers and locking readers.
A database connection without write operations.