I am trying to use rawQuery
and execSQL
methods for manipulating my database, instead of the .update
, .insert
, etc. I am trying to perform an UPDATE with the following code:
db.execSQL("UPDATE configuration " +
"SET number_fields = " + number_fields + ", "
+ "frequency = " + frequency + ", "
+ "ag = " + ag + ", "
+ "number_alarms = " + number_alarms + ", "
+ "failed_rapper = " + failed_rapper + ", "
+ "max_mv = " + max_mv + ", "
+ "max_nav = " + max_nav + " "
+ "WHERE serial_id = " + Integer.toString(id) + ";");
AFter this action there is a log that states an update has occurred and it seems to work, yet when I try to do a select statement on the table, it returns with the following error:
06-10 10:01:47.564: W/System.err(3815): android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
Now I have performed that same SELECT on different data in Android that I manually inserted using SQLite Database Browser and it works fine. I have also performed that same UPADTE in the SQLite Browser and it has worked there. Therefore I know that the problem is that the UPDATE command is not working when running on Android.
Question: Why does the UPDATE command not work within the execSQL()
method?