MediaWiki
REL1_22
|
Database abstraction object for MySQL. More...
Public Member Functions | |
addIdentifierQuotes ($s) | |
MySQL uses `backticks` for identifier quoting instead of the sql standard "double quotes". | |
dataSeek ($res, $row) | |
deleteJoin ($delTable, $joinTable, $delVar, $joinVar, $conds, $fname=__METHOD__) | |
DELETE where the condition is a join. | |
dropTable ($tableName, $fName=__METHOD__) | |
duplicateTableStructure ($oldName, $newName, $temporary=false, $fname=__METHOD__) | |
estimateRowCount ($table, $vars= '*', $conds= '', $fname=__METHOD__, $options=array()) | |
Estimate rows in dataset Returns estimated count, based on EXPLAIN output Takes same arguments as Database::select() | |
fetchObject ($res) | |
fetchRow ($res) | |
fieldInfo ($table, $field) | |
fieldName ($res, $n) | |
freeResult ($res) | |
getLag () | |
Returns slave lag. | |
getLagFromProcesslist () | |
getLagFromSlaveStatus () | |
getMasterPos () | |
Get the position of the master from SHOW MASTER STATUS. | |
getMysqlStatus ($which="%") | |
Get status information from SHOW STATUS in an associative array. | |
getSearchEngine () | |
Get search engine class. | |
getServerUptime () | |
Determines how long the server has been up. | |
getSlavePos () | |
Get the position of the master from SHOW SLAVE STATUS. | |
getSoftwareLink () | |
getType () | |
indexInfo ($table, $index, $fname=__METHOD__) | |
Get information about an index into an object Returns false if the index does not exist. | |
isQuotedIdentifier ($name) | |
isView ($name, $prefix=null) | |
Differentiates between a TABLE and a VIEW. | |
lastError () | |
listTables ($prefix=null, $fname=__METHOD__) | |
List all tables on the database. | |
listViews ($prefix=null, $fname=__METHOD__) | |
Lists VIEWs in the database. | |
lock ($lockName, $method, $timeout=5) | |
lockIsFree ($lockName, $method) | |
Check to see if a named lock is available. | |
lockTables ($read, $write, $method, $lowPriority=true) | |
lowPriorityOption () | |
masterPosWait (DBMasterPos $pos, $timeout) | |
Wait for the slave to catch up to a given master position. | |
numFields ($res) | |
numRows ($res) | |
open ($server, $user, $password, $dbName) | |
ping () | |
replace ($table, $uniqueIndexes, $rows, $fname=__METHOD__) | |
setBigSelects ($value=true) | |
setSessionOptions (array $options) | |
streamStatementEnd (&$sql, &$newLine) | |
Called by sourceStream() to check if we've reached a statement end. | |
strencode ($s) | |
unlock ($lockName, $method) | |
FROM MYSQL DOCS: http://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html#function_release-lock. | |
unlockTables ($method) | |
upsert ($table, array $rows, array $uniqueIndexes, array $set, $fname=__METHOD__) | |
useIndexClause ($index) | |
wasDeadlock () | |
Determines if the last failure was due to a deadlock. | |
wasErrorReissuable () | |
Determines if the last query error was something that should be dealt with by pinging the connection and reissuing the query. | |
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. | |
Protected Member Functions | |
getDefaultSchemaVars () | |
mysqlConnect ($realServer) | |
Open a connection to a MySQL server. | |
mysqlDataSeek ($res, $row) | |
Move internal result pointer. | |
mysqlError ($conn=null) | |
Returns the text of the error message from previous MySQL operation. | |
mysqlFetchArray ($res) | |
Fetch a result row as an associative and numeric array. | |
mysqlFetchField ($res, $n) | |
Get column information from a result. | |
mysqlFetchObject ($res) | |
Fetch a result row as an object. | |
mysqlFieldName ($res, $n) | |
Get the name of the specified field in a result. | |
mysqlFreeResult ($res) | |
Free result memory. | |
mysqlNumFields ($res) | |
Get number of fields in result. | |
mysqlNumRows ($res) | |
Get number of rows in result. | |
mysqlPing () | |
Ping a server connection or reconnect if there is no connection. | |
Protected Attributes | |
MysqlMasterPos | $lastKnownSlavePos |
* |
Database abstraction object for MySQL.
Defines methods independent on used MySQL extension.
Definition at line 32 of file DatabaseMysqlBase.php.
MySQL uses `backticks` for identifier quoting instead of the sql standard "double quotes".
$s | string |
Reimplemented from DatabaseBase.
Definition at line 470 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::dataSeek | ( | $ | res, |
$ | row | ||
) |
$res | ResultWrapper |
$row |
Implements DatabaseType.
Definition at line 300 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::deleteJoin | ( | $ | delTable, |
$ | joinTable, | ||
$ | delVar, | ||
$ | joinVar, | ||
$ | conds, | ||
$ | fname = __METHOD__ |
||
) |
DELETE where the condition is a join.
MySql uses multi-table deletes.
$delTable | string | |
$joinTable | string | |
$delVar | string | |
$joinVar | string | |
$conds | array|string | |
bool | string | $fname | bool |
DBUnexpectedError |
Reimplemented from DatabaseBase.
Definition at line 833 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::dropTable | ( | $ | tableName, |
$ | fName = __METHOD__ |
||
) |
$tableName | |
$fName | string |
Reimplemented from DatabaseBase.
Definition at line 971 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::duplicateTableStructure | ( | $ | oldName, |
$ | newName, | ||
$ | temporary = false , |
||
$ | fname = __METHOD__ |
||
) |
$oldName | |
$newName | |
$temporary | bool |
$fname | string |
Reimplemented from DatabaseBase.
Definition at line 934 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::estimateRowCount | ( | $ | table, |
$ | vars = '*' , |
||
$ | conds = '' , |
||
$ | fname = __METHOD__ , |
||
$ | options = array() |
||
) |
Estimate rows in dataset Returns estimated count, based on EXPLAIN output Takes same arguments as Database::select()
$table | string|array |
$vars | string|array |
$conds | string|array |
$fname | string |
$options | string|array |
Reimplemented from DatabaseBase.
Definition at line 368 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::fetchObject | ( | $ | res | ) |
$res | ResultWrapper |
DBUnexpectedError |
Implements DatabaseType.
Definition at line 168 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::fetchRow | ( | $ | res | ) |
$res | ResultWrapper |
DBUnexpectedError |
Implements DatabaseType.
Definition at line 200 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::fieldInfo | ( | $ | table, |
$ | field | ||
) |
$table | string |
$field | string |
Implements DatabaseType.
Definition at line 390 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::fieldName | ( | $ | res, |
$ | n | ||
) |
$res | ResultWrapper |
$n | string |
Implements DatabaseType.
Definition at line 279 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::freeResult | ( | $ | res | ) |
$res | ResultWrapper |
DBUnexpectedError |
Reimplemented from DatabaseBase.
Definition at line 143 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::getDefaultSchemaVars | ( | ) | [protected] |
Reimplemented from DatabaseBase.
Definition at line 981 of file DatabaseMysqlBase.php.
Returns slave lag.
This will do a SHOW SLAVE STATUS
Reimplemented from DatabaseBase.
Definition at line 514 of file DatabaseMysqlBase.php.
Definition at line 547 of file DatabaseMysqlBase.php.
Definition at line 526 of file DatabaseMysqlBase.php.
Get the position of the master from SHOW MASTER STATUS.
Reimplemented from DatabaseBase.
Definition at line 649 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::getMysqlStatus | ( | $ | which = "%" | ) |
Get status information from SHOW STATUS in an associative array.
$which | string |
Definition at line 994 of file DatabaseMysqlBase.php.
Get search engine class.
All subclasses of this need to implement this if they wish to use searching.
Reimplemented from DatabaseBase.
Definition at line 799 of file DatabaseMysqlBase.php.
Determines how long the server has been up.
Reimplemented from DatabaseBase.
Definition at line 885 of file DatabaseMysqlBase.php.
Get the position of the master from SHOW SLAVE STATUS.
Reimplemented from DatabaseBase.
Definition at line 628 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::indexInfo | ( | $ | table, |
$ | index, | ||
$ | fname = __METHOD__ |
||
) |
Get information about an index into an object Returns false if the index does not exist.
$table | string |
$index | string |
$fname | string |
Implements DatabaseType.
Definition at line 424 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::isQuotedIdentifier | ( | $ | name | ) |
$name | string |
Reimplemented from DatabaseBase.
Definition at line 480 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::isView | ( | $ | name, |
$ | prefix = null |
||
) |
Differentiates between a TABLE and a VIEW.
$name | string: Name of the TABLE/VIEW to test |
Definition at line 1050 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::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 |
Reimplemented from DatabaseBase.
Definition at line 949 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::listViews | ( | $ | prefix = null , |
$ | fname = __METHOD__ |
||
) |
Lists VIEWs in the database.
string | $prefix | Only show VIEWs with this prefix, eg. unit_test_, or $wgDBprefix. Default: null, would return all views. |
string | $fname | Name of calling function |
Reimplemented from DatabaseBase.
Definition at line 1014 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::lock | ( | $ | lockName, |
$ | method, | ||
$ | timeout = 5 |
||
) |
$lockName | string |
$method | string |
$timeout | int |
Reimplemented from DatabaseBase.
Definition at line 734 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::lockIsFree | ( | $ | lockName, |
$ | method | ||
) |
Check to see if a named lock is available.
This is non-blocking.
string | $lockName | name of lock to poll |
string | $method | name of method calling us |
Reimplemented from DatabaseBase.
Definition at line 721 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::lockTables | ( | $ | read, |
$ | write, | ||
$ | method, | ||
$ | lowPriority = true |
||
) |
$read | array |
$write | array |
$method | string |
$lowPriority | bool |
Reimplemented from DatabaseBase.
Definition at line 767 of file DatabaseMysqlBase.php.
Reimplemented from DatabaseBase.
Definition at line 675 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::masterPosWait | ( | DBMasterPos $ | pos, |
$ | timeout | ||
) |
Wait for the slave to catch up to a given master position.
: return values for this and base class are rubbish
$pos | DBMasterPos object |
$timeout | Integer: the maximum number of seconds to wait for synchronisation |
Reimplemented from DatabaseBase.
Definition at line 590 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::mysqlConnect | ( | $ | realServer | ) | [abstract, protected] |
Open a connection to a MySQL server.
$realServer | string |
DBConnectionError |
Reimplemented in DatabaseMysqli, DatabaseMysql, and FakeDatabaseMysqlBase.
DatabaseMysqlBase::mysqlDataSeek | ( | $ | res, |
$ | row | ||
) | [abstract, protected] |
Move internal result pointer.
$res | Raw result |
$row | int |
Reimplemented in DatabaseMysqli, DatabaseMysql, and FakeDatabaseMysqlBase.
DatabaseMysqlBase::mysqlError | ( | $ | conn = null | ) | [abstract, protected] |
Returns the text of the error message from previous MySQL operation.
$conn | Raw connection |
Reimplemented in DatabaseMysqli, DatabaseMysql, and FakeDatabaseMysqlBase.
DatabaseMysqlBase::mysqlFetchArray | ( | $ | res | ) | [abstract, protected] |
Fetch a result row as an associative and numeric array.
$res | Raw result |
Reimplemented in DatabaseMysqli, DatabaseMysql, and FakeDatabaseMysqlBase.
DatabaseMysqlBase::mysqlFetchField | ( | $ | res, |
$ | n | ||
) | [abstract, protected] |
Get column information from a result.
$res | Raw result |
$n | int |
Reimplemented in DatabaseMysqli, DatabaseMysql, and FakeDatabaseMysqlBase.
DatabaseMysqlBase::mysqlFetchObject | ( | $ | res | ) | [abstract, protected] |
Fetch a result row as an object.
$res | Raw result |
Reimplemented in DatabaseMysqli, DatabaseMysql, and FakeDatabaseMysqlBase.
DatabaseMysqlBase::mysqlFieldName | ( | $ | res, |
$ | n | ||
) | [abstract, protected] |
Get the name of the specified field in a result.
$res | Raw result |
$n | int |
Reimplemented in DatabaseMysqli, DatabaseMysql, and FakeDatabaseMysqlBase.
DatabaseMysqlBase::mysqlFreeResult | ( | $ | res | ) | [abstract, protected] |
Free result memory.
$res | Raw result |
Reimplemented in DatabaseMysqli, DatabaseMysql, and FakeDatabaseMysqlBase.
DatabaseMysqlBase::mysqlNumFields | ( | $ | res | ) | [abstract, protected] |
Get number of fields in result.
$res | Raw result |
Reimplemented in DatabaseMysqli, DatabaseMysql, and FakeDatabaseMysqlBase.
DatabaseMysqlBase::mysqlNumRows | ( | $ | res | ) | [abstract, protected] |
Get number of rows in result.
$res | Raw result |
Reimplemented in DatabaseMysqli, DatabaseMysql, and FakeDatabaseMysqlBase.
DatabaseMysqlBase::mysqlPing | ( | ) | [abstract, protected] |
Ping a server connection or reconnect if there is no connection.
Reimplemented in DatabaseMysqli, DatabaseMysql, and FakeDatabaseMysqlBase.
DatabaseMysqlBase::numFields | ( | $ | res | ) |
$res | ResultWrapper |
Implements DatabaseType.
Definition at line 259 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::numRows | ( | $ | res | ) |
DBUnexpectedError |
$res | ResultWrapper |
Implements DatabaseType.
Definition at line 232 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::open | ( | $ | server, |
$ | user, | ||
$ | password, | ||
$ | dbName | ||
) |
$server | string |
$user | string |
$password | string |
$dbName | string |
DBConnectionError |
Implements DatabaseType.
Definition at line 50 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::replace | ( | $ | table, |
$ | uniqueIndexes, | ||
$ | rows, | ||
$ | fname = __METHOD__ |
||
) |
$table | string |
$uniqueIndexes | |
$rows | array |
$fname | string |
Reimplemented from DatabaseBase.
Definition at line 352 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::setBigSelects | ( | $ | value = true | ) |
bool | $value |
Reimplemented from DatabaseBase.
Definition at line 807 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::setSessionOptions | ( | array $ | options | ) |
$options | array |
Reimplemented from DatabaseBase.
Definition at line 696 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::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 |
Reimplemented from DatabaseBase.
Definition at line 704 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::strencode | ( | $ | s | ) |
$s | string |
Implements DatabaseType.
Definition at line 453 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::unlock | ( | $ | lockName, |
$ | method | ||
) |
FROM MYSQL DOCS: http://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html#function_release-lock.
$lockName | string |
$method | string |
Reimplemented from DatabaseBase.
Definition at line 753 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::unlockTables | ( | $ | method | ) |
$method | string |
Reimplemented from DatabaseBase.
Definition at line 788 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::upsert | ( | $ | table, |
array $ | rows, | ||
array $ | uniqueIndexes, | ||
array $ | set, | ||
$ | fname = __METHOD__ |
||
) |
string | $table | |
array | $rows | |
array | $uniqueIndexes | |
array | $set | |
string | $fname | |
array | $options |
Reimplemented from DatabaseBase.
Definition at line 858 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::useIndexClause | ( | $ | index | ) |
$index |
Reimplemented from DatabaseBase.
Definition at line 668 of file DatabaseMysqlBase.php.
Determines if the last failure was due to a deadlock.
Reimplemented from DatabaseBase.
Definition at line 895 of file DatabaseMysqlBase.php.
Determines if the last query error was something that should be dealt with by pinging the connection and reissuing the query.
Reimplemented from DatabaseBase.
Definition at line 914 of file DatabaseMysqlBase.php.
Determines if the last failure was due to a lock timeout.
Reimplemented from DatabaseBase.
Definition at line 904 of file DatabaseMysqlBase.php.
Determines if the last failure was due to the database being read-only.
Reimplemented from DatabaseBase.
Definition at line 923 of file DatabaseMysqlBase.php.
MysqlMasterPos DatabaseMysqlBase::$lastKnownSlavePos [protected] |
*
Definition at line 33 of file DatabaseMysqlBase.php.