EntityInsertionAdapter

@RestrictTo([Scope.LIBRARY_GROUP_PREFIX]) abstract class EntityInsertionAdapter<T> : SharedSQLiteStatement
kotlin.Any
   ↳ androidx.room.SharedSQLiteStatement
   ↳ androidx.room.EntityInsertionAdapter

Implementations of this class knows how to insert a particular entity.

This is an internal library class and all of its implementations are auto-generated.

Summary

Public methods
Unit
insert(entity: T)

Inserts the entity into the database.

Unit
insert(entities: Array<T>)

Inserts the given entities into the database.

Unit
insert(entities: Iterable<T>)

Inserts the given entities into the database.

Long
insertAndReturnId(entity: T)

Inserts the given entity into the database and returns the row id.

LongArray

Inserts the given entities into the database and returns the row ids.

LongArray

Inserts the given entities into the database and returns the row ids.

Array<Long?>

Inserts the given entities into the database and returns the row ids.

Array<Long?>

Inserts the given entities into the database and returns the row ids.

List<Long>

Inserts the given entities into the database and returns the row ids.

List<Long>

Inserts the given entities into the database and returns the row ids.

Protected methods
abstract Unit
bind(statement: SupportSQLiteStatement?, entity: T)

Binds the entity into the given statement.

Inherited functions

Public methods

insert

fun insert(entity: T): Unit

Inserts the entity into the database.

Parameters
entity: T The entity to insert

insert

fun insert(entities: Array<T>): Unit

Inserts the given entities into the database.

Parameters
entities: Array<T> Entities to insert

insert

fun insert(entities: Iterable<T>): Unit

Inserts the given entities into the database.

Parameters
entities: Iterable<T> Entities to insert

insertAndReturnId

fun insertAndReturnId(entity: T): Long

Inserts the given entity into the database and returns the row id.

Parameters
entity: T The entity to insert
Return
The SQLite row id or -1 if no row is inserted

insertAndReturnIdsArray

fun insertAndReturnIdsArray(entities: Collection<T>): LongArray

Inserts the given entities into the database and returns the row ids.

Parameters
entities: Collection<T> Entities to insert
Return
The SQLite row ids, for entities that are not inserted the row id returned will be -1

insertAndReturnIdsArray

fun insertAndReturnIdsArray(entities: Array<T>): LongArray

Inserts the given entities into the database and returns the row ids.

Parameters
entities: Array<T> Entities to insert
Return
The SQLite row ids, for entities that are not inserted the row id returned will be -1

insertAndReturnIdsArrayBox

fun insertAndReturnIdsArrayBox(entities: Collection<T>): Array<Long?>

Inserts the given entities into the database and returns the row ids.

Parameters
entities: Collection<T> Entities to insert
Return
The SQLite row ids, for entities that are not inserted the row id returned will be -1

insertAndReturnIdsArrayBox

fun insertAndReturnIdsArrayBox(entities: Array<T>): Array<Long?>

Inserts the given entities into the database and returns the row ids.

Parameters
entities: Array<T> Entities to insert
Return
The SQLite row ids, for entities that are not inserted the row id returned will be -1

insertAndReturnIdsList

fun insertAndReturnIdsList(entities: Array<T>): List<Long>

Inserts the given entities into the database and returns the row ids.

Parameters
entities: Array<T> Entities to insert
Return
The SQLite row ids, for entities that are not inserted the row id returned will be -1

insertAndReturnIdsList

fun insertAndReturnIdsList(entities: Collection<T>): List<Long>

Inserts the given entities into the database and returns the row ids.

Parameters
entities: Collection<T> Entities to insert
Return
The SQLite row ids, for entities that are not inserted the row id returned will be -1

Protected methods

bind

protected abstract fun bind(
    statement: SupportSQLiteStatement?,
    entity: T
): Unit

Binds the entity into the given statement.

Parameters
statement: SupportSQLiteStatement? The SQLite statement that prepared for the query returned from createInsertQuery.
entity: T The entity of type T.