>>PSQL compiler a little 
>>bit more intelligent and do such optimizations automatically.

It should be more inteligent as this is simple task.
Blob should have flag like returned outside. If set then new blob should be 
created if false it is simple appended.

E.g. in this loop there is no need to create blob as it is not returned
>      while (i < 150)
>      do
>      begin
>          b = b || s;
>          i = i + 1;
>      end


But e.g. here (e.g. blob b is in returning values)

>      while (i < 150)
>      do
>      begin
>          b = b || s;
>          if i mod 10=0 then
>             susspend;
>          i = i + 1;
>      end

Every 10 loop there is need to new one blob to create – as susspend return blob 
outside.
Only should be identified situations when „blob is returned” occure. If it 
sussped or more situations like 

>> insert into t (b) values (:b);

Only need to set flag for blob in that situations and in next assignment create 
new one with flag set to false

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

Reply via email to