Subject | Re: [firebird-support] How to get CURRENT_USER? |
---|---|
Author | Helen Borrie |
Post date | 2005-02-14T22:25:57Z |
At 09:33 AM 14/02/2005 -0600, you wrote:
1. This test is part of a stored procedure
2. IsFirstTimeUser is an executable stored procedure with a return value
with a Boolean semantic, e.g. 1=True, 0=False, that you want to call from
your SP
3. InsertRecord is another executable SP
...
DECLARE VARIABLE RESULT SMALLINT;
....
BEGIN
....
RESULT = 0;
EXECUTE PROCEDURE IsFirstTimeUser(:AAppName, CURRENT_USER)
RETURNING_VALUES (:RESULT);
IF (RESULT = 1) then
EXECUTE PROCEDURE InsertRecord(CURRENT_USER, :other1, :other2);
....
END
./heLen
>I want to insert a record into a table whenever a user runs an app for theAssumptions here:
>first time. To check this, I want to see if there is a record containing the
>name of the app and the name of the user. How can I retrieve the
>CURRENT_USER context variable so that I can pass that as an arg to see if
>such a record exists?
>
>IOW, I want to do something like:
>
>
>If IsFirstTimeUser(AAppName, AUserName: String) then
>
> InsertRecord(AUserName, etc.)
>
>
>The AUserName arg to passed should be CURRENT_USER.
1. This test is part of a stored procedure
2. IsFirstTimeUser is an executable stored procedure with a return value
with a Boolean semantic, e.g. 1=True, 0=False, that you want to call from
your SP
3. InsertRecord is another executable SP
...
DECLARE VARIABLE RESULT SMALLINT;
....
BEGIN
....
RESULT = 0;
EXECUTE PROCEDURE IsFirstTimeUser(:AAppName, CURRENT_USER)
RETURNING_VALUES (:RESULT);
IF (RESULT = 1) then
EXECUTE PROCEDURE InsertRecord(CURRENT_USER, :other1, :other2);
....
END
./heLen