Subject | Re: [Firebird-Architect] Re: RFC: Please unify stored procedure execution |
---|---|
Author | Ivan Prenosil |
Post date | 2004-12-21T17:46:26Z |
From: "Roman Rokytskyy" <rrokytskyy@...>
CREATE PROCEDURE test(a INTEGER) RETURNS (b INTEGER)
AS BEGIN
b = a;
END
CREATE PROCEDURE test(a INTEGER) RETURNS (b INTEGER)
AS BEGIN
b = a;
SUSPEND;
END
CREATE PROCEDURE test(a INTEGER) RETURNS (b INTEGER)
AS BEGIN
b = a;
SUSPEND;
SUSPEND;
END
The first returns zero rows, the second one row, the third two rows.
How the PSQL compiler could know what was programmers intentions ???
Is "programmer" or "Firebird" responsible for "correct" coding of SP ?
What if I am interested only in sideeffects, and do not want to return
any resultset ?
Ivan
> > Can you explain why is a necessity to accept that people doWhy should PSQL complain ???? All these procedures are legal:
> > things against documentation and write stored procedure with RETURNS
> > clauses but without SUSPEND statements?
>
> because PSQL compiler does not complain when it sees following code:
>
> CREATE PROCEDURE test(a INTEGER) RETURNS (b INTEGER)
> AS BEGIN
> b = a;
> END
>
> Since compiler does not complain, this procedure is fully legitimate.
> But when I check whether it has output params and use "SELECT * FROM
> test(1)" I get empty result set, not a result set with 1 row and 1 column.
CREATE PROCEDURE test(a INTEGER) RETURNS (b INTEGER)
AS BEGIN
b = a;
END
CREATE PROCEDURE test(a INTEGER) RETURNS (b INTEGER)
AS BEGIN
b = a;
SUSPEND;
END
CREATE PROCEDURE test(a INTEGER) RETURNS (b INTEGER)
AS BEGIN
b = a;
SUSPEND;
SUSPEND;
END
The first returns zero rows, the second one row, the third two rows.
How the PSQL compiler could know what was programmers intentions ???
Is "programmer" or "Firebird" responsible for "correct" coding of SP ?
What if I am interested only in sideeffects, and do not want to return
any resultset ?
Ivan