- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
403 lines
16 KiB
Java
403 lines
16 KiB
Java
package androidx.sqlite.db.framework;
|
|
|
|
import android.content.ContentValues;
|
|
import android.database.Cursor;
|
|
import android.database.SQLException;
|
|
import android.database.sqlite.SQLiteCursor;
|
|
import android.database.sqlite.SQLiteCursorDriver;
|
|
import android.database.sqlite.SQLiteDatabase;
|
|
import android.database.sqlite.SQLiteQuery;
|
|
import android.database.sqlite.SQLiteStatement;
|
|
import android.database.sqlite.SQLiteTransactionListener;
|
|
import android.os.Build;
|
|
import android.os.CancellationSignal;
|
|
import android.text.TextUtils;
|
|
import android.util.Pair;
|
|
import androidx.annotation.DoNotInline;
|
|
import androidx.annotation.RequiresApi;
|
|
import androidx.sqlite.db.SimpleSQLiteQuery;
|
|
import androidx.sqlite.db.SupportSQLiteCompat;
|
|
import androidx.sqlite.db.SupportSQLiteDatabase;
|
|
import androidx.sqlite.db.SupportSQLiteQuery;
|
|
import androidx.sqlite.db.SupportSQLiteStatement;
|
|
import java.io.IOException;
|
|
import java.util.List;
|
|
import java.util.Locale;
|
|
import kotlin.jvm.functions.Function4;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.jvm.internal.SourceDebugExtension;
|
|
|
|
@SourceDebugExtension({"SMAP\nFrameworkSQLiteDatabase.kt\nKotlin\n*S Kotlin\n*F\n+ 1 FrameworkSQLiteDatabase.kt\nandroidx/sqlite/db/framework/FrameworkSQLiteDatabase\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,336:1\n1#2:337\n*E\n"})
|
|
/* loaded from: classes.dex */
|
|
public final class FrameworkSQLiteDatabase implements SupportSQLiteDatabase {
|
|
private final SQLiteDatabase delegate;
|
|
public static final Companion Companion = new Companion(null);
|
|
private static final String[] CONFLICT_VALUES = {"", " OR ROLLBACK ", " OR ABORT ", " OR FAIL ", " OR IGNORE ", " OR REPLACE "};
|
|
private static final String[] EMPTY_STRING_ARRAY = new String[0];
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public boolean isExecPerConnectionSQLSupported() {
|
|
return Build.VERSION.SDK_INT >= 30;
|
|
}
|
|
|
|
public FrameworkSQLiteDatabase(SQLiteDatabase delegate) {
|
|
Intrinsics.checkNotNullParameter(delegate, "delegate");
|
|
this.delegate = delegate;
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public SupportSQLiteStatement compileStatement(String sql) {
|
|
Intrinsics.checkNotNullParameter(sql, "sql");
|
|
SQLiteStatement compileStatement = this.delegate.compileStatement(sql);
|
|
Intrinsics.checkNotNullExpressionValue(compileStatement, "delegate.compileStatement(sql)");
|
|
return new FrameworkSQLiteStatement(compileStatement);
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public void beginTransaction() {
|
|
this.delegate.beginTransaction();
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public void beginTransactionNonExclusive() {
|
|
this.delegate.beginTransactionNonExclusive();
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public void beginTransactionWithListener(SQLiteTransactionListener transactionListener) {
|
|
Intrinsics.checkNotNullParameter(transactionListener, "transactionListener");
|
|
this.delegate.beginTransactionWithListener(transactionListener);
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public void beginTransactionWithListenerNonExclusive(SQLiteTransactionListener transactionListener) {
|
|
Intrinsics.checkNotNullParameter(transactionListener, "transactionListener");
|
|
this.delegate.beginTransactionWithListenerNonExclusive(transactionListener);
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public void endTransaction() {
|
|
this.delegate.endTransaction();
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public void setTransactionSuccessful() {
|
|
this.delegate.setTransactionSuccessful();
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public boolean inTransaction() {
|
|
return this.delegate.inTransaction();
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public boolean isDbLockedByCurrentThread() {
|
|
return this.delegate.isDbLockedByCurrentThread();
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public boolean yieldIfContendedSafely() {
|
|
return this.delegate.yieldIfContendedSafely();
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public boolean yieldIfContendedSafely(long j) {
|
|
return this.delegate.yieldIfContendedSafely(j);
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public int getVersion() {
|
|
return this.delegate.getVersion();
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public void setVersion(int i) {
|
|
this.delegate.setVersion(i);
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public long getMaximumSize() {
|
|
return this.delegate.getMaximumSize();
|
|
}
|
|
|
|
/* renamed from: setMaximumSize, reason: collision with other method in class */
|
|
public void m177setMaximumSize(long j) {
|
|
this.delegate.setMaximumSize(j);
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public long setMaximumSize(long j) {
|
|
this.delegate.setMaximumSize(j);
|
|
return this.delegate.getMaximumSize();
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public void execPerConnectionSQL(String sql, Object[] objArr) {
|
|
Intrinsics.checkNotNullParameter(sql, "sql");
|
|
int i = Build.VERSION.SDK_INT;
|
|
if (i >= 30) {
|
|
Api30Impl.INSTANCE.execPerConnectionSQL(this.delegate, sql, objArr);
|
|
return;
|
|
}
|
|
throw new UnsupportedOperationException("execPerConnectionSQL is not supported on a SDK version lower than 30, current version is: " + i);
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public long getPageSize() {
|
|
return this.delegate.getPageSize();
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public void setPageSize(long j) {
|
|
this.delegate.setPageSize(j);
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public Cursor query(String query) {
|
|
Intrinsics.checkNotNullParameter(query, "query");
|
|
return query(new SimpleSQLiteQuery(query));
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public Cursor query(String query, Object[] bindArgs) {
|
|
Intrinsics.checkNotNullParameter(query, "query");
|
|
Intrinsics.checkNotNullParameter(bindArgs, "bindArgs");
|
|
return query(new SimpleSQLiteQuery(query, bindArgs));
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public Cursor query(final SupportSQLiteQuery query) {
|
|
Intrinsics.checkNotNullParameter(query, "query");
|
|
final Function4 function4 = new Function4() { // from class: androidx.sqlite.db.framework.FrameworkSQLiteDatabase$query$cursorFactory$1
|
|
{
|
|
super(4);
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function4
|
|
public final SQLiteCursor invoke(SQLiteDatabase sQLiteDatabase, SQLiteCursorDriver sQLiteCursorDriver, String str, SQLiteQuery sQLiteQuery) {
|
|
SupportSQLiteQuery supportSQLiteQuery = SupportSQLiteQuery.this;
|
|
Intrinsics.checkNotNull(sQLiteQuery);
|
|
supportSQLiteQuery.bindTo(new FrameworkSQLiteProgram(sQLiteQuery));
|
|
return new SQLiteCursor(sQLiteCursorDriver, str, sQLiteQuery);
|
|
}
|
|
};
|
|
Cursor rawQueryWithFactory = this.delegate.rawQueryWithFactory(new SQLiteDatabase.CursorFactory() { // from class: androidx.sqlite.db.framework.FrameworkSQLiteDatabase$$ExternalSyntheticLambda1
|
|
@Override // android.database.sqlite.SQLiteDatabase.CursorFactory
|
|
public final Cursor newCursor(SQLiteDatabase sQLiteDatabase, SQLiteCursorDriver sQLiteCursorDriver, String str, SQLiteQuery sQLiteQuery) {
|
|
Cursor query$lambda$0;
|
|
query$lambda$0 = FrameworkSQLiteDatabase.query$lambda$0(Function4.this, sQLiteDatabase, sQLiteCursorDriver, str, sQLiteQuery);
|
|
return query$lambda$0;
|
|
}
|
|
}, query.getSql(), EMPTY_STRING_ARRAY, null);
|
|
Intrinsics.checkNotNullExpressionValue(rawQueryWithFactory, "delegate.rawQueryWithFac…EMPTY_STRING_ARRAY, null)");
|
|
return rawQueryWithFactory;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static final Cursor query$lambda$0(Function4 tmp0, SQLiteDatabase sQLiteDatabase, SQLiteCursorDriver sQLiteCursorDriver, String str, SQLiteQuery sQLiteQuery) {
|
|
Intrinsics.checkNotNullParameter(tmp0, "$tmp0");
|
|
return (Cursor) tmp0.invoke(sQLiteDatabase, sQLiteCursorDriver, str, sQLiteQuery);
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
@RequiresApi(16)
|
|
public Cursor query(final SupportSQLiteQuery query, CancellationSignal cancellationSignal) {
|
|
Intrinsics.checkNotNullParameter(query, "query");
|
|
SQLiteDatabase sQLiteDatabase = this.delegate;
|
|
String sql = query.getSql();
|
|
String[] strArr = EMPTY_STRING_ARRAY;
|
|
Intrinsics.checkNotNull(cancellationSignal);
|
|
return SupportSQLiteCompat.Api16Impl.rawQueryWithFactory(sQLiteDatabase, sql, strArr, null, cancellationSignal, new SQLiteDatabase.CursorFactory() { // from class: androidx.sqlite.db.framework.FrameworkSQLiteDatabase$$ExternalSyntheticLambda0
|
|
@Override // android.database.sqlite.SQLiteDatabase.CursorFactory
|
|
public final Cursor newCursor(SQLiteDatabase sQLiteDatabase2, SQLiteCursorDriver sQLiteCursorDriver, String str, SQLiteQuery sQLiteQuery) {
|
|
Cursor query$lambda$1;
|
|
query$lambda$1 = FrameworkSQLiteDatabase.query$lambda$1(SupportSQLiteQuery.this, sQLiteDatabase2, sQLiteCursorDriver, str, sQLiteQuery);
|
|
return query$lambda$1;
|
|
}
|
|
});
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static final Cursor query$lambda$1(SupportSQLiteQuery query, SQLiteDatabase sQLiteDatabase, SQLiteCursorDriver sQLiteCursorDriver, String str, SQLiteQuery sQLiteQuery) {
|
|
Intrinsics.checkNotNullParameter(query, "$query");
|
|
Intrinsics.checkNotNull(sQLiteQuery);
|
|
query.bindTo(new FrameworkSQLiteProgram(sQLiteQuery));
|
|
return new SQLiteCursor(sQLiteCursorDriver, str, sQLiteQuery);
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public long insert(String table, int i, ContentValues values) throws SQLException {
|
|
Intrinsics.checkNotNullParameter(table, "table");
|
|
Intrinsics.checkNotNullParameter(values, "values");
|
|
return this.delegate.insertWithOnConflict(table, null, values, i);
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public int delete(String table, String str, Object[] objArr) {
|
|
Intrinsics.checkNotNullParameter(table, "table");
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("DELETE FROM ");
|
|
sb.append(table);
|
|
if (str != null && str.length() != 0) {
|
|
sb.append(" WHERE ");
|
|
sb.append(str);
|
|
}
|
|
String sb2 = sb.toString();
|
|
Intrinsics.checkNotNullExpressionValue(sb2, "StringBuilder().apply(builderAction).toString()");
|
|
SupportSQLiteStatement compileStatement = compileStatement(sb2);
|
|
SimpleSQLiteQuery.Companion.bind(compileStatement, objArr);
|
|
return compileStatement.executeUpdateDelete();
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public int update(String table, int i, ContentValues values, String str, Object[] objArr) {
|
|
Intrinsics.checkNotNullParameter(table, "table");
|
|
Intrinsics.checkNotNullParameter(values, "values");
|
|
if (values.size() == 0) {
|
|
throw new IllegalArgumentException("Empty values".toString());
|
|
}
|
|
int size = values.size();
|
|
int length = objArr == null ? size : objArr.length + size;
|
|
Object[] objArr2 = new Object[length];
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("UPDATE ");
|
|
sb.append(CONFLICT_VALUES[i]);
|
|
sb.append(table);
|
|
sb.append(" SET ");
|
|
int i2 = 0;
|
|
for (String str2 : values.keySet()) {
|
|
sb.append(i2 > 0 ? "," : "");
|
|
sb.append(str2);
|
|
objArr2[i2] = values.get(str2);
|
|
sb.append("=?");
|
|
i2++;
|
|
}
|
|
if (objArr != null) {
|
|
for (int i3 = size; i3 < length; i3++) {
|
|
objArr2[i3] = objArr[i3 - size];
|
|
}
|
|
}
|
|
if (!TextUtils.isEmpty(str)) {
|
|
sb.append(" WHERE ");
|
|
sb.append(str);
|
|
}
|
|
String sb2 = sb.toString();
|
|
Intrinsics.checkNotNullExpressionValue(sb2, "StringBuilder().apply(builderAction).toString()");
|
|
SupportSQLiteStatement compileStatement = compileStatement(sb2);
|
|
SimpleSQLiteQuery.Companion.bind(compileStatement, objArr2);
|
|
return compileStatement.executeUpdateDelete();
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public void execSQL(String sql) throws SQLException {
|
|
Intrinsics.checkNotNullParameter(sql, "sql");
|
|
this.delegate.execSQL(sql);
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public void execSQL(String sql, Object[] bindArgs) throws SQLException {
|
|
Intrinsics.checkNotNullParameter(sql, "sql");
|
|
Intrinsics.checkNotNullParameter(bindArgs, "bindArgs");
|
|
this.delegate.execSQL(sql, bindArgs);
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public boolean isReadOnly() {
|
|
return this.delegate.isReadOnly();
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public boolean isOpen() {
|
|
return this.delegate.isOpen();
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public boolean needUpgrade(int i) {
|
|
return this.delegate.needUpgrade(i);
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public String getPath() {
|
|
return this.delegate.getPath();
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public void setLocale(Locale locale) {
|
|
Intrinsics.checkNotNullParameter(locale, "locale");
|
|
this.delegate.setLocale(locale);
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public void setMaxSqlCacheSize(int i) {
|
|
this.delegate.setMaxSqlCacheSize(i);
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
@RequiresApi(api = 16)
|
|
public void setForeignKeyConstraintsEnabled(boolean z) {
|
|
SupportSQLiteCompat.Api16Impl.setForeignKeyConstraintsEnabled(this.delegate, z);
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public boolean enableWriteAheadLogging() {
|
|
return this.delegate.enableWriteAheadLogging();
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
@RequiresApi(api = 16)
|
|
public void disableWriteAheadLogging() {
|
|
SupportSQLiteCompat.Api16Impl.disableWriteAheadLogging(this.delegate);
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
@RequiresApi(api = 16)
|
|
public boolean isWriteAheadLoggingEnabled() {
|
|
return SupportSQLiteCompat.Api16Impl.isWriteAheadLoggingEnabled(this.delegate);
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public List<Pair<String, String>> getAttachedDbs() {
|
|
return this.delegate.getAttachedDbs();
|
|
}
|
|
|
|
@Override // androidx.sqlite.db.SupportSQLiteDatabase
|
|
public boolean isDatabaseIntegrityOk() {
|
|
return this.delegate.isDatabaseIntegrityOk();
|
|
}
|
|
|
|
@Override // java.io.Closeable, java.lang.AutoCloseable
|
|
public void close() throws IOException {
|
|
this.delegate.close();
|
|
}
|
|
|
|
public final boolean isDelegate(SQLiteDatabase sqLiteDatabase) {
|
|
Intrinsics.checkNotNullParameter(sqLiteDatabase, "sqLiteDatabase");
|
|
return Intrinsics.areEqual(this.delegate, sqLiteDatabase);
|
|
}
|
|
|
|
@RequiresApi(30)
|
|
public static final class Api30Impl {
|
|
public static final Api30Impl INSTANCE = new Api30Impl();
|
|
|
|
private Api30Impl() {
|
|
}
|
|
|
|
@DoNotInline
|
|
public final void execPerConnectionSQL(SQLiteDatabase sQLiteDatabase, String sql, Object[] objArr) {
|
|
Intrinsics.checkNotNullParameter(sQLiteDatabase, "sQLiteDatabase");
|
|
Intrinsics.checkNotNullParameter(sql, "sql");
|
|
sQLiteDatabase.execPerConnectionSQL(sql, objArr);
|
|
}
|
|
}
|
|
|
|
public static final class Companion {
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
private Companion() {
|
|
}
|
|
}
|
|
}
|