MediaWiki master
IReadableDatabase.php
Go to the documentation of this file.
1<?php
6namespace Wikimedia\Rdbms;
7
8use stdClass;
9use Stringable;
13
20interface IReadableDatabase extends Stringable, ISQLPlatform, DbQuoter, IDatabaseFlags {
21
23 public const UNION_ALL = true;
25 public const UNION_DISTINCT = false;
26
34 public function getServerInfo();
35
42 public function tablePrefix( $prefix = null );
43
50 public function dbSchema( $schema = null );
51
55 public function isOpen();
56
64 public function getDomainID();
65
71 public function getType();
72
78 public function lastErrno();
79
85 public function lastError();
86
94 public function getSoftwareLink();
95
101 public function getServerVersion();
102
116 public function close( $fname = __METHOD__ );
117
129
142
174 public function selectField(
175 $tables, $var, $cond = '', $fname = __METHOD__, $options = [], $join_conds = []
176 );
177
210 public function selectFieldValues(
211 $tables, $var, $cond = '', $fname = __METHOD__, $options = [], $join_conds = []
212 ): array;
213
421 public function select(
422 $tables,
423 $vars,
424 $conds = '',
425 $fname = __METHOD__,
426 $options = [],
427 $join_conds = []
428 );
429
460 public function selectRow(
461 $tables,
462 $vars,
463 $conds,
464 $fname = __METHOD__,
465 $options = [],
466 $join_conds = []
467 );
468
498 public function estimateRowCount(
499 $tables, $var = '*', $conds = '', $fname = __METHOD__, $options = [], $join_conds = []
500 ): int;
501
534 public function selectRowCount(
535 $tables, $var = '*', $conds = '', $fname = __METHOD__, $options = [], $join_conds = []
536 ): int;
537
550 public function databasesAreIndependent();
551
564 public function selectDomain( $domain );
565
571 public function getDBname();
572
578 public function getServer();
579
586 public function getServerName();
587
593 public function ping();
594
603 public function getLag();
604
618 public function getSessionLagStatus();
619
630 public function encodeBlob( $b );
631
641 public function decodeBlob( $b );
642
656 #[\NoDiscard]
657 public function expr( string $field, string $op, $value ): Expression;
658
668 #[\NoDiscard]
669 public function andExpr( array $conds ): AndExpressionGroup;
670
680 #[\NoDiscard]
681 public function orExpr( array $conds ): OrExpressionGroup;
682
690 public function __toString();
691}
Representing a group of expressions chained via AND.
A composite leaf representing an expression.
Representing a group of expressions chained via OR.
Build SELECT queries with a fluent interface.
A query builder for UNION queries takes SelectQueryBuilder objects.
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.
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)
selectField( $tables, $var, $cond='', $fname=__METHOD__, $options=[], $join_conds=[])
A SELECT wrapper which returns a single field from a single result row.
selectRow( $tables, $vars, $conds, $fname=__METHOD__, $options=[], $join_conds=[])
Wrapper to IDatabase::select() that only fetches one row (via LIMIT)
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.
select( $tables, $vars, $conds='', $fname=__METHOD__, $options=[], $join_conds=[])
Execute a SELECT query constructed using the various parameters provided.
lastErrno()
Get the RDBMS-specific error code from the last attempted query statement.
selectFieldValues( $tables, $var, $cond='', $fname=__METHOD__, $options=[], $join_conds=[])
A SELECT wrapper which returns a list of single field values from result rows.
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.
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.
getServerName()
Get the readable name for the server.
getServerInfo()
Get a human-readable string describing the current software version.
const UNION_ALL
Parameter to unionQueries() for UNION ALL.
getDomainID()
Return the currently selected domain ID.
databasesAreIndependent()
Returns true if DBs are assumed to be on potentially different servers.
expr(string $field, string $op, $value)
See Expression::__construct()
newUnionQueryBuilder()
Create an empty UnionQueryBuilder which can be used to run queries against this connection.
andExpr(array $conds)
See Expression::__construct()
const UNION_DISTINCT
Parameter to unionQueries() for UNION DISTINCT.
orExpr(array $conds)
See Expression::__construct()
__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.