MediaWiki  1.27.3
DBConnRef.php
Go to the documentation of this file.
1 <?php
10 class DBConnRef implements IDatabase {
12  private $lb;
13 
15  private $conn;
16 
18  private $params;
19 
24  public function __construct( LoadBalancer $lb, $conn ) {
25  $this->lb = $lb;
26  if ( $conn instanceof DatabaseBase ) {
27  $this->conn = $conn;
28  } else {
29  $this->params = $conn;
30  }
31  }
32 
33  function __call( $name, array $arguments ) {
34  if ( $this->conn === null ) {
35  list( $db, $groups, $wiki ) = $this->params;
36  $this->conn = $this->lb->getConnection( $db, $groups, $wiki );
37  }
38 
39  return call_user_func_array( [ $this->conn, $name ], $arguments );
40  }
41 
42  public function getServerInfo() {
43  return $this->__call( __FUNCTION__, func_get_args() );
44  }
45 
46  public function bufferResults( $buffer = null ) {
47  return $this->__call( __FUNCTION__, func_get_args() );
48  }
49 
50  public function trxLevel() {
51  return $this->__call( __FUNCTION__, func_get_args() );
52  }
53 
54  public function trxTimestamp() {
55  return $this->__call( __FUNCTION__, func_get_args() );
56  }
57 
58  public function tablePrefix( $prefix = null ) {
59  return $this->__call( __FUNCTION__, func_get_args() );
60  }
61 
62  public function dbSchema( $schema = null ) {
63  return $this->__call( __FUNCTION__, func_get_args() );
64  }
65 
66  public function getLBInfo( $name = null ) {
67  return $this->__call( __FUNCTION__, func_get_args() );
68  }
69 
70  public function setLBInfo( $name, $value = null ) {
71  return $this->__call( __FUNCTION__, func_get_args() );
72  }
73 
74  public function implicitGroupby() {
75  return $this->__call( __FUNCTION__, func_get_args() );
76  }
77 
78  public function implicitOrderby() {
79  return $this->__call( __FUNCTION__, func_get_args() );
80  }
81 
82  public function lastQuery() {
83  return $this->__call( __FUNCTION__, func_get_args() );
84  }
85 
86  public function doneWrites() {
87  return $this->__call( __FUNCTION__, func_get_args() );
88  }
89 
90  public function lastDoneWrites() {
91  return $this->__call( __FUNCTION__, func_get_args() );
92  }
93 
94  public function writesPending() {
95  return $this->__call( __FUNCTION__, func_get_args() );
96  }
97 
98  public function writesOrCallbacksPending() {
99  return $this->__call( __FUNCTION__, func_get_args() );
100  }
101 
102  public function pendingWriteQueryDuration() {
103  return $this->__call( __FUNCTION__, func_get_args() );
104  }
105 
106  public function pendingWriteCallers() {
107  return $this->__call( __FUNCTION__, func_get_args() );
108  }
109 
110  public function isOpen() {
111  return $this->__call( __FUNCTION__, func_get_args() );
112  }
113 
114  public function setFlag( $flag ) {
115  return $this->__call( __FUNCTION__, func_get_args() );
116  }
117 
118  public function clearFlag( $flag ) {
119  return $this->__call( __FUNCTION__, func_get_args() );
120  }
121 
122  public function getFlag( $flag ) {
123  return $this->__call( __FUNCTION__, func_get_args() );
124  }
125 
126  public function getProperty( $name ) {
127  return $this->__call( __FUNCTION__, func_get_args() );
128  }
129 
130  public function getWikiID() {
131  return $this->__call( __FUNCTION__, func_get_args() );
132  }
133 
134  public function getType() {
135  return $this->__call( __FUNCTION__, func_get_args() );
136  }
137 
138  public function open( $server, $user, $password, $dbName ) {
139  return $this->__call( __FUNCTION__, func_get_args() );
140  }
141 
142  public function fetchObject( $res ) {
143  return $this->__call( __FUNCTION__, func_get_args() );
144  }
145 
146  public function fetchRow( $res ) {
147  return $this->__call( __FUNCTION__, func_get_args() );
148  }
149 
150  public function numRows( $res ) {
151  return $this->__call( __FUNCTION__, func_get_args() );
152  }
153 
154  public function numFields( $res ) {
155  return $this->__call( __FUNCTION__, func_get_args() );
156  }
157 
158  public function fieldName( $res, $n ) {
159  return $this->__call( __FUNCTION__, func_get_args() );
160  }
161 
162  public function insertId() {
163  return $this->__call( __FUNCTION__, func_get_args() );
164  }
165 
166  public function dataSeek( $res, $row ) {
167  return $this->__call( __FUNCTION__, func_get_args() );
168  }
169 
170  public function lastErrno() {
171  return $this->__call( __FUNCTION__, func_get_args() );
172  }
173 
174  public function lastError() {
175  return $this->__call( __FUNCTION__, func_get_args() );
176  }
177 
178  public function fieldInfo( $table, $field ) {
179  return $this->__call( __FUNCTION__, func_get_args() );
180  }
181 
182  public function affectedRows() {
183  return $this->__call( __FUNCTION__, func_get_args() );
184  }
185 
186  public function getSoftwareLink() {
187  return $this->__call( __FUNCTION__, func_get_args() );
188  }
189 
190  public function getServerVersion() {
191  return $this->__call( __FUNCTION__, func_get_args() );
192  }
193 
194  public function close() {
195  return $this->__call( __FUNCTION__, func_get_args() );
196  }
197 
198  public function reportConnectionError( $error = 'Unknown error' ) {
199  return $this->__call( __FUNCTION__, func_get_args() );
200  }
201 
202  public function query( $sql, $fname = __METHOD__, $tempIgnore = false ) {
203  return $this->__call( __FUNCTION__, func_get_args() );
204  }
205 
206  public function reportQueryError( $error, $errno, $sql, $fname, $tempIgnore = false ) {
207  return $this->__call( __FUNCTION__, func_get_args() );
208  }
209 
210  public function freeResult( $res ) {
211  return $this->__call( __FUNCTION__, func_get_args() );
212  }
213 
214  public function selectField(
215  $table, $var, $cond = '', $fname = __METHOD__, $options = []
216  ) {
217  return $this->__call( __FUNCTION__, func_get_args() );
218  }
219 
220  public function selectFieldValues(
221  $table, $var, $cond = '', $fname = __METHOD__, $options = []
222  ) {
223  return $this->__call( __FUNCTION__, func_get_args() );
224  }
225 
226  public function select(
227  $table, $vars, $conds = '', $fname = __METHOD__,
228  $options = [], $join_conds = []
229  ) {
230  return $this->__call( __FUNCTION__, func_get_args() );
231  }
232 
233  public function selectSQLText(
234  $table, $vars, $conds = '', $fname = __METHOD__,
235  $options = [], $join_conds = []
236  ) {
237  return $this->__call( __FUNCTION__, func_get_args() );
238  }
239 
240  public function selectRow(
241  $table, $vars, $conds, $fname = __METHOD__,
242  $options = [], $join_conds = []
243  ) {
244  return $this->__call( __FUNCTION__, func_get_args() );
245  }
246 
247  public function estimateRowCount(
248  $table, $vars = '*', $conds = '', $fname = __METHOD__, $options = []
249  ) {
250  return $this->__call( __FUNCTION__, func_get_args() );
251  }
252 
253  public function selectRowCount(
254  $tables, $vars = '*', $conds = '', $fname = __METHOD__, $options = [], $join_conds = []
255  ) {
256  return $this->__call( __FUNCTION__, func_get_args() );
257  }
258 
259  public function fieldExists( $table, $field, $fname = __METHOD__ ) {
260  return $this->__call( __FUNCTION__, func_get_args() );
261  }
262 
263  public function indexExists( $table, $index, $fname = __METHOD__ ) {
264  return $this->__call( __FUNCTION__, func_get_args() );
265  }
266 
267  public function tableExists( $table, $fname = __METHOD__ ) {
268  return $this->__call( __FUNCTION__, func_get_args() );
269  }
270 
271  public function indexUnique( $table, $index ) {
272  return $this->__call( __FUNCTION__, func_get_args() );
273  }
274 
275  public function insert( $table, $a, $fname = __METHOD__, $options = [] ) {
276  return $this->__call( __FUNCTION__, func_get_args() );
277  }
278 
279  public function update( $table, $values, $conds, $fname = __METHOD__, $options = [] ) {
280  return $this->__call( __FUNCTION__, func_get_args() );
281  }
282 
283  public function makeList( $a, $mode = LIST_COMMA ) {
284  return $this->__call( __FUNCTION__, func_get_args() );
285  }
286 
287  public function makeWhereFrom2d( $data, $baseKey, $subKey ) {
288  return $this->__call( __FUNCTION__, func_get_args() );
289  }
290 
291  public function bitNot( $field ) {
292  return $this->__call( __FUNCTION__, func_get_args() );
293  }
294 
295  public function bitAnd( $fieldLeft, $fieldRight ) {
296  return $this->__call( __FUNCTION__, func_get_args() );
297  }
298 
299  public function bitOr( $fieldLeft, $fieldRight ) {
300  return $this->__call( __FUNCTION__, func_get_args() );
301  }
302 
303  public function buildConcat( $stringList ) {
304  return $this->__call( __FUNCTION__, func_get_args() );
305  }
306 
307  public function buildGroupConcatField(
308  $delim, $table, $field, $conds = '', $join_conds = []
309  ) {
310  return $this->__call( __FUNCTION__, func_get_args() );
311  }
312 
313  public function selectDB( $db ) {
314  return $this->__call( __FUNCTION__, func_get_args() );
315  }
316 
317  public function getDBname() {
318  return $this->__call( __FUNCTION__, func_get_args() );
319  }
320 
321  public function getServer() {
322  return $this->__call( __FUNCTION__, func_get_args() );
323  }
324 
325  public function addQuotes( $s ) {
326  return $this->__call( __FUNCTION__, func_get_args() );
327  }
328 
329  public function buildLike() {
330  return $this->__call( __FUNCTION__, func_get_args() );
331  }
332 
333  public function anyChar() {
334  return $this->__call( __FUNCTION__, func_get_args() );
335  }
336 
337  public function anyString() {
338  return $this->__call( __FUNCTION__, func_get_args() );
339  }
340 
341  public function nextSequenceValue( $seqName ) {
342  return $this->__call( __FUNCTION__, func_get_args() );
343  }
344 
345  public function replace( $table, $uniqueIndexes, $rows, $fname = __METHOD__ ) {
346  return $this->__call( __FUNCTION__, func_get_args() );
347  }
348 
349  public function upsert(
350  $table, array $rows, array $uniqueIndexes, array $set, $fname = __METHOD__
351  ) {
352  return $this->__call( __FUNCTION__, func_get_args() );
353  }
354 
355  public function deleteJoin(
356  $delTable, $joinTable, $delVar, $joinVar, $conds, $fname = __METHOD__
357  ) {
358  return $this->__call( __FUNCTION__, func_get_args() );
359  }
360 
361  public function delete( $table, $conds, $fname = __METHOD__ ) {
362  return $this->__call( __FUNCTION__, func_get_args() );
363  }
364 
365  public function insertSelect(
366  $destTable, $srcTable, $varMap, $conds,
367  $fname = __METHOD__, $insertOptions = [], $selectOptions = []
368  ) {
369  return $this->__call( __FUNCTION__, func_get_args() );
370  }
371 
372  public function unionSupportsOrderAndLimit() {
373  return $this->__call( __FUNCTION__, func_get_args() );
374  }
375 
376  public function unionQueries( $sqls, $all ) {
377  return $this->__call( __FUNCTION__, func_get_args() );
378  }
379 
380  public function conditional( $cond, $trueVal, $falseVal ) {
381  return $this->__call( __FUNCTION__, func_get_args() );
382  }
383 
384  public function strreplace( $orig, $old, $new ) {
385  return $this->__call( __FUNCTION__, func_get_args() );
386  }
387 
388  public function getServerUptime() {
389  return $this->__call( __FUNCTION__, func_get_args() );
390  }
391 
392  public function wasDeadlock() {
393  return $this->__call( __FUNCTION__, func_get_args() );
394  }
395 
396  public function wasLockTimeout() {
397  return $this->__call( __FUNCTION__, func_get_args() );
398  }
399 
400  public function wasErrorReissuable() {
401  return $this->__call( __FUNCTION__, func_get_args() );
402  }
403 
404  public function wasReadOnlyError() {
405  return $this->__call( __FUNCTION__, func_get_args() );
406  }
407 
408  public function masterPosWait( DBMasterPos $pos, $timeout ) {
409  return $this->__call( __FUNCTION__, func_get_args() );
410  }
411 
412  public function getSlavePos() {
413  return $this->__call( __FUNCTION__, func_get_args() );
414  }
415 
416  public function getMasterPos() {
417  return $this->__call( __FUNCTION__, func_get_args() );
418  }
419 
420  public function onTransactionIdle( $callback ) {
421  return $this->__call( __FUNCTION__, func_get_args() );
422  }
423 
424  public function onTransactionPreCommitOrIdle( $callback ) {
425  return $this->__call( __FUNCTION__, func_get_args() );
426  }
427 
428  public function startAtomic( $fname = __METHOD__ ) {
429  return $this->__call( __FUNCTION__, func_get_args() );
430  }
431 
432  public function endAtomic( $fname = __METHOD__ ) {
433  return $this->__call( __FUNCTION__, func_get_args() );
434  }
435 
436  public function doAtomicSection( $fname, $callback ) {
437  return $this->__call( __FUNCTION__, func_get_args() );
438  }
439 
440  public function begin( $fname = __METHOD__ ) {
441  return $this->__call( __FUNCTION__, func_get_args() );
442  }
443 
444  public function commit( $fname = __METHOD__, $flush = '' ) {
445  return $this->__call( __FUNCTION__, func_get_args() );
446  }
447 
448  public function rollback( $fname = __METHOD__, $flush = '' ) {
449  return $this->__call( __FUNCTION__, func_get_args() );
450  }
451 
452  public function listTables( $prefix = null, $fname = __METHOD__ ) {
453  return $this->__call( __FUNCTION__, func_get_args() );
454  }
455 
456  public function timestamp( $ts = 0 ) {
457  return $this->__call( __FUNCTION__, func_get_args() );
458  }
459 
460  public function timestampOrNull( $ts = null ) {
461  return $this->__call( __FUNCTION__, func_get_args() );
462  }
463 
464  public function ping() {
465  return $this->__call( __FUNCTION__, func_get_args() );
466  }
467 
468  public function getLag() {
469  return $this->__call( __FUNCTION__, func_get_args() );
470  }
471 
472  public function getSessionLagStatus() {
473  return $this->__call( __FUNCTION__, func_get_args() );
474  }
475 
476  public function maxListLen() {
477  return $this->__call( __FUNCTION__, func_get_args() );
478  }
479 
480  public function encodeBlob( $b ) {
481  return $this->__call( __FUNCTION__, func_get_args() );
482  }
483 
484  public function decodeBlob( $b ) {
485  return $this->__call( __FUNCTION__, func_get_args() );
486  }
487 
488  public function setSessionOptions( array $options ) {
489  return $this->__call( __FUNCTION__, func_get_args() );
490  }
491 
492  public function setSchemaVars( $vars ) {
493  return $this->__call( __FUNCTION__, func_get_args() );
494  }
495 
496  public function lockIsFree( $lockName, $method ) {
497  return $this->__call( __FUNCTION__, func_get_args() );
498  }
499 
500  public function lock( $lockName, $method, $timeout = 5 ) {
501  return $this->__call( __FUNCTION__, func_get_args() );
502  }
503 
504  public function unlock( $lockName, $method ) {
505  return $this->__call( __FUNCTION__, func_get_args() );
506  }
507 
508  public function getScopedLockAndFlush( $lockKey, $fname, $timeout ) {
509  return $this->__call( __FUNCTION__, func_get_args() );
510  }
511 
512  public function namedLocksEnqueue() {
513  return $this->__call( __FUNCTION__, func_get_args() );
514  }
515 
516  public function getInfinity() {
517  return $this->__call( __FUNCTION__, func_get_args() );
518  }
519 
520  public function encodeExpiry( $expiry ) {
521  return $this->__call( __FUNCTION__, func_get_args() );
522  }
523 
524  public function decodeExpiry( $expiry, $format = TS_MW ) {
525  return $this->__call( __FUNCTION__, func_get_args() );
526  }
527 
528  public function setBigSelects( $value = true ) {
529  return $this->__call( __FUNCTION__, func_get_args() );
530  }
531 
532  public function isReadOnly() {
533  return $this->__call( __FUNCTION__, func_get_args() );
534  }
535 
539  function __destruct() {
540  if ( $this->conn !== null ) {
541  $this->lb->reuseConnection( $this->conn );
542  }
543  }
544 }
namedLocksEnqueue()
Check to see if a named lock used by lock() use blocking queues.
Definition: DBConnRef.php:512
anyString()
Returns a token for buildLike() that denotes a '' to be used in a LIKE query.
Definition: DBConnRef.php:337
unionQueries($sqls, $all)
Construct a UNION query This is used for providing overload point for other DB abstractions not compa...
Definition: DBConnRef.php:376
startAtomic($fname=__METHOD__)
Begin an atomic section of statements.
Definition: DBConnRef.php:428
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition: deferred.txt:11
close()
Closes a database connection.
Definition: DBConnRef.php:194
wasErrorReissuable()
Determines if the last query error was something that should be dealt with by pinging the connection ...
Definition: DBConnRef.php:400
wasReadOnlyError()
Determines if the last failure was due to the database being read-only.
Definition: DBConnRef.php:404
the array() calling protocol came about after MediaWiki 1.4rc1.
buildGroupConcatField($delim, $table, $field, $conds= '', $join_conds=[])
Build a GROUP_CONCAT or equivalent statement for a query.
Definition: DBConnRef.php:307
decodeExpiry($expiry, $format=TS_MW)
Decode an expiry time into a DBMS independent format.
Definition: DBConnRef.php:524
buildLike()
LIKE statement wrapper, receives a variable-length argument list with parts of pattern to match conta...
Definition: DBConnRef.php:329
indexUnique($table, $index)
Determines if a given index is unique.
Definition: DBConnRef.php:271
setSessionOptions(array $options)
Override database's default behavior.
Definition: DBConnRef.php:488
lockIsFree($lockName, $method)
Check to see if a named lock is available (non-blocking)
Definition: DBConnRef.php:496
begin($fname=__METHOD__)
Begin a transaction.
Definition: DBConnRef.php:440
__call($name, array $arguments)
Definition: DBConnRef.php:33
getServerVersion()
A string describing the current software version, like from mysql_get_server_info().
Definition: DBConnRef.php:190
getFlag($flag)
Returns a boolean whether the flag $flag is set for this connection.
Definition: DBConnRef.php:122
deleteJoin($delTable, $joinTable, $delVar, $joinVar, $conds, $fname=__METHOD__)
DELETE where the condition is a join.
Definition: DBConnRef.php:355
affectedRows()
Get the number of rows affected by the last write query.
Definition: DBConnRef.php:182
select($table, $vars, $conds= '', $fname=__METHOD__, $options=[], $join_conds=[])
Execute a SELECT query constructed using the various parameters provided.
Definition: DBConnRef.php:226
addQuotes($s)
Adds quotes and backslashes.
Definition: DBConnRef.php:325
commit($fname=__METHOD__, $flush= '')
Commits a transaction previously started using begin().
Definition: DBConnRef.php:444
masterPosWait(DBMasterPos $pos, $timeout)
Wait for the slave to catch up to a given master position.
Definition: DBConnRef.php:408
makeList($a, $mode=LIST_COMMA)
Makes an encoded list of strings from an array.
Definition: DBConnRef.php:283
writesOrCallbacksPending()
Returns true if there is a transaction open with possible write queries or transaction pre-commit/idl...
Definition: DBConnRef.php:98
setLBInfo($name, $value=null)
Set the LB info array, or a member of it.
Definition: DBConnRef.php:70
bitAnd($fieldLeft, $fieldRight)
Definition: DBConnRef.php:295
$value
setBigSelects($value=true)
Allow or deny "big selects" for this session only.
Definition: DBConnRef.php:528
reportConnectionError($error= 'Unknown error')
Definition: DBConnRef.php:198
bitNot($field)
Definition: DBConnRef.php:291
An object representing a master or slave position in a replicated setup.
lastError()
Get a description of the last error.
Definition: DBConnRef.php:174
tablePrefix($prefix=null)
Get/set the table prefix.
Definition: DBConnRef.php:58
maxListLen()
Return the maximum number of items allowed in a list, or 0 for unlimited.
Definition: DBConnRef.php:476
selectRowCount($tables, $vars= '*', $conds= '', $fname=__METHOD__, $options=[], $join_conds=[])
Get the number of rows in dataset.
Definition: DBConnRef.php:253
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist & $tables
Definition: hooks.txt:969
open($server, $user, $password, $dbName)
Open a connection to the database.
Definition: DBConnRef.php:138
__construct(LoadBalancer $lb, $conn)
Definition: DBConnRef.php:24
lastErrno()
Get the last error number.
Definition: DBConnRef.php:170
fieldInfo($table, $field)
mysql_fetch_field() wrapper Returns false if the field doesn't exist
Definition: DBConnRef.php:178
bitOr($fieldLeft, $fieldRight)
Definition: DBConnRef.php:299
array null $params
Definition: DBConnRef.php:18
tableExists($table, $fname=__METHOD__)
Query whether a given table exists.
Definition: DBConnRef.php:267
listTables($prefix=null, $fname=__METHOD__)
List all tables on the database.
Definition: DBConnRef.php:452
Database load balancing object.
bufferResults($buffer=null)
Turns buffering of SQL result sets on (true) or off (false).
Definition: DBConnRef.php:46
pendingWriteCallers()
Get the list of method names that did write queries for this transaction.
Definition: DBConnRef.php:106
trxLevel()
Gets the current transaction level.
Definition: DBConnRef.php:50
freeResult($res)
Free a result object returned by query() or select().
Definition: DBConnRef.php:210
doneWrites()
Returns true if the connection may have been used for write queries.
Definition: DBConnRef.php:86
setSchemaVars($vars)
Set variables to be used in sourceFile/sourceStream, in preference to the ones in $GLOBALS...
Definition: DBConnRef.php:492
nextSequenceValue($seqName)
Returns an appropriately quoted sequence value for inserting a new row.
Definition: DBConnRef.php:341
getServerUptime()
Determines how long the server has been up STUB.
Definition: DBConnRef.php:388
writesPending()
Definition: DBConnRef.php:94
pendingWriteQueryDuration()
Get the time spend running write queries for this transaction.
Definition: DBConnRef.php:102
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
Definition: hooks.txt:1008
fieldName($res, $n)
Get a field name in a result object.
Definition: DBConnRef.php:158
timestamp($ts=0)
Convert a timestamp in one of the formats accepted by wfTimestamp() to the format used for inserting ...
Definition: DBConnRef.php:456
const LIST_COMMA
Definition: Defines.php:192
endAtomic($fname=__METHOD__)
Ends an atomic section of SQL statements.
Definition: DBConnRef.php:432
LoadBalancer $lb
Definition: DBConnRef.php:12
$res
Definition: database.txt:21
getLBInfo($name=null)
Get properties passed down from the server info array of the load balancer.
Definition: DBConnRef.php:66
buildConcat($stringList)
Build a concatenation list to feed into a SQL query.
Definition: DBConnRef.php:303
getServerInfo()
A string describing the current software version, and possibly other details in a user-friendly way...
Definition: DBConnRef.php:42
encodeBlob($b)
Some DBMSs have a special format for inserting into blob fields, they don't allow simple quoted strin...
Definition: DBConnRef.php:480
getMasterPos()
Get the position of this master.
Definition: DBConnRef.php:416
makeWhereFrom2d($data, $baseKey, $subKey)
Build a partial where clause from a 2-d array such as used for LinkBatch.
Definition: DBConnRef.php:287
unlock($lockName, $method)
Release a lock.
Definition: DBConnRef.php:504
fetchObject($res)
Fetch the next row from the given result object, in object form.
Definition: DBConnRef.php:142
query($sql, $fname=__METHOD__, $tempIgnore=false)
Run an SQL query and return the result.
Definition: DBConnRef.php:202
getDBname()
Get the current DB name.
Definition: DBConnRef.php:317
Helper class to handle automatically marking connections as reusable (via RAII pattern) as well handl...
Definition: DBConnRef.php:10
upsert($table, array $rows, array $uniqueIndexes, array $set, $fname=__METHOD__)
INSERT ON DUPLICATE KEY UPDATE wrapper, upserts an array into a table.
Definition: DBConnRef.php:349
$buffer
getSoftwareLink()
Returns a wikitext link to the DB's website, e.g., return "[http://www.mysql.com/ MySQL]"; Should at ...
Definition: DBConnRef.php:186
lock($lockName, $method, $timeout=5)
Acquire a named lock.
Definition: DBConnRef.php:500
lastDoneWrites()
Returns the last time the connection may have been used for write queries.
Definition: DBConnRef.php:90
DatabaseBase null $conn
Definition: DBConnRef.php:15
clearFlag($flag)
Clear a flag for this connection.
Definition: DBConnRef.php:118
getInfinity()
Find out when 'infinity' is.
Definition: DBConnRef.php:516
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
Definition: hooks.txt:246
getSlavePos()
Get the replication position of this slave.
Definition: DBConnRef.php:412
lastQuery()
Return the last query that went through IDatabase::query()
Definition: DBConnRef.php:82
onTransactionIdle($callback)
Run an anonymous function as soon as there is no transaction pending.
Definition: DBConnRef.php:420
wasLockTimeout()
Determines if the last failure was due to a lock timeout STUB.
Definition: DBConnRef.php:396
__destruct()
Clean up the connection when out of scope.
Definition: DBConnRef.php:539
getServer()
Get the server hostname or IP address.
Definition: DBConnRef.php:321
insertId()
Get the inserted value of an auto-increment row.
Definition: DBConnRef.php:162
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
Database abstraction object.
Definition: Database.php:32
dataSeek($res, $row)
Change the position of the cursor in a result object.
Definition: DBConnRef.php:166
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
timestampOrNull($ts=null)
Convert a timestamp in one of the formats accepted by wfTimestamp() to the format used for inserting ...
Definition: DBConnRef.php:460
insertSelect($destTable, $srcTable, $varMap, $conds, $fname=__METHOD__, $insertOptions=[], $selectOptions=[])
INSERT SELECT wrapper.
Definition: DBConnRef.php:365
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined...
Definition: Setup.php:35
decodeBlob($b)
Some DBMSs return a special placeholder object representing blob fields in result objects...
Definition: DBConnRef.php:484
selectFieldValues($table, $var, $cond= '', $fname=__METHOD__, $options=[])
A SELECT wrapper which returns a list of single field values from result rows.
Definition: DBConnRef.php:220
getScopedLockAndFlush($lockKey, $fname, $timeout)
Acquire a named lock, flush any transaction, and return an RAII style unlocker object.
Definition: DBConnRef.php:508
selectField($table, $var, $cond= '', $fname=__METHOD__, $options=[])
A SELECT wrapper which returns a single field from a single result row.
Definition: DBConnRef.php:214
strreplace($orig, $old, $new)
Returns a comand for str_replace function in SQL query.
Definition: DBConnRef.php:384
onTransactionPreCommitOrIdle($callback)
Run an anonymous function before the current transaction commits or now if there is none...
Definition: DBConnRef.php:424
replace($table, $uniqueIndexes, $rows, $fname=__METHOD__)
REPLACE query wrapper.
Definition: DBConnRef.php:345
getType()
Get the type of the DBMS, as it appears in $wgDBtype.
Definition: DBConnRef.php:134
dbSchema($schema=null)
Get/set the db schema.
Definition: DBConnRef.php:62
conditional($cond, $trueVal, $falseVal)
Returns an SQL expression for a simple conditional.
Definition: DBConnRef.php:380
selectRow($table, $vars, $conds, $fname=__METHOD__, $options=[], $join_conds=[])
Single row SELECT wrapper.
Definition: DBConnRef.php:240
fetchRow($res)
Fetch the next row from the given result object, in associative array form.
Definition: DBConnRef.php:146
trxTimestamp()
Get the UNIX timestamp of the time that the transaction was established.
Definition: DBConnRef.php:54
reportQueryError($error, $errno, $sql, $fname, $tempIgnore=false)
Report a query error.
Definition: DBConnRef.php:206
unionSupportsOrderAndLimit()
Returns true if current database backend supports ORDER BY or LIMIT for separate subqueries within th...
Definition: DBConnRef.php:372
fieldExists($table, $field, $fname=__METHOD__)
Determines whether a field exists in a table.
Definition: DBConnRef.php:259
estimateRowCount($table, $vars= '*', $conds= '', $fname=__METHOD__, $options=[])
Estimate the number of rows in dataset.
Definition: DBConnRef.php:247
insert($table, $a, $fname=__METHOD__, $options=[])
INSERT wrapper, inserts an array into a table.
Definition: DBConnRef.php:275
setFlag($flag)
Set a flag for this connection.
Definition: DBConnRef.php:114
numFields($res)
Get the number of fields in a result object.
Definition: DBConnRef.php:154
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.
Definition: DBConnRef.php:233
numRows($res)
Get the number of rows in a result object.
Definition: DBConnRef.php:150
implicitGroupby()
Returns true if this database does an implicit sort when doing GROUP BY.
Definition: DBConnRef.php:74
rollback($fname=__METHOD__, $flush= '')
Rollback a transaction previously started using begin().
Definition: DBConnRef.php:448
ping()
Ping the server and try to reconnect if it there is no connection.
Definition: DBConnRef.php:464
getLag()
Get slave lag.
Definition: DBConnRef.php:468
getProperty($name)
General read-only accessor.
Definition: DBConnRef.php:126
getSessionLagStatus()
Get the slave lag when the current transaction started or a general lag estimate if not transaction i...
Definition: DBConnRef.php:472
anyChar()
Returns a token for buildLike() that denotes a '_' to be used in a LIKE query.
Definition: DBConnRef.php:333
indexExists($table, $index, $fname=__METHOD__)
Determines whether an index exists Usually throws a DBQueryError on failure If errors are explicitly ...
Definition: DBConnRef.php:263
static configuration should be added through ResourceLoaderGetConfigVars instead & $vars
Definition: hooks.txt:2000
encodeExpiry($expiry)
Encode an expiry time into the DBMS dependent format.
Definition: DBConnRef.php:520
doAtomicSection($fname, $callback)
Run a callback to do an atomic set of updates for this database.
Definition: DBConnRef.php:436
selectDB($db)
Change the current database.
Definition: DBConnRef.php:313
isOpen()
Is a connection to the database open?
Definition: DBConnRef.php:110
Basic database interface for live and lazy-loaded DB handles.
Definition: IDatabase.php:35
wasDeadlock()
Determines if the last failure was due to a deadlock STUB.
Definition: DBConnRef.php:392
implicitOrderby()
Returns true if this database does an implicit order by when the column has an index For example: SEL...
Definition: DBConnRef.php:78
update($table, $values, $conds, $fname=__METHOD__, $options=[])
UPDATE wrapper.
Definition: DBConnRef.php:279
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:314