- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
193 lines
6.9 KiB
Java
193 lines
6.9 KiB
Java
package androidx.room;
|
|
|
|
import androidx.annotation.RestrictTo;
|
|
import androidx.sqlite.db.SupportSQLiteStatement;
|
|
import java.util.Collection;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import kotlin.collections.CollectionsKt__CollectionsJVMKt;
|
|
import kotlin.collections.CollectionsKt__CollectionsKt;
|
|
import kotlin.jvm.internal.ArrayIteratorKt;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.jvm.internal.SourceDebugExtension;
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
@SourceDebugExtension({"SMAP\nEntityInsertionAdapter.kt\nKotlin\n*S Kotlin\n*F\n+ 1 EntityInsertionAdapter.kt\nandroidx/room/EntityInsertionAdapter\n+ 2 _Arrays.kt\nkotlin/collections/ArraysKt___ArraysKt\n+ 3 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n*L\n1#1,229:1\n13579#2,2:230\n13644#2,3:237\n13579#2,2:240\n1855#3,2:232\n1864#3,3:234\n1855#3,2:242\n*S KotlinDebug\n*F\n+ 1 EntityInsertionAdapter.kt\nandroidx/room/EntityInsertionAdapter\n*L\n65#1:230,2\n137#1:237,3\n199#1:240,2\n82#1:232,2\n117#1:234,3\n219#1:242,2\n*E\n"})
|
|
/* loaded from: classes.dex */
|
|
public abstract class EntityInsertionAdapter<T> extends SharedSQLiteStatement {
|
|
public abstract void bind(SupportSQLiteStatement supportSQLiteStatement, T t);
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
public EntityInsertionAdapter(RoomDatabase database) {
|
|
super(database);
|
|
Intrinsics.checkNotNullParameter(database, "database");
|
|
}
|
|
|
|
public final void insert(T t) {
|
|
SupportSQLiteStatement acquire = acquire();
|
|
try {
|
|
bind(acquire, t);
|
|
acquire.executeInsert();
|
|
} finally {
|
|
release(acquire);
|
|
}
|
|
}
|
|
|
|
public final void insert(T[] entities) {
|
|
Intrinsics.checkNotNullParameter(entities, "entities");
|
|
SupportSQLiteStatement acquire = acquire();
|
|
try {
|
|
for (T t : entities) {
|
|
bind(acquire, t);
|
|
acquire.executeInsert();
|
|
}
|
|
} finally {
|
|
release(acquire);
|
|
}
|
|
}
|
|
|
|
public final void insert(Iterable<? extends T> entities) {
|
|
Intrinsics.checkNotNullParameter(entities, "entities");
|
|
SupportSQLiteStatement acquire = acquire();
|
|
try {
|
|
Iterator<? extends T> it = entities.iterator();
|
|
while (it.hasNext()) {
|
|
bind(acquire, it.next());
|
|
acquire.executeInsert();
|
|
}
|
|
} finally {
|
|
release(acquire);
|
|
}
|
|
}
|
|
|
|
public final long insertAndReturnId(T t) {
|
|
SupportSQLiteStatement acquire = acquire();
|
|
try {
|
|
bind(acquire, t);
|
|
return acquire.executeInsert();
|
|
} finally {
|
|
release(acquire);
|
|
}
|
|
}
|
|
|
|
public final long[] insertAndReturnIdsArray(Collection<? extends T> entities) {
|
|
Intrinsics.checkNotNullParameter(entities, "entities");
|
|
SupportSQLiteStatement acquire = acquire();
|
|
try {
|
|
long[] jArr = new long[entities.size()];
|
|
int i = 0;
|
|
for (T t : entities) {
|
|
int i2 = i + 1;
|
|
if (i < 0) {
|
|
CollectionsKt__CollectionsKt.throwIndexOverflow();
|
|
}
|
|
bind(acquire, t);
|
|
jArr[i] = acquire.executeInsert();
|
|
i = i2;
|
|
}
|
|
release(acquire);
|
|
return jArr;
|
|
} catch (Throwable th) {
|
|
release(acquire);
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
public final long[] insertAndReturnIdsArray(T[] entities) {
|
|
Intrinsics.checkNotNullParameter(entities, "entities");
|
|
SupportSQLiteStatement acquire = acquire();
|
|
try {
|
|
long[] jArr = new long[entities.length];
|
|
int length = entities.length;
|
|
int i = 0;
|
|
int i2 = 0;
|
|
while (i < length) {
|
|
int i3 = i2 + 1;
|
|
bind(acquire, entities[i]);
|
|
jArr[i2] = acquire.executeInsert();
|
|
i++;
|
|
i2 = i3;
|
|
}
|
|
return jArr;
|
|
} finally {
|
|
release(acquire);
|
|
}
|
|
}
|
|
|
|
public final Long[] insertAndReturnIdsArrayBox(Collection<? extends T> entities) {
|
|
Intrinsics.checkNotNullParameter(entities, "entities");
|
|
SupportSQLiteStatement acquire = acquire();
|
|
Iterator<? extends T> it = entities.iterator();
|
|
try {
|
|
int size = entities.size();
|
|
Long[] lArr = new Long[size];
|
|
for (int i = 0; i < size; i++) {
|
|
bind(acquire, it.next());
|
|
lArr[i] = Long.valueOf(acquire.executeInsert());
|
|
}
|
|
return lArr;
|
|
} finally {
|
|
release(acquire);
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public final Long[] insertAndReturnIdsArrayBox(T[] entities) {
|
|
Intrinsics.checkNotNullParameter(entities, "entities");
|
|
SupportSQLiteStatement acquire = acquire();
|
|
Iterator it = ArrayIteratorKt.iterator(entities);
|
|
try {
|
|
int length = entities.length;
|
|
Long[] lArr = new Long[length];
|
|
for (int i = 0; i < length; i++) {
|
|
bind(acquire, it.next());
|
|
lArr[i] = Long.valueOf(acquire.executeInsert());
|
|
}
|
|
return lArr;
|
|
} finally {
|
|
release(acquire);
|
|
}
|
|
}
|
|
|
|
public final List<Long> insertAndReturnIdsList(T[] entities) {
|
|
List createListBuilder;
|
|
List<Long> build;
|
|
Intrinsics.checkNotNullParameter(entities, "entities");
|
|
SupportSQLiteStatement acquire = acquire();
|
|
try {
|
|
createListBuilder = CollectionsKt__CollectionsJVMKt.createListBuilder();
|
|
for (T t : entities) {
|
|
bind(acquire, t);
|
|
createListBuilder.add(Long.valueOf(acquire.executeInsert()));
|
|
}
|
|
build = CollectionsKt__CollectionsJVMKt.build(createListBuilder);
|
|
release(acquire);
|
|
return build;
|
|
} catch (Throwable th) {
|
|
release(acquire);
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
public final List<Long> insertAndReturnIdsList(Collection<? extends T> entities) {
|
|
List createListBuilder;
|
|
List<Long> build;
|
|
Intrinsics.checkNotNullParameter(entities, "entities");
|
|
SupportSQLiteStatement acquire = acquire();
|
|
try {
|
|
createListBuilder = CollectionsKt__CollectionsJVMKt.createListBuilder();
|
|
Iterator<T> it = entities.iterator();
|
|
while (it.hasNext()) {
|
|
bind(acquire, it.next());
|
|
createListBuilder.add(Long.valueOf(acquire.executeInsert()));
|
|
}
|
|
build = CollectionsKt__CollectionsJVMKt.build(createListBuilder);
|
|
release(acquire);
|
|
return build;
|
|
} catch (Throwable th) {
|
|
release(acquire);
|
|
throw th;
|
|
}
|
|
}
|
|
}
|