Before you begin using eXtremeDB, it is important to understand some basic concepts. For database applications using the C API, development consists of three stages on the host environment:
- Data layout definition (creating what is referred to as a database schema) and compilation (which produces database interface files, including the database dictionary; the database dictionary is a binary representation of the database schema that the eXtremeDB runtime uses to understand the data layout, which fields participate in which indexes, etc.).
- Using the eXtremeDB static and schema-specific generated APIs in the application.
- Compiling the database interface files with the application source code and linking with the appropriate eXtremeDB runtime libraries.
These basic steps in building an eXtremeDB C application are illustrated in the following diagram; the host components are in blue, while the target components are in red:
![]()
Schema definition
The database schema is defined in a high-level C-like Data Definition Language (DDL). The essential DDL statements are a
declare database <db_name>
to assign the database name, and a class <class_name> to define a database class (corresponds to a table in SQL jargon). For example, the following defines a simple database with namemydb
and a single class (table)MyClass
with two fieldsid
(an unsigned 4-byte integer) andname
(a variable length character string):declare database mydb; class MyClass { unsigned<4> id; string name; };Compiling the schema
Typically the schema file will be named with extension
.mco
; likeschema.mco
ormydb.mco
. Then this file is compiled by the DDL compilermcocomp
to produce the schema-specific database dictionary and data access APIs in the form of a<db_name>.h
header file and a<db_name>.c
implementation file. For example the following command will produce filesmydb.h
andmydb.c
in the current working directory:../../host/bin/mcocomp mydb.mcoA more interesting example of DDL usage can be seen in the SDK sample
samples/native/core/00_ddl/schema.mco
.Implementing eXtremeDB APIs in the application source code
A number of "helper" functions are provided in directory
samples/native/common
that can facilitate initial development. The simplest of eXtremeDB applications can merely include thecommon.h
header file, then call helper functionssample_os_initialize()
, print out a "Hello world" type message, callsample_pause_end()
to pause execution, thensample_os_shutdown()
to terminate. Please see the SDK samplesamples/native/core/00_ddl/main.c
for an example.Compiling and linking the application
At a minimum, a simple application that creates an eXtremeDB database in conventional memory will require the following libraries (by convention we use abbreviated naming, for example,
mcolib
which will exist asmcolib.lib
on Windows platforms andlibmcolib.a
on Unix-Linux platforms):
mcolib The “core” runtime library mcovtmem The “virtual tables” library for all-in-memory databases mcomconv The “memory devices” library for conventional memory mcosw32, mcosw32n, or mcoslnx The “synchronization” library mcouwrt The “utilities” library Please refer to the SDK sample
samples/native/core/00_ddl
for a very simple example, and building and running SDK samples for instructions.In the next steps we will add some database functionality to applications. The best way to learn these details is to build and run the sample applications and examine the source code described in these steps.