Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

Field Types

c-treeDB API, c-treeDB API .NET, and c-treeDB API VCL support all original FairCom DB field types and includes redefinition for new field types. For compatibility reasons, the original c-tree Plus field types can be used, but FairCom suggests using the new field types.

Note that these do not represent new field types, however, substitute a new name of existing FairCom DB field types. The new naming convention is used within the FairCom DB SQL product line, and offers a better description of the fields.

There is absolutely no difference in using any of the definitions, however, for future compatibility and better program reading, the new field types offer an improved path.

c-treeDB API
Field Type

FairCom DB
Field Type

Equivalent
Data Type

Implementation

CT_BOOL

CT_BOOL

CTBOOL

One-byte Boolean

CT_TINYINT

CT_CHAR

CTSIGNED

Signed one-byte integer.

CT_UTINYINT

CT_CHARU

CTUNSIGNED

Unsigned one-byte integer.

CT_SMALLINT

CT_INT2

CTSIGNED

Signed two-byte integer.

CT_USMALLINT

CT_INT2U

CTUNSIGNED

Unsigned two-byte integer.

CT_INTEGER

CT_INT4

CTSIGNED

Signed four-byte integer.

CT_UINTEGER

CT_INT4U

CTUNSIGNED

Unsigned four-byte integer.

CT_MONEY

CT_MONEY

CTMONEY

Signed four-byte integer interpreted as number of pennies (two fixed decimal places) up to a precision of 9.

CT_DATE

CT_DATE

CTDATE

Unsigned four-byte integer interpreted as date. No time information.

CT_TIME

CT_TIME

CTTIME

Unsigned four-byte integer interpreted as time with whole second precision. No date information.

This data type does not support millisecond precision. CTTIMEMS functions are recommended for millisecond precision.

CT_TIME_MS

CT_TIME_MS

CTTIMEMS

Similar to CTTIME but with millisecond precision.

CT_FLOAT

CT_SFLOAT

CTFLOAT

Four-byte floating point.

CT_DOUBLE

CT_DFLOAT

CTFLOAT

Eight-byte floating point.

CT_TIMESTAMP

CT_TIMES

CTDATETIME

Time stamp including date and time with millisecond precision.

This data type support millisecond precision.

CT_EFLOAT

CT_EFLOAT

CTFLOAT

Extended precision floating point (not supported as a key segment).

CT_BINARY

CT_F2STRING
(CT_ARRAY*)

pTEXT, pUTEXT

Arbitrary fixed-length data. Fixed-length binary data. 64-kilobytes maximum length.

CT_CHARS

CT_FSTRING

pTEXT

Fixed-length delimited data. Fixed-length string data. 64-kilobytes maximum length.

CT_FPSTRING

CT_FPSTRING

pTEXT

Fixed-length data with 1-byte length count. 255-bytes maximum length.

CT_F2STRING

CT_F2STRING

pTEXT

Fixed-length data with 2-byte length count.

CT_F4STRING

CT_F4STRING

pTEXT

Fixed-length data with 4-byte length count.

CT_BIGINT

CT_BIGINT

CTBIGINT

Eight-byte signed integer.

CT_NUMBER

CT_NUMBER

CTNUMBER

Scaled BCD number.

CT_CURRENCY

CT_CURRENCY

CTCURRENCY

Eight-byte signed integer interpreted as currency value with four fixed decimal digits.

CT_PSTRING

CT_PSTRING

pTEXT

Varying length field data with 1-byte length count.

CT_VARBINARY

CT_2STRING

pTEXT

Varying length field data with 2-byte length count. Variable length binary data of up to 65535 bytes.

CT_LVB

CT_4STRING

pTEXT

Varying length field data with 4-byte length count. Variable length binary data of up to 4294967295 bytes.

CT_VARCHAR or CT_LVC

CT_STRING

pTEXT

Varying length field delimited data. Variable length string data.

CT_UBIGINT

CT_INT8U

CTUBIGNINT

8-byte unsigned integer.

CT_NCHAR

CT_F2UNICODE

 

Fixed-length UNICODE char data.

CT_NVARCHAR

CT_2UNICODE

 

Variable-length UNICODE char data.

*CT_BINARY field type was changed in FairCom DB V9 to CT_F2STRING.

c-treeDB API .NET FIELD_TYPE Enum

All the c-treeDB API .NET field types are defined using the FIELD_TYPE enum:

c-treeDB API .NET Field Type

BOOL

TINYINT

UTINYINT

SMALLINT

USMALLINT

INTEGER

UINTEGER

MONEY

DATE

TIME

FLOAT

DOUBLE

TIMESTAMP

EFLOAT

BINARY

CHARS

FPSTRING

F2STRING

F4STRING

BIGINT

NUMBER

CURRENCY

PSTRING

VARBINARY

LVB

VARCHAR/LVC

Previous Topic

Next Topic

Find Modes

Use the following find modes with the record find methods:

c-treeDB API
Find mode

c-treeDB API .NET
Find Mode

Explanation

CTFIND_EQ

EQ

Find a record equal to the target

CTFIND_LT

LT

Find a record less than target

CTFIND_LE

LE

Find a record less or equal than target

CTFIND_GT

GT

Find a record greater than target

CTFIND_GE

GE

Find a record greater or equal than target

Note: The Find Mode CTFIND_EQ requires that the target contains values for all segments that compose the index and the index cannot allow duplicates.

Note: c-treeDB API .NET defines this mode with the FIND_MODE enum.

TOCIndex