Inherited by DatabaseSqliteStandalone.
Public Member Functions | |
__construct ($server=false, $user=false, $password=false, $dbName=false, $failFunction=false, $flags=0) | |
Constructor. | |
getType () | |
Get the type of the DBMS, as it appears in $wgDBtype. | |
implicitGroupby () | |
open ($server, $user, $pass, $dbName) | |
Open an SQLite database and return a resource handle to it NOTE: only $dbName is used, the other parameters are irrelevant for SQLite databases. | |
openFile ($fileName) | |
Opens a database file. | |
close () | |
Close an SQLite database. | |
getFulltextSearchModule () | |
Returns version of currently supported SQLite fulltext search module or false if none present. | |
doQuery ($sql) | |
SQLite doesn't allow buffered results or data seeking etc, so we'll use fetchAll as the result. | |
freeResult ($res) | |
Free 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. | |
numRows ($res) | |
The PDO::Statement class implements the array interface so count() will work. | |
numFields ($res) | |
Get the number of fields in a result object See documentation for mysql_num_fields(). | |
fieldName ($res, $n) | |
Get a field name in a result object See documentation for mysql_field_name(): http://www.php.net/mysql_field_name. | |
tableName ($name) | |
Use MySQL's naming (accounts for prefix etc) but remove surrounding backticks. | |
indexName ($index) | |
Index names have DB scope. | |
insertId () | |
This must be called after nextSequenceVal. | |
dataSeek ($res, $row) | |
Change the position of the cursor in a result object See mysql_data_seek(). | |
lastError () | |
Get a description of the last error See mysql_error() for more details. | |
lastErrno () | |
Get the last error number See mysql_errno(). | |
affectedRows () | |
Get the number of rows affected by the last write query See mysql_affected_rows() for more details. | |
indexInfo ($table, $index, $fname= 'DatabaseSqlite::indexExists') | |
Returns information about an index Returns false if the index does not exist
| |
indexUnique ($table, $index, $fname= 'DatabaseSqlite::indexUnique') | |
makeSelectOptions ($options) | |
Filter the options used in SELECT statements. | |
insert ($table, $a, $fname= 'DatabaseSqlite::insert', $options=array()) | |
Based on generic method (parent) with some prior SQLite-sepcific adjustments. | |
replace ($table, $uniqueIndexes, $rows, $fname= 'DatabaseSqlite::replace') | |
REPLACE query wrapper PostgreSQL simulates this with a DELETE followed by INSERT $row is the row to insert, an associative array $uniqueIndexes is an array of indexes. | |
textFieldSize ($table, $field) | |
Returns the size of a text field, or -1 for "unlimited" In SQLite this is SQLITE_MAX_LENGTH, by default 1GB. | |
unionSupportsOrderAndLimit () | |
Returns true if current database backend supports ORDER BY or LIMIT for separate subqueries within the UNION construct. | |
unionQueries ($sqls, $all) | |
Construct a UNION query This is used for providing overload point for other DB abstractions not compatible with the MySQL syntax. | |
wasDeadlock () | |
Determines if the last failure was due to a deadlock STUB. | |
wasErrorReissuable () | |
Determines if the last query error was something that should be dealt with by pinging the connection and reissuing the query. | |
wasReadOnlyError () | |
Determines if the last failure was due to the database being read-only. | |
getSoftwareLink () | |
getServerVersion () | |
fieldExists ($table, $field, $fname= '') | |
Query whether a given column exists in the mediawiki schema. | |
fieldInfo ($table, $field) | |
Get information about a given field Returns false if the field does not exist. | |
begin ($fname= '') | |
Begin a transaction, committing any previously open transaction. | |
commit ($fname= '') | |
End a transaction. | |
rollback ($fname= '') | |
Rollback a transaction. | |
limitResultForUpdate ($sql, $num) | |
strencode ($s) | |
Wrapper for addslashes(). | |
encodeBlob ($b) | |
decodeBlob ($b) | |
addQuotes ($s) | |
If it's a string, adds quotes and backslashes Otherwise returns as-is. | |
quote_ident ($s) | |
buildLike () | |
LIKE statement wrapper, receives a variable-length argument list with parts of pattern to match containing either string literals that will be escaped or tokens returned by anyChar() or anyString(). | |
getLag () | |
How lagged is this slave? | |
setup_database () | |
Called by the installer script (when modified according to the MediaWikiLite installation instructions)
| |
getSearchEngine () | |
Get search engine class. | |
deadlockLoop () | |
No-op version of deadlockLoop. | |
buildConcat ($stringList) | |
Build a concatenation list to feed into a SQL query. | |
duplicateTableStructure ($oldName, $newName, $temporary=false, $fname= 'DatabaseSqlite::duplicateTableStructure') | |
Creates a new table with structure copied from existing table Note that unlike most database abstraction functions, this function does not automatically append database prefix, because it works at a lower abstraction level. | |
Static Public Member Functions | |
static | newFromParams ($server, $user, $password, $dbName, $failFunction=false, $flags=0) |
Same as new DatabaseMysql( . | |
static | generateFileName ($dir, $dbName) |
Generates a database file name. | |
Public Attributes | |
$mAffectedRows | |
$mLastResult | |
$mDatabaseFile | |
$mName | |
Protected Member Functions | |
replaceVars ($s) | |
Replace variables in sourced SQL. |
Definition at line 13 of file DatabaseSqlite.php.
DatabaseSqlite::__construct | ( | $ | server = false , |
|
$ | user = false , |
|||
$ | password = false , |
|||
$ | dbName = false , |
|||
$ | failFunction = false , |
|||
$ | flags = 0 | |||
) |
Constructor.
Parameters $server, $user and $password are not used.
Definition at line 24 of file DatabaseSqlite.php.
References open().
DatabaseSqlite::addQuotes | ( | $ | s | ) |
If it's a string, adds quotes and backslashes Otherwise returns as-is.
Reimplemented from DatabaseBase.
Definition at line 453 of file DatabaseSqlite.php.
References $s.
Referenced by fieldInfo(), indexInfo(), and strencode().
DatabaseSqlite::affectedRows | ( | ) |
Get the number of rows affected by the last write query See mysql_affected_rows() for more details.
Reimplemented from DatabaseBase.
Definition at line 252 of file DatabaseSqlite.php.
DatabaseSqlite::begin | ( | $ | fname = '' |
) |
Begin a transaction, committing any previously open transaction.
Reimplemented from DatabaseBase.
Definition at line 416 of file DatabaseSqlite.php.
References commit().
DatabaseSqlite::buildConcat | ( | $ | stringList | ) |
Build a concatenation list to feed into a SQL query.
$stringList | Array: list of raw SQL expressions; caller is responsible for any quoting |
Reimplemented from DatabaseBase.
Definition at line 564 of file DatabaseSqlite.php.
DatabaseSqlite::buildLike | ( | ) |
LIKE statement wrapper, receives a variable-length argument list with parts of pattern to match containing either string literals that will be escaped or tokens returned by anyChar() or anyString().
Alternatively, the function could be provided with an array of aforementioned parameters.
Example: $dbr->buildLike( 'My_page_title/', $dbr->anyString() ) returns a LIKE clause that searches for subpages of 'My page title'. Alternatively: $pattern = array( 'My_page_title/', $dbr->anyString() ); $query .= $dbr->buildLike( $pattern );
@ return String: fully built LIKE statement
Reimplemented from DatabaseBase.
Definition at line 465 of file DatabaseSqlite.php.
DatabaseSqlite::close | ( | ) |
Close an SQLite database.
Reimplemented from DatabaseBase.
Definition at line 94 of file DatabaseSqlite.php.
References commit(), and DatabaseBase::trxLevel().
DatabaseSqlite::commit | ( | $ | fname = '' |
) |
End a transaction.
Reimplemented from DatabaseBase.
Definition at line 422 of file DatabaseSqlite.php.
DatabaseSqlite::dataSeek | ( | $ | res, | |
$ | row | |||
) |
Change the position of the cursor in a result object See mysql_data_seek().
$res | Mixed: A SQL result | |
$row | Mixed: Either MySQL row or ResultWrapper |
Reimplemented from DatabaseBase.
Definition at line 225 of file DatabaseSqlite.php.
DatabaseSqlite::deadlockLoop | ( | ) |
No-op version of deadlockLoop.
Reimplemented from DatabaseBase.
Definition at line 517 of file DatabaseSqlite.php.
DatabaseSqlite::decodeBlob | ( | $ | b | ) |
DatabaseSqlite::doQuery | ( | $ | sql | ) |
SQLite doesn't allow buffered results or data seeking etc, so we'll use fetchAll as the result.
Reimplemented from DatabaseBase.
Definition at line 130 of file DatabaseSqlite.php.
References $res.
DatabaseSqlite::duplicateTableStructure | ( | $ | oldName, | |
$ | newName, | |||
$ | temporary = false , |
|||
$ | fname = 'DatabaseSqlite::duplicateTableStructure' | |||
) |
Creates a new table with structure copied from existing table Note that unlike most database abstraction functions, this function does not automatically append database prefix, because it works at a lower abstraction level.
$oldName | String: name of table whose structure should be copied | |
$newName | String: name of table to be created | |
$temporary | Boolean: whether the new table should be temporary |
Reimplemented from DatabaseBase.
Definition at line 568 of file DatabaseSqlite.php.
References $fname, $res, fetchObject(), and DatabaseBase::query().
DatabaseSqlite::encodeBlob | ( | $ | b | ) |
DatabaseSqlite::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.
$res | SQL result object as returned from Database::query(), etc. |
DBUnexpectedError | Thrown if the database returns an error |
Reimplemented from DatabaseBase.
Definition at line 149 of file DatabaseSqlite.php.
References $res.
Referenced by duplicateTableStructure().
DatabaseSqlite::fetchRow | ( | $ | res | ) |
Fetch the next row from the given result object, in associative array form.
Fields are retrieved with $row['fieldname'].
$res | SQL result object as returned from Database::query(), etc. |
DBUnexpectedError | Thrown if the database returns an error |
Reimplemented from DatabaseBase.
Definition at line 168 of file DatabaseSqlite.php.
References $res.
DatabaseSqlite::fieldExists | ( | $ | table, | |
$ | field, | |||
$ | fname = '' | |||
) |
Query whether a given column exists in the mediawiki schema.
Reimplemented from DatabaseBase.
Definition at line 395 of file DatabaseSqlite.php.
References fieldInfo().
DatabaseSqlite::fieldInfo | ( | $ | table, | |
$ | field | |||
) |
Get information about a given field Returns false if the field does not exist.
Reimplemented from DatabaseBase.
Definition at line 404 of file DatabaseSqlite.php.
References $res, addQuotes(), DatabaseBase::query(), and tableName().
Referenced by fieldExists().
DatabaseSqlite::fieldName | ( | $ | res, | |
$ | n | |||
) |
Get a field name in a result object See documentation for mysql_field_name(): http://www.php.net/mysql_field_name.
$res | Mixed: A SQL result | |
$n | Integer |
Reimplemented from DatabaseBase.
Definition at line 195 of file DatabaseSqlite.php.
DatabaseSqlite::freeResult | ( | $ | res | ) |
Free a result object.
$res | Mixed: A SQL result |
Reimplemented from DatabaseBase.
Definition at line 142 of file DatabaseSqlite.php.
References $res.
static DatabaseSqlite::generateFileName | ( | $ | dir, | |
$ | dbName | |||
) | [static] |
Generates a database file name.
Explicitly public for installer.
$dir | String: Directory where database resides | |
$dbName | String: Database name |
Definition at line 109 of file DatabaseSqlite.php.
Referenced by open().
DatabaseSqlite::getFulltextSearchModule | ( | ) |
Returns version of currently supported SQLite fulltext search module or false if none present.
Definition at line 117 of file DatabaseSqlite.php.
References DatabaseBase::query().
DatabaseSqlite::getLag | ( | ) |
How lagged is this slave?
Reimplemented from DatabaseBase.
Definition at line 476 of file DatabaseSqlite.php.
DatabaseSqlite::getSearchEngine | ( | ) |
Get search engine class.
All subclasses of this need to implement this if they wish to use searching.
Reimplemented from DatabaseBase.
Definition at line 510 of file DatabaseSqlite.php.
DatabaseSqlite::getServerVersion | ( | ) |
Reimplemented from DatabaseBase.
Definition at line 387 of file DatabaseSqlite.php.
DatabaseSqlite::getSoftwareLink | ( | ) |
Reimplemented from DatabaseBase.
Definition at line 380 of file DatabaseSqlite.php.
DatabaseSqlite::getType | ( | ) |
Get the type of the DBMS, as it appears in $wgDBtype.
Reimplemented from DatabaseBase.
Definition at line 31 of file DatabaseSqlite.php.
DatabaseSqlite::implicitGroupby | ( | ) |
Reimplemented from DatabaseBase.
Definition at line 38 of file DatabaseSqlite.php.
DatabaseSqlite::indexInfo | ( | $ | table, | |
$ | index, | |||
$ | fname = 'DatabaseSqlite::indexExists' | |||
) |
Returns information about an index Returns false if the index does not exist
Reimplemented from DatabaseBase.
Definition at line 261 of file DatabaseSqlite.php.
References $fname, $res, addQuotes(), indexName(), and DatabaseBase::query().
DatabaseSqlite::indexName | ( | $ | index | ) |
Index names have DB scope.
Reimplemented from DatabaseBase.
Definition at line 214 of file DatabaseSqlite.php.
Referenced by indexInfo(), and indexUnique().
DatabaseSqlite::indexUnique | ( | $ | table, | |
$ | index, | |||
$ | fname = 'DatabaseSqlite::indexUnique' | |||
) |
Definition at line 277 of file DatabaseSqlite.php.
References $fname, $options, indexName(), and DatabaseBase::selectRow().
DatabaseSqlite::insert | ( | $ | table, | |
$ | a, | |||
$ | fname = 'DatabaseSqlite::insert' , |
|||
$ | options = array() | |||
) |
Based on generic method (parent) with some prior SQLite-sepcific adjustments.
Reimplemented from DatabaseBase.
Definition at line 310 of file DatabaseSqlite.php.
References $options.
DatabaseSqlite::insertId | ( | ) |
This must be called after nextSequenceVal.
Reimplemented from DatabaseBase.
Definition at line 221 of file DatabaseSqlite.php.
DatabaseSqlite::lastErrno | ( | ) |
Get the last error number See mysql_errno().
Reimplemented from DatabaseBase.
Definition at line 243 of file DatabaseSqlite.php.
Referenced by wasDeadlock(), wasErrorReissuable(), and wasReadOnlyError().
DatabaseSqlite::lastError | ( | ) |
Get a description of the last error See mysql_error() for more details.
Reimplemented from DatabaseBase.
Definition at line 236 of file DatabaseSqlite.php.
DatabaseSqlite::limitResultForUpdate | ( | $ | sql, | |
$ | num | |||
) |
Reimplemented from DatabaseBase.
Definition at line 434 of file DatabaseSqlite.php.
References DatabaseBase::limitResult().
DatabaseSqlite::makeSelectOptions | ( | $ | options | ) |
Filter the options used in SELECT statements.
Reimplemented from DatabaseBase.
Definition at line 300 of file DatabaseSqlite.php.
References $options.
static DatabaseSqlite::newFromParams | ( | $ | server, | |
$ | user, | |||
$ | password, | |||
$ | dbName, | |||
$ | failFunction = false , |
|||
$ | flags = 0 | |||
) | [static] |
Same as new DatabaseMysql( .
.. ), kept for backward compatibility
$server | String: database server host | |
$user | String: database user name | |
$password | String: database user password | |
$dbName | String: database name | |
failFunction | ||
$flags |
Reimplemented from DatabaseBase.
Definition at line 40 of file DatabaseSqlite.php.
DatabaseSqlite::numFields | ( | $ | res | ) |
Get the number of fields in a result object See documentation for mysql_num_fields().
$res | Mixed: A SQL result |
Reimplemented from DatabaseBase.
Definition at line 190 of file DatabaseSqlite.php.
References $res.
DatabaseSqlite::numRows | ( | $ | res | ) |
The PDO::Statement class implements the array interface so count() will work.
Reimplemented from DatabaseBase.
Definition at line 185 of file DatabaseSqlite.php.
References $res.
DatabaseSqlite::open | ( | $ | server, | |
$ | user, | |||
$ | pass, | |||
$ | dbName | |||
) |
Open an SQLite database and return a resource handle to it NOTE: only $dbName is used, the other parameters are irrelevant for SQLite databases.
Reimplemented from DatabaseBase.
Definition at line 47 of file DatabaseSqlite.php.
References $wgSQLiteDataDir, generateFileName(), and openFile().
Referenced by __construct().
DatabaseSqlite::openFile | ( | $ | fileName | ) |
Opens a database file.
Definition at line 62 of file DatabaseSqlite.php.
References wfDebug().
Referenced by DatabaseSqliteStandalone::__construct(), and open().
DatabaseSqlite::quote_ident | ( | $ | s | ) |
DatabaseSqlite::replace | ( | $ | table, | |
$ | uniqueIndexes, | |||
$ | rows, | |||
$ | fname = 'DatabaseSqlite::replace' | |||
) |
REPLACE query wrapper PostgreSQL simulates this with a DELETE followed by INSERT $row is the row to insert, an associative array $uniqueIndexes is an array of indexes.
Each element may be either a field name or an array of field names
It may be more efficient to leave off unique indexes which are unlikely to collide. However if you do this, you run the risk of encountering errors which wouldn't have occurred in MySQL
Reimplemented from DatabaseBase.
Definition at line 332 of file DatabaseSqlite.php.
References $rows.
DatabaseSqlite::replaceVars | ( | $ | ins | ) | [protected] |
Replace variables in sourced SQL.
Reimplemented from DatabaseBase.
Reimplemented in MockDatabaseSqlite.
Definition at line 523 of file DatabaseSqlite.php.
References $s.
DatabaseSqlite::rollback | ( | $ | fname = '' |
) |
Rollback a transaction.
No-op on non-transactional databases.
Reimplemented from DatabaseBase.
Definition at line 428 of file DatabaseSqlite.php.
DatabaseSqlite::setup_database | ( | ) |
Called by the installer script (when modified according to the MediaWikiLite installation instructions)
Definition at line 484 of file DatabaseSqlite.php.
References $IP, DatabaseBase::query(), and DatabaseBase::sourceFile().
DatabaseSqlite::strencode | ( | $ | s | ) |
Wrapper for addslashes().
$s | String: to be slashed. |
Reimplemented from DatabaseBase.
Definition at line 438 of file DatabaseSqlite.php.
References $s, and addQuotes().
DatabaseSqlite::tableName | ( | $ | name | ) |
Use MySQL's naming (accounts for prefix etc) but remove surrounding backticks.
Reimplemented from DatabaseBase.
Definition at line 207 of file DatabaseSqlite.php.
References $name.
Referenced by fieldInfo().
DatabaseSqlite::textFieldSize | ( | $ | table, | |
$ | field | |||
) |
Returns the size of a text field, or -1 for "unlimited" In SQLite this is SQLITE_MAX_LENGTH, by default 1GB.
No way to query it though.
Reimplemented from DatabaseBase.
Definition at line 352 of file DatabaseSqlite.php.
DatabaseSqlite::unionQueries | ( | $ | sqls, | |
$ | all | |||
) |
Construct a UNION query This is used for providing overload point for other DB abstractions not compatible with the MySQL syntax.
$sqls | Array: SQL statements to combine | |
$all | Boolean: use UNION ALL |
Reimplemented from DatabaseBase.
Definition at line 360 of file DatabaseSqlite.php.
DatabaseSqlite::unionSupportsOrderAndLimit | ( | ) |
Returns true if current database backend supports ORDER BY or LIMIT for separate subqueries within the UNION construct.
Reimplemented from DatabaseBase.
Definition at line 356 of file DatabaseSqlite.php.
DatabaseSqlite::wasDeadlock | ( | ) |
Determines if the last failure was due to a deadlock STUB.
Reimplemented from DatabaseBase.
Definition at line 365 of file DatabaseSqlite.php.
References lastErrno().
DatabaseSqlite::wasErrorReissuable | ( | ) |
Determines if the last query error was something that should be dealt with by pinging the connection and reissuing the query.
STUB
Reimplemented from DatabaseBase.
Definition at line 369 of file DatabaseSqlite.php.
References lastErrno().
DatabaseSqlite::wasReadOnlyError | ( | ) |
Determines if the last failure was due to the database being read-only.
STUB
Reimplemented from DatabaseBase.
Definition at line 373 of file DatabaseSqlite.php.
References lastErrno().
DatabaseSqlite::$mAffectedRows |
Definition at line 15 of file DatabaseSqlite.php.
DatabaseSqlite::$mDatabaseFile |
Definition at line 17 of file DatabaseSqlite.php.
DatabaseSqlite::$mLastResult |
Definition at line 16 of file DatabaseSqlite.php.
DatabaseSqlite::$mName |
Definition at line 18 of file DatabaseSqlite.php.