I am trying to update a specific column on a list of rows in MySql using Exposed.
Actually Exposed supports a batchInsert
, but there is nothing similar to a batchUpdate
, is there any workaround for this?
NOTE: the table is not an IdTable
.
I am trying to update a specific column on a list of rows in MySql using Exposed.
Actually Exposed supports a batchInsert
, but there is nothing similar to a batchUpdate
, is there any workaround for this?
NOTE: the table is not an IdTable
.
There are BatchUpdateStatement which works with IdTables.
val yourData = listOf<DataToUpdate>()
BatchUpdateStatement(FooTable).apply {
yourData.forEach {
addBatch(it.id)
this[FooTable.name] = it.name
this[FooTable.column] = it.field
}
execute(Transaction.current())
}