Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Harbour Version 0.37 (c) reference Guid - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

COPY STRUCTURE EXTENDED

Copy current database structure into a definition file
---------------------------------------------------------------------------------

 Syntax

        COPY STRUCTURE EXTENDED TO <xcFileName>  

 Arguments

         TO   <xcFileName>   The name of the target definition file 
                  to create. (.dbf) is the default extension if none is
                  given. It can be  specified as a literal file name or as
                  a character expression  enclosed in parentheses.

 Description

      COPY STRUCTURE EXTENDED create a new database named <cFileName> with
      a pre-defined structure (also called "structure extended file"):

      +---------------------------------------+
      | Field name | Type | Length | Decimals |
      |------------+------+--------+----------|
      | FIELD_NAME | C    | 10     | 0        |
      | FIELD_TYPE | C    | 1      | 0        |
      | FIELD_LEN  | N    | 3      | 0        |
      | FIELD_DEC  | N    | 3      | 0        |
      +---------------------------------------+

      Each record in the new file contains information about one field in
      the original file. CREATE FROM could be used to create a database
      from the structure extended file.

      For prehistoric compatibility reasons, Character fields which are
      longer than 255 characters are treated in a special way by writing
      part of the length in the FIELD_DEC according to the following
      formula (this is done internally):

      
      FIELD->FIELD_DEC := int( nLength / 256 )
      FIELD->FIELD_LEN := ( nLength % 256 )
      

      Later if you want to calculate the length of a field you can use  the
      following formula:

      
      nLength := IIF( FIELD->FIELD_TYPE == "C", ;
                      FIELD->FIELD_DEC * 256 + FIELD->FIELD_LEN, ;
                      FIELD->FIELD_LEN )
      

      COPY STRUCTURE EXTENDED command is preprocessed into
      __dbCopyXStruct() function during compile time.

 Examples

      // Open a database, then copy its structure to a new file,
      // Open the new file and list all its records
      USE Test
      COPY STRUCTURE EXTENDED TO TestStru
      USE TestStru
      LIST

Status

      Ready

 Compliance

      COPY STRUCTURE EXTENDED works exactly as in CA-Clipper

 Platforms

      All



See Also: COPY STRUCTURE CREATE CREATE FROM DBCREATE() DBSTRUCT()

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