Página 1 de 1
SQLite Bug on date fields
Publicado: Mar May 12, 2015 4:50 pm
por emeasoft
Hello Xailers,
It seems there is a weird bug with the date fields, using the command ATTACH from sqlite to copy a table and its contents, all the date fields were saved as numeric values.
See the example for more detailed info about this error.
What could be causing this?
TIA,
Juliano
Re: SQLite Bug on date fields
Publicado: Mar May 12, 2015 5:28 pm
por ignacio
Hi,
We are working on this problem right now. BTW, in our tests with oDS:lDateAsString to .T. works correctly. I recommend to use lDateAsString to .T., it uses more disk space, but is the standard on SQLite databases. In any case we hope to have a fix for this problem ASAP.
Regards,
Re: SQLite Bug on date fields
Publicado: Mar May 12, 2015 5:34 pm
por emeasoft
Many thanks Ignacio!
We are going to take a look on the lDateAsString while we wait for the fix then.
Regards,
Juliano
Re: SQLite Bug on date fields
Publicado: Mar May 12, 2015 7:11 pm
por ignacio
emeasoft escribió:Many thanks Ignacio!
We are going to take a look on the lDateAsString while we wait for the fix then.
Regards,
Juliano
Juliano,
Please try with the files attached (.obj for Borland and .o for MinGW) . TIA.
Regards,
Re: SQLite Bug on date fields
Publicado: Mar May 12, 2015 8:51 pm
por emeasoft
Hello Ignacio,
I tested with the .o file but the error still persists.

- error.png (51.65 KiB) Visto 6736 veces
Regards,
Juliano
Re: SQLite Bug on date fields
Publicado: Mié May 13, 2015 11:13 am
por ignacio
Hello Juliano,
I attach with this message the two DBs created by me with the modification I sent you. They look fine. Maybe the object module did not get really linked to the executable. Please try a complete recompile.
BTW, in order to force the use of the new module I attach with this message the complete Xailer library for MingGw, that you can download from the following link:
https://dl.dropboxusercontent.com/u/318 ... Xailer.zip
Regard,
Re: SQLite Bug on date fields
Publicado: Mié May 13, 2015 2:09 pm
por emeasoft
Thanks Ignacio! It worked now!
Just one more question, the date fields on the database created by the attach command are returning as char, not date as on the original table.
Is there any fix for this?
TIA,
Juliano
Re: SQLite Bug on date fields
Publicado: Mié May 13, 2015 5:07 pm
por ignacio
emeasoft escribió:Thanks Ignacio! It worked now!
Just one more question, the date fields on the database created by the attach command are returning as char, not date as on the original table.
Is there any fix for this?
TIA,
Juliano
Hi Juliano,
There is some extra work to do since the select clause you use does not give the necessary information. Change this code:
Código: Seleccionar todo
::dSQL:Execute( "CREATE TABLE LXTMP.TAB1 AS SELECT * FROM TAB1" )
To this:
Código: Seleccionar todo
Local aSql, aHead, cSql
::dSQL:Execute( "SELECT sql FROM SQLITE_MASTER WHERE TYPE = 'table' and upper( tbl_name ) = 'TAB1'",, @aSql )
cSql := Strtran( aSql[1,1], "CREATE TABLE TAB1", "CREATE TABLE LXTMP.TAB1" )
::dSQL:Execute( cSql ) // Creates the new table
::dSQL:QueryRow( "Select * from TAB1 LIMIT 1", @aHead )
cSql := "INSERT INTO LXTMP.TAB1("
AEval( aHead, {|v| cSql += v + "," } )
SwapChr( @cSql, Len( cSql ), ")" )
cSql += " SELECT * FROM TAB1"
::dSQL:Execute( cSql )
Regards,
Re: SQLite Bug on date fields
Publicado: Mié May 13, 2015 7:23 pm
por emeasoft
Many thanks Ignacio! It is working very well now!!
Regards,
Juliano