mercredi 16 septembre 2015

MySQL & SqLite - compatibile timestamp compare

I have php app with test using SqLite, but on production I have MySQL.

Some of my code use date compare in where clause, but SqLite don't support NOW() function.

In MySQL I have:

Select * from `table` where arrive_date < NOW();

where arrive_date is timestamp type.

In SqLite I should use some substitute for NOW(), but I don't want other part of codes for tests and production.

Maybe it's a way to write that SQL to make it work on both engine?

Aucun commentaire:

Enregistrer un commentaire