Product Documentation

c-treeDB API for C++ - Developers Guide

Previous Topic

Next Topic

Working with Tables

A database may contain multiple tables, and a table may belong to multiple databases. Tables created using the c-treeDB interface are kept as files with the extension .dat. Indexes are stored in separate files with the extension .idx. The general process to create and use a c-treeDB table and its associated indexes is as follows:

  • Create a table object
  • Add or insert fields
  • Add indexes
  • Add index segments
  • Create the table
  • Open the table
  • Operate on records

Before you can work with an existing table, the table must be opened as follows:

  • Create a table object
  • Open the table
  • Operate on records

With c-treeDB, it is possible to modify an existing table. The general process to modify a table after it has been created is as follows:

  • Open a table
  • Make changes to:
    • Fields and/or
    • Indexes and/or
    • Segments
  • Call the alter table method CTTable::Alter().

More details on this process are described in "Altering a table".

In general, the table creation is done once in the application, the table is opened, and the data is added in a separate routine. During table creation, besides the table layer itself, three c-treeDB layers will be directly involved: the fields, indexes and segments. These layers 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 layers are not relevant, but the record layer is crucial.

With this in mind, this section on Tables discusses these layers in the appropriate order:

  • Table creation using fields, indexes, and segments.
  • Table parameters and properties.
  • Opening and manipulating tables.

In This Section

Creating a Table object

Creating a New Table

Opening a table

Altering a table

Attach and Detach Open Tables

Table Properties

TOCIndex