WASqliteConnection
Internal
WA-SQLite connection which directly interfaces with WA-SQLite. This is usually instantiated inside a worker.
Extends
Implements
Constructors
new WASqliteConnection()
new WASqliteConnection(options): WASqliteConnection
Parameters
| Parameter | Type |
|---|---|
options | ResolvedWASQLiteOpenFactoryOptions |
Returns
Overrides
Accessors
currentHoldId
Get Signature
get currentHoldId(): null | string
Gets the id for the current hold. This can be used to check for invalid states.
Returns
null | string
Methods
close()
close(): Promise<void>
Returns
Promise<void>
Implementation of
dispose()
dispose(): void
Returns
void
Inherited from
execute()
execute(sql, bindings?): Promise<ProxiedQueryResult>
This executes single SQL statements inside a requested lock.
Parameters
| Parameter | Type |
|---|---|
sql | string | TemplateStringsArray |
bindings? | any[] |
Returns
Promise<ProxiedQueryResult>
Implementation of
AsyncDatabaseConnection.execute
executeBatch()
executeBatch(sql, bindings?): Promise<ProxiedQueryResult>
This executes SQL statements in a batch.
Parameters
| Parameter | Type |
|---|---|
sql | string |
bindings? | any[][] |
Returns
Promise<ProxiedQueryResult>
Implementation of
AsyncDatabaseConnection.executeBatch
executeRaw()
executeRaw(sql, bindings?): Promise<any[][]>
Parameters
| Parameter | Type |
|---|---|
sql | string | TemplateStringsArray |
bindings? | any[] |
Returns
Promise<any[][]>
Implementation of
AsyncDatabaseConnection.executeRaw
fireUpdates()
fireUpdates(shouldBroadcast): void
Parameters
| Parameter | Type | Default value |
|---|---|---|
shouldBroadcast | boolean | true |
Returns
void
getConfig()
getConfig(): Promise<ResolvedWASQLiteOpenFactoryOptions>
Returns
Promise<ResolvedWASQLiteOpenFactoryOptions>
Implementation of
AsyncDatabaseConnection.getConfig
init()
init(): Promise<void>
Returns
Promise<void>
Implementation of
isAutoCommit()
isAutoCommit(): Promise<boolean>
Checks if the database connection is in autocommit mode.
Returns
Promise<boolean>
true if in autocommit mode, false if in a transaction
Implementation of
AsyncDatabaseConnection.isAutoCommit
iterateAsyncListeners()
iterateAsyncListeners(cb): Promise<void>
Parameters
| Parameter | Type |
|---|---|
cb | (listener) => Promise<any> |
Returns
Promise<void>
Inherited from
BaseObserver.iterateAsyncListeners
iterateListeners()
iterateListeners(cb): void
Parameters
| Parameter | Type |
|---|---|
cb | (listener) => any |
Returns
void
Inherited from
markHold()
markHold(): Promise<string>
Marks the connection as in-use by a certain actor.
Returns
Promise<string>
A hold ID which can be used to release the hold.
Implementation of
AsyncDatabaseConnection.markHold
registerListener()
registerListener(listener): () => void
Register a listener for updates to the PowerSync client.
Parameters
| Parameter | Type |
|---|---|
listener | Partial<WASQLiteConnectionListener> |
Returns
Function
Returns
void
Inherited from
registerOnTableChange()
registerOnTableChange(callback): Promise<() => void>
Parameters
| Parameter | Type |
|---|---|
callback | OnTableChangeCallback |
Returns
Promise<() => void>
Implementation of
AsyncDatabaseConnection.registerOnTableChange
releaseHold()
releaseHold(holdId): Promise<void>
Releases a hold on the connection.
Parameters
| Parameter | Type | Description |
|---|---|---|
holdId | string | The hold ID to release. |
Returns
Promise<void>