Subject | RE: [firebird-support] Re: delayed suspend |
---|---|
Author | Alan McDonald |
Post date | 2009-06-04T22:43:30Z |
> Alan,but now try it with an ORDER BY clause and see what happens
>
> > are you now disagreeing with this post?
>
> good question
>
> >If an exception occurs at any point, the procedure will exit
> and return the exception -- and there will be no output.
>
> the experiment we did shows that at least this part is wrong.
>
> I thought a way to build an experiment to test the first part.
>
> I mean:
>
> 1. is the output set stored in memory and sent AFTER the exception
> occurs ?
>
> 2. is data returned to the outside world the exact instant the SUSPEND
> is met ?
>
> Which of the two ?
>
> I deviced the following:
>
> a. build a table TEST, like
>
> create table test
> (
> id_rec integer not null,
> primary key (id_rec)
> )
>
> b. filled in 500,000 rows by using procedure FillTest
>
> create procedure FillTest
> returns
> as
> declare variable i integer;
> begin
> i=0;
> while (i<=500000) do
> begin
> insert into test values (:i);
> i=i+1;
> end
>
> end
>
> c. created the following procedure, that will return 400,000 rows, then
> raise an exception
>
> alter procedure ListTest
> returns
> (
> id_rec integer
> )
> as
> declare variable i integer;
> begin
> i=0;
> for
> select id_rec
> from test
> into :id_rec
> do
> begin
> i=i+1;
> if (i=40000) then
> exception abort;
> suspend;
> end
> end
>
> d. created a minimal Delphi with a TIBOQuery, a TDatasource and a
> TDBGrid. All is shown in a Camtasia video available at
>
> http://www.sendspace.com/file/l2mrmn
>
> e. the query has sql.Text='select * from ListTest'
>
> At first you can see that the grid is filled AND NO EXCEPTION IS
> RAISED.
>
> The exception is raised only when I try to reach the bottom of the
> grid.
>
> This experiment shows that rows are indeed returned interactively (as
> Ivan says) and that case 1 is not true.
>
> Thank you
>
> Peppe
Alan