# __dbCopyStruct()

Create a new database based on current database structure

Syntax

  __dbCopyStruct( <cFileName>, [<aFieldList>] ) --> NIL

Arguments

  <cFileName> is the name of the new database file to create. (.dbf) is the default extension if none is given.
  <aFieldList> is an array where each element is a field name. Names could be specified as uppercase or lowercase.

Returns

  __dbCopyStruct() always return NIL.

Description

  __dbCopyStruct() create a new empty database file with a structure that is based on the currently open database in this work-area. If <aFieldList> is empty, the newly created file would have the same structure as the currently open database. Else, the new file would contain only fields that exactly match <aFieldList>.
  __dbCopyStruct() can be use to create a sub-set of the currently open database, based on a given field list.
  COPY STRUCTURE command is preprocessed into __dbCopyStruct() function during compile time.

Examples

         // Create a new file that contain the same structure
          USE TEST
          __dbCopyStruct( "MyCopy.DBF" )

          // Create a new file that contain part of the original structure
          LOCAL aList
          USE TEST
          aList := { "NAME" }
          __dbCopyStruct( "OnlyName.DBF", aList )

Status

  Ready

Compliance

  __dbCopyStruct() works exactly like CA-Clipper's __dbCopyStruct()

Platforms

  All

Files

  Library is rdd

See Also

- COPY STRUCTURE
- COPY STRUCTURE EXTENDED
- DBCREATE()
- DBSTRUCT()
- __dbCopyXStruct()
- __dbCreate()
- __dbStructFilter()