Search code examples
androidandroid-sqliteactiveandroid

How to filter an ActiveAndroid Delete statement with a date field


I try to delete from a table where there is a date field (represented as a string). I'd like to do it by the following statement:

Object result=new Delete().from(Information.class).where("Date>=?", date.replace(".","-")).execute();

It seems that nothing was deleted, the result variable is null.

I have 2 questions:

  1. How can I get the number of the deleted objects?

  2. How can I use a where with a date variable?


Solution

  • The problem was on the object side, not the ActiveAndroid/SQLite side. SQLite can use dates for comparison but the source date has to be LocalDateTime. As you can see, I've been using Strings so the comparison gave false results.