I have a set of events which I will have to feed into the database before I ship the app so that the application is ready to read from this database.
I have seen some posts like these which explain how to enter NSDate into database so that it can be read back:
- iPhone SQLite date problem
- Persisting Dates to SQLite3 in an iPhone Application
Now, I want to entry dates into the database by running queries like:
insert into VendorEvents (event_start, event_end, notes, event_name) values (date('2012-01-26'), date('2012-01-26'), 'Republic day of India is the day when our constitution was framed and put into practice', 'Republic day')
When I run this query through MesaSQLite application, the returned results are perfect as expected:
select * from VendorEvents where ((event_start between '2011-12-01 00:00:00 +0000' and '2012-02-01 00:00:00 +0000') or (event_end between '2011-12-01 00:00:00 +0000' and '2012-02-01 00:00:00 +0000'))
But when I run the same query through FMDatabase inside the application, no records are returned.
The datatype of the first and second field in VendorEvents in my database is of type "Date". The only difference in the way I am entering the data is by using MesaSQLite application. So, is there any mistake I might be doing due to which I am not getting the results in FMDatabase?
Thanks, Raj