Subject Re: Getting name of FB currently logged in user in Delphi 7
Author Adam
--- In, Alan.Davies@... wrote:
> That works, but how about getting the total number of users logged in
> - say for when you need sole access because of multi-table updates
> that must all work. How can you check there are no other users
> logged-in?
> SELECT count(current_user) FROM rdb$database; returns 1

Well of course it returns one. Get me the count of the current user of
this connection can not possibly return anything else.

select count(current_date) from RDB$DATABASE will also return 1.

You asked for how to get the user name within a query (presumably so
you can do something inside a trigger, your client application will
obviously already know the username it sent during the connection, not
how to enumerate the number of connected users.

There is an API call to get the number of connections which may be
exposed through your connection components, but I will warn you now
that it is unreliable for Classic server, which will always return 1.
But classic server (on Windows), the connection count =
(fb_inet_server.exe instances - 1).