MediaWiki  master
DatabaseType Interface Reference
Inheritance diagram for DatabaseType:

List of all members.

Public Member Functions

 affectedRows ()
 Get the number of rows affected by the last write query.
 dataSeek ($res, $row)
 Change the position of the cursor in a result object.
 fetchObject ($res)
 Fetch the next row from the given result object, in object form.
 fetchRow ($res)
 Fetch the next row from the given result object, in associative array form.
 fieldInfo ($table, $field)
 mysql_fetch_field() wrapper Returns false if the field doesn't exist
 fieldName ($res, $n)
 Get a field name in a result object.
 getServerInfo ()
 A string describing the current software version, and possibly other details in a user-friendly way.
 getServerVersion ()
 A string describing the current software version, like from mysql_get_server_info().
 getType ()
 Get the type of the DBMS, as it appears in $wgDBtype.
 indexInfo ($table, $index, $fname= 'Database::indexInfo')
 Get information about an index into an object.
 insertId ()
 Get the inserted value of an auto-increment row.
 lastErrno ()
 Get the last error number.
 lastError ()
 Get a description of the last error.
 numFields ($res)
 Get the number of fields in a result object.
 numRows ($res)
 Get the number of rows in a result object.
 open ($server, $user, $password, $dbName)
 Open a connection to the database.
 strencode ($s)
 Wrapper for addslashes()

Static Public Member Functions

static 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.

Detailed Description

Definition at line 41 of file Database.php.


Member Function Documentation

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

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

Implemented in DatabaseIbm_db2, DatabasePostgres, DatabaseOracle, DatabaseSqlite, DatabaseMysql, and DatabaseMssql.

DatabaseType::dataSeek ( res,
row 
)

Change the position of the cursor in a result object.

See also:
http://www.php.net/mysql_data_seek
Parameters:
$resMixed: A SQL result
$rowMixed: Either MySQL row or ResultWrapper

Implemented in DatabaseIbm_db2, DatabasePostgres, DatabaseOracle, DatabaseSqlite, DatabaseMysql, and DatabaseMssql.

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.

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

Implemented in DatabaseIbm_db2, DatabasePostgres, DatabaseOracle, DatabaseSqlite, DatabaseMysql, and DatabaseMssql.

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

Fields are retrieved with $row['fieldname'].

Parameters:
$resResultWrapper result object as returned from DatabaseBase::query(), etc.
Returns:
Row object
Exceptions:
DBUnexpectedErrorThrown if the database returns an error

Implemented in DatabaseIbm_db2, DatabasePostgres, DatabaseOracle, DatabaseSqlite, DatabaseMysql, and DatabaseMssql.

DatabaseType::fieldInfo ( table,
field 
)

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

Parameters:
$tablestring: table name
$fieldstring: field name
Returns:
Field

Implemented in DatabaseIbm_db2, DatabasePostgres, DatabaseOracle, DatabaseMssql, DatabaseSqlite, and DatabaseMysql.

DatabaseType::fieldName ( res,
n 
)

Get a field name in a result object.

See also:
http://www.php.net/mysql_field_name
Parameters:
$resMixed: A SQL result
$nInteger
Returns:
string

Implemented in DatabaseIbm_db2, DatabasePostgres, DatabaseOracle, DatabaseSqlite, DatabaseMysql, and DatabaseMssql.

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, and DatabaseBase.

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, DatabaseIbm_db2, DatabaseMysql, and DatabaseSqlite.

static DatabaseType::getSoftwareLink ( ) [static]

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 DatabaseIbm_db2, DatabasePostgres, DatabaseOracle, DatabaseMysql, DatabaseMssql, and DatabaseSqlite.

Get the type of the DBMS, as it appears in $wgDBtype.

Returns:
string

Implemented in DatabaseMssql, DatabaseIbm_db2, DatabasePostgres, DatabaseOracle, DatabaseSqlite, and DatabaseMysql.

DatabaseType::indexInfo ( table,
index,
fname = 'Database::indexInfo' 
)

Get information about an index into an object.

Parameters:
$tablestring: Table name
$indexstring: Index name
$fnamestring: Calling function name
Returns:
Mixed: Database-specific index description class or false if the index does not exist

Implemented in DatabaseIbm_db2, DatabasePostgres, DatabaseOracle, DatabaseSqlite, DatabaseMysql, and DatabaseMssql.

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 DatabaseIbm_db2, DatabasePostgres, DatabaseOracle, DatabaseSqlite, DatabaseMysql, and DatabaseMssql.

Get a description of the last error.

See also:
http://www.php.net/mysql_error
Returns:
string

Implemented in DatabaseIbm_db2, DatabasePostgres, DatabaseOracle, DatabaseSqlite, DatabaseMysql, and DatabaseMssql.

Get the number of fields in a result object.

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

Implemented in DatabaseIbm_db2, DatabasePostgres, DatabaseOracle, DatabaseSqlite, DatabaseMysql, and DatabaseMssql.

Get the number of rows in a result object.

Parameters:
$resMixed: A SQL result
Returns:
int

Implemented in DatabaseIbm_db2, DatabasePostgres, DatabaseOracle, DatabaseSqlite, DatabaseMysql, and DatabaseMssql.

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

Open a connection to the database.

Usually aborts on failure

Parameters:
$serverString: database server host
$userString: database user name
$passwordString: database user password
$dbNameString: database name
Returns:
bool
Exceptions:
DBConnectionError

Implemented in DatabaseIbm_db2, DatabasePostgres, DatabaseOracle, DatabaseSqlite, DatabaseMssql, and DatabaseMysql.

Wrapper for addslashes()

Parameters:
$sstring: to be slashed.
Returns:
string: slashed string.

Implemented in DatabasePostgres, DatabaseOracle, DatabaseMssql, DatabaseIbm_db2, DatabaseSqlite, and DatabaseMysql.


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