Embedded SQL Application Development in C++

As explained in the eXtremeSQL C API page, an embedded SQL application, both in C and C++, will define its database schema using the eXtremeDB DDL then compile the schema using mcocomp . The applications will then use the static C API functions to start the eXtremeSQL runtime and specify memory devices. Database parameters will then be specified in an instance of class McoSqlOpenParameters. Then the open() method of class McoSqlEngine is called to initialize the SQL engine which is used for all SQL database access through methods executeQuery() and executeStatement().

Processing SQL Queries

The classes QueryResult, Cursor and Record are provided for processing query results. Typically a QueryResult will be instantiated by calling McoSqlEngine method executeQuery() with a select statement to obtain a result set; then a Cursor will be created by QueryResult method results() which is used to iterate the result set. The Cursor navigation functions first(), next(), last() and prev() are used to position the cursor and obtain a Record instance for the current result set row.

Executing SQL Statements

The McoSqlEngine method executeStatement()is called with an insert, update or delete statement to modify database contents.

Prepared Statements

SQL statements can be prepared and reused multiple times. This saves processor time by eliminating the statement compilation step each time the statement is executed. An even more significant advantage is that the prepare step binds its statement arguments only once and then reuses these arguments in further calculations. This can have a noticeable effect because, unlike the executeQuery() and executeStatement()methods, prepare()works only with pointers to arguments. Thus the values of arguments are bound at the prepare step so that the executePreparedQuery() or executePreparedStatement()methods work with the actual values of these statement arguments.

eXtremeSQL Application Implementation Details

Please use the links below to view implementation details for the class or functionality of interest:

McoSqlEngine Instructions for using the McoSqlEngine class and key methods
McoDistributedSqlEngine Using the McoDistributedSqlEngine class
Memory Allocator Instructions for using the StdAlocator and QuotaSysAllocator memory allocation classes
Free Memory Threshold Instructions for setting the free memory threshold for SQL operations
Managing Transactions Instructions for managing database transactions
Query_Result_Processing Instructions for processing QueryResult objects returned from executeQuery()
Prepared Statements Executing Prepared Statements
Bulk Insert "Bulk Insert" optimization in C++ API
SqlAggregator Instructions for using the SqlAggregator class
User_Defined_Functions Creating UDFs in dynamic load libraries
McoSqlOpenParameters Instructions for setting McoSqlOpenParameters for persistent or hybrid databases
Structures Arrays and Strings Instructions for using Structures, Arrays, Strings, Binary Data, Dynamic data and References
String, Math and User-defined functions Instructions for using built-in String and Math functions and User-defined functions
Aggregate Functions Instructions for using Aggregate functions
Group By Instructions for using the Group By clause