Subject | Re: [Firebird-Architect] RFC: Please unify stored procedure execution |
---|---|
Author | Vlad Horsun |
Post date | 2004-12-21T09:39:49Z |
"Roman Rokytskyy" ...
don't put SUSPEND in it
SELECT * FROM , if there are no outputs - call with EXECUTE. I think
connectivity drivers can follow this too
Personally i don't see a big problem with current dual syntax, but if we
decide
to add SUSPEND to procedures with outputs and without SUSPEND, i'll don't
resist ;)
Regards,
Vlad
>I think this is developer mistake - call procedure with SELECT and
> Problem definition:
>
> Firebird distinguishes two types of procedures: normal procedures and
> selectable ones. Former should be called using EXECUTE PROCEDURE
> statement, latter with SELECT * FROM ... statement.
>
> If EXECUTE PROCEDURE is used to call selectable procedure, only first
> row of the result set is returned. If SELECT * FROM ... is applied to
> a "normal" (i.e. non-selectable procedure), an empty result set is
> returned.
don't put SUSPEND in it
> There is no flag in RDB$PROCEDURES system table telling whetherI use simple rule : if procedure has output parameters - i call it with
> procedure is selectable or not. Connectivity dirvers that are required
> to translate abstract procedure call syntax (for example {call ...}
> syntax in JDBC) cannot automatically generate appropriate SQL.
SELECT * FROM , if there are no outputs - call with EXECUTE. I think
connectivity drivers can follow this too
> I see the need to unifying the way stored procedures are handled.This is kind of syntax sugar, imho, i don't like it
>
> Solution:
>
> Multiple solutions are possible:
>
> a) provide a new SQL statement, for example CALL, that when applied to
> selectable procedures, returns complete result set (is equivalent to
> SELECT * FROM), when applied to non-selectable procedures returns a
> result set with single row corresponding to the RETURNS declaration.
> b) Fix the PSQL compiler to add SUSPEND before exiting theSELECT can be done only from those procedures which has outputs.
> non-selectable procedure if SUSPEND is not already contained in the
> procedure body (in other words, automatically convert non-selectable
> procedure into selectable). This allows using SELECT * FROM syntax for
> all types of procedures.
Personally i don't see a big problem with current dual syntax, but if we
decide
to add SUSPEND to procedures with outputs and without SUSPEND, i'll don't
resist ;)
Regards,
Vlad