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

 Syntax

     AX_AppendFrom( <cTableName>, [<cDriver>] ) -> logical

     <cTableName>  The name of the source table to import records from.

     <cDriver>     Optional RDD name.  If specified, must be an Advantage
     RDD in order for the Append From operation to occur on the server.

 Returns

     Returns a logical .T. if the Append From operation was successfully
     performed on the server.  Returns .F. if an error occurred and the
     Append From operation had to be performed on the client.  If .F. is
     returned,  AX_Error() will return information on why the Append From
     operation could not be performed on the server.

 Description

     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, AX_AppendFrom() 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 AX_AppendFrom() function, 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 AX_AppendFrom(), Advantage attempts to open the specified
     source table shared and read-only.  If access is denied, AX_AppendFrom()
     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.

     AX_AppendFrom() 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: AX_AppendFrom() is illegal if performed within a transaction.
     If AX_AppendFrom() is called while within a transaction, a runtime
     error will occur.

 Examples

     // 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.
     AX_AppendFrom( "x:\data\Cust_Bos.dbf" )


See Also: AX_CopyTo() APPEND FROM COPY TO

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