PooledConnection


public interface 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 methods

abstract @NonNull R
<R extends Object> usePrepared(
    @NonNull String sql,
    @NonNull Function1<@NonNull SQLiteStatement, @NonNull R> block
)

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

Extension functions

default final void
TransactorKt.execSQL(
    @NonNull PooledConnection receiver,
    @NonNull String sql
)

Executes a single SQL statement that returns no values.

Public methods

usePrepared

abstract @NonNull R <R extends Object> usePrepared(
    @NonNull String sql,
    @NonNull Function1<@NonNull SQLiteStatement, @NonNull R> block
)

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
@NonNull String sql

The SQL statement to prepare

@NonNull Function1<@NonNull SQLiteStatement, @NonNull R> block

The code to use the statement

Extension functions

TransactorKt.execSQL

default final void TransactorKt.execSQL(
    @NonNull PooledConnection receiver,
    @NonNull String sql
)

Executes a single SQL statement that returns no values.