Android support,
This commit is contained in:
@@ -40,14 +40,14 @@ src/Android/jni/sqlite/android_database_SQLiteConnection.cpp
|
||||
src/Android/jni/sqlite/android_database_SQLiteDebug.cpp
|
||||
src/Android/jni/sqlite/android_database_SQLiteGlobal.cpp
|
||||
src/Android/jni/sqlite/nativehelper/jni.h
|
||||
src/Android/jni/sqlite/nativehelper/jniConstants.h
|
||||
src/Android/jni/sqlite/nativehelper/JniConstants.h
|
||||
src/Android/jni/sqlite/nativehelper/JNIHelp.h
|
||||
src/Android/jni/sqlite/nativehelper/ScopedLocalRef.h
|
||||
)
|
||||
|
||||
endif (ANDROID)
|
||||
|
||||
add_component( Yapsqlite3
|
||||
add_library( Yapsqlite3 SHARED
|
||||
${YAPSQLITE3_SOURCES} )
|
||||
|
||||
MY_set_target_properties(Yapsqlite3
|
||||
@@ -56,3 +56,9 @@ add_component( Yapsqlite3
|
||||
# SOVERSION ${LIBYAPTAI_MAJOR_VERSION}.${LIBYAPTAI_MINOR_VERSION}
|
||||
POSITION_INDEPENDENT_CODE TRUE
|
||||
)
|
||||
|
||||
|
||||
if (ANDROID)
|
||||
target_link_libraries(Yapsqlite3 android log)
|
||||
|
||||
endif ()
|
@@ -658,6 +658,17 @@ void init_sqlite3( void )
|
||||
Yap_InitBackMYDDAS_SQLITE3Preds();
|
||||
}
|
||||
|
||||
#if _ANDROID_
|
||||
JNIEXPORT void JNICALL
|
||||
lib_yap_up_pt_init_sqlite(JNIEnv *env);
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
lib_yap_up_pt_init_sqlite(JNIEnv *env)
|
||||
{
|
||||
init_sqlite3();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
|
@@ -360,23 +360,22 @@ static jlong nativePrepareStatement(JNIEnv *env, jclass clazz,
|
||||
int err = sqlite3_prepare16_v2(connection->db, sql, sqlLength * sizeof(jchar),
|
||||
&statement, NULL);
|
||||
env->ReleaseStringCritical(sqlString, sql);
|
||||
|
||||
#if 0
|
||||
if (err != SQLITE_OK) {
|
||||
// Error messages like 'near ")": syntax error' are not
|
||||
// always helpful enough, so construct an error string that
|
||||
// includes the query itself.
|
||||
const char *query = env->GetStringUTFChars(sqlString, NULL);
|
||||
char *message = (char *)malloc(strlen(query) + 50);
|
||||
char *message[512];
|
||||
if (message) {
|
||||
strcpy(message, ", while compiling: "); // less than 50 chars
|
||||
strcat(message, query);
|
||||
}
|
||||
env->ReleaseStringUTFChars(sqlString, query);
|
||||
throw_sqlite3_exception(env, connection->db, message);
|
||||
free(message);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
ALOGV("Prepared statement %p on connection %p", statement, connection->db);
|
||||
return reinterpret_cast<jlong>(statement);
|
||||
}
|
||||
|
Reference in New Issue
Block a user