MediaWiki  1.23.12
DatabaseType Interface Reference
Inheritance diagram for DatabaseType:

Public Member Functions

 affectedRows ()
 Get the number of rows affected by the last write query. More...
 
 dataSeek ( $res, $row)
 Change the position of the cursor in a result object. More...
 
 fetchObject ( $res)
 Fetch the next row from the given result object, in object form. More...
 
 fetchRow ( $res)
 Fetch the next row from the given result object, in associative array form. More...
 
 fieldInfo ( $table, $field)
 mysql_fetch_field() wrapper Returns false if the field doesn't exist More...
 
 fieldName ( $res, $n)
 Get a field name in a result object. More...
 
 getServerInfo ()
 A string describing the current software version, and possibly other details in a user-friendly way. More...
 
 getServerVersion ()
 A string describing the current software version, like from mysql_get_server_info(). More...
 
 getSoftwareLink ()
 Returns a wikitext link to the DB's website, e.g., return "[http://www.mysql.com/ MySQL]"; Should at least contain plain text, if for some reason your database has no website. More...
 
 getType ()
 Get the type of the DBMS, as it appears in $wgDBtype. More...
 
 indexInfo ( $table, $index, $fname=__METHOD__)
 Get information about an index into an object. More...
 
 insertId ()
 Get the inserted value of an auto-increment row. More...
 
 lastErrno ()
 Get the last error number. More...
 
 lastError ()
 Get a description of the last error. More...
 
 numFields ( $res)
 Get the number of fields in a result object. More...
 
 numRows ( $res)
 Get the number of rows in a result object. More...
 
 open ( $server, $user, $password, $dbName)
 Open a connection to the database. More...
 
 strencode ( $s)
 Wrapper for addslashes() More...
 

Detailed Description

Definition at line 35 of file Database.php.

Member Function Documentation

◆ affectedRows()

DatabaseType::affectedRows ( )

Get the number of rows affected by the last write query.

See also
http://www.php.net/mysql_affected_rows
Returns
int

Implemented in DatabasePostgres, DatabaseOracle, DatabaseSqlite, DatabaseMssql, DatabaseMysqli, DatabaseTestHelper, DatabaseMysql, and FakeDatabaseMysqlBase.

◆ dataSeek()

DatabaseType::dataSeek (   $res,
  $row 
)

Change the position of the cursor in a result object.

See also
http://www.php.net/mysql_data_seek
Parameters
mixed$resA SQL result
int$row

Implemented in DatabasePostgres, DatabaseOracle, DatabaseSqlite, DatabaseMysqlBase, DatabaseMssql, and DatabaseTestHelper.

◆ fetchObject()

DatabaseType::fetchObject (   $res)

Fetch the next row from the given result object, in object form.

Fields can be retrieved with $row->fieldname, with fields acting like member variables. If no more rows are available, false is returned.

Parameters
ResultWrapper | stdClass$resObject as returned from DatabaseBase::query(), etc.
Returns
stdClass|bool
Exceptions
DBUnexpectedErrorThrown if the database returns an error

Implemented in DatabasePostgres, DatabaseOracle, DatabaseSqlite, DatabaseMssql, DatabaseMysqlBase, and DatabaseTestHelper.

Referenced by DatabaseBase\selectRow(), and DatabaseBase\textFieldSize().

◆ fetchRow()

DatabaseType::fetchRow (   $res)

Fetch the next row from the given result object, in associative array form.

Fields are retrieved with $row['fieldname']. If no more rows are available, false is returned.

Parameters
ResultWrapper$resResult object as returned from DatabaseBase::query(), etc.
Returns
array|bool
Exceptions
DBUnexpectedErrorThrown if the database returns an error

Implemented in DatabasePostgres, DatabaseOracle, DatabaseSqlite, DatabaseMssql, DatabaseMysqlBase, and DatabaseTestHelper.

Referenced by DatabaseBase\estimateRowCount(), and DatabaseBase\selectField().

◆ fieldInfo()

DatabaseType::fieldInfo (   $table,
  $field 
)

mysql_fetch_field() wrapper Returns false if the field doesn't exist

Parameters
string$tableTable name
string$fieldField name
Returns
Field

Implemented in DatabasePostgres, DatabaseOracle, DatabaseMssql, DatabaseSqlite, DatabaseMysqlBase, and DatabaseTestHelper.

Referenced by DatabaseBase\fieldExists().

◆ fieldName()

DatabaseType::fieldName (   $res,
  $n 
)

Get a field name in a result object.

See also
http://www.php.net/mysql_field_name
Parameters
mixed$resA SQL result
int$n
Returns
string

Implemented in DatabaseOracle, DatabasePostgres, DatabaseSqlite, DatabaseMysqlBase, DatabaseMssql, and DatabaseTestHelper.

◆ getServerInfo()

DatabaseType::getServerInfo ( )

A string describing the current software version, and possibly other details in a user-friendly way.

Will be listed on Special:Version, etc. Use getServerVersion() to get machine-friendly information.

Returns
string Version information from the database server

Implemented in DatabaseSqlite, DatabaseBase, and DatabaseTestHelper.

◆ getServerVersion()

DatabaseType::getServerVersion ( )

A string describing the current software version, like from mysql_get_server_info().

Returns
string Version information from the database server.

Implemented in DatabasePostgres, DatabaseOracle, DatabaseMssql, DatabaseSqlite, DatabaseMysqli, DatabaseTestHelper, DatabaseMysql, and FakeDatabaseMysqlBase.

Referenced by DatabaseBase\getServerInfo(), and DatabaseMysqlBase\getSoftwareLink().

◆ getSoftwareLink()

DatabaseType::getSoftwareLink ( )

Returns a wikitext link to the DB's website, e.g., return "[http://www.mysql.com/ MySQL]"; Should at least contain plain text, if for some reason your database has no website.

Returns
string Wikitext of a link to the server software's web site

Implemented in DatabasePostgres, DatabaseOracle, DatabaseMssql, DatabaseMysqlBase, DatabaseSqlite, and DatabaseTestHelper.

◆ getType()

◆ indexInfo()

DatabaseType::indexInfo (   $table,
  $index,
  $fname = __METHOD__ 
)

Get information about an index into an object.

Parameters
string$tableTable name
string$indexIndex name
string$fnameCalling function name
Returns
mixed Database-specific index description class or false if the index does not exist

Implemented in DatabasePostgres, DatabaseOracle, DatabaseMssql, DatabaseMysqlBase, DatabaseSqlite, and DatabaseTestHelper.

Referenced by DatabaseBase\indexExists(), and DatabaseBase\indexUnique().

◆ insertId()

DatabaseType::insertId ( )

Get the inserted value of an auto-increment row.

The value inserted should be fetched from nextSequenceValue()

Example: $id = $dbw->nextSequenceValue( 'page_page_id_seq' ); $dbw->insert( 'page', array( 'page_id' => $id ) ); $id = $dbw->insertId();

Returns
int

Implemented in DatabasePostgres, DatabaseOracle, DatabaseSqlite, DatabaseMssql, DatabaseMysqli, DatabaseTestHelper, DatabaseMysql, and FakeDatabaseMysqlBase.

◆ lastErrno()

◆ lastError()

◆ numFields()

DatabaseType::numFields (   $res)

Get the number of fields in a result object.

See also
http://www.php.net/mysql_num_fields
Parameters
mixed$resA SQL result
Returns
int

Implemented in DatabasePostgres, DatabaseOracle, DatabaseSqlite, DatabaseMysqlBase, DatabaseMssql, and DatabaseTestHelper.

◆ numRows()

DatabaseType::numRows (   $res)

Get the number of rows in a result object.

Parameters
mixed$resA SQL result
Returns
int

Implemented in DatabasePostgres, DatabaseOracle, DatabaseSqlite, DatabaseMysqlBase, DatabaseMssql, and DatabaseTestHelper.

Referenced by DatabaseBase\selectField(), and DatabaseBase\selectRow().

◆ open()

DatabaseType::open (   $server,
  $user,
  $password,
  $dbName 
)

Open a connection to the database.

Usually aborts on failure

Parameters
string$serverdatabase server host
string$userdatabase user name
string$passworddatabase user password
string$dbNamedatabase name
Returns
bool
Exceptions
DBConnectionError

Implemented in DatabasePostgres, DatabaseOracle, DatabaseTestHelper, DatabaseMssql, DatabaseMysqlBase, and DatabaseSqlite.

Referenced by DatabaseBase\__construct().

◆ strencode()

DatabaseType::strencode (   $s)

Wrapper for addslashes()

Parameters
string$sString to be slashed.
Returns
string Slashed string.

Implemented in DatabasePostgres, DatabaseOracle, DatabaseMssql, DatabaseSqlite, DatabaseMysqlBase, and DatabaseTestHelper.

Referenced by DatabaseBase\addQuotes(), DatabaseBase\escapeLikeInternal(), and DatabaseBase\replaceSchemaVars().


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