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