PooledConnection
-
Cmn
interface PooledConnection
TransactionScope |
A |
Transactor |
A |
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 |
Cmn
|
Extension functions |
||
|---|---|---|
suspend Unit |
PooledConnection.execSQL(sql: String)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
PooledConnection.execSQL
suspend fun PooledConnection.execSQL(sql: String): Unit
Executes a single SQL statement that returns no values.