Hi,

First – good concept 😊

But, how this will work?
In every WHILE loop,  engine will lock loop until next row is „fetched” and 
susspend is called?
I do not know if you understand me?

What if function will do not call susspend at all or do not run while loop 
properly?

Maybe this can be done simpler without while do? Assuming that function is in 
WHILE .. DO .. already and every „call to function” do susspend.
Also why limiting to only one parameter?

Lets introduce:
agg_finished – is true in last row in agg grouping level
agg_i – row numer in the current grouping level

Lets assume:
Variables are „declared” only once per group level only body is called.

/* while (not agg_finished) do */
create aggregate function custom_count_plus_1000 (i integer) returns (o
integer)
as
Begin
   If (agg_i<=1) then  
      Begin
        --init vars and more
        o = 0;
      end;
  -- here body of this function
  -- do whatever you want
  o= o + 1;

  if (agg_finished) then
     o = o + 1000;
end

Maybe you can mix this with your proposition


Regards,
Karol Bieniaszewski


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to