dimanche 28 février 2016

SQLite datetime columns show up as text

I'm creating my own SQLite functions by inheriting from System.Data.SQLite.SQLiteFunction. This works well except I'm having issues with datetime columns. I'm not sure if it's due to SQLite or the .NET wrapper (System.Data.SQLite).

If I pass in a DateTime column into my function as an argument, the values get passed into my function as strings (e.g. "2016-02-28 10:52") instead of datetimes. Also, if my function returns a DateTime object the value gets turned into a string.

So I'm unclear if SQLite understands DateTime. I can create a table that has a datetime column and if I use pragma table_info(myTable), it shows that the column is indeed datetime, but if I test it using typeof(myCol) that returns text. What gives, does it support datetime or no? Can I get it to pass DateTime values to my functions if the column is created as a datetime?

Aucun commentaire:

Enregistrer un commentaire