Field Elements¶
The <Fields> element is a container for one or more <Field> elements.
Each <Field> defines a column within the Btrieve record’s fixed-length
portion.
In the DDF variant (Btrieve2SqlMigration), you do not need to list
every field — only the ones whose settings you want to override. Fields not
listed use the definitions from the DDFs.
In the Full variant (Btrieve2SqlFullMigration), every field must be
defined with at least Name, BtrDataType, and Size.
Fields Element¶
The <Fields> element has no attributes of its own. It serves as a container
for <Field> child elements.
<Fields>
<Field Name="ID" BtrDataType="15" Offset="0" Size="4" />
<Field Name="Name" BtrDataType="0" Offset="4" Size="50" />
</Fields>
Field Attributes¶
Core Attributes¶
These attributes define the fundamental properties of the field.
Attribute |
Required |
Default |
Description |
|---|---|---|---|
|
Yes |
(none) |
Name of the field. In the DDF variant, this must match the field name as defined in Pervasive/Btrieve. In the Full variant, this becomes the SQL column name and should be a valid SQL identifier. |
|
Full only |
(from DDF) |
Btrieve data type number. Determines how the raw bytes in the record buffer are interpreted. See Btrieve Data Types below for common values. |
|
No |
(calculated) |
Byte offset of the field within the record buffer (0-based). If omitted in the Full variant, the offset is calculated by summing the sizes of all preceding fields. |
|
Full only |
(from DDF) |
Size of the field in bytes. |
|
No |
|
Number of decimal places for floating-point or numeric data types. |
Display and Behavior Attributes¶
Attribute |
Required |
Default |
Description |
|---|---|---|---|
|
No |
|
Whether the SQL column allows NULL values (legacy null handling). When
|
|
No |
|
For string-type fields, indicates the data is binary rather than text.
When |
|
No |
|
For string fields, whether comparisons and sorting are case-sensitive. Full variant only. |
|
No |
|
Whether the field can be modified in an UPDATE operation. Full variant only. |
|
No |
|
If Note This attribute is supported by the code but is not yet listed in the DTD files. |
SQL Mapping Attributes¶
Attribute |
Required |
Default |
Description |
|---|---|---|---|
|
No |
(auto-mapped) |
Overrides the automatic Btrieve-to-SQL data type mapping. In the DDF variant, this is the SQL type number. In the Full variant, this is also a numeric SQL type code. The driver validates that the specified SQL type is compatible with the Btrieve data type and field size. |
|
No |
(none) |
Default value for the SQL column. When a Btrieve record contains a “null” value (as defined by legacy null handling), this default is used instead. Set to an empty string to remove a default. Ignored if the field is nullable. |
|
No |
(from Table or driver) |
SQL collation name for this specific field. Overrides the table-level
|
Specialized Attributes (Full Variant)¶
These attributes are primarily used in the Full Migration variant.
Attribute |
Required |
Default |
Description |
|---|---|---|---|
|
No |
|
Number of times to repeat this field definition. Creates an array of
identically-typed fields named |
|
No |
(none) |
Date picture mask applied to the field value, defining how date values
are formatted in the Btrieve data. Examples: |
|
No |
(none) |
COBOL Picture clause and COMP usage assigned to the field. Used for fields originating from COBOL applications. |
Btrieve Data Types¶
The BtrDataType attribute uses numeric codes from the Btrieve specification.
The following table lists the most common values:
Code |
Type Name |
Description |
|---|---|---|
0 |
String |
Fixed-length character string, padded with spaces. |
1 |
Integer |
Signed integer (1, 2, 4, or 8 bytes). |
2 |
Float |
IEEE floating-point number (4 or 8 bytes). |
3 |
Date |
Btrieve date (4 bytes). |
4 |
Time |
Btrieve time (4 bytes). |
5 |
Decimal |
Packed decimal number. |
6 |
Money |
Currency value. |
7 |
Logical |
Boolean value (1 or 2 bytes). |
8 |
Numeric |
Numeric string (ASCII digits). |
9 |
BFloat |
Btrieve floating-point. |
10 |
LString |
Length-prefixed string (first byte is length). |
11 |
ZString |
Null-terminated string. |
12 |
Note / Blob |
Variable-length binary or text data. |
14 |
Unsigned Binary |
Unsigned integer (1, 2, 4, or 8 bytes). |
15 |
Auto-Increment |
Auto-incrementing unsigned integer (typically 4 bytes). |
17 |
Timestamp |
Btrieve timestamp (8 bytes). |
20 |
WString |
Fixed-length wide (Unicode) character string. |
21 |
WZString |
Null-terminated wide (Unicode) string. |
25 |
DateTime |
Combined date and time value. |
26 |
GUID |
16-byte globally unique identifier. |
Note
The driver maps each Btrieve data type to an appropriate SQL column type
automatically. Use SqlDataType only when you need to override the
default mapping.