Joost van der Sluis wrote:
Op donderdag 10-01-2008 om 20:28 uur [tijdzone +0100], schreef Bogusław
Brandys:
Horacio Jamilis wrote:
It seems that the Size field shoud be 0 (zero) for numeric fields...
The size property of TField have different meanings for the different
field types.
So, you should not set the size property of an Integer field to anything
(the default 0 value is correct).
Hope this helps.
Horacio
Yes,I found it too.Very bad.I think that it should be processed silently
instead of force every package which is working under Delphi to modify.
That this works in Delphi is a Delphi-bug. TField.Size should contain
the amount of decimals, which is really 0 for an integer. But it seems
like that most components-developers don't know this, and the Delphi-bug
is that it is not enforced. It's the DataSize property that has to be 8
(or 4).
FPC has the same bug in all released versions. I changed the behaviour
in fpc 2.3.1 to see what happens. It was merged to fixes too, though.
I'll look how to fix this without removing the call to CheckTypeSize
completely. (Maybe ignore invalid values for those fields where it
doesn't matter, like integer-fields)
Joost
Thanks, it would be nice. Btw: is TBCDField fully supported now in FPC
SVN trunk ? I'd like to fix UIB component which is using some ugly
tricks for older fpc versions , for example look below:
Is that possible now to use TBCD type and precision would be perfect ?
I'd like to avoid rounding errors.
Boguslaw
(snippet from jvuibdataset)
(...)
SQL_INT64,
SQL_QUAD:
begin
{$IFDEF COMPILER6_UP}
if (sqlscale = -4) then
PInt64(Buffer)^ := PInt64(sqldata)^ else
if sqlscale > -4 then
PInt64(Buffer)^ := PInt64(sqldata)^ *
CurrencyDivisor[sqlscale] else
TBCD(Buffer^) := strToBcd(FloatToStr(PInt64(sqldata)^ /
scaledivisor[sqlscale]));
{$ELSE}
{$IFDEF COMPILER5_UP}
if (sqlscale = -4) then
PInt64(Buffer)^ := PInt64(sqldata)^ else
if sqlscale > -4 then PInt64(Buffer)^ :=
FastInt64Mul(PInt64(sqldata), @CurrencyDivisor[sqlscale]) else
CurrToBcd(PInt64(sqldata)^/scaledivisor[sqlscale],
TBCD(Buffer^));
{$ELSE}
{$IFDEF FPC}
if (sqlscale = -4) then
PInt64(Buffer)^ := PInt64(sqldata)^ else
if sqlscale > -4 then
PInt64(Buffer)^ := PInt64(sqldata)^ *
CurrencyDivisor[sqlscale] else
PDouble(Buffer)^ := PInt64(sqldata)^ /
scaledivisor[sqlscale];
{$ELSE}
unexpected
{$ENDIF}
{$ENDIF}
{$ENDIF}
end;
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives