[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
AX_UserNames()
Returns info about users currently connected to the Advantage Database Server
------------------------------------------------------------------------------
Syntax
AX_UserNames( [<cFileName>] ) -> array
<cFileName> Optional table name or index file name. If cFileName
contains a table name or index file name, it must include
a fully qualified path to that file, i.e. it must contain
a drive letter and path or must contain a UNC path which
includes the server name and volume/share.
Returns
Returns a two dimensional array of information about users currently
connected to the Advantage Database Server. The length of the first
dimension of the array will be equal to the number of users who either
have the specified table open, who have the specified index open, or
who are connected. The second dimension of the array has two elements
containing:
[n][1] = (string) Name of the connected user
[n][2] = (numeric) NetWare connection number.
- or -
Returns an empty array if an error occurred or if no users are
currently connected to the Advantage Database Server. If an error
occurred, AX_Error() will return information on why the function
failed.
Description
AX_UserNames() returns a two dimensional array of information about
users who either have the specified table open, who have the specified
index open, or who are connected. If cFileName contains a fully
qualified table name, then the returned 2-D array will contain a list of
information about Advantage users that have that table open. If
cFileName contains a fully qualified index name, then the returned 2-D
array will contain a list of information about Advantage users that have
that index open. If cFileName is NULL, then the returned 2-D array will
contain a list of information about all users that are connected to the
Advantage Database Server.
It is possible that the number of elements in the second dimension of
the 2-D array with information about each individual user will increase
in future releases of Advantage. Since it is possible to use a newer
version of the Advantage Database Server with an older version of the
Advantage CA-Clipper Client, any new and additional user information
that may exist if using a newer version of the Advantage Database Server
will not be returned in the second dimension of the returned 2-D array.
Since it is possible that the number of elements in the second dimension
of the 2-D array will increase in future releases of Advantage, it is
highly recommended that the length of the second dimension of the
returned 2-D array be calculated using the Len() function, rather than
hard-coding the expected length to a literal value.
The User Name element (the first element) in the second dimension of the
returned 2-D array is the Advantage client's computer name.
The Connection Number element (the second element) in the second
dimension of the returned 2-D array is the NetWare connection number for
the corresponding user and is only applicable to the Advantage Database
Server for NetWare. This value will be zero if AX_UserNames() is used
with the Advantage Database Server for any other OS.
Note: AX_UserNames() will only return information about users who
are using the Advantage Database Server. Information about any
non-Advantage users that have the specified table or index open, will
not be returned.
Example
// Must first get a connection to the Advantage Database Server
USE x:dummy.dbf VIA "DBFCDXAX"
// Get info about all users that are connected to ADS
aAllUsers := AX_UserNames()
// Get info about all users with table "employee.dbf" open
aUsersWithEmployee := AX_UserNames( "x:\employee.dbf" )
if ( Len( aAllUsers ) == 0 )
? "No users connected"
quit
endif
// Display info about all users connected
? Len( aAllUsers ), "are connected to ADS"
? "Those users are:"
for i := 1 to Len( aAllUsers )
?
for j := 1 to Len( aAllUsers[i] )
?? aAllUsers[i][j]
next
next
// Display just user names of users with "employee.dbf" open
? Len( aUsersWithEmployee ), "users have employee.dbf open"
? "Those users are:"
for i := 1 to Len( aUsersWithEmployee )
? aUsersWithEmployee[i][1]
next
See Also: AX_OpenTables() AX_OpenIndexes()
Online resources provided by: http://www.ClipX.Net --- NG 2 HTML conversion by Dave Pearson