package androidx.room; import androidx.room.RoomDatabase; import androidx.sqlite.db.SupportSQLiteStatement; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.concurrent.Executor; import kotlin.Metadata; import kotlin.jvm.internal.Intrinsics; /* compiled from: QueryInterceptorStatement.kt */ @Metadata(d1 = {"\u0000J\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010!\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u0012\n\u0000\n\u0002\u0010\u0006\n\u0000\n\u0002\u0010\t\n\u0002\b\f\b\u0000\u0018\u00002\u00020\u0001B%\u0012\u0006\u0010\u0002\u001a\u00020\u0001\u0012\u0006\u0010\u0003\u001a\u00020\u0004\u0012\u0006\u0010\u0005\u001a\u00020\u0006\u0012\u0006\u0010\u0007\u001a\u00020\b¢\u0006\u0002\u0010\tJ\u0018\u0010\r\u001a\u00020\u000e2\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u0012H\u0016J\u0018\u0010\u0013\u001a\u00020\u000e2\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u0014H\u0016J\u0018\u0010\u0015\u001a\u00020\u000e2\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u0016H\u0016J\u0010\u0010\u0017\u001a\u00020\u000e2\u0006\u0010\u000f\u001a\u00020\u0010H\u0016J\u0018\u0010\u0018\u001a\u00020\u000e2\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u0004H\u0016J\b\u0010\u0019\u001a\u00020\u000eH\u0016J\t\u0010\u001a\u001a\u00020\u000eH\u0096\u0001J\b\u0010\u001b\u001a\u00020\u000eH\u0016J\b\u0010\u001c\u001a\u00020\u0016H\u0016J\b\u0010\u001d\u001a\u00020\u0010H\u0016J\u001a\u0010\u001e\u001a\u00020\u000e2\u0006\u0010\u001f\u001a\u00020\u00102\b\u0010\u0011\u001a\u0004\u0018\u00010\fH\u0002J\b\u0010 \u001a\u00020\u0016H\u0016J\n\u0010!\u001a\u0004\u0018\u00010\u0004H\u0016R\u0016\u0010\n\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\f0\u000bX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0001X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\bX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\""}, d2 = {"Landroidx/room/QueryInterceptorStatement;", "Landroidx/sqlite/db/SupportSQLiteStatement;", "delegate", "sqlStatement", "", "queryCallbackExecutor", "Ljava/util/concurrent/Executor;", "queryCallback", "Landroidx/room/RoomDatabase$QueryCallback;", "(Landroidx/sqlite/db/SupportSQLiteStatement;Ljava/lang/String;Ljava/util/concurrent/Executor;Landroidx/room/RoomDatabase$QueryCallback;)V", "bindArgsCache", "", "", "bindBlob", "", "index", "", "value", "", "bindDouble", "", "bindLong", "", "bindNull", "bindString", "clearBindings", "close", "execute", "executeInsert", "executeUpdateDelete", "saveArgsToCache", "bindIndex", "simpleQueryForLong", "simpleQueryForString", "room-runtime_release"}, k = 1, mv = {1, 7, 1}, xi = 48) /* loaded from: classes2.dex */ public final class QueryInterceptorStatement implements SupportSQLiteStatement { private final List bindArgsCache; private final SupportSQLiteStatement delegate; private final RoomDatabase.QueryCallback queryCallback; private final Executor queryCallbackExecutor; private final String sqlStatement; @Override // java.io.Closeable, java.lang.AutoCloseable public void close() { this.delegate.close(); } public QueryInterceptorStatement(SupportSQLiteStatement delegate, String sqlStatement, Executor queryCallbackExecutor, RoomDatabase.QueryCallback queryCallback) { Intrinsics.checkNotNullParameter(delegate, "delegate"); Intrinsics.checkNotNullParameter(sqlStatement, "sqlStatement"); Intrinsics.checkNotNullParameter(queryCallbackExecutor, "queryCallbackExecutor"); Intrinsics.checkNotNullParameter(queryCallback, "queryCallback"); this.delegate = delegate; this.sqlStatement = sqlStatement; this.queryCallbackExecutor = queryCallbackExecutor; this.queryCallback = queryCallback; this.bindArgsCache = new ArrayList(); } @Override // androidx.sqlite.db.SupportSQLiteStatement public void execute() { this.queryCallbackExecutor.execute(new Runnable() { // from class: androidx.room.QueryInterceptorStatement$$ExternalSyntheticLambda1 @Override // java.lang.Runnable public final void run() { QueryInterceptorStatement.execute$lambda$0(QueryInterceptorStatement.this); } }); this.delegate.execute(); } /* JADX INFO: Access modifiers changed from: private */ public static final void execute$lambda$0(QueryInterceptorStatement this$0) { Intrinsics.checkNotNullParameter(this$0, "this$0"); this$0.queryCallback.onQuery(this$0.sqlStatement, this$0.bindArgsCache); } @Override // androidx.sqlite.db.SupportSQLiteStatement public int executeUpdateDelete() { this.queryCallbackExecutor.execute(new Runnable() { // from class: androidx.room.QueryInterceptorStatement$$ExternalSyntheticLambda0 @Override // java.lang.Runnable public final void run() { QueryInterceptorStatement.executeUpdateDelete$lambda$1(QueryInterceptorStatement.this); } }); return this.delegate.executeUpdateDelete(); } /* JADX INFO: Access modifiers changed from: private */ public static final void executeUpdateDelete$lambda$1(QueryInterceptorStatement this$0) { Intrinsics.checkNotNullParameter(this$0, "this$0"); this$0.queryCallback.onQuery(this$0.sqlStatement, this$0.bindArgsCache); } @Override // androidx.sqlite.db.SupportSQLiteStatement public long executeInsert() { this.queryCallbackExecutor.execute(new Runnable() { // from class: androidx.room.QueryInterceptorStatement$$ExternalSyntheticLambda2 @Override // java.lang.Runnable public final void run() { QueryInterceptorStatement.executeInsert$lambda$2(QueryInterceptorStatement.this); } }); return this.delegate.executeInsert(); } /* JADX INFO: Access modifiers changed from: private */ public static final void executeInsert$lambda$2(QueryInterceptorStatement this$0) { Intrinsics.checkNotNullParameter(this$0, "this$0"); this$0.queryCallback.onQuery(this$0.sqlStatement, this$0.bindArgsCache); } @Override // androidx.sqlite.db.SupportSQLiteStatement public long simpleQueryForLong() { this.queryCallbackExecutor.execute(new Runnable() { // from class: androidx.room.QueryInterceptorStatement$$ExternalSyntheticLambda4 @Override // java.lang.Runnable public final void run() { QueryInterceptorStatement.simpleQueryForLong$lambda$3(QueryInterceptorStatement.this); } }); return this.delegate.simpleQueryForLong(); } /* JADX INFO: Access modifiers changed from: private */ public static final void simpleQueryForLong$lambda$3(QueryInterceptorStatement this$0) { Intrinsics.checkNotNullParameter(this$0, "this$0"); this$0.queryCallback.onQuery(this$0.sqlStatement, this$0.bindArgsCache); } @Override // androidx.sqlite.db.SupportSQLiteStatement public String simpleQueryForString() { this.queryCallbackExecutor.execute(new Runnable() { // from class: androidx.room.QueryInterceptorStatement$$ExternalSyntheticLambda3 @Override // java.lang.Runnable public final void run() { QueryInterceptorStatement.simpleQueryForString$lambda$4(QueryInterceptorStatement.this); } }); return this.delegate.simpleQueryForString(); } /* JADX INFO: Access modifiers changed from: private */ public static final void simpleQueryForString$lambda$4(QueryInterceptorStatement this$0) { Intrinsics.checkNotNullParameter(this$0, "this$0"); this$0.queryCallback.onQuery(this$0.sqlStatement, this$0.bindArgsCache); } @Override // androidx.sqlite.db.SupportSQLiteProgram public void bindNull(int index) { Object[] array = this.bindArgsCache.toArray(new Object[0]); Intrinsics.checkNotNull(array, "null cannot be cast to non-null type kotlin.Array"); saveArgsToCache(index, Arrays.copyOf(array, array.length)); this.delegate.bindNull(index); } @Override // androidx.sqlite.db.SupportSQLiteProgram public void bindLong(int index, long value) { saveArgsToCache(index, Long.valueOf(value)); this.delegate.bindLong(index, value); } @Override // androidx.sqlite.db.SupportSQLiteProgram public void bindDouble(int index, double value) { saveArgsToCache(index, Double.valueOf(value)); this.delegate.bindDouble(index, value); } @Override // androidx.sqlite.db.SupportSQLiteProgram public void bindString(int index, String value) { Intrinsics.checkNotNullParameter(value, "value"); saveArgsToCache(index, value); this.delegate.bindString(index, value); } @Override // androidx.sqlite.db.SupportSQLiteProgram public void bindBlob(int index, byte[] value) { Intrinsics.checkNotNullParameter(value, "value"); saveArgsToCache(index, value); this.delegate.bindBlob(index, value); } @Override // androidx.sqlite.db.SupportSQLiteProgram public void clearBindings() { this.bindArgsCache.clear(); this.delegate.clearBindings(); } private final void saveArgsToCache(int bindIndex, Object value) { int i = bindIndex - 1; if (i >= this.bindArgsCache.size()) { int size = (i - this.bindArgsCache.size()) + 1; for (int i2 = 0; i2 < size; i2++) { this.bindArgsCache.add(null); } } this.bindArgsCache.set(i, value); } }