PooledConnection


Known direct subclasses
TransactionScope

A PooledConnection with an active transaction capable of performing nested transactions.

Transactor

A PooledConnection that can perform transactions.


A wrapper of SQLiteConnection that belongs to a connection pool and is safe to use in a coroutine.

Summary

Public functions

suspend R
<R : Any?> usePrepared(sql: String, block: (SQLiteStatement) -> R)

Prepares a new SQL statement and use it within the code block.

Cmn

Extension functions

suspend Unit

Executes a single SQL statement that returns no values.

Cmn

Public functions

usePrepared

suspend fun <R : Any?> usePrepared(sql: String, block: (SQLiteStatement) -> R): R

Prepares a new SQL statement and use it within the code block.

Using the given SQLiteStatement after block completes is prohibited. The statement will also be thread confined, attempting to use it from another thread is an error.

Using a statement locks the connection it belongs to, therefore try not to do long-running computations within the block.

Parameters
sql: String

The SQL statement to prepare

block: (SQLiteStatement) -> R

The code to use the statement

Extension functions

execSQL

suspend fun PooledConnection.execSQL(sql: String): Unit

Executes a single SQL statement that returns no values.