SQLiteDb Namespace

Enumeration

Name Description
SQLiteDb.DefaultTxnMode Default transaction mode for SQLiteDbs.

Interface

Name Description
SQLiteDb.OpenOrCreateParams parameters common to opening or creating a new SQLiteDb
SQLiteDb.OpenParams Parameters for opening an existing SQLiteDb
SQLiteDb.PageSize Size of a SQLiteDb page in bytes
SQLiteDb.RequiredVersionRanges A pair of semver VersionRanges, one for read and one for write, required to access a VersionedSqliteDb.
SQLiteDb.VacuumDbArgs Arguments for SQLiteDb.vacuum
SQLiteDb.WithOpenDbArgs Arguments for SqliteDb.withOpenDb

Type alias

Name Description
SQLiteDb.CreateParams Parameters for creating a new SQLiteDb
SQLiteDb.VersionRange A semver version range.

Defined in

SQLiteDb Class

A "generic" SQLiteDb. This class may be used to access local files or databases in a cloud container.

Extended by

Methods

Name Description
constructor(): SQLiteDb    
abandonChanges(): void Abandon (cancel) the outermost transaction, discarding all changes since last save.  
closeDb(saveChanges?: boolean): void Close SQLiteDb.  
createDb(dbName: string): void Create a SQLiteDb  
createDb(dbName: string, container?: CloudSqlite.CloudContainer, params?: SQLiteDb.CreateParams): void    
createTable(args: { addTimestamp?: boolean, columns: string, constraints?: string, tableName: string }): void Protected Create a new table in this database.  
dispose(): void alias for closeDb. Deprecated  
executeSQL(sql: string): DbResult execute an SQL statement  
openDb(dbName: string, openMode: OpenMode | SQLiteDb.OpenParams): void Open a SQLiteDb.  
openDb(dbName: string, openMode: OpenMode | SQLiteDb.OpenParams, container?: CloudSqlite.CloudContainer): void    
readLastModTime(tableName: string, rowId: number): Date Get the last modified date for a row in a table of this database.  
saveChanges(): void Commit the outermost transaction, writing changes to the file.  
vacuum(args?: SQLiteDb.VacuumDbArgs): void vacuum this database  
withOpenDb<T>(args: SQLiteDb.WithOpenDbArgs, operation: () => T): T Open a database, perform an operation, then close the database.  
withPreparedSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T): T Use a prepared SQL statement, potentially from the statement cache.  
withSavePoint(savePointName: string, operation: () => void): void Perform an operation on this database within a savepoint.  
withSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T): T Prepare and execute a callback on a SQL statement.  

Properties

Name Type Description
isOpen Accessor ReadOnly boolean Returns true if this SQLiteDb is open  
isReadonly Accessor ReadOnly boolean Returns true if this SQLiteDb is open readonly  

Defined in

Last Updated: 07 May, 2024