[Lazarus] TFMTBCDField problem

Chris Rempas crori49 at yahoo.com
Sun Nov 9 16:18:53 CET 2014


I am almost convinced that the problem is not what i am seeing...this code works
if VSQLVar^.sqlscale = 0 then  i := AParams[ParNr].AsIntegerelse//i := Round(AParams[ParNr].AsCurrency * IntPower10(-VSQLVar^.sqlscale));
  i := Round(BCDToDouble(AParams[ParNr].AsFMTBCD) * IntPower10(-VSQLVar^.sqlscale));

the reason i think that this is not a *real* fix, is that the TParam.asCurrency returns a Varriant and this raises the error, but TParam.AsFMTBCD returns a TFMTBCD Value converted from a variant! This *should* raise the same error, but it doesn't
How could i have debug info in FMTBCD unit? i would like to take a look at this BCDFactory

PS : I am really trying to fix the problem and not just patch around it, i have the highest hope in your understanding and help :)
Regards,Chris


     On Sunday, November 9, 2014 12:08 PM, Joost van der Sluis <joost at cnoc.nl> wrote:
   

 On 11/09/2014 03:37 AM, Chris Rempas wrote:
> I copied the binaries that were missing in my FPC 2.7.1 from FPC2.6.4
> i run make clean all and make install again and VOILA! i have debug! :)))
> (it seems all the binaries must be in the same directory for some reason)

I don't really understand which binaries you did copy. But I'm glad you 
have the debug-info.

> FILE "dsparams.inc", LINE 519
> Function TParam.GetAsCurrency: Currency;
> begin
>    If IsNull then
>      Result:=0.0
>    else
>      Result:=FValue;    <---- 519
> end;

For 'BCD' fields, the Currency type is used. In your case you have 5 
decimals, so you can not use .AsCurrency...

> when the parser gets the values of the params, this param is BCD and as
> you can see it tries to get it as currency
>
> In a quick check, methods [AssignToField] [AssignFromField] [GetData]
> [SetData] are not fully ready for every "FDataType"
> some are missing BCD Fields, some are missing FMTBCD Fields and
> sometimes it gets the same treatment as Currency...

Currency and BCD are the same. So apparently support for FMTBCD fields 
is missing here. As the FMTBCD support is relatively new this could just 
be missing.

> I am guessing at this point that i don't have the latest code
>
> if i could have a copy of the latest component, i would be able to test
> and maybe help debug with real testing

2.7.1 is the latest version? Yo have to find out where/why the FMTBCD 
param is accesses as AsCurrency (Assign, GetData, SetData?), and fix 
that. Then you can simply recompile fcl-db and see if your program works.

Oh, and if you have fixed the problem, send us a patch. ;)

Joost.



   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20141109/3f33e5e3/attachment-0003.html>


More information about the Lazarus mailing list