Subject | RE: [IBO] BCD overflow |
---|---|
Author | IBO Support List |
Post date | 2014-05-07T01:18:55Z |
I have a patch for this problem:
IBODataset.pas
function TIBODataset.GetFieldData( Field: TField;
{$IFDEF IBO_SUPP_FIELDDATA_IS_TVALUEBUFFER}
{$IFDEF IBO_SUPP_TVALUEBUFFER_BYREF} var {$ENDIF}
Buffer: TValueBuffer;
{$ELSE}
Buffer: Pointer;
{$ENDIF}
NativeFormat: Boolean ): Boolean;
var
tmpBCD: TBCD;
tmpCurr: Currency;
tmpPCurr: PCurrency absolute Buffer;
tmpPBCD: PBCD absolute Buffer;
begin
if (( Field.DataType = ftBCD ) and ( not NativeFormat )) then
begin
if Field.DataSize = SizeOf( TBCD ) then
begin
Result := InternalGetFieldData( Field, @tmpBCD );
if Result then // Needed to add this check.
BCDToCurr( tmpBCD, tmpPCurr^ );
end
else
if Field.DataSize = SizeOf( System.Currency ) then
begin
Result := InternalGetFieldData( Field, @tmpCurr );
if Result then // Needed to add this check.
CurrToBCD( tmpCurr, tmpPBCD^ );
end
else
raise EIB_Error.Create( E_Unsupp_Col_Conversion );
end
else
Result := inherited GetFieldData( Field, Buffer, NativeFormat );
end;
{$IFDEF IBO_SUPP_FIELDDATA_IS_TVALUEBUFFER}
{$IFDEF IBO_SUPP_TVALUEBUFFER_BYREF} var {$ENDIF}
Buffer: TValueBuffer;
{$ELSE}
Buffer: Pointer;
{$ENDIF}
NativeFormat: Boolean ): Boolean;
var
tmpBCD: TBCD;
tmpCurr: Currency;
tmpPCurr: PCurrency absolute Buffer;
tmpPBCD: PBCD absolute Buffer;
begin
if (( Field.DataType = ftBCD ) and ( not NativeFormat )) then
begin
if Field.DataSize = SizeOf( TBCD ) then
begin
Result := InternalGetFieldData( Field, @tmpBCD );
if Result then // Needed to add this check.
BCDToCurr( tmpBCD, tmpPCurr^ );
end
else
if Field.DataSize = SizeOf( System.Currency ) then
begin
Result := InternalGetFieldData( Field, @tmpCurr );
if Result then // Needed to add this check.
CurrToBCD( tmpCurr, tmpPBCD^ );
end
else
raise EIB_Error.Create( E_Unsupp_Col_Conversion );
end
else
Result := inherited GetFieldData( Field, Buffer, NativeFormat );
end;
My regression test was modified/expanded to catch this problem
and then I determined upon this fix.
I will be making another release ASAP.
My apologies to all who were affected by this
problem.
Jason
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf Of IBO Support List
Sent: Wednesday, April 30, 2014 7:25 PM
To: IBObjects@yahoogroups.com
Subject: RE: [IBO] BCD overflow
What values are in the data that trips it
up?
Thanks,
Jason
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf Of johng@...
Sent: Wednesday, April 30, 2014 2:15 PM
To: IBObjects@yahoogroups.com
Subject: RE: [IBO] BCD overflow