SQLite Android Bindings

Check-in [dfed6feb2b]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Allow SQLiteDatabase.execSQL to be used to execute PRAGMA statements, even if they return a value.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: dfed6feb2b1a71eb512d5bb4b9e9d7651c00c059
User & Date: dan 2019-11-22 01:22:37.758
Context
2020-01-22
19:46
Update to version 3.31.0. (check-in: 83554bf5f0 user: dan tags: trunk)
2019-11-22
01:22
Allow SQLiteDatabase.execSQL to be used to execute PRAGMA statements, even if they return a value. (check-in: dfed6feb2b user: dan tags: trunk)
2019-11-20
14:46
Fix a broken test case in the "customsqlitetest" application. (check-in: 0efba721fe user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to sqlite3/src/main/jni/sqlite/android_database_SQLiteConnection.cpp.
453
454
455
456
457
458
459






460
461
462
463
464
465
466

467
468
469
470
471
472
473
    }
    if (err != SQLITE_OK) {
        throw_sqlite3_exception(env, connection->db, NULL);
    }
}

static int executeNonQuery(JNIEnv* env, SQLiteConnection* connection, sqlite3_stmt* statement) {






    int err = sqlite3_step(statement);
    if (err == SQLITE_ROW) {
        throw_sqlite3_exception(env,
                "Queries can be performed using SQLiteDatabase query or rawQuery methods only.");
    } else if (err != SQLITE_DONE) {
        throw_sqlite3_exception(env, connection->db);
    }

    return err;
}

static void nativeExecute(JNIEnv* env, jclass clazz, jlong connectionPtr,
        jlong statementPtr) {
    SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr);
    sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr);







>
>
>
>
>
>







>







453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
    }
    if (err != SQLITE_OK) {
        throw_sqlite3_exception(env, connection->db, NULL);
    }
}

static int executeNonQuery(JNIEnv* env, SQLiteConnection* connection, sqlite3_stmt* statement) {
    int err;
    while( SQLITE_ROW==(err=sqlite3_step(statement)) );
    if( err!=SQLITE_DONE ){
      throw_sqlite3_exception(env, connection->db);
    }
#if 0
    int err = sqlite3_step(statement);
    if (err == SQLITE_ROW) {
        throw_sqlite3_exception(env,
                "Queries can be performed using SQLiteDatabase query or rawQuery methods only.");
    } else if (err != SQLITE_DONE) {
        throw_sqlite3_exception(env, connection->db);
    }
#endif
    return err;
}

static void nativeExecute(JNIEnv* env, jclass clazz, jlong connectionPtr,
        jlong statementPtr) {
    SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr);
    sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr);