apkfuckery/com.discord/smali/androidx/room/util/DBUtil.smali

173 lines
4.1 KiB
Smali
Raw Normal View History

2019-10-07 23:23:22 +00:00
.class public Landroidx/room/util/DBUtil;
.super Ljava/lang/Object;
.source "DBUtil.java"
2019-12-06 03:29:40 +00:00
# annotations
.annotation build Landroidx/annotation/RestrictTo;
value = {
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP_PREFIX:Landroidx/annotation/RestrictTo$Scope;
}
.end annotation
2019-10-07 23:23:22 +00:00
# direct methods
2019-12-06 03:29:40 +00:00
.method public constructor <init>()V
2019-10-07 23:23:22 +00:00
.locals 0
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static dropFtsSyncTriggers(Landroidx/sqlite/db/SupportSQLiteDatabase;)V
2019-12-06 03:29:40 +00:00
.locals 4
2019-10-07 23:23:22 +00:00
new-instance v0, Ljava/util/ArrayList;
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
const-string v1, "SELECT name FROM sqlite_master WHERE type = \'trigger\'"
invoke-interface {p0, v1}, Landroidx/sqlite/db/SupportSQLiteDatabase;->query(Ljava/lang/String;)Landroid/database/Cursor;
move-result-object v1
:goto_0
:try_start_0
invoke-interface {v1}, Landroid/database/Cursor;->moveToNext()Z
move-result v2
if-eqz v2, :cond_0
const/4 v2, 0x0
invoke-interface {v1, v2}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;
move-result-object v2
invoke-interface {v0, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
goto :goto_0
:cond_0
invoke-interface {v1}, Landroid/database/Cursor;->close()V
invoke-interface {v0}, Ljava/util/List;->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 v2, "room_fts_content_sync_"
invoke-virtual {v1, v2}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
move-result v2
if-eqz v2, :cond_1
2019-12-06 03:29:40 +00:00
new-instance v2, Ljava/lang/StringBuilder;
2019-10-07 23:23:22 +00:00
2019-12-06 03:29:40 +00:00
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
const-string v3, "DROP TRIGGER IF EXISTS "
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
2019-10-07 23:23:22 +00:00
2019-12-06 03:29:40 +00:00
invoke-virtual {v2, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
2019-10-07 23:23:22 +00:00
2019-12-06 03:29:40 +00:00
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
2019-10-07 23:23:22 +00:00
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
invoke-interface {v1}, Landroid/database/Cursor;->close()V
throw p0
.end method
.method public static query(Landroidx/room/RoomDatabase;Landroidx/sqlite/db/SupportSQLiteQuery;Z)Landroid/database/Cursor;
.locals 3
2019-12-06 03:29:40 +00:00
.annotation build Landroidx/annotation/NonNull;
.end annotation
2019-10-07 23:23:22 +00:00
invoke-virtual {p0, p1}, Landroidx/room/RoomDatabase;->query(Landroidx/sqlite/db/SupportSQLiteQuery;)Landroid/database/Cursor;
move-result-object p0
if-eqz p2, :cond_2
instance-of p1, p0, Landroid/database/AbstractWindowedCursor;
if-eqz p1, :cond_2
move-object p1, p0
check-cast p1, Landroid/database/AbstractWindowedCursor;
invoke-virtual {p1}, Landroid/database/AbstractWindowedCursor;->getCount()I
move-result p2
invoke-virtual {p1}, Landroid/database/AbstractWindowedCursor;->hasWindow()Z
move-result v0
if-eqz v0, :cond_0
invoke-virtual {p1}, Landroid/database/AbstractWindowedCursor;->getWindow()Landroid/database/CursorWindow;
move-result-object v0
invoke-virtual {v0}, Landroid/database/CursorWindow;->getNumRows()I
move-result v0
goto :goto_0
:cond_0
move v0, p2
:goto_0
sget v1, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v2, 0x17
if-lt v1, v2, :cond_1
if-ge v0, p2, :cond_2
:cond_1
invoke-static {p1}, Landroidx/room/util/CursorUtil;->copyAndClose(Landroid/database/Cursor;)Landroid/database/Cursor;
move-result-object p0
:cond_2
return-object p0
.end method