BCD fields and FMTBCD fields

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
andrewsvaz
Posts: 12
Joined: Fri 04 Apr 2014 18:50

BCD fields and FMTBCD fields

Post by andrewsvaz » Mon 26 May 2014 20:41

Hi all,

So I was reading in the Web docs about the BCD field and FMTBCD Field and some things aren't exactly clear to me.

I have a Field defined in a Firebird database that is:

LTAVLRTOTAL DECIMAL(14,4) DEFAULT 0

and when I open the Fields Editor and add the fields in a TUniQuery, it shows up as FloatField if I have the EnableBCD = True, and if I have the EnableFMTBCD = True it shows up as a FMTBCDField.

As in the Docs at
http://www.devart.com/unidac/docs/index ... _types.htm
shows that
ftBCD -> DECIMAL(p, s) where (p < 15) and (s < 5)
ftFMTBCD -> DECIMAL(p, s) where (14 < p < 19) and(4 < s < 19)

Shouldn't the field showed up as a BCDField?

My doubt, Can I use the FMTBCDField without any problems? Willl this behaviour change in the next versions? is there any significant diference? (I believe not, but better ask now than being sorry later).

I am working with a lot a money operations and the BCDfield has always been the type that I used.

Using XE3 and Unidac 5.3.8 with Firebird 2.53

Just another thing, will the currency property at the field level make any diference?

Thanks
Andrew

ZEuS
Devart Team
Posts: 240
Joined: Thu 05 Apr 2012 07:32

Re: BCD fields and FMTBCD fields

Post by ZEuS » Tue 27 May 2014 08:32

Thank you for the information. We have fixed the error with incorrect DECIMAL fields mapping in UniDAC.
We have added the "SimpleNumericMap" connection specific option for InterBase provider. You should set the option to "False" to force fields like DECIMAL(14, 4) be mapped as ftBCD when EnableBCD is True. The default option value is "True".
The fix will be included in the nearest UniDAC build. We plan to release the build this week.

andrewsvaz
Posts: 12
Joined: Fri 04 Apr 2014 18:50

Re: BCD fields and FMTBCD fields

Post by andrewsvaz » Tue 27 May 2014 14:08

Ok, good to know that I can help with something.

In the meantime, is there a workaround other than setting all the desired fields to BCD fields with the DataMapper?

Thanks
Andrew

ZEuS
Devart Team
Posts: 240
Joined: Thu 05 Apr 2012 07:32

Re: BCD fields and FMTBCD fields

Post by ZEuS » Wed 28 May 2014 07:01

For now, in UniDAC all fields are mapped either as TFloatField or as TFmtBcdField, depending on the EnableFMTBCD option value. You can use Data Type Mapping as a workaround unless we release the UniDAC build.

Kuri_YJ
Posts: 2
Joined: Fri 08 Mar 2019 12:28

Re: BCD fields and FMTBCD fields

Post by Kuri_YJ » Tue 19 Mar 2019 14:54

Hi,

We also need seperation for BCD and FMTBCD fields in Data Mapping for Decimal fields on Database Informix ODBC driver. We can not seperate it. Is there any idea?

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

Re: BCD fields and FMTBCD fields

Post by MaximG » Fri 05 Apr 2019 17:16

The properties you mention are obsolete and are present in our components only for backward compatibility. Currently, you can use DataTypeMapping -
special mechanism provided by our components. It allows you customizing the type conversion in the most flexible way, for example:

Code: Select all

uses ODBCDataTypeMapUni;
     ...
     UniQuery.DataTypeMap.AddDBTypeRule(odbcDecimal, ftBCD);
The detailed description of this mechanism processing can be found in our documentation: https://www.devart.com/unidac/docs/data ... pping.htm

Post Reply