What2107
What2107

Reputation: 33

Android SQLite update method not working properly. Using Content Provider

I am trying to update just one column in a row and for some reason it continues to tell me the column does not exist.

Content Provider

    @Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
    SQLiteDatabase db = ucdb.getReadableDatabase();
    final int match = ContentDescriptor.URI_MATCHER.match(uri);
    int rowsUpdated = 0;
    switch(match){
    case ContentDescriptor.U.PATH_TOKEN:{
        rowsUpdated = db.update(ContentDescriptor.T1.NAME, values, selection, selectionArgs);
    }
    case ContentDescriptor.R.PATH_TOKEN:{
        rowsUpdated = db.update(ContentDescriptor.T2.NAME, values, selection, selectionArgs);
    }
    case ContentDescriptor.Q.PATH_TOKEN:{
        rowsUpdated = db.update(ContentDescriptor.T3.NAME, values, selection, selectionArgs);
    }
    case ContentDescriptor.S.PATH_TOKEN:{
        rowsUpdated = db.update(ContentDescriptor.T4.NAME, values, selection, selectionArgs);
    }
    case ContentDescriptor.E.PATH_TOKEN:{
        rowsUpdated = db.update(ContentDescriptor.T5.NAME, values, selection, selectionArgs);
    }
    }
    return rowsUpdated;
}

Update Query

ContentValues val = new ContentValues();
            val.put(ContentDescriptor.U.Cols.q, newQ);

            contentResolver.update(ContentDescriptor.U.CONTENT_URI, val,
                    ContentDescriptor.U.Cols.UID + "='" + uId + "'", null);

Upvotes: 0

Views: 694

Answers (1)

What2107
What2107

Reputation: 33

the switcher needed breaks or return statements.

Upvotes: 2

Related Questions