Subject | Re: [IBO] Confusion about StoredProc vs use of Cursor or Query (was Help with OnCallBack) |
---|---|
Author | Geoff Worboys |
Post date | 2005-07-06T07:00:47Z |
> But, before I try what you suggested, it seems you missedI had missed that fact.
> that my test app has been using the simple
> SELECT * FROM MYSP(:K)
> and that SP returned ALL rows from MyTable (MasterLibrary),
> and yet there was no firing of the OnCallBack event.
Here is my own test...
SET TERM ^ ;
ALTER PROCEDURE TEST_CB( ANYVAL INTEGER )
RETURNS ( SOMEVAL INTEGER )
AS
DECLARE TMP VARCHAR(31);
BEGIN
SOMEVAL = 999;
WHILE (SOMEVAL > 0) DO
BEGIN
SUSPEND;
-- This stuff is just to slow the loop down a bit
FOR SELECT RDB$FIELD_NAME FROM RDB$FIELDS
ORDER BY RDB$FIELD_NAME
INTO :TMP DO
BEGIN
END
SOMEVAL = SOMEVAL - 1;
END
END^
The relevant parts of my form dfm...
object IB_Query1: TIB_Query
IB_Connection = IB_Connection1
IB_Transaction = IB_Transaction1
SQL.Strings = (
'SELECT *'
'FROM TEST_CB( 0 )')
AutoFetchAll = True
CallbackInc = 100
CallbackInitInt = 10
CallbackRefreshInt = 10
OnCallback = IB_Query1Callback
FetchWholeRows = True
end
And the event handler...
procedure TForm1.IB_Query1Callback(IB_Dataset: TIB_Dataset;
Status: TIB_CallbackStatus; CursorRowNum: Integer; var Abort: Boolean);
begin
ShowMessage('Callback was hit: ' + IntToStr(CursorRowNum));
end;
Thats it. It worked.
The Callback* properties just seemed to be the ones that gave
me the best effects on the very fast loop - without locking me
with too many prompts to acknowledge :-)
One thing I did notice: When I had the query attached to an
IB_Grid it seemed to make very little difference what settings
I had on the Callback* properties, I would get a hit on the
first row that was it - so I am not sure what was going on in
that case.
Indeed the timing issues as to exactly what rows you get hit
on seem pretty interesting even without the gird. 0 and 999
(first and last) seemed pretty consistent, but much of the rest
of the time I might get hits on 1, 2, 3 and then 999. The
simple test above is all too fast to get a really good effect.
But my main point is this... simplify (eg: the above) until
you start getting your callback being hit occassionally. Then
start to fill it out and adjust until you get what you need.
--
Geoff Worboys
Telesis Computing