SQLiteCursor.smali

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


# static fields
.field public static final FIELD_TYPE_BYTEARRAY:I

.field public static final FIELD_TYPE_FLOAT:I

.field public static final FIELD_TYPE_INT:I

.field public static final FIELD_TYPE_NULL:I

.field public static final FIELD_TYPE_STRING:I


# instance fields
.field private inRow:Z

.field private preparedStatement:Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;


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

    const v0, 0x156b

    invoke-static {v0}, Lnp/NPFog;->d(I)I

    move-result v0

    sput v0, Lim/tpelyyftgw/sqlite/SQLiteCursor;->FIELD_TYPE_BYTEARRAY:I

    const v0, 0x156d

    invoke-static {v0}, Lnp/NPFog;->d(I)I

    move-result v0

    sput v0, Lim/tpelyyftgw/sqlite/SQLiteCursor;->FIELD_TYPE_FLOAT:I

    const v0, 0x156e

    invoke-static {v0}, Lnp/NPFog;->d(I)I

    move-result v0

    sput v0, Lim/tpelyyftgw/sqlite/SQLiteCursor;->FIELD_TYPE_INT:I

    const v0, 0x156a

    invoke-static {v0}, Lnp/NPFog;->d(I)I

    move-result v0

    sput v0, Lim/tpelyyftgw/sqlite/SQLiteCursor;->FIELD_TYPE_NULL:I

    const v0, 0x156c

    invoke-static {v0}, Lnp/NPFog;->d(I)I

    move-result v0

    sput v0, Lim/tpelyyftgw/sqlite/SQLiteCursor;->FIELD_TYPE_STRING:I

    return-void
.end method

.method public constructor <init>(Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;)V
    .registers 3
    .param p1, "stmt"    # Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;

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

    .line 16
    const/4 v0, 0x0

    iput-boolean v0, p0, Lim/tpelyyftgw/sqlite/SQLiteCursor;->inRow:Z

    .line 19
    iput-object p1, p0, Lim/tpelyyftgw/sqlite/SQLiteCursor;->preparedStatement:Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;

    .line 20
    return-void
.end method


# virtual methods
.method public byteArrayValue(I)[B
    .registers 4
    .param p1, "columnIndex"    # I
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation

    .line 52
    invoke-virtual {p0}, Lim/tpelyyftgw/sqlite/SQLiteCursor;->checkRow()V

    .line 53
    iget-object v0, p0, Lim/tpelyyftgw/sqlite/SQLiteCursor;->preparedStatement:Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;

    invoke-virtual {v0}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->getStatementHandle()J

    move-result-wide v0

    invoke-virtual {p0, v0, v1, p1}, Lim/tpelyyftgw/sqlite/SQLiteCursor;->columnByteArrayValue(JI)[B

    move-result-object v0

    return-object v0
.end method

.method public byteBufferValue(I)Lim/tpelyyftgw/tgnet/NativeByteBuffer;
    .registers 7
    .param p1, "columnIndex"    # I
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation

    .line 57
    invoke-virtual {p0}, Lim/tpelyyftgw/sqlite/SQLiteCursor;->checkRow()V

    .line 58
    iget-object v0, p0, Lim/tpelyyftgw/sqlite/SQLiteCursor;->preparedStatement:Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;

    invoke-virtual {v0}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->getStatementHandle()J

    move-result-wide v0

    invoke-virtual {p0, v0, v1, p1}, Lim/tpelyyftgw/sqlite/SQLiteCursor;->columnByteBufferValue(JI)J

    move-result-wide v0

    .line 59
    .local v0, "ptr":J
    const-wide/16 v2, 0x0

    cmp-long v4, v0, v2

    if-eqz v4, :cond_18

    .line 60
    invoke-static {v0, v1}, Lim/tpelyyftgw/tgnet/NativeByteBuffer;->wrap(J)Lim/tpelyyftgw/tgnet/NativeByteBuffer;

    move-result-object v2

    return-object v2

    .line 62
    :cond_18
    const/4 v2, 0x0

    return-object v2
.end method

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

    .line 110
    iget-boolean v0, p0, Lim/tpelyyftgw/sqlite/SQLiteCursor;->inRow:Z

    if-eqz v0, :cond_5

    .line 113
    return-void

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

    const-string v1, "You must call next before"

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

    throw v0
.end method

.method native columnByteArrayValue(JI)[B
.end method

.method native columnByteBufferValue(JI)J
.end method

.method native columnCount(J)I
.end method

.method native columnDoubleValue(JI)D
.end method

.method native columnIntValue(JI)I
.end method

.method native columnIsNull(JI)I
.end method

.method native columnLongValue(JI)J
.end method

.method native columnStringValue(JI)Ljava/lang/String;
.end method

.method native columnType(JI)I
.end method

.method public dispose()V
    .registers 2

    .line 106
    iget-object v0, p0, Lim/tpelyyftgw/sqlite/SQLiteCursor;->preparedStatement:Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;

    invoke-virtual {v0}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->dispose()V

    .line 107
    return-void
.end method

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

    .line 37
    invoke-virtual {p0}, Lim/tpelyyftgw/sqlite/SQLiteCursor;->checkRow()V

    .line 38
    iget-object v0, p0, Lim/tpelyyftgw/sqlite/SQLiteCursor;->preparedStatement:Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;

    invoke-virtual {v0}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->getStatementHandle()J

    move-result-wide v0

    invoke-virtual {p0, v0, v1, p1}, Lim/tpelyyftgw/sqlite/SQLiteCursor;->columnDoubleValue(JI)D

    move-result-wide v0

    return-wide v0
.end method

.method public getColumnCount()I
    .registers 3

    .line 102
    iget-object v0, p0, Lim/tpelyyftgw/sqlite/SQLiteCursor;->preparedStatement:Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;

    invoke-virtual {v0}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->getStatementHandle()J

    move-result-wide v0

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

    move-result v0

    return v0
.end method

.method public getPreparedStatement()Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;
    .registers 2

    .line 28
    iget-object v0, p0, Lim/tpelyyftgw/sqlite/SQLiteCursor;->preparedStatement:Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;

    return-object v0
.end method

.method public getStatementHandle()J
    .registers 3

    .line 98
    iget-object v0, p0, Lim/tpelyyftgw/sqlite/SQLiteCursor;->preparedStatement:Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;

    invoke-virtual {v0}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->getStatementHandle()J

    move-result-wide v0

    return-wide v0
.end method

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

    .line 67
    invoke-virtual {p0}, Lim/tpelyyftgw/sqlite/SQLiteCursor;->checkRow()V

    .line 68
    iget-object v0, p0, Lim/tpelyyftgw/sqlite/SQLiteCursor;->preparedStatement:Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;

    invoke-virtual {v0}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->getStatementHandle()J

    move-result-wide v0

    invoke-virtual {p0, v0, v1, p1}, Lim/tpelyyftgw/sqlite/SQLiteCursor;->columnType(JI)I

    move-result v0

    return v0
.end method

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

    .line 32
    invoke-virtual {p0}, Lim/tpelyyftgw/sqlite/SQLiteCursor;->checkRow()V

    .line 33
    iget-object v0, p0, Lim/tpelyyftgw/sqlite/SQLiteCursor;->preparedStatement:Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;

    invoke-virtual {v0}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->getStatementHandle()J

    move-result-wide v0

    invoke-virtual {p0, v0, v1, p1}, Lim/tpelyyftgw/sqlite/SQLiteCursor;->columnIntValue(JI)I

    move-result v0

    return v0
.end method

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

    .line 23
    invoke-virtual {p0}, Lim/tpelyyftgw/sqlite/SQLiteCursor;->checkRow()V

    .line 24
    iget-object v0, p0, Lim/tpelyyftgw/sqlite/SQLiteCursor;->preparedStatement:Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;

    invoke-virtual {v0}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->getStatementHandle()J

    move-result-wide v0

    invoke-virtual {p0, v0, v1, p1}, Lim/tpelyyftgw/sqlite/SQLiteCursor;->columnIsNull(JI)I

    move-result v0

    const/4 v1, 0x1

    if-ne v0, v1, :cond_11

    goto :goto_12

    :cond_11
    const/4 v1, 0x0

    :goto_12
    return v1
.end method

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

    .line 42
    invoke-virtual {p0}, Lim/tpelyyftgw/sqlite/SQLiteCursor;->checkRow()V

    .line 43
    iget-object v0, p0, Lim/tpelyyftgw/sqlite/SQLiteCursor;->preparedStatement:Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;

    invoke-virtual {v0}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->getStatementHandle()J

    move-result-wide v0

    invoke-virtual {p0, v0, v1, p1}, Lim/tpelyyftgw/sqlite/SQLiteCursor;->columnLongValue(JI)J

    move-result-wide v0

    return-wide v0
.end method

.method public next()Z
    .registers 7
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation

    .line 72
    iget-object v0, p0, Lim/tpelyyftgw/sqlite/SQLiteCursor;->preparedStatement:Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;

    invoke-virtual {v0}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->getStatementHandle()J

    move-result-wide v1

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

    move-result v0

    .line 73
    .local v0, "res":I
    const/4 v1, -0x1

    if-ne v0, v1, :cond_3d

    .line 74
    const/4 v2, 0x6

    .line 75
    .local v2, "repeatCount":I
    :goto_e
    add-int/lit8 v3, v2, -0x1

    .end local v2    # "repeatCount":I
    .local v3, "repeatCount":I
    if-eqz v2, :cond_31

    .line 77
    :try_start_12
    sget-boolean v2, Lim/tpelyyftgw/messenger/BuildVars;->LOGS_ENABLED:Z

    if-eqz v2, :cond_1c

    .line 78
    const-string/jumbo v2, "sqlite busy, waiting..."

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

    .line 80
    :cond_1c
    const-wide/16 v4, 0x1f4

    invoke-static {v4, v5}, Ljava/lang/Thread;->sleep(J)V

    .line 81
    iget-object v2, p0, Lim/tpelyyftgw/sqlite/SQLiteCursor;->preparedStatement:Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;

    invoke-virtual {v2}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->step()I

    move-result v2
    :try_end_27
    .catch Ljava/lang/Exception; {:try_start_12 .. :try_end_27} :catch_2b

    move v0, v2

    .line 82
    if-nez v0, :cond_2f

    .line 83
    goto :goto_31

    .line 85
    :catch_2b
    move-exception v2

    .line 86
    .local v2, "e":Ljava/lang/Exception;
    invoke-static {v2}, Lim/tpelyyftgw/messenger/FileLog;->e(Ljava/lang/Throwable;)V

    .line 87
    .end local v2    # "e":Ljava/lang/Exception;
    :cond_2f
    move v2, v3

    goto :goto_e

    .line 89
    :cond_31
    :goto_31
    if-eq v0, v1, :cond_34

    goto :goto_3d

    .line 90
    :cond_34
    new-instance v1, Lim/tpelyyftgw/sqlite/SQLiteException;

    const-string/jumbo v2, "sqlite busy"

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

    throw v1

    .line 93
    .end local v3    # "repeatCount":I
    :cond_3d
    :goto_3d
    if-nez v0, :cond_41

    const/4 v1, 0x1

    goto :goto_42

    :cond_41
    const/4 v1, 0x0

    :goto_42
    iput-boolean v1, p0, Lim/tpelyyftgw/sqlite/SQLiteCursor;->inRow:Z

    .line 94
    return v1
.end method

.method public stringValue(I)Ljava/lang/String;
    .registers 4
    .param p1, "columnIndex"    # I
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lim/tpelyyftgw/sqlite/SQLiteException;
        }
    .end annotation

    .line 47
    invoke-virtual {p0}, Lim/tpelyyftgw/sqlite/SQLiteCursor;->checkRow()V

    .line 48
    iget-object v0, p0, Lim/tpelyyftgw/sqlite/SQLiteCursor;->preparedStatement:Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;

    invoke-virtual {v0}, Lim/tpelyyftgw/sqlite/SQLitePreparedStatement;->getStatementHandle()J

    move-result-wide v0

    invoke-virtual {p0, v0, v1, p1}, Lim/tpelyyftgw/sqlite/SQLiteCursor;->columnStringValue(JI)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method