MediaWiki REL1_32
Wikimedia\Rdbms\DatabaseDomain Class Reference

Class to handle database/prefix specification for IDatabase domains. More...

Collaboration diagram for Wikimedia\Rdbms\DatabaseDomain:

Public Member Functions

 __construct ( $database, $schema, $prefix)
 
 __toString ()
 
 equals ( $other)
 
 getDatabase ()
 
 getId ()
 
 getSchema ()
 
 getTablePrefix ()
 
 isCompatible ( $other)
 Check whether the domain $other meets the specifications of this domain.
 
 isUnspecified ()
 

Static Public Member Functions

static newFromId ( $domain)
 
static newUnspecified ()
 

Private Member Functions

 convertToString ()
 

Static Private Member Functions

static decode ( $encoded)
 
static encode ( $decoded)
 

Private Attributes

string null $database
 
string $equivalentString
 Cache of convertToString()
 
string $prefix
 
string null $schema
 

Detailed Description

Class to handle database/prefix specification for IDatabase domains.

Definition at line 28 of file DatabaseDomain.php.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Rdbms\DatabaseDomain::__construct ( $database,
$schema,
$prefix )
Parameters
string | null$databaseDatabase name
string | null$schemaSchema name
string$prefixTable prefix

Definition at line 44 of file DatabaseDomain.php.

References Wikimedia\Rdbms\DatabaseDomain\$database, Wikimedia\Rdbms\DatabaseDomain\$prefix, and Wikimedia\Rdbms\DatabaseDomain\$schema.

Member Function Documentation

◆ __toString()

Wikimedia\Rdbms\DatabaseDomain::__toString ( )
Returns
string

Definition at line 253 of file DatabaseDomain.php.

References Wikimedia\Rdbms\DatabaseDomain\getId().

◆ convertToString()

Wikimedia\Rdbms\DatabaseDomain::convertToString ( )
private

◆ decode()

static Wikimedia\Rdbms\DatabaseDomain::decode ( $encoded)
staticprivate

Definition at line 225 of file DatabaseDomain.php.

◆ encode()

static Wikimedia\Rdbms\DatabaseDomain::encode ( $decoded)
staticprivate

Definition at line 207 of file DatabaseDomain.php.

◆ equals()

Wikimedia\Rdbms\DatabaseDomain::equals ( $other)
Parameters
DatabaseDomain | string$other
Returns
bool Whether the domain instances are the same by value

Definition at line 105 of file DatabaseDomain.php.

References Wikimedia\Rdbms\DatabaseDomain\getId().

◆ getDatabase()

◆ getId()

◆ getSchema()

◆ getTablePrefix()

Wikimedia\Rdbms\DatabaseDomain::getTablePrefix ( )

◆ isCompatible()

Wikimedia\Rdbms\DatabaseDomain::isCompatible ( $other)

Check whether the domain $other meets the specifications of this domain.

If this instance has a null database specifier, then $other can have any database specified, including the null, and likewise if the schema specifier is null. This is not transitive like equals() since a domain that explicitly wants a certain database or schema cannot be satisfied by one of another (nor null). If the prefix is empty and the DB and schema are both null, then the entire domain is considered unspecified, and any prefix of $other is considered compatible.

Parameters
DatabaseDomain | string$other
Returns
bool
Since
1.32

Definition at line 131 of file DatabaseDomain.php.

References Wikimedia\Rdbms\DatabaseDomain\isUnspecified(), and Wikimedia\Rdbms\DatabaseDomain\newFromId().

◆ isUnspecified()

Wikimedia\Rdbms\DatabaseDomain::isUnspecified ( )
Returns
bool
Since
1.32

Definition at line 149 of file DatabaseDomain.php.

Referenced by Wikimedia\Rdbms\DatabaseDomain\isCompatible().

◆ newFromId()

◆ newUnspecified()

static Wikimedia\Rdbms\DatabaseDomain::newUnspecified ( )
static
Returns
DatabaseDomain

Definition at line 97 of file DatabaseDomain.php.

Referenced by Wikimedia\Rdbms\LBFactory\__construct(), and Wikimedia\Rdbms\LoadBalancer\__construct().

Member Data Documentation

◆ $database

◆ $equivalentString

string Wikimedia\Rdbms\DatabaseDomain::$equivalentString
private

Cache of convertToString()

Definition at line 37 of file DatabaseDomain.php.

Referenced by Wikimedia\Rdbms\DatabaseDomain\getId().

◆ $prefix

◆ $schema


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