Subject | RE: [firebird-support] How to get CURRENT_USER? |
---|---|
Author | Edwin A. Epstein, III |
Post date | 2005-02-14T22:17:07Z |
Just food for thought.........
If you are trying to implement a tracking system in your database, you might
just want to create a table to hold all the tracking records and use
INSERT/UPDATE/DELETE triggers to place records in the tracking table. This
works for me very well with small lookup tables (less than 5000) where
operations are occuring with low frequency. In the tables where I have a
lot of records changing, I use SP's to accomplish that. The SP's themselves
create a single record in the tracking database for multiple operations.
For your purposes checking to see if a user already ran an operation on the
database would be a simple select statement on the tracking database. For
me this works for every type of operation on the database. My tracking
table right now holds more than 100 types of operations on it. Every
tracking record contains an ID, timestamp, CURRENT_USER and up to 15
variable peices of information and 1 blob field.
As an example, every time a user modifies a past operation, or updates the
status of an existing operation, the tracking record is created to hold the
specifics of that operation and the blob field actually holds the email/work
order from the supervisor who ordered it. Additionally, certain operations
actually look up the tracking table to see if the operation was already
performed and then reports to the user that it was in fact done and who did
it. This prevents multiple people trying to run the same operation.
-----Original Message-----
From: Clay Shannon [mailto:cshannon@...]
Sent: Monday, February 14, 2005 12:53 PM
To: firebird-support@yahoogroups.com
Subject: RE: [firebird-support] How to get CURRENT_USER?
<< it's USER
Alan>>
USER and CURRENT_USER are apparently the same. I don't know why there are
two context variables for the same thing, unless it's just to make the newer
one (CURRENT_USER) compatible with other context variables, such as
CURRENT_ROLE, etc.
What I've done is write a temporary record to a table that holds the
CURRENT_USER and CURRENT_ROLE values, immediately retrieve them and assign
them to global vars (properties), and then delete the record (there is
always 0 or 1 record in the table, and the time there is a record in the
table is just a fraction of a second.
I then have those values throughout the run of the app, in case I want to
report "who dunnit" re: who ran the app for the first time or who attempted
to break the password, etc.
Clay Shannon,
Dimension 4 Software
-----Original Message-----
From: Alan McDonald [mailto:alan@...]
Sent: Monday, February 14, 2005 2:47 PM
To: firebird-support@yahoogroups.com
Subject: RE: [firebird-support] How to get CURRENT_USER?
Alan
Yahoo! Groups Links
Yahoo! Groups Links
If you are trying to implement a tracking system in your database, you might
just want to create a table to hold all the tracking records and use
INSERT/UPDATE/DELETE triggers to place records in the tracking table. This
works for me very well with small lookup tables (less than 5000) where
operations are occuring with low frequency. In the tables where I have a
lot of records changing, I use SP's to accomplish that. The SP's themselves
create a single record in the tracking database for multiple operations.
For your purposes checking to see if a user already ran an operation on the
database would be a simple select statement on the tracking database. For
me this works for every type of operation on the database. My tracking
table right now holds more than 100 types of operations on it. Every
tracking record contains an ID, timestamp, CURRENT_USER and up to 15
variable peices of information and 1 blob field.
As an example, every time a user modifies a past operation, or updates the
status of an existing operation, the tracking record is created to hold the
specifics of that operation and the blob field actually holds the email/work
order from the supervisor who ordered it. Additionally, certain operations
actually look up the tracking table to see if the operation was already
performed and then reports to the user that it was in fact done and who did
it. This prevents multiple people trying to run the same operation.
-----Original Message-----
From: Clay Shannon [mailto:cshannon@...]
Sent: Monday, February 14, 2005 12:53 PM
To: firebird-support@yahoogroups.com
Subject: RE: [firebird-support] How to get CURRENT_USER?
<< it's USER
Alan>>
USER and CURRENT_USER are apparently the same. I don't know why there are
two context variables for the same thing, unless it's just to make the newer
one (CURRENT_USER) compatible with other context variables, such as
CURRENT_ROLE, etc.
What I've done is write a temporary record to a table that holds the
CURRENT_USER and CURRENT_ROLE values, immediately retrieve them and assign
them to global vars (properties), and then delete the record (there is
always 0 or 1 record in the table, and the time there is a record in the
table is just a fraction of a second.
I then have those values throughout the run of the app, in case I want to
report "who dunnit" re: who ran the app for the first time or who attempted
to break the password, etc.
Clay Shannon,
Dimension 4 Software
-----Original Message-----
From: Alan McDonald [mailto:alan@...]
Sent: Monday, February 14, 2005 2:47 PM
To: firebird-support@yahoogroups.com
Subject: RE: [firebird-support] How to get CURRENT_USER?
> I want to insert a record into a table whenever a user runs an app for theit's USER
> 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.
>
>
>
> Clay Shannon,
Alan
Yahoo! Groups Links
Yahoo! Groups Links