SQLitePreparedStatement.smali

.class public Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;
.super Ljava/lang/Object;
.source "SQLitePreparedStatement.java"


# instance fields
.field private finalizeAfterQuery:Z

.field private isFinalized:Z

.field private sqliteStatementHandle:J


# direct methods
.method static constructor <clinit>()V
    .registers 1

    return-void
.end method

.method public constructor <init>(Lim/tpelyyftgw/sqlite/SQLiteDatabase;Ljava/lang/String;Z)V
    .registers 6
    .param p1, "db"    # Lim/tpelyyftgw/sqlite/SQLiteDatabase;
    .param p2, "sql"    # Ljava/lang/String;
    .param p3, "finalize"    # Z
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation

    .line 22
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 12
    const/4 v0, 0x0

    iput-boolean v0, p0, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->isFinalized:Z

    .line 23
    iput-boolean p3, p0, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->finalizeAfterQuery:Z

    .line 24
    invoke-virtual {p1}, Lim/tpelyyftgw/sqlite/SQLiteDatabase;->getSQLiteHandle()J

    move-result-wide v0

    invoke-virtual {p0, v0, v1, p2}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->prepare(JLjava/lang/String;)J

    move-result-wide v0

    iput-wide v0, p0, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->sqliteStatementHandle:J

    .line 36
    return-void
.end method

.method private reset()V
    .registers 3
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation

    .line 87
    iget-wide v0, p0, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->sqliteStatementHandle:J

    invoke-virtual {p0, v0, v1}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->reset(J)V

    .line 88
    return-void
.end method


# virtual methods
.method public bindByteBuffer(ILim/tpelyyftgw/tgnet/NativeByteBuffer;)V
    .registers 9
    .param p1, "index"    # I
    .param p2, "value"    # Lim/tpelyyftgw/tgnet/NativeByteBuffer;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation

    .line 136
    iget-wide v1, p0, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->sqliteStatementHandle:J

    iget-object v4, p2, Lim/tpelyyftgw/tgnet/NativeByteBuffer;->buffer:Ljava/nio/ByteBuffer;

    invoke-virtual {p2}, Lim/tpelyyftgw/tgnet/NativeByteBuffer;->limit()I

    move-result v5

    move-object v0, p0

    move v3, p1

    invoke-virtual/range {v0 .. v5}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->bindByteBuffer(JILjava/nio/ByteBuffer;I)V

    .line 137
    return-void
.end method

.method public bindByteBuffer(ILjava/nio/ByteBuffer;)V
    .registers 9
    .param p1, "index"    # I
    .param p2, "value"    # Ljava/nio/ByteBuffer;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation

    .line 132
    iget-wide v1, p0, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->sqliteStatementHandle:J

    invoke-virtual {p2}, Ljava/nio/ByteBuffer;->limit()I

    move-result v5

    move-object v0, p0

    move v3, p1

    move-object v4, p2

    invoke-virtual/range {v0 .. v5}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->bindByteBuffer(JILjava/nio/ByteBuffer;I)V

    .line 133
    return-void
.end method

.method native bindByteBuffer(JILjava/nio/ByteBuffer;I)V
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation
.end method

.method public bindDouble(ID)V
    .registers 10
    .param p1, "index"    # I
    .param p2, "value"    # D
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation

    .line 128
    iget-wide v1, p0, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->sqliteStatementHandle:J

    move-object v0, p0

    move v3, p1

    move-wide v4, p2

    invoke-virtual/range {v0 .. v5}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->bindDouble(JID)V

    .line 129
    return-void
.end method

.method native bindDouble(JID)V
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation
.end method

.method native bindInt(JII)V
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation
.end method

.method public bindInteger(II)V
    .registers 5
    .param p1, "index"    # I
    .param p2, "value"    # I
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation

    .line 124
    iget-wide v0, p0, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->sqliteStatementHandle:J

    invoke-virtual {p0, v0, v1, p1, p2}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->bindInt(JII)V

    .line 125
    return-void
.end method

.method public bindLong(IJ)V
    .registers 10
    .param p1, "index"    # I
    .param p2, "value"    # J
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation

    .line 144
    iget-wide v1, p0, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->sqliteStatementHandle:J

    move-object v0, p0

    move v3, p1

    move-wide v4, p2

    invoke-virtual/range {v0 .. v5}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->bindLong(JIJ)V

    .line 145
    return-void
.end method

.method native bindLong(JIJ)V
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation
.end method

.method public bindNull(I)V
    .registers 4
    .param p1, "index"    # I
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation

    .line 148
    iget-wide v0, p0, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->sqliteStatementHandle:J

    invoke-virtual {p0, v0, v1, p1}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->bindNull(JI)V

    .line 149
    return-void
.end method

.method native bindNull(JI)V
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation
.end method

.method public bindString(ILjava/lang/String;)V
    .registers 5
    .param p1, "index"    # I
    .param p2, "value"    # Ljava/lang/String;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation

    .line 140
    iget-wide v0, p0, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->sqliteStatementHandle:J

    invoke-virtual {p0, v0, v1, p1, p2}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->bindString(JILjava/lang/String;)V

    .line 141
    return-void
.end method

.method native bindString(JILjava/lang/String;)V
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation
.end method

.method checkFinalized()V
    .registers 3
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation

    .line 97
    iget-boolean v0, p0, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->isFinalized:Z

    if-nez v0, :cond_5

    .line 100
    return-void

    .line 98
    :cond_5
    new-instance v0, Lim/tpelyyftgw/sqlite/SQLiteException;

    const-string v1, "Prepared query finalized"

    invoke-direct {v0, v1}, Lim/tpelyyftgw/sqlite/SQLiteException;-><init>(Ljava/lang/String;)V

    throw v0
.end method

.method public dispose()V
    .registers 2

    .line 91
    iget-boolean v0, p0, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->finalizeAfterQuery:Z

    if-eqz v0, :cond_7

    .line 92
    invoke-virtual {p0}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->finalizeQuery()V

    .line 94
    :cond_7
    return-void
.end method

.method native finalize(J)V
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation
.end method

.method public finalizeQuery()V
    .registers 4

    .line 103
    iget-boolean v0, p0, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->isFinalized:Z

    if-eqz v0, :cond_5

    .line 104
    return-void

    .line 110
    :cond_5
    const/4 v0, 0x1

    :try_start_6
    iput-boolean v0, p0, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->isFinalized:Z

    .line 111
    iget-wide v0, p0, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->sqliteStatementHandle:J

    invoke-virtual {p0, v0, v1}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->finalize(J)V
    :try_end_d
    .catch Lim/tpelyyftgw/sqlite/SQLiteException; {:try_start_6 .. :try_end_d} :catch_e

    .line 120
    goto :goto_3c

    .line 112
    :catch_e
    move-exception v0

    .line 113
    .local v0, "e":Lim/tpelyyftgw/sqlite/SQLiteException;
    sget-boolean v1, Lim/tpelyyftgw/messenger/BuildVars;->LOGS_ENABLED:Z

    if-eqz v1, :cond_3c

    .line 114
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "SQLitePreparedStatement ---> catch exception  , isFinalized = "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-boolean v2, p0, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->isFinalized:Z

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;

    const-string v2, " , e = "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 116
    invoke-virtual {v0}, Lim/tpelyyftgw/sqlite/SQLiteException;->getMessage()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    .line 114
    invoke-static {v1}, Lim/tpelyyftgw/messenger/FileLog;->d(Ljava/lang/String;)V

    .line 118
    invoke-virtual {v0}, Lim/tpelyyftgw/sqlite/SQLiteException;->getMessage()Ljava/lang/String;

    move-result-object v1

    invoke-static {v1, v0}, Lim/tpelyyftgw/messenger/FileLog;->e(Ljava/lang/String;Ljava/lang/Throwable;)V

    .line 121
    .end local v0    # "e":Lim/tpelyyftgw/sqlite/SQLiteException;
    :cond_3c
    :goto_3c
    return-void
.end method

.method public getStatementHandle()J
    .registers 3

    .line 19
    iget-wide v0, p0, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->sqliteStatementHandle:J

    return-wide v0
.end method

.method native prepare(JLjava/lang/String;)J
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation
.end method

.method public query([Ljava/lang/Object;)Lim/tpelyyftgw/sqlite/SQLiteCursor;
    .registers 11
    .param p1, "args"    # [Ljava/lang/Object;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation

    .line 40
    if-eqz p1, :cond_6c

    .line 44
    invoke-virtual {p0}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->checkFinalized()V

    .line 46
    invoke-direct {p0}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->reset()V

    .line 49
    const/4 v0, 0x1

    .line 50
    .local v0, "i":I
    const/4 v1, 0x0

    .local v1, "a":I
    :goto_a
    array-length v2, p1

    if-ge v1, v2, :cond_66

    .line 51
    aget-object v8, p1, v1

    .line 52
    .local v8, "obj":Ljava/lang/Object;
    if-nez v8, :cond_17

    .line 53
    iget-wide v2, p0, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->sqliteStatementHandle:J

    invoke-virtual {p0, v2, v3, v0}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->bindNull(JI)V

    goto :goto_5a

    .line 54
    :cond_17
    instance-of v2, v8, Ljava/lang/Integer;

    if-eqz v2, :cond_28

    .line 55
    iget-wide v2, p0, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->sqliteStatementHandle:J

    move-object v4, v8

    check-cast v4, Ljava/lang/Integer;

    invoke-virtual {v4}, Ljava/lang/Integer;->intValue()I

    move-result v4

    invoke-virtual {p0, v2, v3, v0, v4}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->bindInt(JII)V

    goto :goto_5a

    .line 56
    :cond_28
    instance-of v2, v8, Ljava/lang/Double;

    if-eqz v2, :cond_3b

    .line 57
    iget-wide v3, p0, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->sqliteStatementHandle:J

    move-object v2, v8

    check-cast v2, Ljava/lang/Double;

    invoke-virtual {v2}, Ljava/lang/Double;->doubleValue()D

    move-result-wide v6

    move-object v2, p0

    move v5, v0

    invoke-virtual/range {v2 .. v7}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->bindDouble(JID)V

    goto :goto_5a

    .line 58
    :cond_3b
    instance-of v2, v8, Ljava/lang/String;

    if-eqz v2, :cond_48

    .line 59
    iget-wide v2, p0, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->sqliteStatementHandle:J

    move-object v4, v8

    check-cast v4, Ljava/lang/String;

    invoke-virtual {p0, v2, v3, v0, v4}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->bindString(JILjava/lang/String;)V

    goto :goto_5a

    .line 60
    :cond_48
    instance-of v2, v8, Ljava/lang/Long;

    if-eqz v2, :cond_60

    .line 61
    iget-wide v3, p0, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->sqliteStatementHandle:J

    move-object v2, v8

    check-cast v2, Ljava/lang/Long;

    invoke-virtual {v2}, Ljava/lang/Long;->longValue()J

    move-result-wide v6

    move-object v2, p0

    move v5, v0

    invoke-virtual/range {v2 .. v7}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->bindLong(JIJ)V

    .line 65
    :goto_5a
    nop

    .end local v8    # "obj":Ljava/lang/Object;
    add-int/lit8 v0, v0, 0x1

    .line 50
    add-int/lit8 v1, v1, 0x1

    goto :goto_a

    .line 63
    .restart local v8    # "obj":Ljava/lang/Object;
    :cond_60
    new-instance v2, Ljava/lang/IllegalArgumentException;

    invoke-direct {v2}, Ljava/lang/IllegalArgumentException;-><init>()V

    throw v2

    .line 68
    .end local v1    # "a":I
    .end local v8    # "obj":Ljava/lang/Object;
    :cond_66
    new-instance v1, Lim/tpelyyftgw/sqlite/SQLiteCursor;

    invoke-direct {v1, p0}, Lim/tpelyyftgw/sqlite/SQLiteCursor;-><init>(Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;)V

    return-object v1

    .line 41
    .end local v0    # "i":I
    :cond_6c
    new-instance v0, Ljava/lang/IllegalArgumentException;

    invoke-direct {v0}, Ljava/lang/IllegalArgumentException;-><init>()V

    goto :goto_73

    :goto_72
    throw v0

    :goto_73
    goto :goto_72
.end method

.method public requery()V
    .registers 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation

    .line 81
    invoke-virtual {p0}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->checkFinalized()V

    .line 82
    invoke-direct {p0}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->reset()V

    .line 84
    return-void
.end method

.method native reset(J)V
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation
.end method

.method public step()I
    .registers 3
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation

    .line 72
    iget-wide v0, p0, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->sqliteStatementHandle:J

    invoke-virtual {p0, v0, v1}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->step(J)I

    move-result v0

    return v0
.end method

.method native step(J)I
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation
.end method

.method public stepThis()Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;
    .registers 3
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation

    .line 76
    iget-wide v0, p0, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->sqliteStatementHandle:J

    invoke-virtual {p0, v0, v1}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->step(J)I

    .line 77
    return-object p0
.end method