Manual:Database.php

Description
Database.php contains the  class that serves as a base for all database classes (mysql>Special:MyLanguage/Manual:MySQL|MySQL, postgre>Special:MyLanguage/Manual:PostgreSQL|PostgreSQL, etc). It also contains the DatabaseType interface, which has a number of convenience functions.

Functions
These are invoked using the database abstraction layer accessed via, e.g..

- Get the number of rows affected by the last write query. - Change the position of the cursor in a result object. - Fetch the next row from the given result object, in object form. - Fetch the next row from the given result object, in associative array form. - Returns false if the field doesn't exist. - Get a field name in a result object. - A string describing the current software version, and possibly other details in a user-friendly way. - A string describing the current software version, like from mysql_get_server_info. - 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. - Get the type of the DBMS, as it appears in $wgDBtype. - Get information about an index into an object. - Get the inserted value of an auto-increment row. - Get the last error number. - Get a description of the last error. - Get the number of fields in a result object. - Get the number of rows in a result object. - Open a connection to the database. - Wrapper for.

===Timestamp functions===

- Convert a timestamp in one of the formats accepted by wftime>Special:MyLanguage/Manual:wfTimestamp|wfTimestamp to the format used for inserting into timestamp fields in this DBMS. The result is unquoted, and needs to be passed through addQuotes before it can be included in raw SQL. - Convert a timestamp in one of the formats accepted by wfTimestamp to the format used for inserting into timestamp fields in this DBMS. If NULL is input, it is passed through, allowing NULL values to be inserted into timestamp fields. The result is unquoted, and needs to be passed through addQuotes before it can be included in raw SQL.

==See also==