PropertyStore.PropertyDb Class

A SQLite database for storing PropertyName/PropertyValue pairs.

Extends

Methods

Name Description
constructor(): PropertyStore.PropertyDb    
createDDL(): void Protected Implement this method to create all tables for this subclass of VersionedSqliteDb when a new database file is created.  
deleteProperties(propNames: string[]): Promise<void> Delete an array of properties from this PropertyDb.  
deleteProperty(propName: string): Promise<void> Delete a single property from this PropertyDb.  
forAllProperties(iter: PropertyStore.PropertyIteration, filter?: PropertyStore.PropertyFilter): void call an iteration function for each property, optionally applying a filter  
getBlob(name: string): undefined | Uint8Array Get the value of a blob property by name.  
getBlob(name: string, defaultValue: Uint8Array): Uint8Array Get the value of a blob property by name.  
getBoolean(name: string): undefined | boolean Get the value of a boolean property by name.  
getBoolean(name: string, defaultValue: boolean): boolean Get the value of a boolean property by name.  
getNumber(name: string): undefined | number Get the value of a number property by name.  
getNumber(name: string, defaultValue: number): number Get the value of a number property by name.  
getObject(name: string): undefined | SettingObject Get the value of an object property by name.  
getObject(name: string, defaultValue: SettingObject): SettingObject Get the value of an object property by name.  
getProperty(name: string): undefined | PropertyStore.PropertyType get the value of a Property by name.  
getString(name: string, defaultValue: string): string Get the value of a string property by name.  
getString(name: string): undefined | string Get the value of a string property by name.  
saveProperties(props: PropertyStore.PropertyArray): Promise<void> Save an array of properties in this PropertyDb.  
saveProperty(name: string, value: PropertyStore.PropertyType): Promise<void> Save a single property in this PropertyDb.  

Inherited methods

Name Inherited from Description
abandonChanges(): void VersionedSqliteDb Abandon (cancel) the outermost transaction, discarding all changes since last save.
closeDb(saveChanges?: boolean): void VersionedSqliteDb Close SQLiteDb.
createDb(dbName: string): void VersionedSqliteDb Create a SQLiteDb
createDb(dbName: string, container?: CloudSqlite.CloudContainer, params?: SQLiteDb.CreateParams): void VersionedSqliteDb  
createTable(args: { addTimestamp?: boolean, columns: string, constraints?: string, tableName: string }): void Protected VersionedSqliteDb Create a new table in this database.
dispose(): void VersionedSqliteDb alias for closeDb.
executeSQL(sql: string): DbResult VersionedSqliteDb execute an SQL statement
getRequiredVersions(): SQLiteDb.RequiredVersionRanges VersionedSqliteDb Get the required version ranges necessary to open this VersionedSqliteDb.
openDb(dbName: string, openMode: OpenMode | SQLiteDb.OpenParams, container?: CloudSqlite.CloudContainer): void VersionedSqliteDb Open this database and verify that this version of the software meets the required version range (as appropriate, read or write) stored in the database.
readLastModTime(tableName: string, rowId: number): Date VersionedSqliteDb Get the last modified date for a row in a table of this database.
saveChanges(): void VersionedSqliteDb Commit the outermost transaction, writing changes to the file.
setRequiredVersions(versions: SQLiteDb.RequiredVersionRanges): void VersionedSqliteDb Change the "versions required to open this database" property stored in this database.
upgradeSchema(arg: { dbName: string, lockContainer?: { container: CloudSqlite.CloudContainer, user: string }, upgradeFn: () => void }): Promise<void | () => void> VersionedSqliteDb  
vacuum(args?: SQLiteDb.VacuumDbArgs): void VersionedSqliteDb vacuum this database
verifyVersions(): void Protected VersionedSqliteDb Verify that this version of the software meets the required version range (as appropriate, read or write) stored in the database.
withOpenDb<T>(args: SQLiteDb.WithOpenDbArgs, operation: () => T): T VersionedSqliteDb Open a database, perform an operation, then close the database.
withPreparedSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T): T VersionedSqliteDb Use a prepared SQL statement, potentially from the statement cache.
withSavePoint(savePointName: string, operation: () => void): void VersionedSqliteDb Perform an operation on this database within a savepoint.
withSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T): T VersionedSqliteDb Prepare and execute a callback on a SQL statement.
createNewDb(fileName: string): void Static VersionedSqliteDb Create a new database file for the subclass of VersionedSqliteDb.

Properties

Name Type Description
myVersion Readonly "3.0.0" The current semver "persistence version" of this class.  

Inherited properties

Name Type Inherited from Description
_versionProps Protected Static { name: "versions", namespace: "SQLiteDb" } VersionedSqliteDb  
isOpen Accessor ReadOnly boolean VersionedSqliteDb Returns true if this SQLiteDb is open
isReadonly Accessor ReadOnly boolean VersionedSqliteDb Returns true if this SQLiteDb is open readonly

Defined in

Last Updated: 15 May, 2024