mardi 20 janvier 2015

Retrieve ordered list with items from SQLite database

I’m designing tables for a database.


Inside an Android app, I download - from a server - an ordered list in JSON. I insert the list and its items into a SQLite db.


The list table’s columns:



+ list_id
+ timestamp


The list item table’s column:



+ item_id
+ timestamp
+ list of list_ids (a list item can be in multiple lists)


When I retrieve the items for a list they should have the same order as when I downloaded them. What is the most efficient way to store the “list order"? One option is to let the item have a columns with a list of pair like so: list:indexInList. Appreciate advice on betters ways to do this.


Aucun commentaire:

Enregistrer un commentaire