batchInsert

fun <T : Table, E> T.batchInsert(data: Iterable<E>, ignore: Boolean = false, shouldReturnGeneratedValues: Boolean = true, body: BatchInsertStatement.(E) -> Unit): List<ResultRow>

Represents the SQL statement that batch inserts new rows into a table.

Return

A list of ResultRow representing data from each newly inserted row.

Parameters

data

Collection of values to use in the batch insert.

ignore

Whether to ignore errors or not. Note ignore is not supported by all vendors. Please check the documentation.

shouldReturnGeneratedValues

Specifies whether newly generated values (for example, auto-incremented IDs) should be returned. See Batch Insert for more details.

Samples

org.jetbrains.exposed.sql.tests.shared.dml.InsertTests.testBatchInsert01
fun <T : Table, E> T.batchInsert(data: Sequence<E>, ignore: Boolean = false, shouldReturnGeneratedValues: Boolean = true, body: BatchInsertStatement.(E) -> Unit): List<ResultRow>

Represents the SQL statement that batch inserts new rows into a table.

Return

A list of ResultRow representing data from each newly inserted row.

Parameters

data

Sequence of values to use in the batch insert.

ignore

Whether to ignore errors or not. Note ignore is not supported by all vendors. Please check the documentation.

shouldReturnGeneratedValues

Specifies whether newly generated values (for example, auto-incremented IDs) should be returned. See Batch Insert for more details.

Samples

org.jetbrains.exposed.sql.tests.shared.dml.InsertTests.testBatchInsertWithSequence