Page 1 of 1

Currency field mapped as TMemoField

Posted: Tue 04 Jul 2017 16:46
by Frazz
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

Re: Currency field mapped as TMemoField

Posted: Wed 05 Jul 2017 07:39
by Frazz
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.

Re: Currency field mapped as TMemoField

Posted: Wed 05 Jul 2017 12:47
by MaximG
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