SQLite Android Bindings

Check-in [566a4f756b]
Login

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

Overview
Comment:Throw SQLiteMisuseException if built with SQLITE_OMIT_LOAD_EXTENSION and client attempts to enable extension load
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | api-level-9
Files: files | file ages | folders
SHA1: 566a4f756ba6522a3100bae82cd8af4385f6a199
User & Date: pjw 2017-05-02 14:39:37.785
Context
2017-05-02
15:20
Add tests for new extension loading code to android app (Leaf check-in: 251698dcb8 user: pjw tags: api-level-9)
14:39
Throw SQLiteMisuseException if built with SQLITE_OMIT_LOAD_EXTENSION and client attempts to enable extension load (check-in: 566a4f756b user: pjw tags: api-level-9)
12:45
Support for loadable extension to be ensabled/disabled by functions on SQLiteDatabase and flag on openDatabase() (check-in: bd77d855a1 user: pjw tags: api-level-9)
Changes
Unified Diff Ignore Whitespace Patch
Changes to sqlite3/src/main/jni/sqlite/android_database_SQLiteConnection.cpp.
857
858
859
860
861
862
863



864

865
866
867
868
869
870
871
        sqlite3_progress_handler(connection->db, 0, NULL, NULL);
    }
}

/** NOTE: Extension for sqlite.org bindings */
static void nativeEnableLoadExtension(JNIEnv* env, jobject clazz, jlong connectionPtr, jboolean enable) {
    SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr);



    sqlite3_enable_load_extension(connection->db, enable ? 1 : 0);

}

static jboolean nativeHasCodec(JNIEnv* env, jobject clazz){
#ifdef SQLITE_HAS_CODEC
  return true;
#else
  return false;







>
>
>

>







857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
        sqlite3_progress_handler(connection->db, 0, NULL, NULL);
    }
}

/** NOTE: Extension for sqlite.org bindings */
static void nativeEnableLoadExtension(JNIEnv* env, jobject clazz, jlong connectionPtr, jboolean enable) {
    SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr);
#ifdef SQLITE_OMIT_LOAD_EXTENSION
    throw_sqlite3_exception(env, SQLITE_MISUSE, "API unavailable", "Loadable extensions disabled during library build");
#else
    sqlite3_enable_load_extension(connection->db, enable ? 1 : 0);
#endif
}

static jboolean nativeHasCodec(JNIEnv* env, jobject clazz){
#ifdef SQLITE_HAS_CODEC
  return true;
#else
  return false;