Skip to content

//selekt-android/com.bloomberg.selekt.android/SQLiteDatabase/batch

batch

[androidJvm]\ fun batch(sql: String, bindArgs: Sequence<Array<out Any?>>): Int

Transacts to the database in exclusive mode a batch of queries with the same underlying SQL statement. The prototypical use case is for database modifications inside a tight loop to which this is optimised.

Each array in the sequence must have the same length, corresponding to the number of arguments in the SQL statement. It is safe for the sequence to recycle the array with each yield.

The transaction is not committed by this method until the sequence ends. For long sequences you may therefore wish to yield the transaction periodically.

Return

the number of rows affected.

Parameters

androidJvm

sql statement.
bindArgs sequence of standard type arguments for binding to the statement.