MediaWiki  master
IDatabase.php
Go to the documentation of this file.
1 <?php
20 namespace Wikimedia\Rdbms;
21 
26 
38 interface IDatabase {
40  const TRIGGER_IDLE = 1;
42  const TRIGGER_COMMIT = 2;
44  const TRIGGER_ROLLBACK = 3;
46  const TRIGGER_CANCEL = 4;
47 
49  const TRANSACTION_EXPLICIT = '';
51  const TRANSACTION_INTERNAL = 'implicit';
52 
54  const ATOMIC_NOT_CANCELABLE = '';
56  const ATOMIC_CANCELABLE = 'cancelable';
57 
59  const FLUSHING_ONE = '';
61  const FLUSHING_ALL_PEERS = 'flush';
63  const FLUSHING_INTERNAL = 'flush-internal';
64 
66  const REMEMBER_NOTHING = '';
68  const REMEMBER_PRIOR = 'remember';
70  const RESTORE_PRIOR = 'prior';
72  const RESTORE_INITIAL = 'initial';
73 
75  const ESTIMATE_TOTAL = 'total';
77  const ESTIMATE_DB_APPLY = 'apply';
78 
80  const LIST_COMMA = 0;
82  const LIST_AND = 1;
84  const LIST_SET = 2;
86  const LIST_NAMES = 3;
88  const LIST_OR = 4;
89 
91  const DBO_DEBUG = 1;
93  const DBO_NOBUFFER = 2;
95  const DBO_IGNORE = 4;
97  const DBO_TRX = 8;
99  const DBO_DEFAULT = 16;
101  const DBO_PERSISTENT = 32;
103  const DBO_SYSDBA = 64;
105  const DBO_DDLMODE = 128;
107  const DBO_SSL = 256;
109  const DBO_COMPRESS = 512;
110 
112  const QUERY_NORMAL = 0;
114  const QUERY_SILENCE_ERRORS = 1; // b/c for 1.32 query() argument; note that (int)true = 1
119  const QUERY_PSEUDO_PERMANENT = 2;
121  const QUERY_REPLICA_ROLE = 4;
123  const QUERY_IGNORE_DBO_TRX = 8;
125  const QUERY_NO_RETRY = 16;
126 
128  const UNION_ALL = true;
130  const UNION_DISTINCT = false;
131 
139  public function getServerInfo();
140 
161  public function bufferResults( $buffer = null );
162 
171  public function trxLevel();
172 
184  public function trxTimestamp();
185 
190  public function explicitTrxActive();
191 
197  public function assertNoOpenTransactions();
198 
205  public function tablePrefix( $prefix = null );
206 
212  public function dbSchema( $schema = null );
213 
223  public function getLBInfo( $name = null );
224 
231  public function setLBInfo( $nameOrArray, $value = null );
232 
239  public function setLazyMasterHandle( IDatabase $conn );
240 
247  public function implicitGroupby();
248 
255  public function implicitOrderby();
256 
261  public function lastQuery();
262 
270  public function doneWrites();
271 
279  public function lastDoneWrites();
280 
285  public function writesPending();
286 
291  public function preCommitCallbacksPending();
292 
301  public function writesOrCallbacksPending();
302 
312  public function pendingWriteQueryDuration( $type = self::ESTIMATE_TOTAL );
313 
320  public function pendingWriteCallers();
321 
328  public function pendingWriteRowsAffected();
329 
334  public function isOpen();
335 
348  public function setFlag( $flag, $remember = self::REMEMBER_NOTHING );
349 
362  public function clearFlag( $flag, $remember = self::REMEMBER_NOTHING );
363 
370  public function restoreFlags( $state = self::RESTORE_PRIOR );
371 
382  public function getFlag( $flag );
383 
391  public function getDomainID();
392 
399  public function getWikiID();
400 
406  public function getType();
407 
418  public function fetchObject( $res );
419 
429  public function fetchRow( $res );
430 
438  public function numRows( $res );
439 
447  public function numFields( $res );
448 
457  public function fieldName( $res, $n );
458 
468  public function insertId();
469 
477  public function dataSeek( $res, $row );
478 
485  public function lastErrno();
486 
493  public function lastError();
494 
501  public function affectedRows();
502 
511  public function getSoftwareLink();
512 
519  public function getServerVersion();
520 
531  public function close();
532 
559  public function query( $sql, $fname = __METHOD__, $flags = 0 );
560 
568  public function freeResult( $res );
569 
589  public function selectField(
590  $table, $var, $cond = '', $fname = __METHOD__, $options = [], $join_conds = []
591  );
592 
613  public function selectFieldValues(
614  $table, $var, $cond = '', $fname = __METHOD__, $options = [], $join_conds = []
615  );
616 
779  public function select(
780  $table, $vars, $conds = '', $fname = __METHOD__,
781  $options = [], $join_conds = []
782  );
783 
800  public function selectSQLText(
801  $table, $vars, $conds = '', $fname = __METHOD__,
802  $options = [], $join_conds = []
803  );
804 
820  public function selectRow( $table, $vars, $conds, $fname = __METHOD__,
821  $options = [], $join_conds = []
822  );
823 
846  public function estimateRowCount(
847  $table, $var = '*', $conds = '', $fname = __METHOD__, $options = [], $join_conds = []
848  );
849 
868  public function selectRowCount(
869  $tables, $var = '*', $conds = '', $fname = __METHOD__, $options = [], $join_conds = []
870  );
871 
883  public function lockForUpdate(
884  $table, $conds = '', $fname = __METHOD__, $options = [], $join_conds = []
885  );
886 
896  public function fieldExists( $table, $field, $fname = __METHOD__ );
897 
909  public function indexExists( $table, $index, $fname = __METHOD__ );
910 
919  public function tableExists( $table, $fname = __METHOD__ );
920 
954  public function insert( $table, $a, $fname = __METHOD__, $options = [] );
955 
977  public function update( $table, $values, $conds, $fname = __METHOD__, $options = [] );
978 
1004  public function makeList( $a, $mode = self::LIST_COMMA );
1005 
1016  public function makeWhereFrom2d( $data, $baseKey, $subKey );
1017 
1027  public function aggregateValue( $valuedata, $valuename = 'value' );
1028 
1033  public function bitNot( $field );
1034 
1040  public function bitAnd( $fieldLeft, $fieldRight );
1041 
1047  public function bitOr( $fieldLeft, $fieldRight );
1048 
1055  public function buildConcat( $stringList );
1056 
1073  public function buildGroupConcatField(
1074  $delim, $table, $field, $conds = '', $join_conds = []
1075  );
1076 
1089  public function buildSubString( $input, $startPosition, $length = null );
1090 
1096  public function buildStringCast( $field );
1097 
1103  public function buildIntegerCast( $field );
1104 
1119  public function buildSelectSubquery(
1120  $table, $vars, $conds = '', $fname = __METHOD__,
1121  $options = [], $join_conds = []
1122  );
1123 
1141  public function limitResult( $sql, $limit, $offset = false );
1142 
1154  public function databasesAreIndependent();
1155 
1167  public function selectDB( $db );
1168 
1180  public function selectDomain( $domain );
1181 
1186  public function getDBname();
1187 
1192  public function getServer();
1193 
1200  public function addQuotes( $s );
1201 
1211  public function addIdentifierQuotes( $s );
1212 
1232  public function buildLike( $param );
1233 
1239  public function anyChar();
1240 
1246  public function anyString();
1247 
1264  public function nextSequenceValue( $seqName );
1265 
1291  public function replace( $table, $uniqueIndexes, $rows, $fname = __METHOD__ );
1292 
1332  public function upsert(
1333  $table, array $rows, $uniqueIndexes, array $set, $fname = __METHOD__
1334  );
1335 
1356  public function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds,
1357  $fname = __METHOD__
1358  );
1359 
1371  public function delete( $table, $conds, $fname = __METHOD__ );
1372 
1409  public function insertSelect( $destTable, $srcTable, $varMap, $conds,
1410  $fname = __METHOD__,
1411  $insertOptions = [], $selectOptions = [], $selectJoinConds = []
1412  );
1413 
1419  public function unionSupportsOrderAndLimit();
1420 
1429  public function unionQueries( $sqls, $all );
1430 
1457  public function unionConditionPermutations(
1458  $table, $vars, array $permute_conds, $extra_conds = '', $fname = __METHOD__,
1459  $options = [], $join_conds = []
1460  );
1461 
1471  public function conditional( $cond, $trueVal, $falseVal );
1472 
1483  public function strreplace( $orig, $old, $new );
1484 
1491  public function getServerUptime();
1492 
1500  public function wasDeadlock();
1501 
1509  public function wasLockTimeout();
1510 
1519  public function wasConnectionLoss();
1520 
1526  public function wasReadOnlyError();
1527 
1535  public function wasErrorReissuable();
1536 
1551  public function masterPosWait( DBMasterPos $pos, $timeout );
1552 
1559  public function getReplicaPos();
1560 
1567  public function getMasterPos();
1568 
1573  public function serverIsReadOnly();
1574 
1596  public function onTransactionResolution( callable $callback, $fname = __METHOD__ );
1597 
1630  public function onTransactionCommitOrIdle( callable $callback, $fname = __METHOD__ );
1631 
1640  public function onTransactionIdle( callable $callback, $fname = __METHOD__ );
1641 
1665  public function onTransactionPreCommitOrIdle( callable $callback, $fname = __METHOD__ );
1666 
1690  public function onAtomicSectionCancel( callable $callback, $fname = __METHOD__ );
1691 
1709  public function setTransactionListener( $name, callable $callback = null );
1710 
1785  public function startAtomic( $fname = __METHOD__, $cancelable = self::ATOMIC_NOT_CANCELABLE );
1786 
1798  public function endAtomic( $fname = __METHOD__ );
1799 
1825  public function cancelAtomic( $fname = __METHOD__, AtomicSectionIdentifier $sectionId = null );
1826 
1899  public function doAtomicSection(
1900  $fname, callable $callback, $cancelable = self::ATOMIC_NOT_CANCELABLE
1901  );
1902 
1923  public function begin( $fname = __METHOD__, $mode = self::TRANSACTION_EXPLICIT );
1924 
1945  public function commit( $fname = __METHOD__, $flush = self::FLUSHING_ONE );
1946 
1967  public function rollback( $fname = __METHOD__, $flush = self::FLUSHING_ONE );
1968 
1991  public function flushSnapshot( $fname = __METHOD__, $flush = self::FLUSHING_ONE );
1992 
2004  public function timestamp( $ts = 0 );
2005 
2019  public function timestampOrNull( $ts = null );
2020 
2027  public function ping( &$rtt = null );
2028 
2037  public function getLag();
2038 
2053  public function getSessionLagStatus();
2054 
2060  public function maxListLen();
2061 
2071  public function encodeBlob( $b );
2072 
2081  public function decodeBlob( $b );
2082 
2094  public function setSessionOptions( array $options );
2095 
2103  public function setSchemaVars( $vars );
2104 
2114  public function lockIsFree( $lockName, $method );
2115 
2127  public function lock( $lockName, $method, $timeout = 5 );
2128 
2143  public function unlock( $lockName, $method );
2144 
2166  public function getScopedLockAndFlush( $lockKey, $fname, $timeout );
2167 
2174  public function namedLocksEnqueue();
2175 
2183  public function getInfinity();
2184 
2191  public function encodeExpiry( $expiry );
2192 
2200  public function decodeExpiry( $expiry, $format = TS_MW );
2201 
2211  public function setBigSelects( $value = true );
2212 
2217  public function isReadOnly();
2218 
2232  public function setTableAliases( array $aliases );
2233 
2246  public function setIndexAliases( array $aliases );
2247 
2255  public function __toString();
2256 }
2257 
2261 class_alias( IDatabase::class, 'IDatabase' );
upsert( $table, array $rows, $uniqueIndexes, array $set, $fname=__METHOD__)
INSERT ON DUPLICATE KEY UPDATE wrapper, upserts an array into a table.
selectDB( $db)
Change the current database.
const DBO_IGNORE
Definition: defines.php:11
buildSelectSubquery( $table, $vars, $conds='', $fname=__METHOD__, $options=[], $join_conds=[])
Equivalent to IDatabase::selectSQLText() except wraps the result in Subqyery.
implicitGroupby()
Returns true if this database does an implicit sort when doing GROUP BY.
close()
Close the database connection.
aggregateValue( $valuedata, $valuename='value')
Return aggregated value alias.
pendingWriteCallers()
Get the list of method names that did write queries for this transaction.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction $rows
Definition: hooks.txt:2621
dbSchema( $schema=null)
Get/set the db schema.
insertSelect( $destTable, $srcTable, $varMap, $conds, $fname=__METHOD__, $insertOptions=[], $selectOptions=[], $selectJoinConds=[])
INSERT SELECT wrapper.
getServerInfo()
A string describing the current software version, and possibly other details in a user-friendly way...
deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds, $fname=__METHOD__)
DELETE where the condition is a join.
addIdentifierQuotes( $s)
Quotes an identifier, in order to make user controlled input safe.
selectDomain( $domain)
Set the current domain (database, schema, and table prefix)
setSessionOptions(array $options)
Override database&#39;s default behavior.
conditional( $cond, $trueVal, $falseVal)
Returns an SQL expression for a simple conditional.
fetchObject( $res)
Fetch the next row from the given result object, in object form.
affectedRows()
Get the number of rows affected by the last write query.
getServerUptime()
Determines how long the server has been up.
if(is_array( $mode)) switch( $mode) $input
timestampOrNull( $ts=null)
Convert a timestamp in one of the formats accepted by wfTimestamp() to the format used for inserting ...
selectField( $table, $var, $cond='', $fname=__METHOD__, $options=[], $join_conds=[])
A SELECT wrapper which returns a single field from a single result row.
lastErrno()
Get the last error number.
getLBInfo( $name=null)
Get properties passed down from the server info array of the load balancer.
maxListLen()
Return the maximum number of items allowed in a list, or 0 for unlimited.
getInfinity()
Find out when &#39;infinity&#39; is.
numFields( $res)
Get the number of fields in a result object.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
unionSupportsOrderAndLimit()
Returns true if current database backend supports ORDER BY or LIMIT for separate subqueries within th...
pendingWriteRowsAffected()
Get the number of affected rows from pending write queries.
namedLocksEnqueue()
Check to see if a named lock used by lock() use blocking queues.
const LIST_NAMES
Definition: Defines.php:41
numRows( $res)
Get the number of rows in a query result.
setLBInfo( $nameOrArray, $value=null)
Set the entire array or a particular key of the managing load balancer info array.
insert( $table, $a, $fname=__METHOD__, $options=[])
INSERT wrapper, inserts an array into a table.
lock( $lockName, $method, $timeout=5)
Acquire a named lock.
getWikiID()
Alias for getDomainID()
getSessionLagStatus()
Get the replica DB lag when the current transaction started or a general lag estimate if not transact...
$value
isOpen()
Is a connection to the database open?
getMasterPos()
Get the position of this master.
commit( $fname=__METHOD__, $flush=self::FLUSHING_ONE)
Commits a transaction previously started using begin().
endAtomic( $fname=__METHOD__)
Ends an atomic section of SQL statements.
encodeBlob( $b)
Some DBMSs have a special format for inserting into blob fields, they don&#39;t allow simple quoted strin...
getLag()
Get the amount of replication lag for this database server.
databasesAreIndependent()
Returns true if DBs are assumed to be on potentially different servers.
insertId()
Get the inserted value of an auto-increment row.
implicitOrderby()
Returns true if this database does an implicit order by when the column has an index For example: SEL...
flushSnapshot( $fname=__METHOD__, $flush=self::FLUSHING_ONE)
Commit any transaction but error out if writes or callbacks are pending.
trxLevel()
Gets the current transaction level.
wasDeadlock()
Determines if the last failure was due to a deadlock.
getDomainID()
Return the currently selected domain ID.
estimateRowCount( $table, $var=' *', $conds='', $fname=__METHOD__, $options=[], $join_conds=[])
Estimate the number of rows in dataset.
const DBO_DDLMODE
Definition: defines.php:16
this hook is for auditing only RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist & $tables
Definition: hooks.txt:960
wasErrorReissuable()
Determines if the last query error was due to something outside of the query itself.
getServerVersion()
A string describing the current software version, like from mysql_get_server_info().
timestamp( $ts=0)
Convert a timestamp in one of the formats accepted by wfTimestamp() to the format used for inserting ...
anyString()
Returns a token for buildLike() that denotes a &#39;&#39; to be used in a LIKE query.
pendingWriteQueryDuration( $type=self::ESTIMATE_TOTAL)
Get the time spend running write queries for this transaction.
const DBO_PERSISTENT
Definition: defines.php:14
begin( $fname=__METHOD__, $mode=self::TRANSACTION_EXPLICIT)
Begin a transaction.
writesOrCallbacksPending()
Whether there is a transaction open with either possible write queries or unresolved pre-commit/commi...
unionQueries( $sqls, $all)
Construct a UNION query This is used for providing overload point for other DB abstractions not compa...
selectRow( $table, $vars, $conds, $fname=__METHOD__, $options=[], $join_conds=[])
Single row SELECT wrapper.
bitAnd( $fieldLeft, $fieldRight)
rollback( $fname=__METHOD__, $flush=self::FLUSHING_ONE)
Rollback a transaction previously started using begin().
cancelAtomic( $fname=__METHOD__, AtomicSectionIdentifier $sectionId=null)
Cancel an atomic section of SQL statements.
assertNoOpenTransactions()
Assert that all explicit transactions or atomic sections have been closed.
getScopedLockAndFlush( $lockKey, $fname, $timeout)
Acquire a named lock, flush any transaction, and return an RAII style unlocker object.
lastDoneWrites()
Returns the last time the connection may have been used for write queries.
setSchemaVars( $vars)
Set variables to be used in sourceFile/sourceStream, in preference to the ones in $GLOBALS...
const DBO_DEBUG
Definition: defines.php:9
const LIST_AND
Definition: Defines.php:39
getReplicaPos()
Get the replication position of this replica DB.
const DBO_SYSDBA
Definition: defines.php:15
An object representing a master or replica DB position in a replicated setup.
Definition: DBMasterPos.php:12
bufferResults( $buffer=null)
Turns buffering of SQL result sets on (true) or off (false).
__toString()
Get a debugging string that mentions the database type, the ID of this instance, and the ID of any un...
const LIST_COMMA
Definition: Defines.php:38
onTransactionIdle(callable $callback, $fname=__METHOD__)
Alias for onTransactionCommitOrIdle() for backwards-compatibility.
$res
Definition: database.txt:21
makeWhereFrom2d( $data, $baseKey, $subKey)
Build a partial where clause from a 2-d array such as used for LinkBatch.
buildConcat( $stringList)
Build a concatenation list to feed into a SQL query.
getDBname()
Get the current DB name.
fieldName( $res, $n)
Get a field name in a result object.
bitOr( $fieldLeft, $fieldRight)
dataSeek( $res, $row)
Change the position of the cursor in a result object.
wasLockTimeout()
Determines if the last failure was due to a lock timeout.
wasReadOnlyError()
Determines if the last failure was due to the database being read-only.
unionConditionPermutations( $table, $vars, array $permute_conds, $extra_conds='', $fname=__METHOD__, $options=[], $join_conds=[])
Construct a UNION query for permutations of conditions.
getSoftwareLink()
Returns a wikitext link to the DB&#39;s website, e.g., return "[https://www.mysql.com/ MySQL]"; Should at...
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
Definition: hooks.txt:1972
encodeExpiry( $expiry)
Encode an expiry time into the DBMS dependent format.
selectSQLText( $table, $vars, $conds='', $fname=__METHOD__, $options=[], $join_conds=[])
The equivalent of IDatabase::select() except that the constructed SQL is returned, instead of being immediately executed.
setLazyMasterHandle(IDatabase $conn)
Set a lazy-connecting DB handle to the master DB (for replication status purposes) ...
onTransactionPreCommitOrIdle(callable $callback, $fname=__METHOD__)
Run a callback before the current transaction commits or now if there is none.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
Definition: hooks.txt:767
lastError()
Get a description of the last error.
$buffer
lastQuery()
Return the last query that sent on account of IDatabase::query()
selectRowCount( $tables, $var=' *', $conds='', $fname=__METHOD__, $options=[], $join_conds=[])
Get the number of rows in dataset.
wasConnectionLoss()
Determines if the last query error was due to a dropped connection.
decodeExpiry( $expiry, $format=TS_MW)
Decode an expiry time into a DBMS independent format.
strreplace( $orig, $old, $new)
Returns a command for str_replace function in SQL query.
lockIsFree( $lockName, $method)
Check to see if a named lock is not locked by any thread (non-blocking)
setTransactionListener( $name, callable $callback=null)
Run a callback after each time any transaction commits or rolls back.
buildSubString( $input, $startPosition, $length=null)
Build a SUBSTRING function.
if(defined( 'MW_SETUP_CALLBACK')) $fname
Customization point after all loading (constants, functions, classes, DefaultSettings, LocalSettings).
Definition: Setup.php:131
const LIST_SET
Definition: Defines.php:40
const LIST_OR
Definition: Defines.php:42
const DBO_TRX
Definition: defines.php:12
setFlag( $flag, $remember=self::REMEMBER_NOTHING)
Set a flag for this connection.
const DBO_NOBUFFER
Definition: defines.php:10
setIndexAliases(array $aliases)
Convert certain index names to alternative names before querying the DB.
masterPosWait(DBMasterPos $pos, $timeout)
Wait for the replica DB to catch up to a given master position.
setBigSelects( $value=true)
Allow or deny "big selects" for this session only.
anyChar()
Returns a token for buildLike() that denotes a &#39;_&#39; to be used in a LIKE query.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
const DBO_DEFAULT
Definition: defines.php:13
selectFieldValues( $table, $var, $cond='', $fname=__METHOD__, $options=[], $join_conds=[])
A SELECT wrapper which returns a list of single field values from result rows.
getType()
Get the type of the DBMS, as it appears in $wgDBtype.
doAtomicSection( $fname, callable $callback, $cancelable=self::ATOMIC_NOT_CANCELABLE)
Perform an atomic section of reversable SQL statements from a callback.
buildGroupConcatField( $delim, $table, $field, $conds='', $join_conds=[])
Build a GROUP_CONCAT or equivalent statement for a query.
Basic database interface for live and lazy-loaded relation database handles.
Definition: IDatabase.php:38
setTableAliases(array $aliases)
Make certain table names use their own database, schema, and table prefix when passed into SQL querie...
indexExists( $table, $index, $fname=__METHOD__)
Determines whether an index exists Usually throws a DBQueryError on failure If errors are explicitly ...
startAtomic( $fname=__METHOD__, $cancelable=self::ATOMIC_NOT_CANCELABLE)
Begin an atomic section of SQL statements.
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
Definition: maintenance.txt:52
makeList( $a, $mode=self::LIST_COMMA)
Makes an encoded list of strings from an array.
getFlag( $flag)
Returns a boolean whether the flag $flag is set for this connection.
freeResult( $res)
Free a result object returned by query() or select().
limitResult( $sql, $limit, $offset=false)
Construct a LIMIT query with optional offset.
getServer()
Get the server hostname or IP address.
select( $table, $vars, $conds='', $fname=__METHOD__, $options=[], $join_conds=[])
Execute a SELECT query constructed using the various parameters provided.
restoreFlags( $state=self::RESTORE_PRIOR)
Restore the flags to their prior state before the last setFlag/clearFlag call.
replace( $table, $uniqueIndexes, $rows, $fname=__METHOD__)
REPLACE query wrapper.
lockForUpdate( $table, $conds='', $fname=__METHOD__, $options=[], $join_conds=[])
Lock all rows meeting the given conditions/options FOR UPDATE.
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:271
onTransactionResolution(callable $callback, $fname=__METHOD__)
Run a callback as soon as the current transaction commits or rolls back.
update( $table, $values, $conds, $fname=__METHOD__, $options=[])
UPDATE wrapper.
trxTimestamp()
Get the UNIX timestamp of the time that the transaction was established.
query( $sql, $fname=__METHOD__, $flags=0)
Run an SQL query and return the result.
unlock( $lockName, $method)
Release a lock.
Class used for token representing identifiers for atomic sections from IDatabase instances.
doneWrites()
Returns true if the connection may have been used for write queries.
fetchRow( $res)
Fetch the next row from the given result object, in associative array form.
const DBO_SSL
Definition: defines.php:17
addQuotes( $s)
Adds quotes and backslashes.
tablePrefix( $prefix=null)
Get/set the table prefix.
onAtomicSectionCancel(callable $callback, $fname=__METHOD__)
Run a callback when the atomic section is cancelled.
fieldExists( $table, $field, $fname=__METHOD__)
Determines whether a field exists in a table.
onTransactionCommitOrIdle(callable $callback, $fname=__METHOD__)
Run a callback as soon as there is no transaction pending.
const DBO_COMPRESS
Definition: defines.php:18
static configuration should be added through ResourceLoaderGetConfigVars instead & $vars
Definition: hooks.txt:2205
clearFlag( $flag, $remember=self::REMEMBER_NOTHING)
Clear a flag for this connection.
buildLike( $param)
LIKE statement wrapper, receives a variable-length argument list with parts of pattern to match conta...
tableExists( $table, $fname=__METHOD__)
Query whether a given table exists.
nextSequenceValue( $seqName)
Deprecated method, calls should be removed.
ping(&$rtt=null)
Ping the server and try to reconnect if it there is no connection.
decodeBlob( $b)
Some DBMSs return a special placeholder object representing blob fields in result objects...