Copy the field definitions in a database file structure to a structure-extended file as data.
XSharp.RT (in XSharp.RT.dll) Version: 2.16
Syntax Request Example
cTargetFile AS STRING
) AS LOGIC
public static bool DbCopyXStruct(
- Type: String
The name of the target structure-extended database file, including an optional drive, directory, and extension. See SetDefault() and SetPath() for file searching and creation rules.
The default extension for database files is determined by the RDD .
If cTargetFile does not exist, it is created.
If it exists, this function attempts to open the file in exclusive mode and, if successful, the file is overwritten without warning or error.
If access is denied because, for example, another process is using the file, NetErr() is set to TRUE.
DBCreate() creates the specified file in ANSI or OEM character set format, based on the SetAnsi() setting. (For more information, refer to the SetAnsi() function.)
TRUE if successful; otherwise, FALSE.
DBCopyXStruct() creates a database file whose contents is the structure of the current database file, with a record for the definition of each field.
By default, this function operates on the currently selected work area.
It can be made to operate on an unselected work area by specifying
it within an aliased expression
The structure-extended database file has the following structure:
Name Type Length Decimals
Field_Name Character 10
Field_Type Character 1
Field_Len Numeric 3 0
Field_Dec Numeric 3 0
Used in application programs, DBCopyXStruct() permits you to create or modify the structure of a database file programmatically.
To create a new database file from the structure-extended file, use CREATE FROM.
If you need an empty structure-extended file, use CREATE.
DBCopyXStruct() is the functional implementation of the COPY STRUCTURE EXTENDED command.
Character field lengths greater than 255: Field lengths greater than 255 are represented as a combination of the Field_Dec and Field_Len fields.|
After performing DBCopyXStruct(), you can use the following formula to determine the length of any character field:
1nFieldLen := If((Field_Type = "C" .AND. ;
2 Field_Dec != 0), Field_Dec * 256 + ;
3 Field_Len, Field_Len)
The following example creates a new structure-extended file: