lundi 23 février 2015

GreenDAO query for the oldest data

With a very lazy and inefficient method, I could query the entire table and sort it by time stamp, then get the first item in the list.


The problem is, how can I achieve the same goal without having to query the entire database like that? I could set up a field for keeping track of the earliest value during data insertion, but when data deletion happens (where earliest data are deleted), how can it be efficiently updated without querying the entire database (or any significant portion of it)?


If GreenDAO has no native ways to achieve it, what's the best practice to walk around it?


Aucun commentaire:

Enregistrer un commentaire