Rabbit-R1/original r1/smali/smali_classes2/androidx/room/util/DBUtil.smali
2024-05-21 17:08:36 -04:00

681 lines
19 KiB
Smali

.class public final Landroidx/room/util/DBUtil;
.super Ljava/lang/Object;
.source "DBUtil.kt"
# annotations
.annotation system Ldalvik/annotation/SourceDebugExtension;
value = "SMAP\nDBUtil.kt\nKotlin\n*S Kotlin\n*F\n+ 1 DBUtil.kt\nandroidx/room/util/DBUtil\n+ 2 CursorUtil.kt\nandroidx/room/util/CursorUtil\n+ 3 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n*L\n1#1,213:1\n145#2,7:214\n145#2,7:223\n1851#3,2:221\n*S KotlinDebug\n*F\n+ 1 DBUtil.kt\nandroidx/room/util/DBUtil\n*L\n100#1:214,7\n121#1:223,7\n107#1:221,2\n*E\n"
.end annotation
.annotation runtime Lkotlin/Metadata;
d1 = {
"\u0000D\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0008\u0002\n\u0002\u0010\u000e\n\u0002\u0008\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\u0008\u0002\n\u0002\u0010\u0008\n\u0000\n\u0002\u0018\u0002\n\u0000\u001a\u0008\u0010\u0000\u001a\u0004\u0018\u00010\u0001\u001a\u000e\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u0005\u001a\u0016\u0010\u0006\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u00052\u0006\u0010\u0007\u001a\u00020\u0008\u001a\u0010\u0010\t\u001a\u00020\u00082\u0006\u0010\n\u001a\u00020\u000bH\u0002\u001a \u0010\u000c\u001a\u00020\u000b2\u0006\u0010\u0004\u001a\u00020\r2\u0006\u0010\u000e\u001a\u00020\u000f2\u0006\u0010\u0010\u001a\u00020\u0011H\u0007\u001a(\u0010\u000c\u001a\u00020\u000b2\u0006\u0010\u0004\u001a\u00020\r2\u0006\u0010\u000e\u001a\u00020\u000f2\u0006\u0010\u0010\u001a\u00020\u00112\u0008\u0010\u0012\u001a\u0004\u0018\u00010\u0001\u001a\u000e\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u0015\u001a\u00020\u0016\u00a8\u0006\u0017"
}
d2 = {
"createCancellationSignal",
"Landroid/os/CancellationSignal;",
"dropFtsSyncTriggers",
"",
"db",
"Landroidx/sqlite/db/SupportSQLiteDatabase;",
"foreignKeyCheck",
"tableName",
"",
"processForeignKeyCheckFailure",
"cursor",
"Landroid/database/Cursor;",
"query",
"Landroidx/room/RoomDatabase;",
"sqLiteQuery",
"Landroidx/sqlite/db/SupportSQLiteQuery;",
"maybeCopy",
"",
"signal",
"readVersion",
"",
"databaseFile",
"Ljava/io/File;",
"room-runtime_release"
}
k = 0x2
mv = {
0x1,
0x7,
0x1
}
xi = 0x30
.end annotation
# direct methods
.method public static final createCancellationSignal()Landroid/os/CancellationSignal;
.locals 1
.line 163
invoke-static {}, Landroidx/sqlite/db/SupportSQLiteCompat$Api16Impl;->createCancellationSignal()Landroid/os/CancellationSignal;
move-result-object v0
return-object v0
.end method
.method public static final dropFtsSyncTriggers(Landroidx/sqlite/db/SupportSQLiteDatabase;)V
.locals 6
const-string v0, "db"
invoke-static {p0, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
.line 99
invoke-static {}, Lkotlin/collections/CollectionsKt;->createListBuilder()Ljava/util/List;
move-result-object v0
const-string v1, "SELECT name FROM sqlite_master WHERE type = \'trigger\'"
.line 100
invoke-interface {p0, v1}, Landroidx/sqlite/db/SupportSQLiteDatabase;->query(Ljava/lang/String;)Landroid/database/Cursor;
move-result-object v1
.line 215
check-cast v1, Ljava/io/Closeable;
:try_start_0
move-object v2, v1
check-cast v2, Landroid/database/Cursor;
.line 101
:goto_0
invoke-interface {v2}, Landroid/database/Cursor;->moveToNext()Z
move-result v3
const/4 v4, 0x0
if-eqz v3, :cond_0
.line 102
invoke-interface {v2, v4}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;
move-result-object v3
invoke-interface {v0, v3}, Ljava/util/List;->add(Ljava/lang/Object;)Z
goto :goto_0
.line 104
:cond_0
sget-object v2, Lkotlin/Unit;->INSTANCE:Lkotlin/Unit;
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
const/4 v2, 0x0
.line 215
invoke-static {v1, v2}, Lkotlin/io/CloseableKt;->closeFinally(Ljava/io/Closeable;Ljava/lang/Throwable;)V
.line 99
invoke-static {v0}, Lkotlin/collections/CollectionsKt;->build(Ljava/util/List;)Ljava/util/List;
move-result-object v0
.line 107
check-cast v0, Ljava/lang/Iterable;
.line 221
invoke-interface {v0}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator;
move-result-object v0
:cond_1
:goto_1
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
move-result v1
if-eqz v1, :cond_2
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
check-cast v1, Ljava/lang/String;
const-string v3, "triggerName"
.line 108
invoke-static {v1, v3}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
const-string v3, "room_fts_content_sync_"
const/4 v5, 0x2
invoke-static {v1, v3, v4, v5, v2}, Lkotlin/text/StringsKt;->startsWith$default(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z
move-result v3
if-eqz v3, :cond_1
.line 109
new-instance v3, Ljava/lang/StringBuilder;
const-string v5, "DROP TRIGGER IF EXISTS "
invoke-direct {v3, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {v3, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-interface {p0, v1}, Landroidx/sqlite/db/SupportSQLiteDatabase;->execSQL(Ljava/lang/String;)V
goto :goto_1
:cond_2
return-void
:catchall_0
move-exception p0
.line 215
:try_start_1
throw p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_1
:catchall_1
move-exception v0
invoke-static {v1, p0}, Lkotlin/io/CloseableKt;->closeFinally(Ljava/io/Closeable;Ljava/lang/Throwable;)V
throw v0
.end method
.method public static final foreignKeyCheck(Landroidx/sqlite/db/SupportSQLiteDatabase;Ljava/lang/String;)V
.locals 2
const-string v0, "db"
invoke-static {p0, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
const-string v0, "tableName"
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
.line 121
new-instance v0, Ljava/lang/StringBuilder;
const-string v1, "PRAGMA foreign_key_check(`"
invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p1
const-string v0, "`)"
invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p1
invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
invoke-interface {p0, p1}, Landroidx/sqlite/db/SupportSQLiteDatabase;->query(Ljava/lang/String;)Landroid/database/Cursor;
move-result-object p0
.line 224
check-cast p0, Ljava/io/Closeable;
:try_start_0
move-object p1, p0
check-cast p1, Landroid/database/Cursor;
.line 122
invoke-interface {p1}, Landroid/database/Cursor;->getCount()I
move-result v0
if-gtz v0, :cond_0
.line 126
sget-object p1, Lkotlin/Unit;->INSTANCE:Lkotlin/Unit;
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
const/4 p1, 0x0
.line 224
invoke-static {p0, p1}, Lkotlin/io/CloseableKt;->closeFinally(Ljava/io/Closeable;Ljava/lang/Throwable;)V
return-void
.line 123
:cond_0
:try_start_1
invoke-static {p1}, Landroidx/room/util/DBUtil;->processForeignKeyCheckFailure(Landroid/database/Cursor;)Ljava/lang/String;
move-result-object p1
.line 124
new-instance v0, Landroid/database/sqlite/SQLiteConstraintException;
invoke-direct {v0, p1}, Landroid/database/sqlite/SQLiteConstraintException;-><init>(Ljava/lang/String;)V
throw v0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
:catchall_0
move-exception p1
.line 224
:try_start_2
throw p1
:try_end_2
.catchall {:try_start_2 .. :try_end_2} :catchall_1
:catchall_1
move-exception v0
invoke-static {p0, p1}, Lkotlin/io/CloseableKt;->closeFinally(Ljava/io/Closeable;Ljava/lang/Throwable;)V
throw v0
.end method
.method private static final processForeignKeyCheckFailure(Landroid/database/Cursor;)Ljava/lang/String;
.locals 6
.line 185
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
.line 186
invoke-interface {p0}, Landroid/database/Cursor;->getCount()I
move-result v1
.line 187
new-instance v2, Ljava/util/LinkedHashMap;
invoke-direct {v2}, Ljava/util/LinkedHashMap;-><init>()V
check-cast v2, Ljava/util/Map;
.line 189
:cond_0
:goto_0
invoke-interface {p0}, Landroid/database/Cursor;->moveToNext()Z
move-result v3
if-eqz v3, :cond_2
.line 190
invoke-interface {p0}, Landroid/database/Cursor;->isFirst()Z
move-result v3
if-eqz v3, :cond_1
const-string v3, "Foreign key violation(s) detected in \'"
.line 191
invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const/4 v3, 0x0
.line 192
invoke-interface {p0, v3}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;
move-result-object v3
invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v3
const-string v4, "\'.\n"
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
:cond_1
const/4 v3, 0x3
.line 194
invoke-interface {p0, v3}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;
move-result-object v3
.line 195
invoke-interface {v2, v3}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
move-result v4
if-nez v4, :cond_0
const-string v4, "constraintIndex"
.line 196
invoke-static {v3, v4}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
const/4 v4, 0x2
invoke-interface {p0, v4}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;
move-result-object v4
const-string v5, "cursor.getString(2)"
invoke-static {v4, v5}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
invoke-interface {v2, v3, v4}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
goto :goto_0
:cond_2
const-string p0, "Number of different violations discovered: "
.line 200
invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
.line 201
invoke-interface {v2}, Ljava/util/Map;->keySet()Ljava/util/Set;
move-result-object p0
invoke-interface {p0}, Ljava/util/Set;->size()I
move-result p0
invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object p0
const-string v3, "\nNumber of rows in violation: "
invoke-virtual {p0, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
.line 203
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object p0
const-string v1, "\nViolation(s) detected in the following constraint(s):\n"
invoke-virtual {p0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
.line 206
invoke-interface {v2}, Ljava/util/Map;->entrySet()Ljava/util/Set;
move-result-object p0
invoke-interface {p0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
move-result-object p0
:goto_1
invoke-interface {p0}, Ljava/util/Iterator;->hasNext()Z
move-result v1
if-eqz v1, :cond_3
invoke-interface {p0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
check-cast v1, Ljava/util/Map$Entry;
invoke-interface {v1}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object;
move-result-object v2
check-cast v2, Ljava/lang/String;
invoke-interface {v1}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;
move-result-object v1
check-cast v1, Ljava/lang/String;
const-string v3, "\tParent Table = "
.line 207
invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
.line 208
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string v1, ", Foreign Key Constraint Index = "
.line 209
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
.line 210
invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
const-string v2, "\n"
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
goto :goto_1
.line 185
:cond_3
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p0
const-string v0, "StringBuilder().apply(builderAction).toString()"
invoke-static {p0, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
return-object p0
.end method
.method public static final query(Landroidx/room/RoomDatabase;Landroidx/sqlite/db/SupportSQLiteQuery;Z)Landroid/database/Cursor;
.locals 1
.annotation runtime Lkotlin/Deprecated;
message = "This is only used in the generated code and shouldn\'t be called directly."
.end annotation
const-string v0, "db"
invoke-static {p0, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
const-string v0, "sqLiteQuery"
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
const/4 v0, 0x0
.line 53
invoke-static {p0, p1, p2, v0}, Landroidx/room/util/DBUtil;->query(Landroidx/room/RoomDatabase;Landroidx/sqlite/db/SupportSQLiteQuery;ZLandroid/os/CancellationSignal;)Landroid/database/Cursor;
move-result-object p0
return-object p0
.end method
.method public static final query(Landroidx/room/RoomDatabase;Landroidx/sqlite/db/SupportSQLiteQuery;ZLandroid/os/CancellationSignal;)Landroid/database/Cursor;
.locals 1
const-string v0, "db"
invoke-static {p0, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
const-string v0, "sqLiteQuery"
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
.line 75
invoke-virtual {p0, p1, p3}, Landroidx/room/RoomDatabase;->query(Landroidx/sqlite/db/SupportSQLiteQuery;Landroid/os/CancellationSignal;)Landroid/database/Cursor;
move-result-object p0
if-eqz p2, :cond_1
.line 76
instance-of p1, p0, Landroid/database/AbstractWindowedCursor;
if-eqz p1, :cond_1
.line 77
move-object p1, p0
check-cast p1, Landroid/database/AbstractWindowedCursor;
invoke-virtual {p1}, Landroid/database/AbstractWindowedCursor;->getCount()I
move-result p2
.line 78
invoke-virtual {p1}, Landroid/database/AbstractWindowedCursor;->hasWindow()Z
move-result p3
if-eqz p3, :cond_0
.line 79
invoke-virtual {p1}, Landroid/database/AbstractWindowedCursor;->getWindow()Landroid/database/CursorWindow;
move-result-object p1
invoke-virtual {p1}, Landroid/database/CursorWindow;->getNumRows()I
move-result p1
goto :goto_0
:cond_0
move p1, p2
:goto_0
if-ge p1, p2, :cond_1
.line 84
invoke-static {p0}, Landroidx/room/util/CursorUtil;->copyAndClose(Landroid/database/Cursor;)Landroid/database/Cursor;
move-result-object p0
:cond_1
return-object p0
.end method
.method public static final readVersion(Ljava/io/File;)I
.locals 9
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
const-string v0, "databaseFile"
invoke-static {p0, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
.line 142
new-instance v0, Ljava/io/FileInputStream;
invoke-direct {v0, p0}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V
invoke-virtual {v0}, Ljava/io/FileInputStream;->getChannel()Ljava/nio/channels/FileChannel;
move-result-object p0
check-cast p0, Ljava/io/Closeable;
:try_start_0
move-object v6, p0
check-cast v6, Ljava/nio/channels/FileChannel;
const/4 v7, 0x4
.line 143
invoke-static {v7}, Ljava/nio/ByteBuffer;->allocate(I)Ljava/nio/ByteBuffer;
move-result-object v8
const-wide/16 v1, 0x3c
const-wide/16 v3, 0x4
const/4 v5, 0x1
move-object v0, v6
.line 144
invoke-virtual/range {v0 .. v5}, Ljava/nio/channels/FileChannel;->tryLock(JJZ)Ljava/nio/channels/FileLock;
const-wide/16 v0, 0x3c
.line 145
invoke-virtual {v6, v0, v1}, Ljava/nio/channels/FileChannel;->position(J)Ljava/nio/channels/FileChannel;
.line 146
invoke-virtual {v6, v8}, Ljava/nio/channels/FileChannel;->read(Ljava/nio/ByteBuffer;)I
move-result v0
if-ne v0, v7, :cond_0
.line 150
invoke-virtual {v8}, Ljava/nio/ByteBuffer;->rewind()Ljava/nio/Buffer;
.line 151
invoke-virtual {v8}, Ljava/nio/ByteBuffer;->getInt()I
move-result v0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
const/4 v1, 0x0
invoke-static {p0, v1}, Lkotlin/io/CloseableKt;->closeFinally(Ljava/io/Closeable;Ljava/lang/Throwable;)V
return v0
.line 148
:cond_0
:try_start_1
new-instance v0, Ljava/io/IOException;
const-string v1, "Bad database header, unable to read 4 bytes at offset 60"
invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
throw v0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
:catchall_0
move-exception v0
.line 151
:try_start_2
throw v0
:try_end_2
.catchall {:try_start_2 .. :try_end_2} :catchall_1
:catchall_1
move-exception v1
invoke-static {p0, v0}, Lkotlin/io/CloseableKt;->closeFinally(Ljava/io/Closeable;Ljava/lang/Throwable;)V
throw v1
.end method