LargeInt like FMTBcdField Size 0

The offical for ZeosLib 7.3 Report problems, ask for help, post proposals for the new version of Zeoslib 7.3/v8
Quick Info:
-We made two new drivers: odbc(raw and unicode version) and oledb
-GUID domain/field-defined support for FB
-extended error infos of Firebird
-performance ups are still in queue
In future some more feature will arrive, so stay tuned and don't hassitate to help
Post Reply
amonteiro
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 20.07.2022, 15:11

LargeInt like FMTBcdField Size 0

Post by amonteiro »

Hi,

We use FIBPlus in our application and we are changing to ZEOS framework. In the FIB exists a property in the dataset (PrepareOptions) called psSQLINT64toBCD, when i check this the BIGINT in the Firebird is treated like type BCD size 0. Is there something like this in the ZEOS?

In the moment i am receiving this message of error when i execute:

ERRO(#01): cdsCfg: Type mismatch for field 'ID', expecting: FMTBcdField actual: LargeInt

In the file Zeos.inc i comment:

{$DEFINE WITH_ASLARGEINT}
{$DEFINE WITH_PARAM_ASLARGEINT}
{$DEFINE TFIELD_HAS_ASLARGEINT}

But the error continues.
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1918
Joined: 17.01.2011, 14:17

Re: LargeInt like FMTBcdField Size 0

Post by marsupilami »

Hello amonteiro,
amonteiro wrote: 28.12.2023, 21:05 In the FIB exists a property in the dataset (PrepareOptions) called psSQLINT64toBCD, when i check this the BIGINT in the Firebird is treated like type BCD size 0. Is there something like this in the ZEOS?
No - there is no property like that in Zeos. Why would you want to treat an INT64 field as a BCD?
amonteiro wrote: 28.12.2023, 21:05 ERRO(#01): cdsCfg: Type mismatch for field 'ID', expecting: FMTBcdField actual: LargeInt
This error means that your persistent field is a TFMTBcdField and Zeos expects you to have a TLargeIntField. You should change your field definition in the dfm file and the pas file.
amonteiro wrote: 28.12.2023, 21:05 In the file Zeos.inc i comment:

{$DEFINE WITH_ASLARGEINT}
{$DEFINE WITH_PARAM_ASLARGEINT}
{$DEFINE TFIELD_HAS_ASLARGEINT}

But the error continues.
These defines are not meant to be modified by Zeos users. They tell zeos which capabilities the RTL has that is in use.
amonteiro
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 20.07.2022, 15:11

Re: LargeInt like FMTBcdField Size 0

Post by amonteiro »

Hi,
I changed to LargeInt the INT64 field and it works.

With BCD field i have this situation now:

object cdsClienteLIMITE: TBCDField
FieldName = 'LIMITE'
Origin = 'GETCLIENTE.LIMITE'
Precision = 32
Size = 2
end

The field above is giving the error "expecting BCD actual: FMTBCDField". I changed the property "ControlsCodePage := cGET_ACP" but the error already keep. Is there a mode to treat this field like a TBCDField?

Note: In my tests, if size different 4(NUMERIC 18,2) i receive the error above, but if i keep it in 4(NUMERIC 18,4) don't give me the error.
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1918
Joined: 17.01.2011, 14:17

Re: LargeInt like FMTBcdField Size 0

Post by marsupilami »

Hello amonteiro,

Delphi and FPC have to different types to support BCD like fields: TBCDField and TFMTBCDField. Depending on your field sizes, Zeos will choose one of those field types.
TBCDField uses the Currency type internally which really just is an Integer. TFMTBCDField uses the TBCD data type which is slower in use than the Currency type but allows to store bigger numbers. So - again you will have to change your field type from TBCDField to TFMTBCDField.
Your numeric(18,2) can store numbers that are just to big for the Currency data type. This is why Zeos chooses TFMTBCDField for that column.


Best regards,

Jan
Post Reply