diff options
author | Vasu Nori <vnori@google.com> | 2010-09-15 18:40:49 -0700 |
---|---|---|
committer | Vasu Nori <vnori@google.com> | 2010-09-17 10:15:40 -0700 |
commit | 4e874edf69ce9900eb847629dc4d3616972a3468 (patch) | |
tree | a767a7453e14168e8e4ff707d1e2be0edf1d47f0 /core/jni/android_database_SQLiteStatement.cpp | |
parent | 7553cf74e67a83440139b34a098b90a2ad6ed86d (diff) | |
download | frameworks_base-4e874edf69ce9900eb847629dc4d3616972a3468.zip frameworks_base-4e874edf69ce9900eb847629dc4d3616972a3468.tar.gz frameworks_base-4e874edf69ce9900eb847629dc4d3616972a3468.tar.bz2 |
don't compile statement for certain SQL statements
SQL statements such as Create table, Pragma, Begin, Commit, Rollback
etc don't need a compiled statement.
Change-Id: I55f5e4e6cbb41cbe83e592e25ba852fe23e2b39f
Diffstat (limited to 'core/jni/android_database_SQLiteStatement.cpp')
-rw-r--r-- | core/jni/android_database_SQLiteStatement.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/jni/android_database_SQLiteStatement.cpp b/core/jni/android_database_SQLiteStatement.cpp index 0f3114b..97e0483 100644 --- a/core/jni/android_database_SQLiteStatement.cpp +++ b/core/jni/android_database_SQLiteStatement.cpp @@ -239,6 +239,17 @@ static jobject native_1x1_blob_ashmem(JNIEnv* env, jobject object) return value; } +static void native_executeSql(JNIEnv* env, jobject object, jstring sql) +{ + char const* sqlString = env->GetStringUTFChars(sql, NULL); + sqlite3 * handle = GET_HANDLE(env, object); + int err = sqlite3_exec(handle, sqlString, NULL, NULL, NULL); + if (err != SQLITE_OK) { + throw_sqlite3_exception(env, handle); + } + env->ReleaseStringUTFChars(sql, sqlString); +} + static JNINativeMethod sMethods[] = { /* name, signature, funcPtr */ @@ -247,6 +258,7 @@ static JNINativeMethod sMethods[] = {"native_1x1_long", "()J", (void *)native_1x1_long}, {"native_1x1_string", "()Ljava/lang/String;", (void *)native_1x1_string}, {"native_1x1_blob_ashmem", "()Landroid/os/ParcelFileDescriptor;", (void *)native_1x1_blob_ashmem}, + {"native_executeSql", "(Ljava/lang/String;)V", (void *)native_executeSql}, }; int register_android_database_SQLiteStatement(JNIEnv * env) |