SQLiteDriver

class SQLiteDriver(connection: SQLiteConnection, beginImmediate: Boolean = false, readers: List<SQLiteConnection> = emptyList()) : SqlDriver

Asynchronous SQLDelight driver on top of a SQLiteConnection provided by a backend module.

Parameters

beginImmediate

start transactions with BEGIN IMMEDIATE instead of BEGIN TRANSACTION

readers

extra connections to the same database file in WAL mode, SELECT queries outside a transaction go to the least busy one, everything else to connection; since 1.1.0

Constructors

Link copied to clipboard
constructor(connection: SQLiteConnection, beginImmediate: Boolean = false, readers: List<SQLiteConnection> = emptyList())

Functions

Link copied to clipboard
fun _endTransactionForTests(successful: Boolean): QueryResult<Unit>?

Use for tests only.

Link copied to clipboard
open override fun addListener(vararg queryKeys: String, listener: Query.Listener)
Link copied to clipboard
open override fun close()

Fire-and-forget: the database may still be open when this returns. Use closeSuspending to wait for the close to complete.

Link copied to clipboard
suspend fun closeSuspending()

Closes the database and waits for completion; throws SQLiteJsException on failure. Idempotent, backends answer a second close with an error. A failed close (e.g. unfinalized statements in sqlite3) leaves the database open and can be retried.

Link copied to clipboard
open override fun currentTransaction(): Transacter.Transaction?
Link copied to clipboard
open override fun execute(identifier: Int?, sql: String, parameters: Int, binders: SqlPreparedStatement.() -> Unit?): QueryResult<Long>
Link copied to clipboard
open override fun <R> executeQuery(identifier: Int?, sql: String, mapper: (SqlCursor) -> QueryResult<R>, parameters: Int, binders: SqlPreparedStatement.() -> Unit?): QueryResult<R>
Link copied to clipboard
open override fun newTransaction(): QueryResult<Transacter.Transaction>
Link copied to clipboard
open override fun notifyListeners(vararg queryKeys: String)
Link copied to clipboard
open override fun removeListener(vararg queryKeys: String, listener: Query.Listener)
Link copied to clipboard
suspend fun SQLiteDriver.withSchema(schema: SqlSchema<QueryResult.AsyncValue<Unit>>? = null): SQLiteDriver

Creates schema (if given) on this driver, used by backend modules' init functions.