A database may contain multiple tables, and a table may belong to multiple databases. A table can contain zero or more records (rows). Each record is made up of one or more fields. A record is essentially an entry row in a table.
A table can have zero or more indexes associated with it, which enhance the retrieval of records from that table and allow the table to be sorted in various ways. Indexes typically have one or more segments, which describe the index key structure and how the index works.
Tables created using the c-treeDB API interface are kept as files with the extension .dat.
Indices are stored in separate files with the extension .idx.
Indexes are stored in separate files with the extension .idx.
Tables, records, fields, and indexes are all manipulated programmatically with handles. The general process to create and use a new c-treeDB API table and its associated indexes is as follows:
Before you can work with an existing table, the table must be opened as follows:
With c-treeDB API, it is possible to modify an existing table. The general process to modify a table after it has been created is as follows:
More details on this process are described in Altering a table.
In general, the table creation is done once in the application, in a Create() function. Then the table is opened and the data is added (records inserted into the table) in a separate routine.
During table creation, besides the table layer itself, three c-treeDB API APIs will be directly involved: the fields, indexes and segments. These APIs are only directly involved when the table is being created, or in the event the table structure is modified. When records are being added to or searched in the table, these APIs are not relevant, but the record layer is crucial.
With this in mind, this section on Tables discusses these layers in the appropriate order: