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_openindexes() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 AX_OpenIndexes()
 Returns info about indexes currently opened on the Advantage Database Server
------------------------------------------------------------------------------

Syntax

     AX_OpenIndexes( [<cTableName>], [<cUserName> | <nConnNumber>] )
                       -> array

     <cTableName>  Table name.  cTableName 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.

     <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 indexes that are
     currently opened on the Advantage Database Server. The length of the
     first dimension of the returned 2-D array will be equal to the number of
     indexes: 1) the specified user has open for the specified table, 2) the
     specified user has open for all tables, 3) that are open for the
     specified table by any user, or 4) that are open by any user for any
     table. The second dimension of the returned 2-D array has one element
     containing:

     [n][1] = (string) Name of the index file

     - or -

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

Description

     AX_OpenIndexes() returns a two dimensional array of information about
     indexes that: 1) the specified user has open for the specified table,
     2) the specified user has open for all tables, 3) that are open for the
     specified table by any user, or 4) that are open by any user for any
     table.  If cUserName contains an Advantage client's user name or if
     nConnNumber is non-zero, and if cTableName contains a table name, then
     the returned 2-D array will contain a list of information about indexes
     opened by that Advantage user for that table. If cUserName contains an
     Advantage client's user name or if nConnNumber is non-zero, and if
     cTableName is not specified or is NIL, then the returned 2-D array will
     contain a list of information about all indexes opened by that Advantage
     user. If cUserName and nConnNumber are not specified or are NIL, and if
     cTableName contains a table name, then the returned 2-D array will
     contain a list of information about indexes opened for that table by any
     Advantage users.  If cUserName and nConnNumber are not specified or are
     NIL, and cTableName is not specified or is NIL, then the returned 2-D
     array will contain a list of information about all indexes 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 index information 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 index 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 Index 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 index name will
     contain the server volume name, the full path, and the index name.  If
     running against the Advantage Database Server for Windows NT/2000, the
     index name will contain the NT drive letter, the full path, and the index
     name.

     Note: AX_OpenIndexes() will only return information about index
     files open on the Advantage Database Server.  Information about any
     index files 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 index files that are open on ADS
     aAllIndexFiles := AX_OpenIndexes()

     // Get info about all indexes open by user "Fred"
     aIndexFilesByFred := AX_OpenIndexes( , "Fred" )

     // Get info about all indexes open for table "employee.dbf"
     aIndexesForEmployee := AX_OpenIndexes( "x:\employee.dbf" )

     if ( Len( aAllIndexFiles ) == 0 )
        ? "No index files open"
        quit
     endif

     // Display info about all open index files
     ? Len( aAllIndexFiles ), "index files are open"
     ? "Those index files are:"
     for i := 1 to Len( aAllIndexFiles )
        ?
        for j := 1 to Len( aAllIndexFiles[i] )
           ?? aAllIndexFiles[i][j]
        next
     next

     // Display just the index file names opened by user "Fred"
     ? Len( aIndexFilesByFred ), "index files are opened by Fred"
     ? "Those index file names are:"
     for i := 1 to Len( aIndexFilesByFred )
        ? aIndexFilesByFred[i][1]
     next

     // Display info about index files opened on table employee.dbf
     ? Len( aIndexesForEmployee ), "indexes are open for table employee.dbf"
     ? "Those index files are:"
     for i := 1 to Len( aIndexesForEmployee )
        ?
        for j := 1 to Len( aIndexesForEmployee[i] )
           ?? aIndexesForEmployee[i][j]
        next
     next


See Also: AX_UserNames() AX_OpenTables()

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