MediaWiki  REL1_22
DatabaseSqlite Class Reference
Inheritance diagram for DatabaseSqlite:
Collaboration diagram for DatabaseSqlite:

List of all members.

Public Member Functions

 __construct ($server=false, $user=false, $password=false, $dbName=false, $flags=0)
 Constructor.
 addQuotes ($s)
 affectedRows ()
 attachDatabase ($name, $file=false, $fname=__METHOD__)
 Attaches external database to our connection, see http://sqlite.org/lang_attach.html for details.
 buildConcat ($stringList)
 Build a concatenation list to feed into a SQL query.
 buildLike ()
 checkForEnabledSearch ()
 Check if the searchindext table is FTS enabled.
 dataSeek ($res, $row)
 deadlockLoop ()
 No-op version of deadlockLoop.
 decodeBlob ($b)
 duplicateTableStructure ($oldName, $newName, $temporary=false, $fname=__METHOD__)
 encodeBlob ($b)
 fetchObject ($res)
 fetchRow ($res)
 fieldInfo ($table, $field)
 Get information about a given field Returns false if the field does not exist.
 fieldName ($res, $n)
 freeResult ($res)
 getSearchEngine ()
 getServerInfo ()
 getServerVersion ()
 getSoftwareLink ()
 getType ()
 implicitGroupby ()
 indexInfo ($table, $index, $fname=__METHOD__)
 Returns information about an index Returns false if the index does not exist.
 indexName ($index)
 Index names have DB scope.
 indexUnique ($table, $index, $fname=__METHOD__)
 insert ($table, $a, $fname=__METHOD__, $options=array())
 Based on generic method (parent) with some prior SQLite-sepcific adjustments.
 insertId ()
 This must be called after nextSequenceVal.
 isWriteQuery ($sql)
 lastErrno ()
 lastError ()
 listTables ($prefix=null, $fname=__METHOD__)
 List all tables on the database.
 makeInsertOptions ($options)
 makeSelectOptions ($options)
 Filter the options used in SELECT statements.
 makeUpdateOptions ($options)
 numFields ($res)
 numRows ($res)
 The PDO::Statement class implements the array interface so count() will work.
 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.
 replace ($table, $uniqueIndexes, $rows, $fname=__METHOD__)
 strencode ($s)
 tableName ($name, $format= 'quoted')
 Use MySQL's naming (accounts for prefix etc) but remove surrounding backticks.
 textFieldSize ($table, $field)
 Returns the size of a text field, or -1 for "unlimited" In SQLite this is SQLITE_MAX_LENGTH, by default 1GB.
 unionQueries ($sqls, $all)
 unionSupportsOrderAndLimit ()
 wasDeadlock ()
 wasErrorReissuable ()
 wasReadOnlyError ()

Static Public Member Functions

static fixIgnore ($options)
static generateFileName ($dir, $dbName)
 Generates a database file name.
static getFulltextSearchModule ()
 Returns version of currently supported SQLite fulltext search module or false if none present.

Public Attributes

 $mAffectedRows
 $mDatabaseFile
 $mLastResult
 $mName

Protected Member Functions

 closeConnection ()
 Does not actually close the connection, just destroys the reference for GC to do its work.
 doBegin ($fname= '')
 Issues the BEGIN command to the database server.
 doCommit ($fname= '')
 Issues the COMMIT command to the database server.
 doQuery ($sql)
 SQLite doesn't allow buffered results or data seeking etc, so we'll use fetchAll as the result.
 doRollback ($fname= '')
 Issues the ROLLBACK command to the database server.
 replaceVars ($s)

Protected Attributes

PDO $mConn

Static Private Attributes

static $fulltextEnabled = null

Detailed Description

Definition at line 28 of file DatabaseSqlite.php.


Constructor & Destructor Documentation

DatabaseSqlite::__construct ( server = false,
user = false,
password = false,
dbName = false,
flags = 0 
)

Constructor.

Parameters $server, $user and $password are not used.

Parameters:
$serverstring
$userstring
$passwordstring
$dbNamestring
$flagsint

Definition at line 50 of file DatabaseSqlite.php.


Member Function Documentation

Parameters:
$sBlob|string
Returns:
string

Reimplemented from DatabaseBase.

Definition at line 717 of file DatabaseSqlite.php.

Returns:
int

Implements DatabaseType.

Definition at line 412 of file DatabaseSqlite.php.

DatabaseSqlite::attachDatabase ( name,
file = false,
fname = __METHOD__ 
)

Attaches external database to our connection, see http://sqlite.org/lang_attach.html for details.

Parameters:
string$namedatabase name to be used in queries like SELECT foo FROM dbname.table
string$filedatabase file name. If omitted, will be generated using $name and $wgSQLiteDataDir
string$fnamecalling function name
Returns:
ResultWrapper

Definition at line 203 of file DatabaseSqlite.php.

DatabaseSqlite::buildConcat ( stringList)

Build a concatenation list to feed into a SQL query.

Parameters:
$stringListarray
Returns:
string

Reimplemented from DatabaseBase.

Definition at line 816 of file DatabaseSqlite.php.

Returns:
string

Reimplemented from DatabaseBase.

Definition at line 738 of file DatabaseSqlite.php.

Check if the searchindext table is FTS enabled.

Returns:
bool False if not enabled.

Definition at line 159 of file DatabaseSqlite.php.

Does not actually close the connection, just destroys the reference for GC to do its work.

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 140 of file DatabaseSqlite.php.

DatabaseSqlite::dataSeek ( res,
row 
)
Parameters:
$resResultWrapper
$row

Implements DatabaseType.

Definition at line 372 of file DatabaseSqlite.php.

No-op version of deadlockLoop.

Returns:
mixed

Reimplemented from DatabaseBase.

Definition at line 757 of file DatabaseSqlite.php.

Parameters:
$bBlob|string
Returns:
string

Reimplemented from DatabaseBase.

Definition at line 706 of file DatabaseSqlite.php.

DatabaseSqlite::doBegin ( fname = '') [protected]

Issues the BEGIN command to the database server.

See also:
DatabaseBase::begin()
Parameters:
type$fname

Reimplemented from DatabaseBase.

Definition at line 654 of file DatabaseSqlite.php.

References DatabaseBase\commit().

DatabaseSqlite::doCommit ( fname = '') [protected]

Issues the COMMIT command to the database server.

See also:
DatabaseBase::commit()
Parameters:
type$fname

Reimplemented from DatabaseBase.

Definition at line 666 of file DatabaseSqlite.php.

DatabaseSqlite::doQuery ( sql) [protected]

SQLite doesn't allow buffered results or data seeking etc, so we'll use fetchAll as the result.

Parameters:
$sqlstring
Returns:
ResultWrapper

Reimplemented from DatabaseBase.

Definition at line 230 of file DatabaseSqlite.php.

DatabaseSqlite::doRollback ( fname = '') [protected]

Issues the ROLLBACK command to the database server.

See also:
DatabaseBase::rollback()
Parameters:
type$fname

Reimplemented from DatabaseBase.

Definition at line 678 of file DatabaseSqlite.php.

DatabaseSqlite::duplicateTableStructure ( oldName,
newName,
temporary = false,
fname = __METHOD__ 
)
Exceptions:
MWException
Parameters:
$oldName
$newName
$temporarybool
$fnamestring
Returns:
bool|ResultWrapper

Reimplemented from DatabaseBase.

Definition at line 828 of file DatabaseSqlite.php.

Parameters:
$b
Returns:
Blob

Reimplemented from DatabaseBase.

Definition at line 698 of file DatabaseSqlite.php.

Parameters:
$resResultWrapper
Returns:
object|bool

Implements DatabaseType.

Definition at line 257 of file DatabaseSqlite.php.

Parameters:
$resResultWrapper
Returns:
array|bool

Implements DatabaseType.

Definition at line 283 of file DatabaseSqlite.php.

DatabaseSqlite::fieldInfo ( table,
field 
)

Get information about a given field Returns false if the field does not exist.

Parameters:
$tablestring
$fieldstring
Returns:
SQLiteField|bool False on failure

Implements DatabaseType.

Definition at line 642 of file DatabaseSqlite.php.

DatabaseSqlite::fieldName ( res,
n 
)
Parameters:
$resResultWrapper
$n
Returns:
bool

Implements DatabaseType.

Definition at line 323 of file DatabaseSqlite.php.

static DatabaseSqlite::fixIgnore ( options) [static]
Parameters:
$optionsarray
Returns:
array

Definition at line 494 of file DatabaseSqlite.php.

Parameters:
$resResultWrapper

Reimplemented from DatabaseBase.

Definition at line 245 of file DatabaseSqlite.php.

static DatabaseSqlite::generateFileName ( dir,
dbName 
) [static]

Generates a database file name.

Explicitly public for installer.

Parameters:
string$dirDirectory where database resides
string$dbNameDatabase name
Returns:
String

Definition at line 151 of file DatabaseSqlite.php.

Returns version of currently supported SQLite fulltext search module or false if none present.

Returns:
String

Definition at line 176 of file DatabaseSqlite.php.

Referenced by RebuildTextIndex\execute(), and SqliteUpdater\sqliteSetupSearchindex().

Returns:
string

Reimplemented from DatabaseBase.

Definition at line 749 of file DatabaseSqlite.php.

Returns:
string User-friendly database information

Reimplemented from DatabaseBase.

Definition at line 630 of file DatabaseSqlite.php.

Returns:
string Version information from the database

Implements DatabaseType.

Definition at line 622 of file DatabaseSqlite.php.

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

Implements DatabaseType.

Definition at line 615 of file DatabaseSqlite.php.

Returns:
string

Implements DatabaseType.

Definition at line 65 of file DatabaseSqlite.php.

Todo:
Check if it should be true like parent class
Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 74 of file DatabaseSqlite.php.

DatabaseSqlite::indexInfo ( table,
index,
fname = __METHOD__ 
)

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

  • if errors are explicitly ignored, returns NULL on failure
Returns:
array

Implements DatabaseType.

Definition at line 423 of file DatabaseSqlite.php.

Index names have DB scope.

Parameters:
$indexstring
Returns:
string

Reimplemented from DatabaseBase.

Definition at line 354 of file DatabaseSqlite.php.

DatabaseSqlite::indexUnique ( table,
index,
fname = __METHOD__ 
)
Parameters:
$table
$index
$fnamestring
Returns:
bool|null

Definition at line 445 of file DatabaseSqlite.php.

DatabaseSqlite::insert ( table,
a,
fname = __METHOD__,
options = array() 
)

Based on generic method (parent) with some prior SQLite-sepcific adjustments.

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 517 of file DatabaseSqlite.php.

This must be called after nextSequenceVal.

Returns:
int

Implements DatabaseType.

Definition at line 363 of file DatabaseSqlite.php.

See also:
DatabaseBase::isWriteQuery()
Parameters:
$sqlstring
Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 219 of file DatabaseSqlite.php.

Returns:
string

Implements DatabaseType.

Definition at line 400 of file DatabaseSqlite.php.

Returns:
string

Implements DatabaseType.

Definition at line 389 of file DatabaseSqlite.php.

DatabaseSqlite::listTables ( prefix = null,
fname = __METHOD__ 
)

List all tables on the database.

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

Reimplemented from DatabaseBase.

Definition at line 854 of file DatabaseSqlite.php.

Referenced by DatabaseSqliteTest\getTables().

Parameters:
$optionsarray
Returns:
string

Reimplemented from DatabaseBase.

Definition at line 508 of file DatabaseSqlite.php.

Filter the options used in SELECT statements.

Parameters:
$optionsarray
Returns:
array

Reimplemented from DatabaseBase.

Definition at line 472 of file DatabaseSqlite.php.

Parameters:
$optionsarray
Returns:
string

Reimplemented from DatabaseBase.

Definition at line 485 of file DatabaseSqlite.php.

Parameters:
$resResultWrapper
Returns:
int

Implements DatabaseType.

Definition at line 313 of file DatabaseSqlite.php.

The PDO::Statement class implements the array interface so count() will work.

Parameters:
$resResultWrapper
Returns:
int

Implements DatabaseType.

Definition at line 304 of file DatabaseSqlite.php.

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.

Parameters:
string$server
string$user
string$pass
string$dbName
Exceptions:
DBConnectionError
Returns:
PDO

Implements DatabaseType.

Definition at line 89 of file DatabaseSqlite.php.

DatabaseSqlite::openFile ( fileName)

Opens a database file.

Parameters:
$fileNamestring
Exceptions:
DBConnectionError
Returns:
PDO|bool SQL connection or false if failed

Definition at line 110 of file DatabaseSqlite.php.

Referenced by DatabaseSqliteStandalone\__construct().

DatabaseSqlite::replace ( table,
uniqueIndexes,
rows,
fname = __METHOD__ 
)
Parameters:
$table
$uniqueIndexes
$rows
$fnamestring
Returns:
bool|ResultWrapper

Reimplemented from DatabaseBase.

Definition at line 544 of file DatabaseSqlite.php.

DatabaseSqlite::replaceVars ( s) [protected]
Parameters:
$sstring
Returns:
string

Reimplemented from DatabaseBase.

Reimplemented in MockDatabaseSqlite.

Definition at line 767 of file DatabaseSqlite.php.

Parameters:
$sstring
Returns:
string

Implements DatabaseType.

Definition at line 690 of file DatabaseSqlite.php.

DatabaseSqlite::tableName ( name,
format = 'quoted' 
)

Use MySQL's naming (accounts for prefix etc) but remove surrounding backticks.

Parameters:
$name
$formatString
Returns:
string

Reimplemented from DatabaseBase.

Definition at line 339 of file DatabaseSqlite.php.

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.

Returns:
int

Reimplemented from DatabaseBase.

Definition at line 570 of file DatabaseSqlite.php.

DatabaseSqlite::unionQueries ( sqls,
all 
)
Parameters:
$sqls
$all
Returns:
string

Reimplemented from DatabaseBase.

Definition at line 586 of file DatabaseSqlite.php.

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 577 of file DatabaseSqlite.php.

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 594 of file DatabaseSqlite.php.

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 601 of file DatabaseSqlite.php.

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 608 of file DatabaseSqlite.php.


Member Data Documentation

DatabaseSqlite::$fulltextEnabled = null [static, private]

Definition at line 30 of file DatabaseSqlite.php.

DatabaseSqlite::$mAffectedRows

Definition at line 32 of file DatabaseSqlite.php.

PDO DatabaseSqlite::$mConn [protected]

Reimplemented from DatabaseBase.

Definition at line 39 of file DatabaseSqlite.php.

DatabaseSqlite::$mDatabaseFile

Definition at line 34 of file DatabaseSqlite.php.

DatabaseSqlite::$mLastResult

Definition at line 33 of file DatabaseSqlite.php.

DatabaseSqlite::$mName

Definition at line 35 of file DatabaseSqlite.php.


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