DBMS ConteXt:Data Types



#

Data Type

Description

1

STRING

Character string, has a fixed size up to 64 Kbytes.
2

DATE

This field is used to store the date. It takes 3 bytes and actually contains the number of days from January 1, Year 0000.
3

TIME

This field contains time. It takes 3 or 4 bytes and contains number of seconds from the start of the day (midnight) or number seconds from 1 Jan 1970.
4

POINTER

This field is a pointer to a record in another Class. Physically it contains the sub-Class record number. Size can be from 1 to 4 bytes. Having pointers makes ConteXt somewhat different than traditional DBMS systems. Connection between tables in relational databases is done through the common indexing of two tables with common keys. In this case, the keys must be present in both tables, which means size overhead. To perform search for related records in two tables both indexes are needed. In ConteXt there is no need to search. The number of a record in a sub Class is contained in the field of the main Class. (Terms "main Class" and "sub-Class" in the future will only be used for clarity, but in reality all Classs in ConteXt are equal.) Since there are no keys, the performance is much better In this case it is important to understand that fields are not linked together, only records. The field simply points to a record.
5

VARIANT

It is an even more exotic field type. The standard POINTER field can only link two Classs. The value of a POINTER field is the sub-Class record number. The name of this sub Class is contained in the header of the main Class. At times there is a need to have the POINTER to several different Class. EXAMPLE: There is a "CHECK" Class with "PAY_TO" field. A check made out for supplies will have the pointer point to "SUPPLIES", whereas a payment for employee salaries will use the pointer to "STAFF" Class, etc. VARIANT consists of two ponters, the first points to a name of the sub Class the second to a record in this Class.
6,7

INTEGER, UNSIGNED

These types of fields are designed to store integer. Size may vary from 1 to 8 bytes. 8 bytes holds a very large number. It is often necessary to enter a number with decimal points (dollars and cents). A choice in selecting how precise you wish the number to be is available to you. Example: You many have an integer field that contains 7 bytes long with 2 numbers after the decimal point.
8,9

FLOAT, DOUBLE

Four and eight bit numbers with floating point. Size is fixed, but you can pick how precise you want them to be. Output will be limited to the number of digits you pick.
10

STRUCTUE

It is a static composite field. Actually this isn't a field. It is a package of fields or structure. This field consist of subfields that holds others ConteXt fields or objects. A subfields maybe STRUCTURE too etc. In other words this type of field can create a hierarchy of data inside a record. This opens up a lot of new opportunities in database design and makes some applications much easier to develop
11,12

TEXT, BINARY

(BLOB - Binary Large Object) These are regular fields with a varying size. You can store unlimited size (limited by disk space) text or binary information .
13

IMAGE

This is a BINARY field clone. Contains GIF or JPEG image.
14

FILE

This field is similar to TEXT, but contains the name of the file in a file system. Essentially this is a pointer to a file. It is often a better idea to have a pointer to the file instead of copying the file contents into the file.
15

EXPRESSION

This is another TEXT field clone but contains a program on a certain language. When the output of a true field value is calculated.
16

COMPLEX

This is a dynamic composite field. The idea is similar to VARIANT but in relation to structures. Field STRUCTURE can contain sub fields, but their number and type is specified during the databse creation, and are therefore constant. What if it is necessary to change the structure of a field depending on the information? That's where COMPLEX type of fields comes in. Basically, it is a combination of a pointer to a sub Class containing the stuctures and a binary field containing the information.
17-255

OBJECT(s)

User defined types.
-

VIRTUAL

The last field type is VIRTUAL field. In essence, this field is really not a field since it is not stored in the Class. For ConteXt, it is regarded as a normal field. The values of such fields are calculated by a special program which is written by the programmer. If ConteXt contains a request to a field which does not exist in the Class, it executes this program (or process if you wish) to get the information. If the process is aware of such a field, it will respond, ConteXt will then display this information, if not, it will remain blank.


This concludes data type list in ConteXt. However it is necessary to note that along with the field type you can set the following field attributes:

ARRAY

This attributes means that the field will be an array. Number of elements in the array is almost unlimited (2 to the power of 31). There's no limit on the type of the main field and you can create array of pointers or array of structures or array of text fields - its up to you.

SET/LIST

There are two versions of arrays. SET it is an array of unique elements. LIST is a sorted array.

DIRECT

This attribute means that the field will be taken out from the main Class and put into a separate file. This is useful when you need to add a field into an already existing Class.

For more information about internal structure of the DBMS ConteXt see: Architecture

DBMS ConteXt: Front Page