Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Advantage CA-Clipper Guide v6.11 - ax_opentables() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 AX_OpenTables()
 Returns info about tables that are currently opened on the Advantage server
------------------------------------------------------------------------------

Syntax

     AX_OpenTables( [<cUserName> | <nConnNumber> ] ) -> array

     <cUserName>   Optional user name.  The user name of an Advantage
                   client is the client computer name.

     <nConnNumber> Optional NetWare connection number.  Only applicable
                   if running against the Advantage Database Server for
                   NetWare.

Returns
     Returns a two dimensional array of information about tables that are
     currently opened on the Advantage Database Server. The length of the
     first dimension in the returned 2-D array will be equal to the number of
     tables the specified user has open or all tables that are open.  The
     second dimension of the returned 2-D array has two elements containing:

     [n][1] = (string) Name of table that is open
     [n][2] = (numeric) Advantage locking mode:
                           ADS_MGMT_PROPRIETARY_LOCKING (1),
                           ADS_MGMT_CDX_LOCKING (2), or
                           ADS_MGMT_NTX_LOCKING (3)

     - or -

     Returns an empty array if an error occurred or no tables are currently
     open on the Advantage Database Server. If an error occurred, AX_Error()
     will return information on why the function failed.


Description

     AX_OpenTables() returns a two dimensional array of information about
     tables the specified user has open or all tables that are open
     (depending upon the cUserName/nConnNumber parameter).  If cUserName
     contains an Advantage client's user name or if nConnNumber is non-zero,
     then the returned 2-D array will contain a list of information about
     tables opened by that Advantage user.  If cUserName and nConnNumber are
     not specified or are NIL, then the returned 2-D array will contain a
     list of information about all tables that are opened on the Advantage
     Database Server.

     It is possible that the number of elements in the second dimension of
     the returned 2-D array with information about each individual table 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 table
     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 returned 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 Table Name element (the first element) in the second dimension of
     the returned 2-D array includes a fully qualified path.  If running
     against the Advantage Database Server for NetWare, the table name
     element will contain the server volume name, the full path, and the
     table name.  If running against the Advantage Database Server for
     Windows NT/2000, the table name element will contain the NT drive
     letter, the full path, and the table name.

     The Lock Type element (the second element) in the second dimension of
     the returned 2-D array is the Advantage locking mode in which the table
     is opened.  If the table is using Advantage's proprietary locking mode,
     ADS_MGMT_PROPRIETARY_LOCKING (1) will be returned.  If the table is
     using Advantage's compatible locking mode, and the table was opened with
     the CDX index type, then ADS_MGMT_CDX_LOCKING (2) will be returned. If
     the table is using Advantage's compatible locking mode, and the table
     was opened with the NTX index type, then ADS_MGMT_NTX_LOCKING (3) will
     be returned.

     Note: AX_OpenTables() will only return information about tables open
     on the Advantage Database Server.  Information about any tables opened by
     non-Advantage users 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 tables that are open on ADS
     aAllTables := AX_OpenTables()

     // Get info about all tables open by user "Fred"
     aTablesByFred := AX_OpenTables( "Fred" )

     if ( Len( aAllTables ) == 0 )
        ? "No tables open"
        quit
     endif

     // Display info about all open tables
     ? Len( aAllTables ), "tables are open"
     ? "Those tables (and locking mode) are:"
     for i := 1 to Len( aAllTables )
        ?
        for j := 1 to Len( aAllTables[i] )
           ?? aAllTables[i][j]
        next
     next

     // Display just the table names opened by user "Fred"
     ? Len( aTablesByFred ), "tables are opened by Fred"
     ? "Those table names are:"
     for i := 1 to Len( aTablesByFred )
        ? aTablesByFred[i][1]
     next


See Also: AX_UserNames() AX_OpenIndexes()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson