MediaWiki  REL1_19
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= 'DatabaseSqlite::attachDatabase')
 Attaches external database to our connection, see http://sqlite.org/lang_attach.html for details.
 begin ($fname= '')
 Begin a transaction, committing any previously open transaction.
 buildConcat ($stringList)
 Build a concatenation list to feed into a SQL query.
 buildLike ()
 checkForEnabledSearch ()
 Check if the searchindext table is FTS enabled.
 close ()
 Close an SQLite database.
 commit ($fname= '')
 End a transaction.
 dataSeek ($res, $row)
 deadlockLoop ()
 No-op version of deadlockLoop.
 decodeBlob ($b)
 duplicateTableStructure ($oldName, $newName, $temporary=false, $fname= 'DatabaseSqlite::duplicateTableStructure')
 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 ()
 getType ()
 implicitGroupby ()
 indexInfo ($table, $index, $fname= 'DatabaseSqlite::indexExists')
 Returns information about an index Returns false if the index does not exist.
 indexName ($index)
 Index names have DB scope.
 indexUnique ($table, $index, $fname= 'DatabaseSqlite::indexUnique')
 insert ($table, $a, $fname= 'DatabaseSqlite::insert', $options=array())
 Based on generic method (parent) with some prior SQLite-sepcific adjustments.
 insertId ()
 This must be called after nextSequenceVal.
 isWriteQuery ($sql)
 lastErrno ()
 lastError ()
 limitResultForUpdate ($sql, $num)
 listTables ($prefix=null, $fname= 'DatabaseSqlite::listTables')
 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= 'DatabaseSqlite::replace')
 rollback ($fname= '')
 Rollback a transaction.
 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.
static getSoftwareLink ()

Public Attributes

 $mAffectedRows
 $mDatabaseFile
 $mLastResult
 $mName

Protected Member Functions

 doQuery ($sql)
 SQLite doesn't allow buffered results or data seeking etc, so we'll use fetchAll as the result.
 replaceVars ($s)

Protected Attributes

 $mConn

Static Private Attributes

static $fulltextEnabled = null

Detailed Description

Definition at line 13 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 36 of file DatabaseSqlite.php.

References $user, $wgSharedDB, attachDatabase(), and open().

Here is the call graph for this function:


Member Function Documentation

Parameters:
$sBlob|string
Returns:
string

Reimplemented from DatabaseBase.

Definition at line 698 of file DatabaseSqlite.php.

Referenced by attachDatabase(), duplicateTableStructure(), fieldInfo(), indexInfo(), and strencode().

Here is the caller graph for this function:

Returns:
int

Implements DatabaseType.

Definition at line 397 of file DatabaseSqlite.php.

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

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

Parameters:
$nameString: database name to be used in queries like SELECT foo FROM dbname.table
$fileString: database file name. If omitted, will be generated using $name and $wgSQLiteDataDir
$fnameString: calling function name
Returns:
ResultWrapper

Definition at line 189 of file DatabaseSqlite.php.

References $file, $fname, $wgSQLiteDataDir, addQuotes(), generateFileName(), and DatabaseBase\query().

Referenced by __construct().

Here is the call graph for this function:

Here is the caller graph for this function:

DatabaseSqlite::begin ( fname = '')

Begin a transaction, committing any previously open transaction.

Parameters:
$fnamestring

Reimplemented from DatabaseBase.

Definition at line 634 of file DatabaseSqlite.php.

References commit().

Here is the call graph for this function:

DatabaseSqlite::buildConcat ( stringList)

Build a concatenation list to feed into a SQL query.

Parameters:
$stringListarray
Returns:
string

Reimplemented from DatabaseBase.

Definition at line 786 of file DatabaseSqlite.php.

Returns:
string

Reimplemented from DatabaseBase.

Definition at line 709 of file DatabaseSqlite.php.

Check if the searchindext table is FTS enabled.

Returns:
false if not enabled.

Definition at line 145 of file DatabaseSqlite.php.

References $fulltextEnabled, $res, DatabaseBase\query(), and tableName().

Here is the call graph for this function:

Close an SQLite database.

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 122 of file DatabaseSqlite.php.

References commit(), and DatabaseBase\trxLevel().

Here is the call graph for this function:

DatabaseSqlite::commit ( fname = '')

End a transaction.

Parameters:
$fnamestring

Reimplemented from DatabaseBase.

Definition at line 642 of file DatabaseSqlite.php.

Referenced by begin(), and close().

Here is the caller graph for this function:

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

Implements DatabaseType.

Definition at line 357 of file DatabaseSqlite.php.

References $res.

No-op version of deadlockLoop.

Reimplemented from DatabaseBase.

Definition at line 727 of file DatabaseSqlite.php.

Parameters:
$bBlob|string
Returns:
string

Reimplemented from DatabaseBase.

Definition at line 687 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 216 of file DatabaseSqlite.php.

References $res.

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

Reimplemented from DatabaseBase.

Definition at line 798 of file DatabaseSqlite.php.

References $fname, $res, DatabaseBase\addIdentifierQuotes(), addQuotes(), fetchObject(), DatabaseBase\query(), and wfDebug().

Here is the call graph for this function:

Parameters:
$b
Returns:
Blob

Reimplemented from DatabaseBase.

Definition at line 679 of file DatabaseSqlite.php.

Parameters:
$resResultWrapper
Returns:

Implements DatabaseType.

Definition at line 243 of file DatabaseSqlite.php.

References $res.

Referenced by duplicateTableStructure().

Here is the caller graph for this function:

Parameters:
$resResultWrapper
Returns:
bool|mixed

Implements DatabaseType.

Definition at line 269 of file DatabaseSqlite.php.

References $res.

DatabaseSqlite::fieldInfo ( table,
field 
)

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

Returns:
SQLiteField|false

Implements DatabaseType.

Definition at line 622 of file DatabaseSqlite.php.

References $res, addQuotes(), DatabaseBase\query(), and tableName().

Here is the call graph for this function:

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

Implements DatabaseType.

Definition at line 309 of file DatabaseSqlite.php.

References $keys, $n, and $res.

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

Definition at line 479 of file DatabaseSqlite.php.

References $options.

Referenced by makeInsertOptions(), and makeUpdateOptions().

Here is the caller graph for this function:

Parameters:
$resResultWrapper

Reimplemented from DatabaseBase.

Definition at line 231 of file DatabaseSqlite.php.

References $res.

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

Generates a database file name.

Explicitly public for installer.

Parameters:
$dirString: Directory where database resides
$dbNameString: Database name
Returns:
String

Definition at line 137 of file DatabaseSqlite.php.

Referenced by attachDatabase(), SqliteInstaller\needsUpgrade(), open(), and SqliteInstaller\setupDatabase().

Here is the caller graph for this function:

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

Returns:
String

Definition at line 162 of file DatabaseSqlite.php.

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

Here is the caller graph for this function:

Returns:
string

Reimplemented from DatabaseBase.

Definition at line 720 of file DatabaseSqlite.php.

Returns:
string User-friendly database information

Reimplemented from DatabaseBase.

Definition at line 612 of file DatabaseSqlite.php.

References getServerVersion(), and wfMsg().

Here is the call graph for this function:

Returns:
string Version information from the database

Implements DatabaseType.

Definition at line 604 of file DatabaseSqlite.php.

Referenced by getServerInfo().

Here is the caller graph for this function:

static DatabaseSqlite::getSoftwareLink ( ) [static]
Returns:
string wikitext of a link to the server software's web site

Implements DatabaseType.

Definition at line 597 of file DatabaseSqlite.php.

Returns:
string

Implements DatabaseType.

Definition at line 51 of file DatabaseSqlite.php.

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

Reimplemented from DatabaseBase.

Definition at line 60 of file DatabaseSqlite.php.

DatabaseSqlite::indexInfo ( table,
index,
fname = 'DatabaseSqlite::indexExists' 
)

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 408 of file DatabaseSqlite.php.

References $fname, $res, addQuotes(), indexName(), and DatabaseBase\query().

Here is the call graph for this function:

Index names have DB scope.

Parameters:
$indexstring
Returns:
string

Reimplemented from DatabaseBase.

Definition at line 340 of file DatabaseSqlite.php.

Referenced by indexInfo(), and indexUnique().

Here is the caller graph for this function:

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

Definition at line 430 of file DatabaseSqlite.php.

References $fname, $options, indexName(), and DatabaseBase\selectRow().

Here is the call graph for this function:

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 501 of file DatabaseSqlite.php.

References $options.

This must be called after nextSequenceVal.

Returns:
int

Implements DatabaseType.

Definition at line 349 of file DatabaseSqlite.php.

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

Reimplemented from DatabaseBase.

Definition at line 205 of file DatabaseSqlite.php.

Returns:
string

Implements DatabaseType.

Definition at line 385 of file DatabaseSqlite.php.

Referenced by wasDeadlock(), wasErrorReissuable(), and wasReadOnlyError().

Here is the caller graph for this function:

Returns:
string

Implements DatabaseType.

Definition at line 374 of file DatabaseSqlite.php.

DatabaseSqlite::limitResultForUpdate ( sql,
num 
)
Parameters:
$sql
$num
Returns:
string

Reimplemented from DatabaseBase.

Definition at line 663 of file DatabaseSqlite.php.

References DatabaseBase\limitResult().

Here is the call graph for this function:

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

List all tables on the database.

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

Reimplemented from DatabaseBase.

Definition at line 825 of file DatabaseSqlite.php.

References $result, and DatabaseBase\select().

Here is the call graph for this function:

Parameters:
$optionsarray
Returns:
string

Reimplemented from DatabaseBase.

Definition at line 493 of file DatabaseSqlite.php.

References $options, and fixIgnore().

Here is the call graph for this function:

Filter the options used in SELECT statements.

Parameters:
$optionsarray
Returns:
array

Reimplemented from DatabaseBase.

Definition at line 457 of file DatabaseSqlite.php.

References $options.

Parameters:
$optionsarray
Returns:
string

Reimplemented from DatabaseBase.

Definition at line 470 of file DatabaseSqlite.php.

References $options, and fixIgnore().

Here is the call graph for this function:

Parameters:
$resResultWrapper
Returns:
int

Implements DatabaseType.

Definition at line 299 of file DatabaseSqlite.php.

References $res.

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

Parameters:
$resResultWrapper
Returns:
int

Implements DatabaseType.

Definition at line 290 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.

Parameters:
$server
$user
$pass
$dbName
Returns:
PDO

Implements DatabaseType.

Definition at line 74 of file DatabaseSqlite.php.

References $wgSQLiteDataDir, generateFileName(), and openFile().

Referenced by __construct().

Here is the call graph for this function:

Here is the caller graph for this function:

DatabaseSqlite::openFile ( fileName)

Opens a database file.

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

Definition at line 93 of file DatabaseSqlite.php.

References wfDebug().

Referenced by DatabaseSqliteStandalone\__construct(), and open().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from DatabaseBase.

Definition at line 528 of file DatabaseSqlite.php.

References $rows, and DatabaseBase\nativeReplace().

Here is the call graph for this function:

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

Reimplemented from DatabaseBase.

Reimplemented in MockDatabaseSqlite.

Definition at line 737 of file DatabaseSqlite.php.

DatabaseSqlite::rollback ( fname = '')

Rollback a transaction.

No-op on non-transactional databases.

Parameters:
$fnamestring

Reimplemented from DatabaseBase.

Definition at line 650 of file DatabaseSqlite.php.

Parameters:
$sstring
Returns:
string

Implements DatabaseType.

Definition at line 671 of file DatabaseSqlite.php.

References addQuotes().

Here is the call graph for this function:

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 325 of file DatabaseSqlite.php.

Referenced by checkForEnabledSearch(), and fieldInfo().

Here is the caller graph for this function:

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 552 of file DatabaseSqlite.php.

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

Reimplemented from DatabaseBase.

Definition at line 568 of file DatabaseSqlite.php.

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 559 of file DatabaseSqlite.php.

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 576 of file DatabaseSqlite.php.

References lastErrno().

Here is the call graph for this function:

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 583 of file DatabaseSqlite.php.

References lastErrno().

Here is the call graph for this function:

Returns:
bool

Reimplemented from DatabaseBase.

Definition at line 590 of file DatabaseSqlite.php.

References lastErrno().

Here is the call graph for this function:


Member Data Documentation

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

Definition at line 15 of file DatabaseSqlite.php.

Referenced by checkForEnabledSearch().

DatabaseSqlite::$mAffectedRows

Definition at line 17 of file DatabaseSqlite.php.

DatabaseSqlite::$mConn [protected]

Reimplemented from DatabaseBase.

Definition at line 25 of file DatabaseSqlite.php.

DatabaseSqlite::$mDatabaseFile

Definition at line 19 of file DatabaseSqlite.php.

DatabaseSqlite::$mLastResult

Definition at line 18 of file DatabaseSqlite.php.

DatabaseSqlite::$mName

Definition at line 20 of file DatabaseSqlite.php.


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