Subject Re: [IBO] CalculatedField problem with MIDAS
Author Jason Wharton
I finally figured this out. It was actually quite easy to fix. When
packetsize is other than -1 it uses a different state to fetch records
called dsBlockRead. I didn't have this state recognized in the
etFieldData( ) method when a calc field was being determined.

Here is all that needs to be done:

function TIBODataset.InternalGetFieldData( Field: TField;
Buffer: Pointer ): boolean;
...
...
end
else
begin
{ !!! Add dsBlockRead state to this condition !!! }
if State in [dsBrowse, dsEdit, dsInsert, dsCalcFields, dsBlockRead] then
begin
if Assigned( ACalcBuf ) then
begin
Inc( longint( ACalcBuf ), FRecordSize + Field.Offset );
Result := boolean( pchar(ACalcBuf)[0] );
if Result and Assigned( Buffer ) then
Move( pchar( ACalcBuf )[1], Buffer^, Field.DataSize );
end
else
Result := false;
end;
end;
end;

Look in IBDataset.pas around line 2650.

Thanks for pointing this out!

PS. This is the last known MIDAS bug I have to resolve...

Regards,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com


----- Original Message -----
From: "Dominique Van Roie" <Dominique@...>
To: <IBObjects@...>
Sent: Thursday, January 04, 2001 10:51 AM
Subject: [IBO] CalculatedField problem with MIDAS


> Hi,
>
> I found an other problem with IBOQuery caclulated fields when viewed
through
> a client DataSet.
> If you set ClientDataSet.PacketRecords to a positive number like 20, the
> caclulated fields are empty
> on the clientDataSet side but are ok on the IBOQuery side.
> All is ok if ClientDataSet.PacketRecords = -1 but I really prefer the
> incremental fetching
>
> I found that the calculated fields values are lost in
> procedure TDataSetProvider.InternalGetRecords
> ...
> DataSet.BlockReadSize := Count; // count is the
> ClientDataSet.PacketRecords
> ...
> end;
>
> As an attachment is a small .dpr reproducing the problem.
> You will have to adapt the path to employee.gdb (demo file comming with
> delphi)
>
> <<CalcFieldsBug.zip>>
> I made all my testing with the latest version of IBO : IBO_3_6_Cc.zip
>
> Does anybody know a fix or a workAround
> Thanks
> Dominique