Subject | Re: [IBO] SP and Client App Progress Bar |
---|---|
Author | Salvatore Besso |
Post date | 2004-04-02T15:36:19Z |
hello Enrico,
suppose you have a stored procedure more or less like this:
SET TERM ^ ;
DECLARE PROCEDURE MYPROC(PARAM...optional)
AS
BEGIN
FOR SELECT FIELDNAME FROM MYTABLE DO
BEGIN
....
YOUR PROCESSES HERE;
....
SUSPEND;
END
END ^
SET TERM ; ^
Now, in Delphi code, you can use an TIB_Cursor with the following SQL
statement:
SELECT * FROM MYPROC /* FOR UPDATE */
Remember to assign a proper callback method to the OnCallback property
of the TIB_Cursor used to "open" the stored procedure and to set its
CallbackInc property accordingly, for example your procedure could
update a progress bar using the CursorRowNum variable of the callback
procedure:
MyProgressBar.Position := Trunc((CursorRowNum / TotalRows) * 100);
But you can do even more, for example you can have your procedure
returning values indicating the current row num (I use it in addition
to the progress bar to update a label).
Adding my two cents to what Jason said in his last message, I have to
say that I have not used the "FOR UPDATE" clause and my callback works
very fine and the progress bar and the labels are updated smootly. But
in this case I'm using Firebird embedded with a local connection.
HTH
Salvatore
suppose you have a stored procedure more or less like this:
SET TERM ^ ;
DECLARE PROCEDURE MYPROC(PARAM...optional)
AS
BEGIN
FOR SELECT FIELDNAME FROM MYTABLE DO
BEGIN
....
YOUR PROCESSES HERE;
....
SUSPEND;
END
END ^
SET TERM ; ^
Now, in Delphi code, you can use an TIB_Cursor with the following SQL
statement:
SELECT * FROM MYPROC /* FOR UPDATE */
Remember to assign a proper callback method to the OnCallback property
of the TIB_Cursor used to "open" the stored procedure and to set its
CallbackInc property accordingly, for example your procedure could
update a progress bar using the CursorRowNum variable of the callback
procedure:
MyProgressBar.Position := Trunc((CursorRowNum / TotalRows) * 100);
But you can do even more, for example you can have your procedure
returning values indicating the current row num (I use it in addition
to the progress bar to update a label).
Adding my two cents to what Jason said in his last message, I have to
say that I have not used the "FOR UPDATE" clause and my callback works
very fine and the progress bar and the labels are updated smootly. But
in this case I'm using Firebird embedded with a local connection.
HTH
Salvatore