Subject | Re: [firebird-support] Re: Stored Procedure -- Select |
---|---|
Author | Pavel Menshchikov |
Post date | 2005-09-30T13:56:30Z |
Hello Peter,
See in-line comments.
p> The stored procedure is as follows:
p> ----------------------------------------------------------
p> CREATE PROCEDURE QUERY_FOR_USER_ACCESS (
p> USER_LOGIN_NAME VARCHAR (50) CHARACTER SET NONE,
p> USER_PASSWORD VARCHAR (50) CHARACTER SET NONE,
p> STORE_ID INTEGER)
p> RETURNS (
p> USERNAME VARCHAR (50) CHARACTER SET NONE,
p> USERLOGGED CHAR (1) CHARACTER SET NONE,
p> USERID INTEGER,
p> USERGROUP INTEGER)
p> AS
p> BEGIN
p> SELECT
p> USERS.logged,
p> USERS.name,
p> USERS.user_group_id,
p> USERS.user_id
p> FROM
p> users,store_user
p> WHERE
p> USERS.userlogin_id = :USER_LOGIN_NAME AND
p> USERS.passwd = :USER_PASSWORD AND
p> USERS.user_id = store_user.user_id AND
p> store_user.store_id = :STORE_ID
p> INTO
p> :USERLOGGED,
p> :USERNAME,
p> :USERGROUP,
p> :USERID;
-- here you may get a resulting row (and may not, as you expect).
p> SUSPEND;
-- and here you return the result (expected or not) anyway
p> END
p> ----------------------------------------------------------
p> It does have a SUSPEND, but I'm using the default IB Manager setting,
p> so I'm not exactly sure if it's in the right place. Thanks for the
p> info on the .NET FB forum group, I'll check there also.
You were right that your problem is not with .net. Move SUSPEND in
FOR SELECT... loop (as Alan suggested) - and try it again. With FOR
SELECT...SUSPEND in case there is no data to return, you'll get an
empty dataset after selecting from the stored procedure.
--
Best regards,
Pavel Menshchikov
http://www.ls-software.com/
See in-line comments.
p> The stored procedure is as follows:
p> ----------------------------------------------------------
p> CREATE PROCEDURE QUERY_FOR_USER_ACCESS (
p> USER_LOGIN_NAME VARCHAR (50) CHARACTER SET NONE,
p> USER_PASSWORD VARCHAR (50) CHARACTER SET NONE,
p> STORE_ID INTEGER)
p> RETURNS (
p> USERNAME VARCHAR (50) CHARACTER SET NONE,
p> USERLOGGED CHAR (1) CHARACTER SET NONE,
p> USERID INTEGER,
p> USERGROUP INTEGER)
p> AS
p> BEGIN
p> SELECT
p> USERS.logged,
p> USERS.name,
p> USERS.user_group_id,
p> USERS.user_id
p> FROM
p> users,store_user
p> WHERE
p> USERS.userlogin_id = :USER_LOGIN_NAME AND
p> USERS.passwd = :USER_PASSWORD AND
p> USERS.user_id = store_user.user_id AND
p> store_user.store_id = :STORE_ID
p> INTO
p> :USERLOGGED,
p> :USERNAME,
p> :USERGROUP,
p> :USERID;
-- here you may get a resulting row (and may not, as you expect).
p> SUSPEND;
-- and here you return the result (expected or not) anyway
p> END
p> ----------------------------------------------------------
p> It does have a SUSPEND, but I'm using the default IB Manager setting,
p> so I'm not exactly sure if it's in the right place. Thanks for the
p> info on the .NET FB forum group, I'll check there also.
You were right that your problem is not with .net. Move SUSPEND in
FOR SELECT... loop (as Alan suggested) - and try it again. With FOR
SELECT...SUSPEND in case there is no data to return, you'll get an
empty dataset after selecting from the stored procedure.
--
Best regards,
Pavel Menshchikov
http://www.ls-software.com/