PreparedStatement

Exposes the Statement API.

Unless documented otherwise, every member throws IllegalStateException once this statement is closed.

Properties

Link copied to clipboard
abstract val columnCount: Int

Number of columns in the result set.

Link copied to clipboard

Database connection to which this statement belongs.

Link copied to clipboard
abstract val expandedSql: String?

SQL associated with the statement with bound parameters expanded.

Link copied to clipboard
abstract override var explain: SqliteExplainMode

Explain mode.

Link copied to clipboard
abstract val isBusy: Boolean

Whether the prepared statement has been stepped at least once using step but has neither run to completion (returned null from step) nor been reset.

Link copied to clipboard
abstract val isReadOnly: Boolean

Whether the prepared statement makes no direct changes to the content of the database file.

Link copied to clipboard

Statement parameters.

Link copied to clipboard
abstract val sql: String

SQL text used to create this statement.

Functions

Link copied to clipboard
abstract override fun close()

Finalizes this prepared statement. Calling this again on an already closed statement has no effect.

Link copied to clipboard
inline fun PreparedStatement.forEachRow(action: (Row) -> Unit)

Calls action once for every Row produced by stepping this statement, until it's exhausted. Equivalent to manually looping on step, generateSequence(::step).forEach(action) for that matter, but without the intermediate Sequence.

Link copied to clipboard
abstract fun getStatus(counter: SqliteStatementStatusCounter, reset: Boolean): Int

Returns the current value of the given counter, resetting it afterward if reset is true.

Returns the current value of the given counter, without resetting it.

Link copied to clipboard
abstract fun reset()

Resets the prepared statement object back to its initial state, making it ready to be re-executed.

Link copied to clipboard
abstract fun step(): Row?

Evaluates the statement and returns a Row if any data is found or null if the statement has finished executing.