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 - autouse http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 AUTOUSE
 Open an existing table and its associated files
------------------------------------------------------------------------------

 Syntax

     AUTOUSE <cDatabase> VIA <cAdvantage RDD>
           ALTERNATE <cOtherRDD>
           [INDEX <cIndexList>]
           [ALIAS <cAlias>] [EXCLUSIVE | SHARED]
           [NEW] [READONLY]

     <cDatabase> is the name of the table to open and may be
     specified as a literal filename or as a character expression enclosed
     in parentheses.

     <cAdvantage RDD> is a character expression that specifies the
     Advantage RDD to use within current work area.  If <cAdvantage RDD>
     is specified as a literal value, it must be in all capital letters
     and enclosed in quotes.

     <cOtherRDD> is a character expression that specifies an alternate
     RDD to use if the Advantage Database Server is not loaded on the
     network drive where the <cDatabase> is located.  If <cOtherRDD> is
     specified as a literal value, it must be in all capital letters and
     enclosed in quotes.

     INDEX <cIndexList> specifies the name of 1-15 index files to open
     in the current work area.  Specify each index as a literal filename or
     as a character expression enclosed in parentheses.  The first index
     in the list becomes the controlling index.  If you specify an <cIndex>
     as an expression and the value returned is spaces or NIL, it is
     ignored.

     ALIAS <cAlias> is the name to associate with the work area when the
     table is opened.  You may specify the alias name as a literal
     name or as a character expression enclosed in parentheses.  A valid
     <cAlias> may be any legal identifier (i.e., it must begin with an
     alphabetic character and may contain numeric or alphabetic characters
     and the underscore).

     EXCLUSIVE opens the table for non-shared use in a network
     environment.  All other users are denied access until the table
     is closed.

     SHARED opens the table for shared use in a network
     environment.  Specifying this clause overrides the current SET
     EXCLUSIVE setting.

     NEW opens <cDatabase> in the next available work area and makes it
     the current work area.  If this clause is not specified, the table
     is opened in the current work area.

     READONLY opens the table with a read-only attribute.  This
     lets you open tables marked read-only.  If you cannot open the
     <cDatabase> in READONLY mode, a runtime error is generated.  If this
     clause is not specified, <cDatabase> is opened read-write.

 Description

     AUTOUSE is similar to the CA-Clipper USE command in that it opens an
     existing table, its associated memo file, and the optionally associated
     index file(s) in the current or next available work area.  For specific
     definition of the USE command, see your CA-Clipper manual.

     AUTOUSE introduces the use of VIA and ALTERNATE clauses, allowing you
     to specify replaceable database drivers (RDDs) as the preferred and
     alternate RDDs for the work area. The VIA clause must specify an
     Advantage RDD to use for this work area. If the Advantage
     Database Server is not loaded on the network drive specified by the
     table, then the alternate RDD is used for this work area.
     The alternate RDD can be CA-Clipper's DBFNTX or any non-Advantage RDD.
     To verify which RDD is being used, you may use the AX_RDDName()
     function.

     Note: This command may take up to two seconds to default to the
     alternate RDD if the specified file exists on a server that does not
     have the Advantage Database Server started/loaded. Thus, for best
     performance, it is recommended this command not be used.  Instead,
     call AX_Loaded() once near the beginning of the application and store
     the result into a global variable. Use the result stored in that
     global data in later "USE" operations to determine whether to open
     a table with an Advantage RDD or a local RDD.

 Example

     #include "DBFNTXAX.CH"

     // Open the table with the Advantage NTX RDD.
     // If the server is not loaded, use the Clipper NTX RDD.
     AUTOUSE test.dbf VIA "DBFNTXAX" ALTERNATE "DBFNTX" ;
        SHARED INDEX name, state

     // Check if Advantage RDD is loaded
     ? AX_Driver()   // Returns .T. if test.dbf was opened via the DBFNTXAX


See Also: USE AX_Loaded()

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