Bind

interface Bind

An interface that defines the binding of values with ? to handle safely. Typically used within the context of INSERT or UPDATE statements.

This interface acts as a receiver scope for lambda expressions in operations like com.kqlite.statement.quickInsert or com.kqlite.statement.quickUpdate, providing a DSL for associating values with their respective columns in a type-safe manner. Each bind function maps a column to a specific value that will be used by underlying driver.

Note: Only primitive values and literals user ? bind args. Functions are inserted without binding args.

Example

// INSERT INTO Artists (ArtistId, ArtistName) VALUES (?, ?)
Artists.quickInsert { // 'it' is implicitly of type table 'Artists'
it.artistId.bind(1)
it.artistName.bind("John Doe")
}

Author

MOHAMMAD AZIM ANSARI

See also

Functions

Link copied to clipboard
abstract fun KQLiteColumn<*>.bind(select: SelectStatement<*>)

Binds the result of a SelectStatement to this column.

abstract fun <T> KQLiteColumn<T>.bind(value: T)

Binds a literal value using ? to this column.

abstract fun <T> KQLiteColumn<T>.bind(value: KQLiteColumn<out T>)

Binds the value of another column or function to this column.

abstract fun KQLiteColumn<in Double>.bind(value: Float)

Binds a Float value to a column that accepts Double types.

abstract fun KQLiteColumn<in Long>.bind(value: Int)

Binds an Int value to a column that accepts Long types.