158 lines
3.6 KiB
Smali
158 lines
3.6 KiB
Smali
.class public Landroidx/room/util/DBUtil;
|
|
.super Ljava/lang/Object;
|
|
.source "DBUtil.java"
|
|
|
|
|
|
# direct methods
|
|
.method private constructor <init>()V
|
|
.locals 0
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static dropFtsSyncTriggers(Landroidx/sqlite/db/SupportSQLiteDatabase;)V
|
|
.locals 3
|
|
|
|
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
|
|
|
|
invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
const-string v2, "DROP TRIGGER IF EXISTS "
|
|
|
|
invoke-virtual {v2, v1}, Ljava/lang/String;->concat(Ljava/lang/String;)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
|
|
|
|
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
|
|
|
|
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
|