bind
Specifies the column-to-value mappings for the INSERT statement using a lambda.
This function is used to define which columns to insert and what their values should be. It is one of the primary ways to provide data for an INSERT operation, along with values and select.
The lambda receiver is a Bind object, which provides the bind extension function for each KQLiteColumn. The lambda also receives the table instance T as a parameter.
If the InsertStatement was created without specifying columns (e.g., table.insert()), all columns provided in the binding block will be inserted. If columns were specified (e.g., table.insert(colA, colB)), then only those columns can be bound in the lambda; binding an unlisted column will cause an error at execution time.
Example:
// INSERT INTO Artists (artistId, artistName) VALUES (?, ?);
Artists.insert().use { statement ->
statement.bind { // 'it' is the Artists table instance
it.artistId.bind(1)
it.artistName.bind("New Artist")
}.execute()
}Return
This InsertStatement instance, allowing for method chaining.
Author
MOHAMMAD AZIM ANSARI
Parameters
A lambda function with a Bind receiver where you call bind on the columns of the table to set their values for the new row.
See also
Throws
if the binding block is empty.