MediaWiki  REL1_19
DatabaseMysql Class Reference

Database abstraction object for mySQL Inherit all methods and properties of Database::Database() More...

Inheritance diagram for DatabaseMysql:
Collaboration diagram for DatabaseMysql:

List of all members.

Public Member Functions

 addIdentifierQuotes ($s)
 MySQL uses `backticks` for identifier quoting instead of the sql standard "double quotes".
 affectedRows ()
 close ()
 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)
 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)
 standardSelectDistinct ()
 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

 doQuery ($sql)
 getDefaultSchemaVars ()

Detailed Description

Database abstraction object for mySQL Inherit all methods and properties of Database::Database()

See also:
Database

Definition at line 16 of file DatabaseMysql.php.


Member Function Documentation

MySQL uses `backticks` for identifier quoting instead of the sql standard "double quotes".

Parameters:
$sstring
Returns:
string

Reimplemented from DatabaseBase.

Definition at line 445 of file DatabaseMysql.php.

References strencode().

Referenced by duplicateTableStructure().

Here is the call graph for this function:

Here is the caller graph for this function:

Returns:
int

Implements DatabaseType.

Definition at line 316 of file DatabaseMysql.php.

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 157 of file DatabaseMysql.php.

References DatabaseBase\commit(), and DatabaseBase\trxLevel().

Referenced by open().

Here is the call graph for this function:

Here is the caller graph for this function:

DatabaseMysql::dataSeek ( res,
row 
)
Parameters:
$resResultWrapper
$row
Returns:
bool

Implements DatabaseType.

Definition at line 274 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.

Parameters:
$delTablestring
$joinTablestring
$delVarstring
$joinVarstring
$condsarray|string
$fnamebool
Returns:
bool|ResultWrapper

Reimplemented from DatabaseBase.

Definition at line 782 of file DatabaseMysql.php.

References $fname, DatabaseBase\makeList(), DatabaseBase\query(), and DatabaseBase\tableName().

Here is the call graph for this function:

DatabaseMysql::doQuery ( sql) [protected]
Parameters:
$sqlstring
Returns:
resource

Reimplemented from DatabaseBase.

Definition at line 29 of file DatabaseMysql.php.

References DatabaseBase\bufferResults().

Referenced by masterPosWait().

Here is the call graph for this function:

Here is the caller graph for this function:

DatabaseMysql::dropTable ( tableName,
fName = 'DatabaseMysql::dropTable' 
)
Parameters:
$tableName
$fNamestring
Returns:
bool|ResultWrapper

Reimplemented from DatabaseBase.

Definition at line 889 of file DatabaseMysql.php.

References DatabaseBase\query(), DatabaseBase\tableExists(), and DatabaseBase\tableName().

Here is the call graph for this function:

DatabaseMysql::duplicateTableStructure ( oldName,
newName,
temporary = false,
fname = 'DatabaseMysql::duplicateTableStructure' 
)
Parameters:
$oldName
$newName
$temporarybool
$fnamestring

Reimplemented from DatabaseBase.

Definition at line 852 of file DatabaseMysql.php.

References $fname, addIdentifierQuotes(), and DatabaseBase\query().

Here is the call graph for this function:

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()

Parameters:
$tablestring|array
$varsstring|array
$condsstring|array
$fnamestring
$optionsstring|array
Returns:
int

Reimplemented from DatabaseBase.

Definition at line 343 of file DatabaseMysql.php.

References $fname, $options, $res, $rows, numRows(), and DatabaseBase\select().

Here is the call graph for this function:

Parameters:
$resResultWrapper
Returns:
object|stdClass
Exceptions:
DBUnexpectedError

Implements DatabaseType.

Definition at line 190 of file DatabaseMysql.php.

References $res, lastErrno(), lastError(), wfRestoreWarnings(), and wfSuppressWarnings().

Referenced by getMasterPos(), getSlavePos(), lock(), and unlock().

Here is the call graph for this function:

Here is the caller graph for this function:

Parameters:
$resResultWrapper
Returns:
array
Exceptions:
DBUnexpectedError

Implements DatabaseType.

Definition at line 208 of file DatabaseMysql.php.

References $res, lastErrno(), lastError(), wfRestoreWarnings(), and wfSuppressWarnings().

Referenced by masterPosWait().

Here is the call graph for this function:

Here is the caller graph for this function:

DatabaseMysql::fieldInfo ( table,
field 
)
Parameters:
$tablestring
$fieldstring
Returns:
bool|MySQLField

Implements DatabaseType.

Definition at line 365 of file DatabaseMysql.php.

References $n, $res, DatabaseBase\query(), and DatabaseBase\tableName().

Here is the call graph for this function:

DatabaseMysql::fieldName ( res,
n 
)
Parameters:
$resResultWrapper
$nstring
Returns:
string

Implements DatabaseType.

Definition at line 255 of file DatabaseMysql.php.

References $n, and $res.

Parameters:
$resResultWrapper
Exceptions:
DBUnexpectedError

Reimplemented from DatabaseBase.

Definition at line 173 of file DatabaseMysql.php.

References $ok, $res, wfRestoreWarnings(), and wfSuppressWarnings().

Here is the call graph for this function:

Returns:
array

Reimplemented from DatabaseBase.

Definition at line 899 of file DatabaseMysql.php.

Returns slave lag.

This will do a SHOW SLAVE STATUS

Returns:
int

Reimplemented from DatabaseBase.

Definition at line 480 of file DatabaseMysql.php.

References getLagFromSlaveStatus(), and wfDebug().

Here is the call graph for this function:

Deprecated:
in 1.19, use getLagFromSlaveStatus
Returns:
bool|int

Definition at line 513 of file DatabaseMysql.php.

References $res, DatabaseBase\query(), and wfDeprecated().

Here is the call graph for this function:

Returns:
bool|int

Definition at line 492 of file DatabaseMysql.php.

References $res, and DatabaseBase\query().

Referenced by getLag().

Here is the call graph for this function:

Here is the caller graph for this function:

Get the position of the master from SHOW MASTER STATUS.

Returns:
MySQLMasterPos|false

Reimplemented from DatabaseBase.

Definition at line 611 of file DatabaseMysql.php.

References $res, fetchObject(), and DatabaseBase\query().

Here is the call graph for this function:

DatabaseMysql::getMysqlStatus ( which = "%")

Get status information from SHOW STATUS in an associative array.

Parameters:
$whichstring
Returns:
array

Definition at line 912 of file DatabaseMysql.php.

References $res, and DatabaseBase\query().

Referenced by getServerUptime().

Here is the call graph for this function:

Here is the caller graph for this function:

Get search engine class.

All subclasses of this need to implement this if they wish to use searching.

Returns:
String

Reimplemented from DatabaseBase.

Definition at line 749 of file DatabaseMysql.php.

Determines how long the server has been up.

Returns:
int

Reimplemented from DatabaseBase.

Definition at line 803 of file DatabaseMysql.php.

References getMysqlStatus().

Here is the call graph for this function:

Returns:
string

Implements DatabaseType.

Definition at line 629 of file DatabaseMysql.php.

Get the position of the master from SHOW SLAVE STATUS.

Returns:
MySQLMasterPos|false

Reimplemented from DatabaseBase.

Definition at line 590 of file DatabaseMysql.php.

References $res, fetchObject(), and DatabaseBase\query().

Here is the call graph for this function:

static DatabaseMysql::getSoftwareLink ( ) [static]
Returns:
string

Implements DatabaseType.

Definition at line 651 of file DatabaseMysql.php.

Returns:
string

Implements DatabaseType.

Definition at line 21 of file DatabaseMysql.php.

DatabaseMysql::indexInfo ( table,
index,
fname = 'DatabaseMysql::indexInfo' 
)

Get information about an index into an object Returns false if the index does not exist.

Parameters:
$tablestring
$indexstring
$fnamestring
Returns:
false|array

Implements DatabaseType.

Definition at line 390 of file DatabaseMysql.php.

References $fname, $res, $result, DatabaseBase\indexName(), DatabaseBase\query(), and DatabaseBase\tableName().

Here is the call graph for this function:

Returns:
int

Implements DatabaseType.

Definition at line 265 of file DatabaseMysql.php.

Parameters:
$namestring
Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 453 of file DatabaseMysql.php.

Returns:
int

Implements DatabaseType.

Definition at line 284 of file DatabaseMysql.php.

Referenced by fetchObject(), fetchRow(), numRows(), wasDeadlock(), wasErrorReissuable(), wasLockTimeout(), and wasReadOnlyError().

Here is the caller graph for this function:

Returns:
string

Implements DatabaseType.

Definition at line 295 of file DatabaseMysql.php.

References wfRestoreWarnings(), and wfSuppressWarnings().

Referenced by fetchObject(), fetchRow(), numRows(), open(), and wasReadOnlyError().

Here is the call graph for this function:

Here is the caller graph for this function:

DatabaseMysql::listTables ( prefix = null,
fname = 'DatabaseMysql::listTables' 
)

List all tables on the database.

Parameters:
$prefixOnly show tables with this prefix, e.g. mw_
$fnameString: calling function name
Returns:
array

Reimplemented from DatabaseBase.

Definition at line 867 of file DatabaseMysql.php.

References $fname, $result, and DatabaseBase\query().

Here is the call graph for this function:

DatabaseMysql::lock ( lockName,
method,
timeout = 5 
)
Parameters:
$lockNamestring
$methodstring
$timeoutint
Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 688 of file DatabaseMysql.php.

References $result, DatabaseBase\addQuotes(), fetchObject(), DatabaseBase\query(), and wfDebug().

Here is the call graph for this function:

DatabaseMysql::lockTables ( read,
write,
method,
lowPriority = true 
)
Parameters:
$readarray
$writearray
$methodstring
$lowPrioritybool

Reimplemented from DatabaseBase.

Definition at line 720 of file DatabaseMysql.php.

References DatabaseBase\query(), and DatabaseBase\tableName().

Here is the call graph for this function:

Returns:
string

Reimplemented from DatabaseBase.

Definition at line 644 of file DatabaseMysql.php.

DatabaseMysql::masterPosWait ( DBMasterPos pos,
timeout 
)

Wait for the slave to catch up to a given master position.

Parameters:
$posDBMasterPos object
$timeoutInteger: the maximum number of seconds to wait for synchronisation
Returns:
bool|string

Reimplemented from DatabaseBase.

Definition at line 555 of file DatabaseMysql.php.

References $fname, $res, DatabaseBase\addQuotes(), DatabaseBase\commit(), doQuery(), fetchRow(), wfProfileIn(), and wfProfileOut().

Here is the call graph for this function:

Parameters:
$resResultWrapper
Returns:
int

Implements DatabaseType.

Definition at line 243 of file DatabaseMysql.php.

References $res.

Exceptions:
DBUnexpectedError
Parameters:
$resResultWrapper
Returns:
int

Implements DatabaseType.

Definition at line 226 of file DatabaseMysql.php.

References $n, $res, lastErrno(), lastError(), wfRestoreWarnings(), and wfSuppressWarnings().

Referenced by estimateRowCount().

Here is the call graph for this function:

Here is the caller graph for this function:

DatabaseMysql::open ( server,
user,
password,
dbName 
)
Parameters:
$serverstring
$userstring
$passwordstring
$dbNamestring
Returns:
bool
Exceptions:
DBConnectionError

Implements DatabaseType.

Definition at line 46 of file DatabaseMysql.php.

References $success, $user, $wgAllDBsAreLocalhost, $wgDBmysql5, $wgSQLMode, DatabaseBase\addQuotes(), close(), DatabaseBase\installErrorHandler(), lastError(), DatabaseBase\query(), DatabaseBase\reportConnectionError(), DatabaseBase\restoreErrorHandler(), wfDebug(), wfDl(), wfHostname(), wfLogDBError(), wfProfileIn(), wfProfileOut(), wfRestoreWarnings(), and wfSuppressWarnings().

Referenced by ping().

Here is the call graph for this function:

Here is the caller graph for this function:

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 460 of file DatabaseMysql.php.

References open().

Referenced by strencode().

Here is the call graph for this function:

Here is the caller graph for this function:

DatabaseMysql::replace ( table,
uniqueIndexes,
rows,
fname = 'DatabaseMysql::replace' 
)
Parameters:
$tablestring
$uniqueIndexes
$rowsarray
$fnamestring
Returns:
ResultWrapper

Reimplemented from DatabaseBase.

Definition at line 327 of file DatabaseMysql.php.

References $fname, $rows, and DatabaseBase\nativeReplace().

Here is the call graph for this function:

Parameters:
$db
Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 418 of file DatabaseMysql.php.

DatabaseMysql::setBigSelects ( value = true)
Parameters:
bool$value
Returns:
mixed

Reimplemented from DatabaseBase.

Definition at line 757 of file DatabaseMysql.php.

References DatabaseBase\query(), and DatabaseBase\selectField().

Here is the call graph for this function:

DatabaseMysql::setSessionOptions ( array $  options)
Parameters:
$optionsarray

Reimplemented from DatabaseBase.

Definition at line 665 of file DatabaseMysql.php.

References DatabaseBase\query().

Here is the call graph for this function:

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 658 of file DatabaseMysql.php.

DatabaseMysql::streamStatementEnd ( &$  sql,
&$  newLine 
)

Called by sourceStream() to check if we've reached a statement end.

Parameters:
$sqlString SQL assembled so far
$newLineString New line about to be added to $sql
Returns:
Bool Whether $newLine contains end of the statement

Reimplemented from DatabaseBase.

Definition at line 673 of file DatabaseMysql.php.

Parameters:
$sstring
Returns:
string

Implements DatabaseType.

Definition at line 428 of file DatabaseMysql.php.

References ping().

Referenced by addIdentifierQuotes().

Here is the call graph for this function:

Here is the caller graph for this function:

DatabaseMysql::unlock ( lockName,
method 
)

FROM MYSQL DOCS: http://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html#function_release-lock.

Parameters:
$lockNamestring
$methodstring
Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 707 of file DatabaseMysql.php.

References $result, DatabaseBase\addQuotes(), fetchObject(), and DatabaseBase\query().

Here is the call graph for this function:

Parameters:
$methodstring

Reimplemented from DatabaseBase.

Definition at line 739 of file DatabaseMysql.php.

References DatabaseBase\query().

Here is the call graph for this function:

Parameters:
$index
Returns:
string

Reimplemented from DatabaseBase.

Definition at line 637 of file DatabaseMysql.php.

References DatabaseBase\indexName().

Here is the call graph for this function:

Determines if the last failure was due to a deadlock.

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 813 of file DatabaseMysql.php.

References lastErrno().

Here is the call graph for this function:

Determines if the last query error was something that should be dealt with by pinging the connection and reissuing the query.

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 832 of file DatabaseMysql.php.

References lastErrno().

Here is the call graph for this function:

Determines if the last failure was due to a lock timeout.

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 822 of file DatabaseMysql.php.

References lastErrno().

Here is the call graph for this function:

Determines if the last failure was due to the database being read-only.

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 841 of file DatabaseMysql.php.

References false, lastErrno(), and lastError().

Here is the call graph for this function:


The documentation for this class was generated from the following file: