From d72ec5f29d49ce1841b65044c6144fef7335bdec Mon Sep 17 00:00:00 2001 From: Vasu Nori Date: Tue, 25 May 2010 15:21:18 -0700 Subject: [PATCH] when sqlite returns SQLITE_OK on SQLITEStatement.execute(), ignore it if it is not ignored AND if SQLITEStatement.execute() is called with a SELECT or a pragma or some sql statement that returns data, caller gets an exception with a weird error: "error code 100: unknown error" to avoid confusion generated by this exception, just write a warning and ignore the returned data. Change-Id: I8f0225ceff8f92e32a58f323551e5ada6df63593 --- core/jni/android_database_SQLiteStatement.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/jni/android_database_SQLiteStatement.cpp b/core/jni/android_database_SQLiteStatement.cpp index ff2ed5d9731ea..0341e0bd4b17e 100644 --- a/core/jni/android_database_SQLiteStatement.cpp +++ b/core/jni/android_database_SQLiteStatement.cpp @@ -58,7 +58,9 @@ static void native_execute(JNIEnv* env, jobject object) err = sqlite3_step(statement); // Throw an exception if an error occured - if (err != SQLITE_DONE) { + if (err == SQLITE_ROW) { + LOGV("Queries cannot be performed using execute(). use SQLiteDatabase.query() instead."); + } else if (err != SQLITE_DONE) { throw_sqlite3_exception_errcode(env, err, sqlite3_errmsg(handle)); }