Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper 5.2 . The Guide To CA-Clippe - <b>dbstruct()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 DBSTRUCT()
 Create an array containing the structure of a database file
------------------------------------------------------------------------------
 Syntax

     DBSTRUCT() --> aStruct

 Returns

     DBSTRUCT() returns the structure of the current database file in an
     array whose length is equal to the number of fields in the database
     file.  Each element of the array is a subarray containing information
     for one field.  The subarrays have the following format:

     DBSTRUCT() Return Array
     ------------------------------------------------------------------------
     Position     Metasymbol     Dbstruct.ch
     ------------------------------------------------------------------------
     1            cName          DBS_NAME
     2            cType          DBS_TYPE
     3            nLength        DBS_LEN
     4            nDecimals      DBS_DEC
     ------------------------------------------------------------------------

     If there is no database file in USE in the current work area, DBSTRUCT()
     returns an empty array ({}).

 Description

     DBSTRUCT() is a database function that operates like COPY STRUCTURE
     EXTENDED by creating an array of structure information rather than a
     database file of structure information.  There is another function,
     DBCREATE(), that can create a database file from the structure array.

     By default, DBSTRUCT() operates on the currently selected work area.  It
     will operate on an unselected work area if you specify it as part of an
     aliased expression as shown below.

     Note, a header file, Dbstruct.ch, located in \CLIPPER5\INCLUDE contains
     a series of manifest constants for each field attribute.

 Examples

     .  This example opens two database files then creates an array
        containing the database structure using DBSTRUCT() within an aliased
        expression.  The field names are then listed using AEVAL():

        #include "Dbstruct.ch"
        //
        LOCAL aStruct
        USE Customer NEW
        USE Invoices NEW
        //
        aStruct := Customer->(DBSTRUCT())
        AEVAL( aStruct, {|aField| QOUT(aField[DBS_NAME])} )

 Files:  Library is CLIPPER.LIB, header file is Dbstruct.ch.

See Also: AFIELDS()* COPY STRU EXTE

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