Subject Re: [Firebird-Architect] Re: External procedures: implementation proposal.
Author Adriano dos Santos Fernandes
Jim Starkey escreveu:

>The semantics of the IscDbc ResultSet are defined by a broadly accepted
>standard. Violating the standard because you have a better idea can
>sometimes be justified, but in my opinion, not in this case.
>
The interface should be pratical for everyone that want to write
procedures in C++. Not only for one or to engines.
You could easy insert the output values in a ResultSet *inside* the engine.

How this SPs could be created in your proposal?

create procedure sp (i integer) returns (o integer)
as
declare variable x integer;
begin
x = 0;

while (x < 10) do
begin
o = i;
x = x + 1;
suspend;
end
end

This is in mine:

MyResultSet* MyExternalProcedure::open(Error* error, const* Values input, Values*
output)
{
return new MyResultSet(input, output);
}

MyResultSet::MyResultSet(const* Values input, Values* output)
: input(input),
output(output),
x(0)
{
}

virtual bool MyResultSet::fetch(Error* error)
{
output->setInt(0, input->getInt(0));
return x++ < 10;
}