MediaWiki
REL1_24
|
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) | |
fieldType ($res, $n) | |
mysql_field_type() wrapper | |
freeResult ($res) | |
getLag () | |
Returns slave lag. | |
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) | |
setFakeMaster ($enabled=true) | |
Make this connection a fake master. | |
setFakeSlaveLag ($lag) | |
Set lag time in seconds for a fake slave. | |
setSessionOptions (array $options) | |
streamStatementEnd (&$sql, &$newLine) | |
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 | |
connectInitCharset () | |
Set the character set information right after connection. | |
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. | |
mysqlFieldType ($res, $n) | |
Get the type 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. | |
mysqlSetCharset ($charset) | |
Set the character set of the MySQL link. | |
Protected Attributes | |
MysqlMasterPos | $lastKnownSlavePos |
* | |
$mFakeMaster = false | |
null int | $mFakeSlaveLag = null |
* |
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".
string | $s |
Reimplemented from DatabaseBase.
Definition at line 546 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::connectInitCharset | ( | ) | [protected] |
Set the character set information right after connection.
Reimplemented in DatabaseMysqli.
Definition at line 146 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::dataSeek | ( | $ | res, |
$ | row | ||
) |
ResultWrapper | resource | $res | |
int | $row |
Implements DatabaseType.
Definition at line 370 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.
string | $delTable | |
string | $joinTable | |
string | $delVar | |
string | $joinVar | |
array | string | $conds | |
bool | string | $fname |
DBUnexpectedError |
Reimplemented from DatabaseBase.
Definition at line 929 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::dropTable | ( | $ | tableName, |
$ | fName = __METHOD__ |
||
) |
string | $tableName | |
string | $fName |
Reimplemented from DatabaseBase.
Definition at line 1072 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::duplicateTableStructure | ( | $ | oldName, |
$ | newName, | ||
$ | temporary = false , |
||
$ | fname = __METHOD__ |
||
) |
string | $oldName | |
string | $newName | |
bool | $temporary | |
string | $fname |
Reimplemented from DatabaseBase.
Definition at line 1034 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()
string | array | $table | |
string | array | $vars | |
string | array | $conds | |
string | $fname | |
string | array | $options |
Reimplemented from DatabaseBase.
Definition at line 440 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::fetchObject | ( | $ | res | ) |
ResultWrapper | resource | $res |
DBUnexpectedError |
Implements DatabaseType.
Definition at line 204 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::fetchRow | ( | $ | res | ) |
ResultWrapper | resource | $res |
DBUnexpectedError |
Implements DatabaseType.
Definition at line 240 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::fieldInfo | ( | $ | table, |
$ | field | ||
) |
string | $table | |
string | $field |
Implements DatabaseType.
Definition at line 465 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::fieldName | ( | $ | res, |
$ | n | ||
) |
ResultWrapper | resource | $res | |
int | $n |
Implements DatabaseType.
Definition at line 325 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::fieldType | ( | $ | res, |
$ | n | ||
) |
mysql_field_type() wrapper
ResultWrapper | resource | $res | |
int | $n |
Definition at line 348 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::freeResult | ( | $ | res | ) |
ResultWrapper | resource | $res |
DBUnexpectedError |
Reimplemented from DatabaseBase.
Definition at line 179 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::getDefaultSchemaVars | ( | ) | [protected] |
Reimplemented from DatabaseBase.
Definition at line 1083 of file DatabaseMysqlBase.php.
Returns slave lag.
This will do a SHOW SLAVE STATUS
Reimplemented from DatabaseBase.
Definition at line 609 of file DatabaseMysqlBase.php.
Definition at line 622 of file DatabaseMysqlBase.php.
Get the position of the master from SHOW MASTER STATUS.
Reimplemented from DatabaseBase.
Definition at line 730 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::getMysqlStatus | ( | $ | which = "%" | ) |
Get status information from SHOW STATUS in an associative array.
string | $which |
Definition at line 1101 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 896 of file DatabaseMysqlBase.php.
Determines how long the server has been up.
Reimplemented from DatabaseBase.
Definition at line 983 of file DatabaseMysqlBase.php.
Get the position of the master from SHOW SLAVE STATUS.
Reimplemented from DatabaseBase.
Definition at line 703 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.
string | $table | |
string | $index | |
string | $fname |
Implements DatabaseType.
Definition at line 500 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::isQuotedIdentifier | ( | $ | name | ) |
string | $name |
Reimplemented from DatabaseBase.
Definition at line 556 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::isView | ( | $ | name, |
$ | prefix = null |
||
) |
Differentiates between a TABLE and a VIEW.
string | $name | Name of the TABLE/VIEW to test |
string | $prefix |
Definition at line 1159 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 1050 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 1121 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::lock | ( | $ | lockName, |
$ | method, | ||
$ | timeout = 5 |
||
) |
string | $lockName | |
string | $method | |
int | $timeout |
Reimplemented from DatabaseBase.
Definition at line 826 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 812 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::lockTables | ( | $ | read, |
$ | write, | ||
$ | method, | ||
$ | lowPriority = true |
||
) |
array | $read | |
array | $write | |
string | $method | |
bool | $lowPriority |
Reimplemented from DatabaseBase.
Definition at line 862 of file DatabaseMysqlBase.php.
Reimplemented from DatabaseBase.
Definition at line 756 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::masterPosWait | ( | DBMasterPos $ | pos, |
$ | timeout | ||
) |
Wait for the slave to catch up to a given master position.
DBMasterPos | MySQLMasterPos | $pos | |
int | $timeout | The maximum number of seconds to wait for synchronisation |
Reimplemented from DatabaseBase.
Definition at line 648 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::mysqlConnect | ( | $ | realServer | ) | [abstract, protected] |
Open a connection to a MySQL server.
string | $realServer |
DBConnectionError |
Reimplemented in DatabaseMysqli, DatabaseMysql, and FakeDatabaseMysqlBase.
DatabaseMysqlBase::mysqlDataSeek | ( | $ | res, |
$ | row | ||
) | [abstract, protected] |
Move internal result pointer.
ResultWrapper | resource | $res | |
int | $row |
Reimplemented in DatabaseMysqli, DatabaseMysql, and FakeDatabaseMysqlBase.
DatabaseMysqlBase::mysqlError | ( | $ | conn = null | ) | [abstract, protected] |
Returns the text of the error message from previous MySQL operation.
resource | $conn | Raw connection |
Reimplemented in DatabaseMysqli, DatabaseMysql, and FakeDatabaseMysqlBase.
DatabaseMysqlBase::mysqlFetchArray | ( | $ | res | ) | [abstract, protected] |
Fetch a result row as an associative and numeric array.
resource | $res | Raw result |
Reimplemented in DatabaseMysqli, DatabaseMysql, and FakeDatabaseMysqlBase.
DatabaseMysqlBase::mysqlFetchField | ( | $ | res, |
$ | n | ||
) | [abstract, protected] |
Get column information from a result.
resource | $res | Raw result |
int | $n |
Reimplemented in DatabaseMysqli, DatabaseMysql, and FakeDatabaseMysqlBase.
DatabaseMysqlBase::mysqlFetchObject | ( | $ | res | ) | [abstract, protected] |
Fetch a result row as an object.
resource | $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.
ResultWrapper | resource | $res | |
int | $n |
Reimplemented in DatabaseMysqli, DatabaseMysql, and FakeDatabaseMysqlBase.
DatabaseMysqlBase::mysqlFieldType | ( | $ | res, |
$ | n | ||
) | [abstract, protected] |
Get the type of the specified field in a result.
ResultWrapper | resource | $res | |
int | $n |
Reimplemented in DatabaseMysqli, DatabaseMysql, and FakeDatabaseMysqlBase.
DatabaseMysqlBase::mysqlFreeResult | ( | $ | res | ) | [abstract, protected] |
Free result memory.
resource | $res | Raw result |
Reimplemented in DatabaseMysqli, DatabaseMysql, and FakeDatabaseMysqlBase.
DatabaseMysqlBase::mysqlNumFields | ( | $ | res | ) | [abstract, protected] |
Get number of fields in result.
resource | $res | Raw result |
Reimplemented in DatabaseMysqli, DatabaseMysql, and FakeDatabaseMysqlBase.
DatabaseMysqlBase::mysqlNumRows | ( | $ | res | ) | [abstract, protected] |
Get number of rows in result.
resource | $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::mysqlSetCharset | ( | $ | charset | ) | [abstract, protected] |
Set the character set of the MySQL link.
string | $charset |
Reimplemented in DatabaseMysqli, DatabaseMysql, and FakeDatabaseMysqlBase.
DatabaseMysqlBase::numFields | ( | $ | res | ) |
ResultWrapper | resource | $res |
Implements DatabaseType.
Definition at line 304 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::numRows | ( | $ | res | ) |
DBUnexpectedError |
ResultWrapper | resource | $res |
Implements DatabaseType.
Definition at line 276 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::open | ( | $ | server, |
$ | user, | ||
$ | password, | ||
$ | dbName | ||
) |
string | $server | |
string | $user | |
string | $password | |
string | $dbName |
Exception|DBConnectionError |
Implements DatabaseType.
Definition at line 54 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::replace | ( | $ | table, |
$ | uniqueIndexes, | ||
$ | rows, | ||
$ | fname = __METHOD__ |
||
) |
string | $table | |
array | $uniqueIndexes | |
array | $rows | |
string | $fname |
Reimplemented from DatabaseBase.
Definition at line 424 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::setBigSelects | ( | $ | value = true | ) |
bool | $value |
Reimplemented from DatabaseBase.
Definition at line 903 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::setFakeMaster | ( | $ | enabled = true | ) |
Make this connection a fake master.
bool | $enabled |
Reimplemented from DatabaseBase.
Definition at line 598 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::setFakeSlaveLag | ( | $ | lag | ) |
Set lag time in seconds for a fake slave.
int | $lag |
Reimplemented from DatabaseBase.
Definition at line 589 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::setSessionOptions | ( | array $ | options | ) |
array | $options |
Reimplemented from DatabaseBase.
Definition at line 781 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::streamStatementEnd | ( | &$ | sql, |
&$ | newLine | ||
) |
string | $sql | |
string | $newLine |
Reimplemented from DatabaseBase.
Definition at line 794 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::strencode | ( | $ | s | ) |
string | $s |
Implements DatabaseType.
Definition at line 529 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.
string | $lockName | |
string | $method |
Reimplemented from DatabaseBase.
Definition at line 847 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::unlockTables | ( | $ | method | ) |
string | $method |
Reimplemented from DatabaseBase.
Definition at line 884 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 |
Reimplemented from DatabaseBase.
Definition at line 953 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::useIndexClause | ( | $ | index | ) |
string | $index |
Reimplemented from DatabaseBase.
Definition at line 749 of file DatabaseMysqlBase.php.
Determines if the last failure was due to a deadlock.
Reimplemented from DatabaseBase.
Definition at line 994 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 1013 of file DatabaseMysqlBase.php.
Determines if the last failure was due to a lock timeout.
Reimplemented from DatabaseBase.
Definition at line 1003 of file DatabaseMysqlBase.php.
Determines if the last failure was due to the database being read-only.
Reimplemented from DatabaseBase.
Definition at line 1022 of file DatabaseMysqlBase.php.
MysqlMasterPos DatabaseMysqlBase::$lastKnownSlavePos [protected] |
*
Definition at line 33 of file DatabaseMysqlBase.php.
DatabaseMysqlBase::$mFakeMaster = false [protected] |
Definition at line 37 of file DatabaseMysqlBase.php.
null int DatabaseMysqlBase::$mFakeSlaveLag = null [protected] |
*
Definition at line 35 of file DatabaseMysqlBase.php.