Page 1 of 1

Lazarus 1.26 / UniDac 6.02 / SQLite3

Posted: Mon 09 Mar 2015 15:45
by Uli65
Problem: When I check a database field to the data type "DATE" out, that does not work under Lazarus:

-> if (uqTmp.Fields.DataType = ftDate) then
begin
.........
end;

=> Result: do nothing when the field data type is "DATE"


When I check the data type of each field, the value for "Date" is the same value as for "VARCHAR"

-> VarToStr(uqTmp.Fields.DataType => 16 (for DATE, DATETIME and VARCHAR)

Re: Lazarus 1.26 / UniDac 6.02 / SQLite3

Posted: Tue 10 Mar 2015 07:05
by AlexP
Hello,

We cannot reproduce the problem on the latest version of UniDAC 6.0.2, and SQLite3 3.8.5. Please specify the exact version of the SQLite3 library, and send a sample and the DB file reproducing the problem to alexp*devart*com.

Re: Lazarus 1.26 / UniDac 6.02 / SQLite3

Posted: Tue 10 Mar 2015 12:33
by Uli65
Hello,

I have found the error:

I check the data fields of a copy of the original table. When I copy the table with the command

"CREATE TABLE IF NOT EXISTS t_copytbl AS SELECT * FROM t_orgtbl"

the DATE - data fields will copy as VARCHAR - data fields, and so the result was false.

The problem relates to SQLite, not UniDac.

Re: Lazarus 1.26 / UniDac 6.02 / SQLite3

Posted: Tue 10 Mar 2015 13:46
by AlexP
Hello,

Yes, this is behavior of SQLite and we can't affect it. However, you can use DataTypeMapping to map "NUM" field type to Date, for example

Code: Select all

CREATE TABLE TEST(В DATE);
CREATE TABLE COPY_TEST AS SELECT * FROM TEST;

Code: Select all

UniTable1.TableName := 'COPY_TEST';
UniTable1.DataTypeMap.AddFieldNameRule('B', ftDate);
UniTable1.Open;