Note that there are some explanatory texts on larger screens.

plurals
  1. POWhen I update a column an duplicate column is created in DB for my android app
    primarykey
    data
    text
    <p>I am creating my first android app, and now struck on a weird issue </p> <p>Here is the situation: The user can enter a numeric value for any given date. </p> <p>Issue: So when user tries to give another score for the same date, as we all know the app should over write the old value and update the new value the user just gave.</p> <p>So I have a update method that gets the rowId and overwrites old values by new. but what's happening in my table is scary. When I update a numeric value for the same date say 6/6/2011. it creates another record, now I have 2 entries on same date one is old and one is new. and then when i do it to some other date say 6/7/2011(like give a value for a date and then update it) the duplicate column created for 6/6/2011 is gone and a duplicate column is created for 6/7/2011.</p> <pre><code>updateValue(...){ ContentValues args = new ContentValues(); args.put(KEY_DATESTAMP_SUBTABLE, day); args.put(KEY_HABIT, habit); args.put(KEY_USER_SCORE_SUBTABLE, userScore); args.put(KEY_CALCULATED_SCORE_SUBTABLE, calculateCompoundScore(scoringMethod, userScore, importance)); String whereClause = KEY_ROWID + "=" + rowId; return mDb.update(SCORE_TABLE, args, whereClause, null) &gt; 0; } </code></pre> <p>can anybody explain me this behavior!!!!</p> <p>I edited and added the code: </p> <p>edited: I found the problem, it is a dumb mistake, the rowID is the row id of a different table, so every time i delete using that it gives me wild results. It is my bad..BUt @Alex idea helped me to figure it out as for update as he said, i deleted first and then inserted, while doing this i found it is deleting some other row. </p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload