Loading core/jni/android_database_SQLiteDatabase.cpp +8 −3 Original line number Original line Diff line number Diff line Loading @@ -64,7 +64,7 @@ enum { static jfieldID offset_db_handle; static jfieldID offset_db_handle; static jmethodID method_custom_function_callback; static jmethodID method_custom_function_callback; static jclass string_class = NULL; static jclass string_class; static jint sSqliteSoftHeapLimit = 0; static jint sSqliteSoftHeapLimit = 0; static char *createStr(const char *path, short extra) { static char *createStr(const char *path, short extra) { Loading Loading @@ -406,8 +406,6 @@ static void custom_function_callback(sqlite3_context * context, int argc, sqlite jobject function = (jobject)sqlite3_user_data(context); jobject function = (jobject)sqlite3_user_data(context); // pack up the arguments into a string array // pack up the arguments into a string array if (!string_class) string_class = (jclass)env->NewGlobalRef(env->FindClass("java/lang/String")); jobjectArray strArray = env->NewObjectArray(argc, string_class, NULL); jobjectArray strArray = env->NewObjectArray(argc, string_class, NULL); if (!strArray) if (!strArray) goto done; goto done; Loading @@ -425,6 +423,7 @@ static void custom_function_callback(sqlite3_context * context, int argc, sqlite } } env->CallVoidMethod(function, method_custom_function_callback, strArray); env->CallVoidMethod(function, method_custom_function_callback, strArray); env->DeleteLocalRef(strArray); done: done: if (env->ExceptionCheck()) { if (env->ExceptionCheck()) { Loading Loading @@ -489,6 +488,12 @@ int register_android_database_SQLiteDatabase(JNIEnv *env) return -1; return -1; } } string_class = (jclass)env->NewGlobalRef(env->FindClass("java/lang/String")); if (string_class == NULL) { LOGE("Can't find java/lang/String\n"); return -1; } offset_db_handle = env->GetFieldID(clazz, "mNativeHandle", "I"); offset_db_handle = env->GetFieldID(clazz, "mNativeHandle", "I"); if (offset_db_handle == NULL) { if (offset_db_handle == NULL) { LOGE("Can't find SQLiteDatabase.mNativeHandle\n"); LOGE("Can't find SQLiteDatabase.mNativeHandle\n"); Loading Loading
core/jni/android_database_SQLiteDatabase.cpp +8 −3 Original line number Original line Diff line number Diff line Loading @@ -64,7 +64,7 @@ enum { static jfieldID offset_db_handle; static jfieldID offset_db_handle; static jmethodID method_custom_function_callback; static jmethodID method_custom_function_callback; static jclass string_class = NULL; static jclass string_class; static jint sSqliteSoftHeapLimit = 0; static jint sSqliteSoftHeapLimit = 0; static char *createStr(const char *path, short extra) { static char *createStr(const char *path, short extra) { Loading Loading @@ -406,8 +406,6 @@ static void custom_function_callback(sqlite3_context * context, int argc, sqlite jobject function = (jobject)sqlite3_user_data(context); jobject function = (jobject)sqlite3_user_data(context); // pack up the arguments into a string array // pack up the arguments into a string array if (!string_class) string_class = (jclass)env->NewGlobalRef(env->FindClass("java/lang/String")); jobjectArray strArray = env->NewObjectArray(argc, string_class, NULL); jobjectArray strArray = env->NewObjectArray(argc, string_class, NULL); if (!strArray) if (!strArray) goto done; goto done; Loading @@ -425,6 +423,7 @@ static void custom_function_callback(sqlite3_context * context, int argc, sqlite } } env->CallVoidMethod(function, method_custom_function_callback, strArray); env->CallVoidMethod(function, method_custom_function_callback, strArray); env->DeleteLocalRef(strArray); done: done: if (env->ExceptionCheck()) { if (env->ExceptionCheck()) { Loading Loading @@ -489,6 +488,12 @@ int register_android_database_SQLiteDatabase(JNIEnv *env) return -1; return -1; } } string_class = (jclass)env->NewGlobalRef(env->FindClass("java/lang/String")); if (string_class == NULL) { LOGE("Can't find java/lang/String\n"); return -1; } offset_db_handle = env->GetFieldID(clazz, "mNativeHandle", "I"); offset_db_handle = env->GetFieldID(clazz, "mNativeHandle", "I"); if (offset_db_handle == NULL) { if (offset_db_handle == NULL) { LOGE("Can't find SQLiteDatabase.mNativeHandle\n"); LOGE("Can't find SQLiteDatabase.mNativeHandle\n"); Loading