batchUpdate
fun <T : BaseTable<*>> T.batchUpdate(block: BatchUpdateStatementBuilder<T>.() -> Unit): IntArray(source)
Deprecated
ktorm-global will be removed in the future, please migrate to the standard API.
Construct update expressions in the given closure, then batch execute them and return the effected row counts for each expression.
Note that this function is implemented based on Statement.addBatch and Statement.executeBatch, and any item in a batch operation must have the same structure, otherwise an exception will be thrown.
Usage:
Departments.batchUpdate {
for (i in 1..2) {
item {
set(it.location, "Hong Kong")
where {
it.id eq i
}
}
}
}
Content copied to clipboard
Return
the effected row counts for each sub-operation.
Parameters
block
the DSL block, extension function of BatchUpdateStatementBuilder, used to construct the expressions.