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 - append from http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 APPEND FROM
 Imports records from another table located on the same server
------------------------------------------------------------------------------

 Syntax

     APPEND FROM <cTableName>
        [VIA <cDriver>]

     FROM <cTableName> specifies the name of the source table.  You can
     specify <cTableName> either as a literal filename or as a character
     expression enclosed in parentheses.  If a file extension is not
     specified, (.dbf) is the default input file type.

     VIA <cDriver> specifies the replaceable database driver (RDD) to
     use to import the desired data.  If specified, <cDriver> must be an
     Advantage RDD in order for the Append From operation to occur on the
     server.  If the VIA clause is omitted, APPEND FROM uses the driver in
     the current work area.

 Description

     The APPEND FROM command pre-compiles into a call to the AX_AppendFrom()
     function.  AX_AppendFrom() appends all records from the specified
     table (i.e. the source table) to the current table (i.e. the destination
     table).  The Append From operation will be attempted to be performed
     entirely on the server by the Advantage Database Server.  Thus, an
     Advantage APPEND FROM command may be up to 1000 times faster than a
     standard CA-Clipper APPEND FROM command.  If the Append From operation
     cannot be performed on the server, it will be automatically performed
     on the client.

     In order for the Append From operation to be successfully performed on
     the server, the following must be true:
      . The source and destination tables must be located on the same file
        server where the Advantage Database Server is running.  If the
        tables are on different servers, or some other error occurs
        attempting the Append From on the server, the Append From operation
        will be automatically performed on the client.
      . No indexes can be open in the current (destination) work area.  If
        indexes are open, the Append From operation will be automatically
        performed on the client.  If indexes exist in the destination work
        area, close them, perform the APPEND FROM command, re-open the
        indexes, and re-build the indexes.
      . The source and destination tables must not contain any weakly-typed
        VariFields (a.k.a. VarChar fields).  If the tables contain
        weakly-typed VariFields, the Append From operation will be
        automatically performed on the client.

     Only fields with the same names and data types are appended.  Fields
     with the same name from both the destination table and the source table
     must be the same data type.  If they are not, a runtime error will
     occur.  If a field in the destination table is of data type character
     and has a field length greater than the incoming source table field of
     the same name and data type, the field data from the source table will
     be padded with blanks.  If a field in the destination table is of data
     type character and its field length is less than the incoming source
     table field of the same name and data type, the source filed data is
     truncated to fit.  If a field with the same name in both the source and
     destination tables is of a numeric data type and the fields widths or
     number of decimals is different, a runtime error occurs.

     When you call APPEND FROM, Advantage attempts to open the specified
     source table shared and read-only.  If access is denied, APPEND FROM
     terminates with a runtime error.  No error is raised if the source
     table is already open in a shared mode.  The specified source table
     will be automatically closed when the Append From operation is complete.

     APPEND FROM does not require that the destination table be used
     exclusively or locked with FLock() to perform the append operation.
     As each record is added, Advantage automatically arbitrates contention
     for the new record.

     If SET DELETED is OFF, deleted records in the specified source table
     are appended to the destination table and retain their deleted status.
     If SET DELETED is ON, however, none of the deleted records in the source
     table records are appended.

     Note:  APPEND FROM is illegal if performed within a transaction.
     If APPEND FROM is called while within a transaction, a runtime error
     will occur.

 Example

     // An Advantage header file must be included in your source code to use
     //   Advantage's APPEND FROM command.
     #include "DBFCDXAX.CH"

     // Open the customers table for the New York branch
     USE x:\data\Cust_NY.dbf VIA "DBFCDXAX"

     // Append the customer table info from the Boston branch to the customer
     //   table in the New York branch.
     APPEND FROM x:\data\Cust_Bos.dbf


See Also: AX_AppendFrom() COPY TO AX_CopyTo()

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