I am trying to update cached_name column of callog.calls table in android,but getting sql lite exception .I have been trying this for long but could not able to come up with anything.I have searched a lot but could not find sufficient information about update statement.kindly help.
ContentResolver cr = getContentResolver();
Cursor cur = cr.query(CallLog.Calls.CONTENT_URI,
null, null, null, null);
ContentValues value=new ContentValues();
value.put("CallLog.Calls.CACHED_NAME","frank");
cr.update(CallLog.Calls.CONTENT_URI,value,CallLog.Calls.CACHED_NAME, null);
Error:
11-25 20:11:17.755: ERROR/Database(106): Error updating CallLog.Calls.CACHED_NAME=frank using UPDATE calls SET CallLog.Calls.CACHED_NAME=? WHERE name
11-25 20:11:17.776: ERROR/DatabaseUtils(106): Writing exception to parcel
11-25 20:11:17.776: ERROR/DatabaseUtils(106): android.database.sqlite.SQLiteException: near ".": syntax error: , while compiling: UPDATE calls SET CallLog.Calls.CACHED_NAME=? WHERE name
The syntax of your call to update is wrong. It needs to look like this:
that will update all the values in the table. To update a specific row do:
where oldName is the value to use in your WHERE clause.