Apr 11

AIR provides additionnal SQL features to support local SQLite databases. For example: dates.

So you can store dates directly in your SQLite database with no formatting. I think that pure SQLite databases would store dates in a text field after a transformation (to ISO format for example).

This is great but I had real difficulties to define a query with dates in the WHERE clause in all SQLite AIR admin tools.

After a few googling sessions and some tries in my SQLite Sorcerer, I found a way that works well.

select * from orders
where date(creationdate)>"2009-03-01";

Dates that are stored and retrieved by AIR have to be converted using the date function in the WHERE clause of the query. You can also add modifiers as localtime for instance.

dates in where clause query

 

This is maybe obviously obvious for SQL gurus but really not for me, so I wanted to share the information.

 

not goodquite goodgoodvery goodexcellent (No Ratings Yet)
Loading ... Loading ...

Written by Arnaud
Tags: , , ,

Share/Save/Bookmark


Oct 07

I was used to execute simple queries in my AIR applications, ie with only one INSERT, UPDATE or DELETE statement. But, recently, I had to execute queries including several statements (database creation or mass-insertion of data). I thought that would be easy but actually it requires a “workaround”.

Continue reading »

not goodquite goodgoodvery goodexcellent (1 votes, average: 5 out of 5)
Loading ... Loading ...

Written by Arnaud
Tags: , , ,

Share/Save/Bookmark