Currency field mapped as TMemoField

Discussion of open issues, suggestions and bugs regarding LiteDAC (SQLite Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Frazz
Posts: 10
Joined: Tue 04 Jul 2017 16:33

Currency field mapped as TMemoField

Post by Frazz » Tue 04 Jul 2017 16:46

Hi to all,
I am testing UniDAC and trying to integrate it with a small layer of mine own that will handle both UniDAC and FireDAC. I'm using version 7.0.2 for RAD Studio 10.1.

One of the problems I've stumbled upon is that given this SQLite table:

Code: Select all

CREATE TABLE patients (
  id BINARY(16) PRIMARY KEY,
  ...
  total_bonuses CURRENCY,
  credit_limit CURRENCY,
  ...
);
... and dropping a TSQLiteProvider a TUniConnection and a TUniTable... I can correctly reach the database and open the table... but those two currency fields are mapped as TMemoField objects. This happens with the IDE fields editor, but also at runtime. If I define them as TCurrencyField persistent fields in the IDE, when I open the table I get an error that says it was expecting a TCurrencyField, but actually found a TMemoField.

The same thing happens with a TUniquery (SELECT * FROM patients)

Any ideas?
TIA
Marco

Frazz
Posts: 10
Joined: Tue 04 Jul 2017 16:33

Re: Currency field mapped as TMemoField

Post by Frazz » Wed 05 Jul 2017 07:39

I was digging through the SQLite documentation and saw that the problem is that there is no CURRENCY data type. So probably what is happening is that SQLite is creating the column with a TEXT or BLOB affinity.

I solved the problem by creating those columns as REAL. Now the fields editor will create fields as TFloatField. But if I create persistent TCurrencyField fields it will also work.

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Currency field mapped as TMemoField

Post by MaximG » Wed 05 Jul 2017 12:47

Thank you for the information. You are absolutely right. The CURRENCY type is not SQLite standard type. In this case LiteDAC creates a field with the Memo. We will support the work with fields of the CURRENCY type in the next LiteDAC build

Post Reply