MediaWiki REL1_31
|
Helper class to handle automatically marking connections as reusable (via RAII pattern) as well handling deferring the actual network connection until the handle is used. More...
Public Member Functions | |
deadlockLoop () | |
Perform a deadlock-prone transaction. | |
dropTable ( $tableName, $fName=__METHOD__) | |
Delete a table. | |
duplicateTableStructure ( $oldName, $newName, $temporary=false, $fname=__METHOD__) | |
Creates a new table with structure copied from existing table. | |
fieldInfo ( $table, $field) | |
mysql_fetch_field() wrapper Returns false if the field doesn't exist | |
indexUnique ( $table, $index) | |
Determines if a given index is unique. | |
listTables ( $prefix=null, $fname=__METHOD__) | |
List all tables on the database. | |
listViews ( $prefix=null, $fname=__METHOD__) | |
Lists all the VIEWs in the database. | |
lockTables (array $read, array $write, $method) | |
Lock specific tables. | |
sourceFile ( $filename, callable $lineCallback=null, callable $resultCallback=null, $fname=false, callable $inputCallback=null) | |
Read and execute SQL commands from a file. | |
sourceStream ( $fp, callable $lineCallback=null, callable $resultCallback=null, $fname=__METHOD__, callable $inputCallback=null) | |
Read and execute commands from an open file handle. | |
streamStatementEnd (&$sql, &$newLine) | |
Called by sourceStream() to check if we've reached a statement end. | |
tableLocksHaveTransactionScope () | |
Checks if table locks acquired by lockTables() are transaction-bound in their scope. | |
tableName ( $name, $format='quoted') | |
Format a table name ready for use in constructing an SQL query. | |
tableNames () | |
Fetch a number of table names into an array This is handy when you need to construct SQL for joins. | |
tableNamesN () | |
Fetch a number of table names into an zero-indexed numerical array This is handy when you need to construct SQL for joins. | |
textFieldSize ( $table, $field) | |
Returns the size of a text field, or -1 for "unlimited". | |
unlockTables ( $method) | |
Unlock all tables locked via lockTables() | |
Public Member Functions inherited from Wikimedia\Rdbms\DBConnRef | |
__call ( $name, array $arguments) | |
__construct (ILoadBalancer $lb, $conn) | |
__destruct () | |
Clean up the connection when out of scope. | |
addQuotes ( $s) | |
Adds quotes and backslashes. | |
affectedRows () | |
Get the number of rows affected by the last write query. | |
aggregateValue ( $valuedata, $valuename='value') | |
Return aggregated value alias. | |
anyChar () | |
Returns a token for buildLike() that denotes a '_' to be used in a LIKE query. | |
anyString () | |
Returns a token for buildLike() that denotes a '' to be used in a LIKE query. | |
begin ( $fname=__METHOD__, $mode=IDatabase::TRANSACTION_EXPLICIT) | |
Begin a transaction. | |
bitAnd ( $fieldLeft, $fieldRight) | |
bitNot ( $field) | |
bitOr ( $fieldLeft, $fieldRight) | |
bufferResults ( $buffer=null) | |
Turns buffering of SQL result sets on (true) or off (false). | |
buildConcat ( $stringList) | |
Build a concatenation list to feed into a SQL query. | |
buildGroupConcatField ( $delim, $table, $field, $conds='', $join_conds=[]) | |
Build a GROUP_CONCAT or equivalent statement for a query. | |
buildIntegerCast ( $field) | |
buildLike () | |
LIKE statement wrapper, receives a variable-length argument list with parts of pattern to match containing either string literals that will be escaped or tokens returned by anyChar() or anyString(). | |
buildSelectSubquery ( $table, $vars, $conds='', $fname=__METHOD__, $options=[], $join_conds=[]) | |
Equivalent to IDatabase::selectSQLText() except wraps the result in Subqyery. | |
buildStringCast ( $field) | |
buildSubstring ( $input, $startPosition, $length=null) | |
cancelAtomic ( $fname=__METHOD__, AtomicSectionIdentifier $sectionId=null) | |
Cancel an atomic section of SQL statements. | |
clearFlag ( $flag, $remember=self::REMEMBER_NOTHING) | |
Clear a flag for this connection. | |
close () | |
Close the database connection. | |
commit ( $fname=__METHOD__, $flush='') | |
Commits a transaction previously started using begin(). | |
conditional ( $cond, $trueVal, $falseVal) | |
Returns an SQL expression for a simple conditional. | |
databasesAreIndependent () | |
Returns true if DBs are assumed to be on potentially different servers. | |
dataSeek ( $res, $row) | |
Change the position of the cursor in a result object. | |
dbSchema ( $schema=null) | |
Get/set the db schema. | |
decodeBlob ( $b) | |
Some DBMSs return a special placeholder object representing blob fields in result objects. | |
decodeExpiry ( $expiry, $format=TS_MW) | |
Decode an expiry time into a DBMS independent format. | |
delete ( $table, $conds, $fname=__METHOD__) | |
DELETE query wrapper. | |
deleteJoin ( $delTable, $joinTable, $delVar, $joinVar, $conds, $fname=__METHOD__) | |
DELETE where the condition is a join. | |
doAtomicSection ( $fname, callable $callback, $cancelable=self::ATOMIC_NOT_CANCELABLE) | |
Perform an atomic section of reversable SQL statements from a callback. | |
doneWrites () | |
Returns true if the connection may have been used for write queries. | |
encodeBlob ( $b) | |
Some DBMSs have a special format for inserting into blob fields, they don't allow simple quoted strings to be inserted. | |
encodeExpiry ( $expiry) | |
Encode an expiry time into the DBMS dependent format. | |
endAtomic ( $fname=__METHOD__) | |
Ends an atomic section of SQL statements. | |
estimateRowCount ( $table, $vars=' *', $conds='', $fname=__METHOD__, $options=[], $join_conds=[]) | |
Estimate the number of rows in dataset. | |
explicitTrxActive () | |
fetchObject ( $res) | |
Fetch the next row from the given result object, in object form. | |
fetchRow ( $res) | |
Fetch the next row from the given result object, in associative array form. | |
fieldExists ( $table, $field, $fname=__METHOD__) | |
Determines whether a field exists in a table. | |
fieldName ( $res, $n) | |
Get a field name in a result object. | |
flushSnapshot ( $fname=__METHOD__) | |
Commit any transaction but error out if writes or callbacks are pending. | |
freeResult ( $res) | |
Free a result object returned by query() or select(). | |
getDBname () | |
Get the current DB name. | |
getDomainID () | |
getFlag ( $flag) | |
Returns a boolean whether the flag $flag is set for this connection. | |
getInfinity () | |
Find out when 'infinity' is. | |
getLag () | |
Get the amount of replication lag for this database server. | |
getLBInfo ( $name=null) | |
Get properties passed down from the server info array of the load balancer. | |
getMasterPos () | |
Get the position of this master. | |
getProperty ( $name) | |
getReplicaPos () | |
Get the replication position of this replica DB. | |
getScopedLockAndFlush ( $lockKey, $fname, $timeout) | |
Acquire a named lock, flush any transaction, and return an RAII style unlocker object. | |
getServer () | |
Get the server hostname or IP address. | |
getServerInfo () | |
A string describing the current software version, and possibly other details in a user-friendly way. | |
getServerUptime () | |
Determines how long the server has been up. | |
getServerVersion () | |
A string describing the current software version, like from mysql_get_server_info(). | |
getSessionLagStatus () | |
Get the replica DB lag when the current transaction started or a general lag estimate if not transaction is active. | |
getSoftwareLink () | |
Returns a wikitext link to the DB's website, e.g., return "[https://www.mysql.com/ MySQL]"; Should at least contain plain text, if for some reason your database has no website. | |
getType () | |
Get the type of the DBMS, as it appears in $wgDBtype. | |
getWikiID () | |
Alias for getDomainID() | |
implicitGroupby () | |
Returns true if this database does an implicit sort when doing GROUP BY. | |
implicitOrderby () | |
Returns true if this database does an implicit order by when the column has an index For example: SELECT page_title FROM page LIMIT 1. | |
indexExists ( $table, $index, $fname=__METHOD__) | |
Determines whether an index exists Usually throws a DBQueryError on failure If errors are explicitly ignored, returns NULL on failure. | |
insert ( $table, $a, $fname=__METHOD__, $options=[]) | |
INSERT wrapper, inserts an array into a table. | |
insertId () | |
Get the inserted value of an auto-increment row. | |
insertSelect ( $destTable, $srcTable, $varMap, $conds, $fname=__METHOD__, $insertOptions=[], $selectOptions=[], $selectJoinConds=[]) | |
INSERT SELECT wrapper. | |
isOpen () | |
Is a connection to the database open? | |
isReadOnly () | |
lastDoneWrites () | |
Returns the last time the connection may have been used for write queries. | |
lastErrno () | |
Get the last error number. | |
lastError () | |
Get a description of the last error. | |
lastQuery () | |
Return the last query that went through IDatabase::query() | |
lock ( $lockName, $method, $timeout=5) | |
Acquire a named lock. | |
lockIsFree ( $lockName, $method) | |
Check to see if a named lock is not locked by any thread (non-blocking) | |
makeList ( $a, $mode=self::LIST_COMMA) | |
Makes an encoded list of strings from an array. | |
makeWhereFrom2d ( $data, $baseKey, $subKey) | |
Build a partial where clause from a 2-d array such as used for LinkBatch. | |
masterPosWait (DBMasterPos $pos, $timeout) | |
Wait for the replica DB to catch up to a given master position. | |
maxListLen () | |
Return the maximum number of items allowed in a list, or 0 for unlimited. | |
namedLocksEnqueue () | |
Check to see if a named lock used by lock() use blocking queues. | |
nextSequenceValue ( $seqName) | |
Deprecated method, calls should be removed. | |
numFields ( $res) | |
Get the number of fields in a result object. | |
numRows ( $res) | |
Get the number of rows in a result object. | |
onTransactionIdle (callable $callback, $fname=__METHOD__) | |
Run a callback as soon as there is no transaction pending. | |
onTransactionPreCommitOrIdle (callable $callback, $fname=__METHOD__) | |
Run a callback before the current transaction commits or now if there is none. | |
onTransactionResolution (callable $callback, $fname=__METHOD__) | |
Run a callback as soon as the current transaction commits or rolls back. | |
open ( $server, $user, $password, $dbName) | |
Open a new connection to the database (closing any existing one) | |
pendingWriteCallers () | |
Get the list of method names that did write queries for this transaction. | |
pendingWriteQueryDuration ( $type=self::ESTIMATE_TOTAL) | |
Get the time spend running write queries for this transaction. | |
pendingWriteRowsAffected () | |
Get the number of affected rows from pending write queries. | |
ping (&$rtt=null) | |
Ping the server and try to reconnect if it there is no connection. | |
query ( $sql, $fname=__METHOD__, $tempIgnore=false) | |
Run an SQL query and return the result. | |
replace ( $table, $uniqueIndexes, $rows, $fname=__METHOD__) | |
REPLACE query wrapper. | |
restoreFlags ( $state=self::RESTORE_PRIOR) | |
Restore the flags to their prior state before the last setFlag/clearFlag call. | |
rollback ( $fname=__METHOD__, $flush='') | |
Rollback a transaction previously started using begin(). | |
select ( $table, $vars, $conds='', $fname=__METHOD__, $options=[], $join_conds=[]) | |
Execute a SELECT query constructed using the various parameters provided. | |
selectDB ( $db) | |
Change the current database. | |
selectField ( $table, $var, $cond='', $fname=__METHOD__, $options=[], $join_conds=[]) | |
A SELECT wrapper which returns a single field from a single result row. | |
selectFieldValues ( $table, $var, $cond='', $fname=__METHOD__, $options=[], $join_conds=[]) | |
A SELECT wrapper which returns a list of single field values from result rows. | |
selectRow ( $table, $vars, $conds, $fname=__METHOD__, $options=[], $join_conds=[]) | |
Single row SELECT wrapper. | |
selectRowCount ( $tables, $vars=' *', $conds='', $fname=__METHOD__, $options=[], $join_conds=[]) | |
Get the number of rows in dataset. | |
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. | |
serverIsReadOnly () | |
setBigSelects ( $value=true) | |
Allow or deny "big selects" for this session only. | |
setFlag ( $flag, $remember=self::REMEMBER_NOTHING) | |
Set a flag for this connection. | |
setIndexAliases (array $aliases) | |
Convert certain index names to alternative names before querying the DB. | |
setLazyMasterHandle (IDatabase $conn) | |
Set a lazy-connecting DB handle to the master DB (for replication status purposes) | |
setLBInfo ( $name, $value=null) | |
Set the LB info array, or a member of it. | |
setSchemaVars ( $vars) | |
Set variables to be used in sourceFile/sourceStream, in preference to the ones in $GLOBALS. | |
setSessionOptions (array $options) | |
Override database's default behavior. | |
setTableAliases (array $aliases) | |
Make certain table names use their own database, schema, and table prefix when passed into SQL queries pre-escaped and without a qualified database name. | |
setTransactionListener ( $name, callable $callback=null) | |
Run a callback each time any transaction commits or rolls back. | |
startAtomic ( $fname=__METHOD__, $cancelable=IDatabase::ATOMIC_NOT_CANCELABLE) | |
Begin an atomic section of SQL statements. | |
strreplace ( $orig, $old, $new) | |
Returns a command for str_replace function in SQL query. | |
tableExists ( $table, $fname=__METHOD__) | |
Query whether a given table exists. | |
tablePrefix ( $prefix=null) | |
Get/set the table prefix. | |
timestamp ( $ts=0) | |
Convert a timestamp in one of the formats accepted by wfTimestamp() to the format used for inserting into timestamp fields in this DBMS. | |
timestampOrNull ( $ts=null) | |
Convert a timestamp in one of the formats accepted by wfTimestamp() to the format used for inserting into timestamp fields in this DBMS. | |
trxLevel () | |
Gets the current transaction level. | |
trxTimestamp () | |
Get the UNIX timestamp of the time that the transaction was established. | |
unionConditionPermutations ( $table, $vars, array $permute_conds, $extra_conds='', $fname=__METHOD__, $options=[], $join_conds=[]) | |
Construct a UNION query for permutations of conditions. | |
unionQueries ( $sqls, $all) | |
Construct a UNION query This is used for providing overload point for other DB abstractions not compatible with the MySQL syntax. | |
unionSupportsOrderAndLimit () | |
Returns true if current database backend supports ORDER BY or LIMIT for separate subqueries within the UNION construct. | |
unlock ( $lockName, $method) | |
Release a lock. | |
update ( $table, $values, $conds, $fname=__METHOD__, $options=[]) | |
UPDATE wrapper. | |
upsert ( $table, array $rows, array $uniqueIndexes, array $set, $fname=__METHOD__) | |
INSERT ON DUPLICATE KEY UPDATE wrapper, upserts an array into a table. | |
wasConnectionLoss () | |
Determines if the last query error was due to a dropped connection. | |
wasDeadlock () | |
Determines if the last failure was due to a deadlock. | |
wasErrorReissuable () | |
Determines if the last query error was due to something outside of the query itself. | |
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. | |
writesOrCallbacksPending () | |
Returns true if there is a transaction/round open with possible write queries or transaction pre-commit/idle callbacks waiting on it to finish. | |
writesPending () | |
Public Member Functions inherited from Wikimedia\Rdbms\IDatabase | |
buildSubString ( $input, $startPosition, $length=null) | |
Build a SUBSTRING function. | |
Additional Inherited Members | |
Public Attributes inherited from Wikimedia\Rdbms\DBConnRef | |
const | FLD_DOMAIN = 2 |
const | FLD_FLAGS = 3 |
const | FLD_GROUP = 1 |
const | FLD_INDEX = 0 |
Helper class to handle automatically marking connections as reusable (via RAII pattern) as well handling deferring the actual network connection until the handle is used.
Definition at line 13 of file MaintainableDBConnRef.php.
Wikimedia\Rdbms\MaintainableDBConnRef::deadlockLoop | ( | ) |
Perform a deadlock-prone transaction.
This function invokes a callback function to perform a set of write queries. If a deadlock occurs during the processing, the transaction will be rolled back and the callback function will be called again.
Avoid using this method outside of Job or Maintenance classes.
Usage: $dbw->deadlockLoop( callback, ... );
Extra arguments are passed through to the specified callback function. This method requires that no transactions are already active to avoid causing premature commits or exceptions.
Returns whatever the callback function returned on its successful, iteration, or false on error, for example if the retry limit was reached.
DBUnexpectedError | |
Exception |
Implements Wikimedia\Rdbms\IMaintainableDatabase.
Definition at line 50 of file MaintainableDBConnRef.php.
References Wikimedia\Rdbms\DBConnRef\__call().
Wikimedia\Rdbms\MaintainableDBConnRef::dropTable | ( | $tableName, | |
$fName = __METHOD__ ) |
Delete a table.
string | $tableName | |
string | $fName |
Implements Wikimedia\Rdbms\IMaintainableDatabase.
Definition at line 46 of file MaintainableDBConnRef.php.
References Wikimedia\Rdbms\DBConnRef\__call().
Wikimedia\Rdbms\MaintainableDBConnRef::duplicateTableStructure | ( | $oldName, | |
$newName, | |||
$temporary = false, | |||
$fname = __METHOD__ ) |
Creates a new table with structure copied from existing table.
Note that unlike most database abstraction functions, this function does not automatically append database prefix, because it works at a lower abstraction level. The table names passed to this function shall not be quoted (this function calls addIdentifierQuotes() when needed).
string | $oldName | Name of table whose structure should be copied |
string | $newName | Name of table to be created |
bool | $temporary | Whether the new table should be temporary |
string | $fname | Calling function name |
RuntimeException |
Implements Wikimedia\Rdbms\IMaintainableDatabase.
Definition at line 66 of file MaintainableDBConnRef.php.
References Wikimedia\Rdbms\DBConnRef\__call().
Wikimedia\Rdbms\MaintainableDBConnRef::fieldInfo | ( | $table, | |
$field ) |
mysql_fetch_field() wrapper Returns false if the field doesn't exist
string | $table | Table name |
string | $field | Field name |
Implements Wikimedia\Rdbms\IMaintainableDatabase.
Definition at line 92 of file MaintainableDBConnRef.php.
References Wikimedia\Rdbms\DBConnRef\__call().
Wikimedia\Rdbms\MaintainableDBConnRef::indexUnique | ( | $table, | |
$index ) |
Determines if a given index is unique.
string | $table | |
string | $index |
Implements Wikimedia\Rdbms\IMaintainableDatabase.
Definition at line 84 of file MaintainableDBConnRef.php.
References Wikimedia\Rdbms\DBConnRef\__call().
Wikimedia\Rdbms\MaintainableDBConnRef::listTables | ( | $prefix = null, | |
$fname = __METHOD__ ) |
List all tables on the database.
string | $prefix | Only show tables with this prefix, e.g. mw_ |
string | $fname | Calling function name |
DBError |
Implements Wikimedia\Rdbms\IMaintainableDatabase.
Definition at line 88 of file MaintainableDBConnRef.php.
References Wikimedia\Rdbms\DBConnRef\__call().
Wikimedia\Rdbms\MaintainableDBConnRef::listViews | ( | $prefix = null, | |
$fname = __METHOD__ ) |
Lists all the VIEWs in the database.
string | $prefix | Only show VIEWs with this prefix, eg. unit_test_ |
string | $fname | Name of calling function |
RuntimeException |
Implements Wikimedia\Rdbms\IMaintainableDatabase.
Definition at line 54 of file MaintainableDBConnRef.php.
References Wikimedia\Rdbms\DBConnRef\__call().
Wikimedia\Rdbms\MaintainableDBConnRef::lockTables | ( | array | $read, |
array | $write, | ||
$method ) |
Lock specific tables.
Any pending transaction should be resolved before calling this method, since: a) Doing so resets any REPEATABLE-READ snapshot of the data to a fresh one. b) Previous row and table locks from the transaction or session may be released by LOCK TABLES, which may be unsafe for the changes in such a transaction. c) The main use case of lockTables() is to avoid deadlocks and timeouts by locking entire tables in order to do long-running, batched, and lag-aware, updates. Batching and replication lag checks do not work when all the updates happen in a transaction.
Always get all relevant table locks up-front in one call, since LOCK TABLES might release any prior table locks on some RDBMes (e.g MySQL).
For compatibility, callers should check tableLocksHaveTransactionScope() before using this method. If locks are scoped specifically to transactions then caller must either:
If session scoped locks are not supported, then calling lockTables() will trigger startAtomic(), with unlockTables() triggering endAtomic(). This will automatically start a transaction if one is not already present and cause the locks to be released when the transaction finishes (normally during the unlockTables() call).
In any case, avoid using begin()/commit() in code that runs while such table locks are acquired, as that breaks in case when a transaction is needed. The startAtomic() and endAtomic() methods are safe, however, since they will join any existing transaction.
array | $read | Array of tables to lock for read access |
array | $write | Array of tables to lock for write access |
string | $method | Name of caller |
Implements Wikimedia\Rdbms\IMaintainableDatabase.
Definition at line 76 of file MaintainableDBConnRef.php.
References Wikimedia\Rdbms\DBConnRef\__call().
Wikimedia\Rdbms\MaintainableDBConnRef::sourceFile | ( | $filename, | |
callable | $lineCallback = null, | ||
callable | $resultCallback = null, | ||
$fname = false, | |||
callable | $inputCallback = null ) |
Read and execute SQL commands from a file.
Returns true on success, error string or exception on failure (depending on object's error ignore settings).
string | $filename | File name to open |
callable | null | $lineCallback | Optional function called before reading each line |
callable | null | $resultCallback | Optional function called for each MySQL result |
bool | string | $fname | Calling function name or false if name should be generated dynamically using $filename |
callable | null | $inputCallback | Optional function called for each complete line sent |
Exception |
Implements Wikimedia\Rdbms\IMaintainableDatabase.
Definition at line 26 of file MaintainableDBConnRef.php.
References Wikimedia\Rdbms\DBConnRef\__call().
Wikimedia\Rdbms\MaintainableDBConnRef::sourceStream | ( | $fp, | |
callable | $lineCallback = null, | ||
callable | $resultCallback = null, | ||
$fname = __METHOD__, | |||
callable | $inputCallback = null ) |
Read and execute commands from an open file handle.
Returns true on success, error string or exception on failure (depending on object's error ignore settings).
resource | $fp | File handle |
callable | null | $lineCallback | Optional function called before reading each query |
callable | null | $resultCallback | Optional function called for each MySQL result |
string | $fname | Calling function name |
callable | null | $inputCallback | Optional function called for each complete query sent |
Implements Wikimedia\Rdbms\IMaintainableDatabase.
Definition at line 36 of file MaintainableDBConnRef.php.
References Wikimedia\Rdbms\DBConnRef\__call().
Wikimedia\Rdbms\MaintainableDBConnRef::streamStatementEnd | ( | & | $sql, |
& | $newLine ) |
Called by sourceStream() to check if we've reached a statement end.
string | &$sql | SQL assembled so far |
string | &$newLine | New line about to be added to $sql |
Implements Wikimedia\Rdbms\IMaintainableDatabase.
Definition at line 62 of file MaintainableDBConnRef.php.
References Wikimedia\Rdbms\DBConnRef\__call().
Wikimedia\Rdbms\MaintainableDBConnRef::tableLocksHaveTransactionScope | ( | ) |
Checks if table locks acquired by lockTables() are transaction-bound in their scope.
Transaction-bound table locks will be released when the current transaction terminates. Table locks that are not bound to a transaction are not effected by BEGIN/COMMIT/ROLLBACK and will last until either lockTables()/unlockTables() is called or the TCP connection to the database is closed.
Implements Wikimedia\Rdbms\IMaintainableDatabase.
Definition at line 72 of file MaintainableDBConnRef.php.
References Wikimedia\Rdbms\DBConnRef\__call().
Wikimedia\Rdbms\MaintainableDBConnRef::tableName | ( | $name, | |
$format = 'quoted' ) |
Format a table name ready for use in constructing an SQL query.
This does two important things: it quotes the table names to clean them up, and it adds a table prefix if only given a table name with no quotes.
All functions of this object which require a table name call this function themselves. Pass the canonical name to such functions. This is only needed when calling query() directly.
string | $name | Database table name |
string | $format | One of: quoted - Automatically pass the table name through addIdentifierQuotes() so that it can be used in a query. raw - Do not add identifier quotes to the table name |
Implements Wikimedia\Rdbms\IMaintainableDatabase.
Definition at line 14 of file MaintainableDBConnRef.php.
References Wikimedia\Rdbms\DBConnRef\__call().
Wikimedia\Rdbms\MaintainableDBConnRef::tableNames | ( | ) |
Fetch a number of table names into an array This is handy when you need to construct SQL for joins.
Example: list( $user, $watchlist ) = $dbr->tableNames( 'user', 'watchlist' ) ); $sql = "SELECT wl_namespace, wl_title FROM $watchlist, $user WHERE wl_user=user_id AND wl_user=$nameWithQuotes";
Implements Wikimedia\Rdbms\IMaintainableDatabase.
Definition at line 18 of file MaintainableDBConnRef.php.
References Wikimedia\Rdbms\DBConnRef\__call().
Wikimedia\Rdbms\MaintainableDBConnRef::tableNamesN | ( | ) |
Fetch a number of table names into an zero-indexed numerical array This is handy when you need to construct SQL for joins.
Example: list( $user, $watchlist ) = $dbr->tableNamesN( 'user', 'watchlist' ); $sql = "SELECT wl_namespace,wl_title FROM $watchlist,$user WHERE wl_user=user_id AND wl_user=$nameWithQuotes";
Implements Wikimedia\Rdbms\IMaintainableDatabase.
Definition at line 22 of file MaintainableDBConnRef.php.
References Wikimedia\Rdbms\DBConnRef\__call().
Wikimedia\Rdbms\MaintainableDBConnRef::textFieldSize | ( | $table, | |
$field ) |
Returns the size of a text field, or -1 for "unlimited".
string | $table | |
string | $field |
Implements Wikimedia\Rdbms\IMaintainableDatabase.
Definition at line 58 of file MaintainableDBConnRef.php.
References Wikimedia\Rdbms\DBConnRef\__call().
Wikimedia\Rdbms\MaintainableDBConnRef::unlockTables | ( | $method | ) |
Unlock all tables locked via lockTables()
If table locks are scoped to transactions, then locks might not be released until the transaction ends, which could happen after this method is called.
string | $method | The caller |
Implements Wikimedia\Rdbms\IMaintainableDatabase.
Definition at line 80 of file MaintainableDBConnRef.php.
References Wikimedia\Rdbms\DBConnRef\__call().