Update table using rawQuery() method does not work
android, sqlite
Solution
Problem solved.
http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html
Can't works because `rawQuery` runs the provided SQL and returns a `Cursor` over the result set.
If I want to return a table I have to use `rawQuery`, otherwise no!
Increase the value of a record in android/sqlite database
Problem
I tried the following SQLite query: ``` int idServizo = 150; String whereClause = id_servizio+" = '"+idServizio+" ' "; ContentValues cv = new ContentValues(); cv.put("sync", 1); int r = dbManager.updateTable("myTable", cv, whereClause); ``` Where fields sync and id_servizio are both integer. The method updateTable is: ``` public int updateTable(String table, ContentValues values, String whereClause){ int r = mDb.update(table, values, whereClause, null); return r; } // mDb is SQLiteDatabase object ``` All this works good. But if I try this with the rawQuery() method: ``` public Cursor RawQuery(String sqlQuery, String[] columns){ return mDb.rawQuery(sqlQuery, columns); } ``` The table is not updated! even if no error occurs. ``` int idServizo = 150; String updateQuery ="UPDATE myTable SET sync = 1 WHERE id_servizio = "+idServizio; dbManager.RawQuery(updateQuery, null); ``` Why does this not work?