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;
45 
47  const TRANSACTION_EXPLICIT = '';
49  const TRANSACTION_INTERNAL = 'implicit';
50 
52  const ATOMIC_NOT_CANCELABLE = '';
54  const ATOMIC_CANCELABLE = 'cancelable';
55 
57  const FLUSHING_ONE = '';
59  const FLUSHING_ALL_PEERS = 'flush';
61  const FLUSHING_INTERNAL = 'flush-internal';
62 
64  const REMEMBER_NOTHING = '';
66  const REMEMBER_PRIOR = 'remember';
68  const RESTORE_PRIOR = 'prior';
70  const RESTORE_INITIAL = 'initial';
71 
73  const ESTIMATE_TOTAL = 'total';
75  const ESTIMATE_DB_APPLY = 'apply';
76 
78  const LIST_COMMA = 0;
80  const LIST_AND = 1;
82  const LIST_SET = 2;
84  const LIST_NAMES = 3;
86  const LIST_OR = 4;
87 
89  const DBO_DEBUG = 1;
91  const DBO_NOBUFFER = 2;
93  const DBO_IGNORE = 4;
95  const DBO_TRX = 8;
97  const DBO_DEFAULT = 16;
99  const DBO_PERSISTENT = 32;
101  const DBO_SYSDBA = 64;
103  const DBO_DDLMODE = 128;
105  const DBO_SSL = 256;
107  const DBO_COMPRESS = 512;
108 
110  const QUERY_SILENCE_ERRORS = 1; // b/c for 1.32 query() argument; note that (int)true = 1
115  const QUERY_PSEUDO_PERMANENT = 2;
117  const QUERY_REPLICA_ROLE = 4;
118 
120  const UNION_ALL = true;
122  const UNION_DISTINCT = false;
123 
131  public function getServerInfo();
132 
153  public function bufferResults( $buffer = null );
154 
163  public function trxLevel();
164 
174  public function trxTimestamp();
175 
180  public function explicitTrxActive();
181 
187  public function assertNoOpenTransactions();
188 
195  public function tablePrefix( $prefix = null );
196 
202  public function dbSchema( $schema = null );
203 
213  public function getLBInfo( $name = null );
214 
223  public function setLBInfo( $name, $value = null );
224 
231  public function setLazyMasterHandle( IDatabase $conn );
232 
239  public function implicitGroupby();
240 
247  public function implicitOrderby();
248 
253  public function lastQuery();
254 
262  public function doneWrites();
263 
271  public function lastDoneWrites();
272 
277  public function writesPending();
278 
283  public function preCommitCallbacksPending();
284 
293  public function writesOrCallbacksPending();
294 
304  public function pendingWriteQueryDuration( $type = self::ESTIMATE_TOTAL );
305 
312  public function pendingWriteCallers();
313 
320  public function pendingWriteRowsAffected();
321 
326  public function isOpen();
327 
340  public function setFlag( $flag, $remember = self::REMEMBER_NOTHING );
341 
354  public function clearFlag( $flag, $remember = self::REMEMBER_NOTHING );
355 
362  public function restoreFlags( $state = self::RESTORE_PRIOR );
363 
374  public function getFlag( $flag );
375 
383  public function getDomainID();
384 
391  public function getWikiID();
392 
398  public function getType();
399 
410  public function fetchObject( $res );
411 
421  public function fetchRow( $res );
422 
430  public function numRows( $res );
431 
439  public function numFields( $res );
440 
449  public function fieldName( $res, $n );
450 
460  public function insertId();
461 
469  public function dataSeek( $res, $row );
470 
477  public function lastErrno();
478 
485  public function lastError();
486 
493  public function affectedRows();
494 
503  public function getSoftwareLink();
504 
511  public function getServerVersion();
512 
523  public function close();
524 
551  public function query( $sql, $fname = __METHOD__, $flags = 0 );
552 
560  public function freeResult( $res );
561 
581  public function selectField(
582  $table, $var, $cond = '', $fname = __METHOD__, $options = [], $join_conds = []
583  );
584 
605  public function selectFieldValues(
606  $table, $var, $cond = '', $fname = __METHOD__, $options = [], $join_conds = []
607  );
608 
771  public function select(
772  $table, $vars, $conds = '', $fname = __METHOD__,
773  $options = [], $join_conds = []
774  );
775 
792  public function selectSQLText(
793  $table, $vars, $conds = '', $fname = __METHOD__,
794  $options = [], $join_conds = []
795  );
796 
812  public function selectRow( $table, $vars, $conds, $fname = __METHOD__,
813  $options = [], $join_conds = []
814  );
815 
838  public function estimateRowCount(
839  $table, $var = '*', $conds = '', $fname = __METHOD__, $options = [], $join_conds = []
840  );
841 
860  public function selectRowCount(
861  $tables, $var = '*', $conds = '', $fname = __METHOD__, $options = [], $join_conds = []
862  );
863 
875  public function lockForUpdate(
876  $table, $conds = '', $fname = __METHOD__, $options = [], $join_conds = []
877  );
878 
888  public function fieldExists( $table, $field, $fname = __METHOD__ );
889 
901  public function indexExists( $table, $index, $fname = __METHOD__ );
902 
911  public function tableExists( $table, $fname = __METHOD__ );
912 
946  public function insert( $table, $a, $fname = __METHOD__, $options = [] );
947 
969  public function update( $table, $values, $conds, $fname = __METHOD__, $options = [] );
970 
996  public function makeList( $a, $mode = self::LIST_COMMA );
997 
1008  public function makeWhereFrom2d( $data, $baseKey, $subKey );
1009 
1019  public function aggregateValue( $valuedata, $valuename = 'value' );
1020 
1025  public function bitNot( $field );
1026 
1032  public function bitAnd( $fieldLeft, $fieldRight );
1033 
1039  public function bitOr( $fieldLeft, $fieldRight );
1040 
1047  public function buildConcat( $stringList );
1048 
1065  public function buildGroupConcatField(
1066  $delim, $table, $field, $conds = '', $join_conds = []
1067  );
1068 
1081  public function buildSubString( $input, $startPosition, $length = null );
1082 
1088  public function buildStringCast( $field );
1089 
1095  public function buildIntegerCast( $field );
1096 
1111  public function buildSelectSubquery(
1112  $table, $vars, $conds = '', $fname = __METHOD__,
1113  $options = [], $join_conds = []
1114  );
1115 
1133  public function limitResult( $sql, $limit, $offset = false );
1134 
1146  public function databasesAreIndependent();
1147 
1159  public function selectDB( $db );
1160 
1172  public function selectDomain( $domain );
1173 
1178  public function getDBname();
1179 
1184  public function getServer();
1185 
1192  public function addQuotes( $s );
1193 
1203  public function addIdentifierQuotes( $s );
1204 
1221  public function buildLike();
1222 
1228  public function anyChar();
1229 
1235  public function anyString();
1236 
1253  public function nextSequenceValue( $seqName );
1254 
1280  public function replace( $table, $uniqueIndexes, $rows, $fname = __METHOD__ );
1281 
1321  public function upsert(
1322  $table, array $rows, $uniqueIndexes, array $set, $fname = __METHOD__
1323  );
1324 
1345  public function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds,
1346  $fname = __METHOD__
1347  );
1348 
1360  public function delete( $table, $conds, $fname = __METHOD__ );
1361 
1398  public function insertSelect( $destTable, $srcTable, $varMap, $conds,
1399  $fname = __METHOD__,
1400  $insertOptions = [], $selectOptions = [], $selectJoinConds = []
1401  );
1402 
1408  public function unionSupportsOrderAndLimit();
1409 
1418  public function unionQueries( $sqls, $all );
1419 
1446  public function unionConditionPermutations(
1447  $table, $vars, array $permute_conds, $extra_conds = '', $fname = __METHOD__,
1448  $options = [], $join_conds = []
1449  );
1450 
1460  public function conditional( $cond, $trueVal, $falseVal );
1461 
1472  public function strreplace( $orig, $old, $new );
1473 
1480  public function getServerUptime();
1481 
1489  public function wasDeadlock();
1490 
1498  public function wasLockTimeout();
1499 
1508  public function wasConnectionLoss();
1509 
1515  public function wasReadOnlyError();
1516 
1524  public function wasErrorReissuable();
1525 
1540  public function masterPosWait( DBMasterPos $pos, $timeout );
1541 
1548  public function getReplicaPos();
1549 
1556  public function getMasterPos();
1557 
1562  public function serverIsReadOnly();
1563 
1582  public function onTransactionResolution( callable $callback, $fname = __METHOD__ );
1583 
1616  public function onTransactionCommitOrIdle( callable $callback, $fname = __METHOD__ );
1617 
1626  public function onTransactionIdle( callable $callback, $fname = __METHOD__ );
1627 
1651  public function onTransactionPreCommitOrIdle( callable $callback, $fname = __METHOD__ );
1652 
1670  public function setTransactionListener( $name, callable $callback = null );
1671 
1746  public function startAtomic( $fname = __METHOD__, $cancelable = self::ATOMIC_NOT_CANCELABLE );
1747 
1759  public function endAtomic( $fname = __METHOD__ );
1760 
1786  public function cancelAtomic( $fname = __METHOD__, AtomicSectionIdentifier $sectionId = null );
1787 
1860  public function doAtomicSection(
1861  $fname, callable $callback, $cancelable = self::ATOMIC_NOT_CANCELABLE
1862  );
1863 
1884  public function begin( $fname = __METHOD__, $mode = self::TRANSACTION_EXPLICIT );
1885 
1906  public function commit( $fname = __METHOD__, $flush = '' );
1907 
1928  public function rollback( $fname = __METHOD__, $flush = '' );
1929 
1942  public function flushSnapshot( $fname = __METHOD__ );
1943 
1955  public function timestamp( $ts = 0 );
1956 
1970  public function timestampOrNull( $ts = null );
1971 
1978  public function ping( &$rtt = null );
1979 
1988  public function getLag();
1989 
2004  public function getSessionLagStatus();
2005 
2011  public function maxListLen();
2012 
2022  public function encodeBlob( $b );
2023 
2032  public function decodeBlob( $b );
2033 
2045  public function setSessionOptions( array $options );
2046 
2054  public function setSchemaVars( $vars );
2055 
2065  public function lockIsFree( $lockName, $method );
2066 
2078  public function lock( $lockName, $method, $timeout = 5 );
2079 
2094  public function unlock( $lockName, $method );
2095 
2117  public function getScopedLockAndFlush( $lockKey, $fname, $timeout );
2118 
2125  public function namedLocksEnqueue();
2126 
2134  public function getInfinity();
2135 
2142  public function encodeExpiry( $expiry );
2143 
2151  public function decodeExpiry( $expiry, $format = TS_MW );
2152 
2162  public function setBigSelects( $value = true );
2163 
2168  public function isReadOnly();
2169 
2183  public function setTableAliases( array $aliases );
2184 
2197  public function setIndexAliases( array $aliases );
2198 }
2199 
2203 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.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
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:2633
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:45
numRows( $res)
Get the number of rows in a query result.
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.
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.
buildLike()
LIKE statement wrapper, receives a variable-length argument list with parts of pattern to match conta...
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...
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:979
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().
rollback( $fname=__METHOD__, $flush='')
Rollback a transaction previously started using begin().
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...
setLBInfo( $name, $value=null)
Set the LB info array, or a member of it.
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)
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:43
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).
const LIST_COMMA
Definition: Defines.php:42
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:1982
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:780
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.
commit( $fname=__METHOD__, $flush='')
Commits a transaction previously started using begin().
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:123
const LIST_SET
Definition: Defines.php:44
const LIST_OR
Definition: Defines.php:46
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.
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:2217
flushSnapshot( $fname=__METHOD__)
Commit any transaction but error out if writes or callbacks are pending.
clearFlag( $flag, $remember=self::REMEMBER_NOTHING)
Clear a flag for this connection.
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...