[Gambas-devel] SHOW STOPPER: GB3, sqlite3 and date fields

Kadaitcha Man nospam.nospam.nospam at ...176...
Mon Dec 14 21:24:32 CET 2009


Benoît Minisini wrote:
>> sqlite3 correctly displays dates:
>>
>> sqlite> select LogdtTimestamp from log limit 10;
>> 9/7/2008 20:22:04
>> 9/7/2008 20:26:03
>> 9/7/2008 20:41:29
>> 9/7/2008 20:59:48
>> 9/7/2008 21:35:02
>> 9/7/2008 21:37:37
>> 9/7/2008 22:02:28
>> 9/7/2008 22:26:49
>> 9/7/2008 22:29:20
>> 9/7/2008 22:38:10
>>
>> Attachment Screenshot-1.png shows the date as Gambas3 interprets it,
>> which is plainly wrong.
>>
>> I have checked the data with sqlite3 and with sqlitebrowser, and in
>> both cases the dates are displayed correctly.
>>
>> Also attached is a database and supporting code showing the problem.
>> In short, the dates returned by Gambas are gobbledegook.
>>
>> I have confirmed that the problem also exists in gb2.
>>
>> Environment is Ubuntu 9.10.
>>
>
> The date datatype does not exist in SQLite, it is stored as a string.
>
> So it has to be emulated by Gambas.
>
> It was decided to store dates in ISO-8601 format, the format used by
> date and time functions of SQLite. As soon as you write the data with
> Gambas, and read it back, there is no problem.
>
> But if you write data in a different format, Gambas does not
> recognize it and returns garbage. It should return an error anyway
> instead of garbage, but the guy who wrote the code didn't do that.
>
> I can modify the SQLite drivers to accept the american format, but I
> can't add all date format of the planet easily...

That would not be wise. I'll see about getting the dates converted to 
ISO-8601 format.

> And, no, crying, howling and moaning like a child is not a solution. Just
> explain your problem like an adult, and you will get the answer as well.

I explained the problem. I got told "save the date with gambas", no 
explanation or reason that could be understood, then I got asked if I had 
time to test it in MySQL. Anypone in their right mind would howl at that 
latter suggestion. 





More information about the Devel mailing list