Lazarus 1.26 / UniDac 6.02 / SQLite3

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Uli65
Posts: 12
Joined: Wed 22 Feb 2012 10:11

Lazarus 1.26 / UniDac 6.02 / SQLite3

Post by Uli65 » Mon 09 Mar 2015 15:45

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)

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Lazarus 1.26 / UniDac 6.02 / SQLite3

Post by AlexP » Tue 10 Mar 2015 07:05

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.

Uli65
Posts: 12
Joined: Wed 22 Feb 2012 10:11

Re: Lazarus 1.26 / UniDac 6.02 / SQLite3

Post by Uli65 » Tue 10 Mar 2015 12:33

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.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Lazarus 1.26 / UniDac 6.02 / SQLite3

Post by AlexP » Tue 10 Mar 2015 13:46

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;

Post Reply