Subject | Re: [Firebird-Architect] Legacy Behavior |
---|---|
Author | Dmitry Yemanov |
Post date | 2004-12-22T17:03:06Z |
"Jim Starkey" <jas@...> wrote:
RETURNS (SESSION_ID INT)
AS
BEGIN
SELECT ID
FROM SYS_SESSIONS
WHERE CONNECTION_ID = CURRENT_CONNECTION
INTO :SESSION_ID;
SUSPEND;
END;
Then I may use this procedure in another SPs:
...
EXECUTE PROCEDURE CURRENT_SESSION
RETURNING_VALUES :SESSION_ID;
...
This is very unnaturally for me to make a select to always return a single
value. But also I may use this procedure to limit some rowset:
SELECT ... WHERE SESSION_ID = ( SELECT SESSION_ID FROM P_CURRENT_SESSION )
Believe me, you'll find enough such examples. This usage is 100% legal.
Taking this example apart, I agree with your other words.
Dmitry
>CREATE PROCEDURE P_CURRENT_SESSION
> It is certainly possible to write a procedure that does something
> meaningful if invoked in either environment, though it is unlikely that
> anyone has actually done this. The fact that the procedure can't tell
> which way it was invoked is kind of a showstopper. But if someone did,
> he either knew or should have known that this was entirely too cute to
> work in the long run. And if not, next time he'll know.
RETURNS (SESSION_ID INT)
AS
BEGIN
SELECT ID
FROM SYS_SESSIONS
WHERE CONNECTION_ID = CURRENT_CONNECTION
INTO :SESSION_ID;
SUSPEND;
END;
Then I may use this procedure in another SPs:
...
EXECUTE PROCEDURE CURRENT_SESSION
RETURNING_VALUES :SESSION_ID;
...
This is very unnaturally for me to make a select to always return a single
value. But also I may use this procedure to limit some rowset:
SELECT ... WHERE SESSION_ID = ( SELECT SESSION_ID FROM P_CURRENT_SESSION )
Believe me, you'll find enough such examples. This usage is 100% legal.
Taking this example apart, I agree with your other words.
Dmitry