Reputation: 60184
I'm getting the exception:
09-17 09:49:05.424: ERROR/Database(5971): Error updating suggest_text_1=Testttttttt suggest_text_2=null using UPDATE FTStitleslist SET suggest_text_1=?, suggest_text_2=? WHERE suggest_text_1=Test 09-17 09:49:05.434: ERROR/AndroidRuntime(5971): FATAL EXCEPTION: main android.database.sqlite.SQLiteException: no such column: Test: , while compiling: UPDATE FTStitleslist SET suggest_text_1=?, suggest_text_2=? WHERE suggest_text_1=Test at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
When I execute the method:
public void updateTitle(String oldTitle, String newTitle) {
ContentValues newValues = new ContentValues();
newValues.put(KEY_WORD, newTitle);
newValues.put(KEY_DEFINITION, "null");
getWritableDatabase().update(FTS_VIRTUAL_TABLE, newValues, KEY_WORD + "=" + oldTitle, null);
}
for the db created like:
private static final String FTS_TABLE_CREATE =
"CREATE VIRTUAL TABLE " + FTS_VIRTUAL_TABLE +
" USING fts3 (" +
KEY_WORD + ", " +
KEY_DEFINITION + ");";
What's wrong?
Upvotes: 0
Views: 103
Reputation: 14472
Your text values must be enclosed in single quotes:
'Test'
If they are not, the compiler will try to interpret the value (i.e. Test) as a column name.
From the exception message:
WHERE suggest_text_1=Test
Upvotes: 1