mardi 17 mars 2015

Android GreenDAO - query by date limit 1

I just started using greenDAO as my SQLite ORM for an application. Unfortunately the documentation for it is still a bit limited. I want to query a table and get the oldest record (based on dateCreated field). In mySQL, this would be something like



mysql> select * from acct order by date_created asc limit 1;


In greenDAO, I can't even get the syntax correctly, since I don't even have a where condition. I tried something like this but it is obviously wrong.



Acct oldest = acctDao.queryBuilder().orderAsc(Properties.DateCreated).limit(1);

Aucun commentaire:

Enregistrer un commentaire