Defining Open SQL
An Alternative API
The standard interface of the DB Interface Module protects you from many of the details associated with accessing relational databases in C++. Datatype conversion, SQL statement generation, and memory allocation are all performed automatically, and this benefit serves most customers well. If you are one of a growing number of developers who write advanced, high-performance systems, however, you may be willing to trade ease of coding for more control over the details. The Open SQL API of the DB Interface Module, called simply Open SQL, was designed for you.
Open SQL is an alternative API that allows you to control SQL statements directly. It encapsulates the semantics for statement execution, parameter binding, and results fetching provided by each database vendor into a vendor-independent interface. The operations you perform with Open SQL translate directly to the primitive operations provided by each database, yet the API is consistent across all vendors.
Specifically, Open SQL is a database-portable set of these classes:
*RWDBOSql encapsulates an SQL statement and its input and output bindings.
*RWDBTBuffer<T>, a template class, encapsulates buffers of data that can be bound to the SQL statement.
*RWDBMultiRow adds row semantics to collections of RWDBTBuffers.
*Three data callback classes that define interfaces for specifying data callback methods:
*RWDBCharCallback, for standard character data
*RWDBUChar16Callback, for UTF-16 data
*RWDBBinaryCallback, for binary data
The Open SQL classes are described in A Summary of the Open SQL Classes; using these classes is explained in Chapter 15, Using the Open SQL Classes. Before pursuing the details, however, we suggest that you read the following section to determine whether Open SQL fits your coding requirements.