TurboDB Engine Documentation

Column Data Types

Previous  Top  Next

TurboDB offers the following types of table columns. This list refers to the data types of the storage engine, their SQL counterparts are described in "TurboSQL Column Types".

String

A string field holds alphanumeric characters up to the given limit. The maximum size is 32765 characters (255 for table level 3 and below). A string field holds one byte for each character plus one or two bytes for the length of the string plus an additional byte, if the string is nullable.

WideString

Up to 16382 Unicode characters (255 for table level 3 and below). The actual field size in bytes is twice the number of characters plus two for the string length plus one, if the string is nullable.

Byte

Numbers from 0 to 255. Byte fields can have an optional null indicator. The size is one or two bytes depending on the null indicator.

SmallInt

Numbers from -32767 to +32768. SmallInt fields can have an optional null indicator. The size is two or three bytes.

Integer

Numbers from -2147483648 to +2147483647. Integer fields can have an optional null indicator. It takes four or five bytes in the database table.

LargeInt

Numbers from 2^63 to +2^63 1 with an optional null indicator. One Int64 field uses eight or nine bytes in the table.

Float

Holds a 8 byte floating number, i.e. from 5.0e-324 to 1.7 x 10e308. Can have an optional null indicator. The size is eight or nine bytes.

Time

Values from 12:00:00.000 am to 11:59:59.999 pm. Precision is either minutes, seconds or milliseconds and must be given when creating a level 4 table and above. In level 3 tables and below, precision is always minutes. Can have an optional null indicator. Depending on precision and null indicator, size is between two and five bytes.

Date

Values from 1/1/0000 to 12/31/9999. Size is four bytes. Internally dates are represented as a packed bit field.

DateTime

Values from 1/1/0000 12:00:00.000 am to 12/31/9999 11:59:59.999 pm. Values take eight bytes internally.

Boolean

Holds a Boolean value: True or False. Can have an optional null indicator. Size is one or two bytes.

Enum

Holds one of a definable set of named values, e.g. mon, tue, wed, thu, fri, sat, sun. The values have to be valid identifiers similar to column names. They can be converted to textual representation using the function Str. Example for a enumeration field gender with values male, female, unknown: When the value female has been assigned Str(gender) returns the string 'female' while gender by itself returns the number 2.
An enumeration value may have up to 20 characters, the maximum number of enumeration values is 15 and the total length of all enumeration values including separators must not exceed 255 characters.

Memo

Long strings of variable length  up to 1 GB. Memos are stored in additional storage objects called the memo file (extension mmo/tdbm).

WideMemo

Unicode string of variable length up to 1 GB. Wide memos are stored in the blob storage object (extension blb/tdbb).

Blob

Images and other binary data of variable length up to 1 GB. Blobs are stored in an additional storage object (extension blb/tdbb).

Link

Pointer to another record in the same or another table (1:n relation). The target table is fixed for all link values of this column. Links are explained in "Automatic Linking". A link field contains the record id of the record the field is linked to. Its size is four bytes.

Relation

Pointer list to other records in the same or another table (m:n relation). The target table is fixed for all link values of this column. Relations are explained in "Automatic Linking". Relations fields are not physical columns in the database table itself. There is an additional database table created transparently for each relation field that holds one link per row. The relation table has two link columns, one of which points to the database table that has the relation field and the other one points to the database table the relation field links to. Such the relation field itself has a size of zero bytes.
Feature is not supported in TurboDB Managed

AutoInc

Counter that gives a unique number to each record. AutoInc fields are assigned its values by the database engine and can not be edited. The Automatic Data Link mechanism uses AutoInc fields as the primary index to store record references. An AutoInc column has an optional indication property, which can be set to a list of column names. This property is used for Automatic Linking and can be left empty to make the AutoInc column behave just like a "normal" one.

GUID

128 bit number used by MS COM and ActiveX technologies. GUID stands for Globally Unique Identifier. GUIDs are usually calculated by a OS function which assures that no other call anywhere on earth will produce the same value.

 

Hint

Using data types AutoInc, Link and Relation will automatically generate one ore more indexes. Depending on the table level these (system) indexes are named as the table or start with prefix 'sys_'. Modifying or deleting of these indexes is not possible.

 

See also

TurboSQL Column Types