MediaWiki  master
IReadableDatabase.php
Go to the documentation of this file.
1 <?php
20 namespace Wikimedia\Rdbms;
21 
22 use stdClass;
26 
34 
36  public const UNION_ALL = true;
38  public const UNION_DISTINCT = false;
39 
47  public function getServerInfo();
48 
55  public function tablePrefix( $prefix = null );
56 
63  public function dbSchema( $schema = null );
64 
68  public function isOpen();
69 
77  public function getDomainID();
78 
84  public function getType();
85 
91  public function lastErrno();
92 
98  public function lastError();
99 
107  public function getSoftwareLink();
108 
114  public function getServerVersion();
115 
129  public function close( $fname = __METHOD__ );
130 
142 
155 
175  public function selectField(
176  $table, $var, $cond = '', $fname = __METHOD__, $options = [], $join_conds = []
177  );
178 
199  public function selectFieldValues(
200  $table, $var, $cond = '', $fname = __METHOD__, $options = [], $join_conds = []
201  ): array;
202 
386  public function select(
387  $table,
388  $vars,
389  $conds = '',
390  $fname = __METHOD__,
391  $options = [],
392  $join_conds = []
393  );
394 
414  public function selectRow(
415  $table,
416  $vars,
417  $conds,
418  $fname = __METHOD__,
419  $options = [],
420  $join_conds = []
421  );
422 
448  public function estimateRowCount(
449  $tables, $var = '*', $conds = '', $fname = __METHOD__, $options = [], $join_conds = []
450  );
451 
473  public function selectRowCount(
474  $tables, $var = '*', $conds = '', $fname = __METHOD__, $options = [], $join_conds = []
475  );
476 
489  public function databasesAreIndependent();
490 
503  public function selectDomain( $domain );
504 
510  public function getDBname();
511 
517  public function getServer();
518 
525  public function getServerName();
526 
534  public function wasDeadlock();
535 
541  public function wasReadOnlyError();
542 
560  public function primaryPosWait( DBPrimaryPos $pos, $timeout );
561 
568  public function getReplicaPos();
569 
575  public function ping();
576 
585  public function getLag();
586 
600  public function getSessionLagStatus();
601 
612  public function encodeBlob( $b );
613 
623  public function decodeBlob( $b );
624 
632  public function __toString();
633 }
Build SELECT queries with a fluent interface.
A query builder for UNION queries takes SelectQueryBuilder objects.
An object representing a primary or replica DB position in a replicated setup.
A database connection without write operations.
getSessionLagStatus()
Get a cached estimate of the seconds of replication lag on this database server, using the estimate o...
ping()
Ping the server and try to reconnect if it there is no connection.
close( $fname=__METHOD__)
Close the database connection.
getServerVersion()
A string describing the current software version, like from mysql_get_server_info()
getType()
Get the RDBMS type of the server (e.g.
newSelectQueryBuilder()
Create an empty SelectQueryBuilder which can be used to run queries against this connection.
encodeBlob( $b)
Some DBMSs have a special format for inserting into blob fields, they don't allow simple quoted strin...
getDBname()
Get the current database name; null if there isn't one.
selectDomain( $domain)
Set the current domain (database, schema, and table prefix)
selectRowCount( $tables, $var=' *', $conds='', $fname=__METHOD__, $options=[], $join_conds=[])
Get the number of rows in dataset.
decodeBlob( $b)
Some DBMSs return a special placeholder object representing blob fields in result objects.
dbSchema( $schema=null)
Get/set the db schema.
wasDeadlock()
Determines if the last failure was due to a deadlock.
lastErrno()
Get the RDBMS-specific error code from the last attempted query statement.
select( $table, $vars, $conds='', $fname=__METHOD__, $options=[], $join_conds=[])
Execute a SELECT query constructed using the various parameters provided.
selectField( $table, $var, $cond='', $fname=__METHOD__, $options=[], $join_conds=[])
A SELECT wrapper which returns a single field from a single result row.
lastError()
Get the RDBMS-specific error description from the last attempted query statement.
tablePrefix( $prefix=null)
Get/set the table prefix.
getServer()
Get the hostname or IP address of the server.
getSoftwareLink()
Returns a wikitext style link to the DB's website (e.g.
wasReadOnlyError()
Determines if the last failure was due to the database being read-only.
getLag()
Get the seconds of replication lag on this database server.
estimateRowCount( $tables, $var=' *', $conds='', $fname=__METHOD__, $options=[], $join_conds=[])
Estimate the number of rows in dataset.
selectFieldValues( $table, $var, $cond='', $fname=__METHOD__, $options=[], $join_conds=[])
A SELECT wrapper which returns a list of single field values from result rows.
getServerName()
Get the readable name for the server.
getServerInfo()
Get a human-readable string describing the current software version.
selectRow( $table, $vars, $conds, $fname=__METHOD__, $options=[], $join_conds=[])
Wrapper to IDatabase::select() that only fetches one row (via LIMIT)
getDomainID()
Return the currently selected domain ID.
databasesAreIndependent()
Returns true if DBs are assumed to be on potentially different servers.
newUnionQueryBuilder()
Create an empty UnionQueryBuilder which can be used to run queries against this connection.
getReplicaPos()
Get the replication position of this replica DB.
primaryPosWait(DBPrimaryPos $pos, $timeout)
Wait for the replica server to catch up to a given primary server position.
__toString()
Get a debugging string that mentions the database type, the ID of this instance, and the ID of any un...
Interface for query language.