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

>Adriano dos Santos Fernandes wrote:
>
>
>
>>Imagine a procedure that returns int, string, int.
>>
>>Then you have to implement getInt to handle columns 1 and 3. And
>>implement getString to handle column 2.
>>And the others methods that are pure virtual?
>>
>>
>>
>>
>You can call getInt(), getString(), getDouble(), etc., on any column.
>The class must either perform the conversion or throw an exception if it
>can't.
>
>
ResultSet is abstract and mean that inherited class must implement get*.
The procedure logic will be very strange with get methods.
If you don't want PARAMDSC then pass something like the Values class.

>
>
>>And how NULL is handled in ResultSet?
>>I imagine wasNull will be poor to use.
>>
>>
>>
>>
>Yes, wasNull(). It wouldn't have been my first choice, but it made more
>sense to be consistent with JDBC than to introduce an abitrary difference.
>
>
Arrgh...

I think a better interface is:

class ExternalProcedure : public ExternalResource
{
public:
virtual ResultSet* open(Error* error, const* Values input, Values*
output) = 0;
};

class ResultSet : public ExternalResource
{
public:
virtual bool fetch(Error* error) = 0;
};

ExternalProcedure::open may pass input and output to ResultSet
implementor constructor.
The procedure can be writen entire in one method, instead of implement
many methods to return values.
EXECUTE PROCEDURE could get output parameters too.


Adriano