MediaWiki
REL1_20
|
Database abstraction object for mySQL Inherit all methods and properties of Database::Database() More...
Public Member Functions | |
addIdentifierQuotes ($s) | |
MySQL uses `backticks` for identifier quoting instead of the sql standard "double quotes". | |
affectedRows () | |
dataSeek ($res, $row) | |
deleteJoin ($delTable, $joinTable, $delVar, $joinVar, $conds, $fname= 'DatabaseBase::deleteJoin') | |
DELETE where the condition is a join. | |
dropTable ($tableName, $fName= 'DatabaseMysql::dropTable') | |
duplicateTableStructure ($oldName, $newName, $temporary=false, $fname= 'DatabaseMysql::duplicateTableStructure') | |
estimateRowCount ($table, $vars='*', $conds='', $fname= 'DatabaseMysql::estimateRowCount', $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. | |
getServerVersion () | |
getSlavePos () | |
Get the position of the master from SHOW SLAVE STATUS. | |
getType () | |
indexInfo ($table, $index, $fname= 'DatabaseMysql::indexInfo') | |
Get information about an index into an object Returns false if the index does not exist. | |
insertId () | |
isQuotedIdentifier ($name) | |
lastErrno () | |
lastError () | |
listTables ($prefix=null, $fname= 'DatabaseMysql::listTables') | |
List all tables on 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= 'DatabaseMysql::replace') | |
selectDB ($db) | |
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) | |
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. | |
Static Public Member Functions | |
static | getSoftwareLink () |
Protected Member Functions | |
closeConnection () | |
doQuery ($sql) | |
getDefaultSchemaVars () |
Database abstraction object for mySQL Inherit all methods and properties of Database::Database()
Definition at line 31 of file DatabaseMysql.php.
MySQL uses `backticks` for identifier quoting instead of the sql standard "double quotes".
$s | string |
Reimplemented from DatabaseBase.
Definition at line 466 of file DatabaseMysql.php.
References $s, and strencode().
Referenced by duplicateTableStructure().
DatabaseMysql::closeConnection | ( | ) | [protected] |
DatabaseMysql::dataSeek | ( | $ | res, |
$ | row | ||
) |
$res | ResultWrapper |
$row |
Implements DatabaseType.
Definition at line 295 of file DatabaseMysql.php.
References $res.
DatabaseMysql::deleteJoin | ( | $ | delTable, |
$ | joinTable, | ||
$ | delVar, | ||
$ | joinVar, | ||
$ | conds, | ||
$ | fname = 'DatabaseBase::deleteJoin' |
||
) |
DELETE where the condition is a join.
MySql uses multi-table deletes.
$delTable | string |
$joinTable | string |
$delVar | string |
$joinVar | string |
$conds | array|string |
$fname | bool |
Reimplemented from DatabaseBase.
Definition at line 811 of file DatabaseMysql.php.
References $fname, DatabaseBase\makeList(), DatabaseBase\query(), and DatabaseBase\tableName().
DatabaseMysql::doQuery | ( | $ | sql | ) | [protected] |
$sql | string |
Reimplemented from DatabaseBase.
Definition at line 44 of file DatabaseMysql.php.
References DatabaseBase\bufferResults().
Referenced by masterPosWait().
DatabaseMysql::dropTable | ( | $ | tableName, |
$ | fName = 'DatabaseMysql::dropTable' |
||
) |
$tableName | |
$fName | string |
Reimplemented from DatabaseBase.
Definition at line 918 of file DatabaseMysql.php.
References DatabaseBase\query(), DatabaseBase\tableExists(), and DatabaseBase\tableName().
DatabaseMysql::duplicateTableStructure | ( | $ | oldName, |
$ | newName, | ||
$ | temporary = false , |
||
$ | fname = 'DatabaseMysql::duplicateTableStructure' |
||
) |
$oldName | |
$newName | |
$temporary | bool |
$fname | string |
Reimplemented from DatabaseBase.
Definition at line 881 of file DatabaseMysql.php.
References $fname, addIdentifierQuotes(), and DatabaseBase\query().
DatabaseMysql::estimateRowCount | ( | $ | table, |
$ | vars = '*' , |
||
$ | conds = '' , |
||
$ | fname = 'DatabaseMysql::estimateRowCount' , |
||
$ | 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 364 of file DatabaseMysql.php.
References $fname, $options, $res, numRows(), and DatabaseBase\select().
DatabaseMysql::fetchObject | ( | $ | res | ) |
$res | ResultWrapper |
DBUnexpectedError |
Implements DatabaseType.
Definition at line 199 of file DatabaseMysql.php.
References $res, lastErrno(), lastError(), wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by getMasterPos(), getSlavePos(), lock(), lockIsFree(), and unlock().
DatabaseMysql::fetchRow | ( | $ | res | ) |
$res | ResultWrapper |
DBUnexpectedError |
Implements DatabaseType.
Definition at line 223 of file DatabaseMysql.php.
References $res, lastErrno(), lastError(), wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by masterPosWait().
DatabaseMysql::fieldInfo | ( | $ | table, |
$ | field | ||
) |
$table | string |
$field | string |
Implements DatabaseType.
Definition at line 386 of file DatabaseMysql.php.
References $n, $res, DatabaseBase\query(), and DatabaseBase\tableName().
DatabaseMysql::fieldName | ( | $ | res, |
$ | n | ||
) |
$res | ResultWrapper |
$n | string |
Implements DatabaseType.
Definition at line 276 of file DatabaseMysql.php.
DatabaseMysql::freeResult | ( | $ | res | ) |
$res | ResultWrapper |
DBUnexpectedError |
Reimplemented from DatabaseBase.
Definition at line 182 of file DatabaseMysql.php.
References $ok, $res, wfRestoreWarnings(), and wfSuppressWarnings().
DatabaseMysql::getDefaultSchemaVars | ( | ) | [protected] |
Returns slave lag.
This will do a SHOW SLAVE STATUS
Reimplemented from DatabaseBase.
Definition at line 501 of file DatabaseMysql.php.
References getLagFromSlaveStatus(), and wfDebug().
Definition at line 534 of file DatabaseMysql.php.
References $res, DatabaseBase\query(), and wfDeprecated().
Definition at line 513 of file DatabaseMysql.php.
References $res, and DatabaseBase\query().
Referenced by getLag().
Get the position of the master from SHOW MASTER STATUS.
Reimplemented from DatabaseBase.
Definition at line 632 of file DatabaseMysql.php.
References $res, fetchObject(), and DatabaseBase\query().
DatabaseMysql::getMysqlStatus | ( | $ | which = "%" | ) |
Get status information from SHOW STATUS in an associative array.
$which | string |
Definition at line 941 of file DatabaseMysql.php.
References $res, and DatabaseBase\query().
Referenced by getServerUptime().
Get search engine class.
All subclasses of this need to implement this if they wish to use searching.
Reimplemented from DatabaseBase.
Definition at line 778 of file DatabaseMysql.php.
Determines how long the server has been up.
Reimplemented from DatabaseBase.
Definition at line 832 of file DatabaseMysql.php.
References getMysqlStatus().
Get the position of the master from SHOW SLAVE STATUS.
Reimplemented from DatabaseBase.
Definition at line 611 of file DatabaseMysql.php.
References $res, fetchObject(), and DatabaseBase\query().
static DatabaseMysql::getSoftwareLink | ( | ) | [static] |
DatabaseMysql::indexInfo | ( | $ | table, |
$ | index, | ||
$ | fname = 'DatabaseMysql::indexInfo' |
||
) |
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 411 of file DatabaseMysql.php.
References $fname, $res, $result, DatabaseBase\indexName(), DatabaseBase\query(), and DatabaseBase\tableName().
DatabaseMysql::isQuotedIdentifier | ( | $ | name | ) |
$name | string |
Reimplemented from DatabaseBase.
Definition at line 474 of file DatabaseMysql.php.
Implements DatabaseType.
Definition at line 305 of file DatabaseMysql.php.
Referenced by fetchObject(), fetchRow(), numRows(), wasDeadlock(), wasErrorReissuable(), wasLockTimeout(), and wasReadOnlyError().
Implements DatabaseType.
Definition at line 316 of file DatabaseMysql.php.
References wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by fetchObject(), fetchRow(), numRows(), open(), and wasReadOnlyError().
DatabaseMysql::listTables | ( | $ | prefix = null , |
$ | fname = 'DatabaseMysql::listTables' |
||
) |
List all tables on the database.
$prefix | string Only show tables with this prefix, e.g. mw_ |
$fname | String: calling function name |
Reimplemented from DatabaseBase.
Definition at line 896 of file DatabaseMysql.php.
References $fname, $result, and DatabaseBase\query().
DatabaseMysql::lock | ( | $ | lockName, |
$ | method, | ||
$ | timeout = 5 |
||
) |
$lockName | string |
$method | string |
$timeout | int |
Reimplemented from DatabaseBase.
Definition at line 717 of file DatabaseMysql.php.
References $result, DatabaseBase\addQuotes(), fetchObject(), DatabaseBase\query(), and wfDebug().
DatabaseMysql::lockIsFree | ( | $ | lockName, |
$ | method | ||
) |
Check to see if a named lock is available.
This is non-blocking.
$lockName | String: name of lock to poll |
$method | String: name of method calling us |
Reimplemented from DatabaseBase.
Definition at line 704 of file DatabaseMysql.php.
References $result, DatabaseBase\addQuotes(), fetchObject(), and DatabaseBase\query().
DatabaseMysql::lockTables | ( | $ | read, |
$ | write, | ||
$ | method, | ||
$ | lowPriority = true |
||
) |
$read | array |
$write | array |
$method | string |
$lowPriority | bool |
Reimplemented from DatabaseBase.
Definition at line 749 of file DatabaseMysql.php.
References DatabaseBase\query(), and DatabaseBase\tableName().
DatabaseMysql::masterPosWait | ( | DBMasterPos $ | pos, |
$ | timeout | ||
) |
Wait for the slave to catch up to a given master position.
$pos | DBMasterPos object |
$timeout | Integer: the maximum number of seconds to wait for synchronisation |
Reimplemented from DatabaseBase.
Definition at line 576 of file DatabaseMysql.php.
References $fname, $res, DatabaseBase\addQuotes(), DatabaseBase\commit(), doQuery(), fetchRow(), wfProfileIn(), and wfProfileOut().
DatabaseMysql::numFields | ( | $ | res | ) |
$res | ResultWrapper |
Implements DatabaseType.
Definition at line 264 of file DatabaseMysql.php.
References $res.
DatabaseMysql::numRows | ( | $ | res | ) |
DBUnexpectedError |
$res | ResultWrapper |
Implements DatabaseType.
Definition at line 247 of file DatabaseMysql.php.
References $n, $res, lastErrno(), lastError(), wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by estimateRowCount().
DatabaseMysql::open | ( | $ | server, |
$ | user, | ||
$ | password, | ||
$ | dbName | ||
) |
$server | string |
$user | string |
$password | string |
$dbName | string |
DBConnectionError |
Implements DatabaseType.
Definition at line 61 of file DatabaseMysql.php.
References $success, $user, DatabaseBase\addQuotes(), DatabaseBase\close(), DatabaseBase\installErrorHandler(), lastError(), DatabaseBase\query(), DatabaseBase\reportConnectionError(), DatabaseBase\restoreErrorHandler(), wfDebug(), wfDl(), wfHostname(), wfLogDBError(), wfProfileIn(), wfProfileOut(), wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by ping().
Reimplemented from DatabaseBase.
Definition at line 481 of file DatabaseMysql.php.
References open().
Referenced by strencode().
DatabaseMysql::replace | ( | $ | table, |
$ | uniqueIndexes, | ||
$ | rows, | ||
$ | fname = 'DatabaseMysql::replace' |
||
) |
$table | string |
$uniqueIndexes | |
$rows | array |
$fname | string |
Reimplemented from DatabaseBase.
Definition at line 348 of file DatabaseMysql.php.
References $fname, and DatabaseBase\nativeReplace().
DatabaseMysql::selectDB | ( | $ | db | ) |
$db |
Reimplemented from DatabaseBase.
Definition at line 439 of file DatabaseMysql.php.
DatabaseMysql::setBigSelects | ( | $ | value = true | ) |
bool | $value |
Reimplemented from DatabaseBase.
Definition at line 786 of file DatabaseMysql.php.
References $value, DatabaseBase\query(), and DatabaseBase\selectField().
DatabaseMysql::setSessionOptions | ( | array $ | options | ) |
$options | array |
Reimplemented from DatabaseBase.
Definition at line 679 of file DatabaseMysql.php.
References DatabaseBase\query().
DatabaseMysql::streamStatementEnd | ( | &$ | sql, |
&$ | newLine | ||
) |
Called by sourceStream() to check if we've reached a statement end.
$sql | String SQL assembled so far |
$newLine | String New line about to be added to $sql |
Reimplemented from DatabaseBase.
Definition at line 687 of file DatabaseMysql.php.
DatabaseMysql::strencode | ( | $ | s | ) |
$s | string |
Implements DatabaseType.
Definition at line 449 of file DatabaseMysql.php.
Referenced by addIdentifierQuotes().
DatabaseMysql::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 736 of file DatabaseMysql.php.
References $result, DatabaseBase\addQuotes(), fetchObject(), and DatabaseBase\query().
DatabaseMysql::unlockTables | ( | $ | method | ) |
$method | string |
Reimplemented from DatabaseBase.
Definition at line 768 of file DatabaseMysql.php.
References DatabaseBase\query().
DatabaseMysql::useIndexClause | ( | $ | index | ) |
$index |
Reimplemented from DatabaseBase.
Definition at line 658 of file DatabaseMysql.php.
References DatabaseBase\indexName().
Determines if the last failure was due to a deadlock.
Reimplemented from DatabaseBase.
Definition at line 842 of file DatabaseMysql.php.
References lastErrno().
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 861 of file DatabaseMysql.php.
References lastErrno().
Determines if the last failure was due to a lock timeout.
Reimplemented from DatabaseBase.
Definition at line 851 of file DatabaseMysql.php.
References lastErrno().
Determines if the last failure was due to the database being read-only.
Reimplemented from DatabaseBase.
Definition at line 870 of file DatabaseMysql.php.
References false, lastErrno(), and lastError().