Well, even if you assumed that insert transactions never failed, you'd
still have gaps when a user deletes a row in the middle.  So, you're
not going to be able to avoid having gaps in your indexes.  (And don't
even think about trying to re-assign indexes every time you delete a
row, because this will cause more problems than it will solve!)

So, yeah, it can seem annoying at first that your indexes will grow
more non-contiguous over time, but it's commonly accepted reality.  :)

Anyway... +1 vote to the suggestion that you just use the actual row
id in the database when you do updates!  Much safer/reliable.  And
AUTOINCREMENT is still fantastic for keeping your row id's unique.

-- PJ



On Nov 20, 2:52 pm, jotobjects <[email protected]> wrote:
> On Nov 20, 11:00 am, JasonMP <[email protected]> wrote:
>
> > The issue came up b/c when i do delete rows i get gaps.  gaps were bad
> > for my code :).  I'm not sure I understand what a general transaction
> > abort is.  Is this something that happens often?
>
> There is no such thing as a "general transaction abort".  Sorry my
> statement came out sounding that way!  See
> android.database.sqlite.SQLiteDatabase method beginTransaction().
> Even if not in an explicit transaction an insert could result in a gap
> if the insert fails.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to