[<<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 \CLIP53\INCLUDE contains a
     series of manifest constants for each field attribute.

 Examples

     .  This example opens two database files and 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
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson