MediaWiki master
Wikimedia\Rdbms\DatabaseDomain Class Reference

Class to handle database/schema/prefix specifications for IDatabase. More...

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 ()
 

Detailed Description

Class to handle database/schema/prefix specifications for IDatabase.

The components of a database domain are defined as follows:

  • database: name of a server-side collection of schemas that is client-selectable
  • schema: name of a server-side collection of tables within the given database
  • prefix: table name prefix of an application-defined table collection

If an RDBMS does not support server-side collections of table collections (schemas) then the schema component should be null and the "database" component treated as a collection of exactly one table collection (the implied schema for that "database").

The above criteria should determine how components should map to RDBMS specific keywords rather than "database"/"schema" always mapping to "DATABASE"/"SCHEMA" as used by the RDBMS.

Definition at line 41 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 57 of file DatabaseDomain.php.

Member Function Documentation

◆ __toString()

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

Definition at line 236 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 130 of file DatabaseDomain.php.

◆ getDatabase()

◆ getId()

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

Definition at line 204 of file DatabaseDomain.php.

Referenced by Wikimedia\Rdbms\LoadBalancer\reallyOpenConnection().

◆ getSchema()

◆ 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 specifier, including null. This is likewise true 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 156 of file DatabaseDomain.php.

◆ isUnspecified()

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

Definition at line 174 of file DatabaseDomain.php.

◆ newFromId()

static Wikimedia\Rdbms\DatabaseDomain::newFromId ( $domain)
static
Parameters
DatabaseDomain | string$domainResult of DatabaseDomain::toString()
Returns
DatabaseDomain

Definition at line 78 of file DatabaseDomain.php.

Referenced by Wikimedia\Rdbms\DBConnRef\__construct().

◆ newUnspecified()

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

Definition at line 122 of file DatabaseDomain.php.

Referenced by Wikimedia\Rdbms\Platform\SQLPlatform\__construct().


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