Create an array containing the structure of a database file

     DBSTRUCT() --> aStruct


     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 ({}).


     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.


     .  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.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.