bind

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

Binds a literal value using ? to this column.

This function is used to associate a specific value with a column, typically for operations like INSERT or UPDATE where you are providing the data to be written.

Underlying driver will use ? in query to bind the value safely.

Example

Artists.quickInsert {
it.artistId.bind(1)
it.artistName.bind("SuperCoolMan")
}

Parameters

value

The value to bind to the column. The type of the value must match the column's type T.

Type Parameters

T

The data type of the column and the value being bound.


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

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

Example

Artists.quickInsert {
it.artistName.bind(UPPER(StringLiteral("SuperCoolMan")))
}

Parameters

value

The column or function whose value should be bound to this column.

Type Parameters

T

The data type of the columns.


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

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

This is a convenience function that allows binding an integer directly to a Long column, as this is a common and safe conversion in database operations.

Parameters

value

The Int value to bind. It will be treated as a Long by the database driver.


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

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

This is a convenience function that allows binding a float directly to a Double column, as this is a common and safe conversion in database operations.

Parameters

value

The Float value to bind. It will be treated as a Double by the database driver.


abstract fun KQLiteColumn<*>.bind(select: SelectStatement<*>)

Binds the result of a SelectStatement to this column.

This is typically used for subqueries within an INSERT or UPDATE operation, allowing the value of this column to be populated by the output of the provided select statement.

Example

Artists.quickInsert {
it.artistId.bind(2)
// Binds the name from another table using a subquery
it.artistName.bind(
OtherTable
.select(OtherTable.name)
.where { OtherTable.id eq 1 },
)
}

Parameters

select

The select statement whose result will be bound to this column.