Subject Re: [IBO] Confusion about StoredProc vs use of Cursor or Query (was Help with OnCallBack)
Author Geoff Worboys
Hi Chuck,

...
> Just in case you need this information: I'm using IBO 4.2Ie.

Very relevant - things are in different places in the later
version.

...
> SysFetchNext was called on the first row to be fetched but it
> looks like the property FETCHING was always false. I assume
> that this should be true. I noticed, also, that FCursorRowNum
> was incrementing properly, too. There's a WHILE loop in
> SysFetchNext which just kept looping until the end of
> retrieving the dataset.

Callbacks are only performed when IBO "thinks" that it may have
taken over the processor while processing an internal loop.

If you do a first or next or moveby(1) - that is a scroll by
one row - then the callback processing will not be performed.
So a loop like this:
first;
while not Qry.Eof do
begin
// do stuff
Qry.Next
end;

Does NOT experience callback processing - this is intentional
because you can just as easily do what whatever else is needed
inside your own loop.

However if you do a Last, moveby(20), FetchAll etc - that is a
scroll by many rows - then callback processing will be
performed. This is because the IBO code "knows" it is an
internal loop and so feedback can only be achieved through
callbacks.

You are also likely to get callbacks occuring during things
like refresh etc - as these also incur internal loops.

The arrangement is not perfect - as you have seen "Fetching"
is sometimes true anyway. But it is generally pretty good.


You can turn on callback processing in your own loops via
something like this:

Qry.BeginCallbackFetching;
try
first;
while not Qry.Eof do
begin
// do stuff
Qry.Next
end;
finally
Qry.EndCallbackFetching;
end;


Exactly what you will want to do depends on lots of factors.
For example you may want to simply call FetchAll, or perhaps
set AutoFetchAll = true, and let IBO take care of the rest.
Then again perhaps fetching everything is not necessary, I
dont really know what you are trying to achieve. I am not
even sure why you need a query rather than a cursor. (But
the callback processing is the same anyway.)

HTH

--
Geoff Worboys
Telesis Computing