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.
How to filter an ActiveAndroid Delete statement with a date field
-
04-06-2022 - |
سؤال
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:
How can I get the number of the deleted objects?
How can I use a where with a date variable?
المحلول
نصائح أخرى
Dont you have to add the (') char to a date?
Object result=new Delete().from(Information.class).where("Date>='?" + "'", date.replace(".","-") ).execute();
Like that?
لا تنتمي إلى StackOverflow