The Pointer Layer
The traditional benefit of the DB Interface Module lies in the value layer, which shields users from the problems of conventional pointer-based programming interfaces for databases. However, the DB Interface Module also provides a pointer layer, with pointer-based classes and methods for users who need them.
Because pointer-based interfaces are significantly more difficult and error-prone, we recommend limited use of the pointer layer. This use should be isolated to areas of a program that require a high level of explicit control; for example, where program variables must be directly bound to result-set columns, or where it is imperative that no extra copies of data are made.
NOTE: Use the pointer layer only where explicit control is required.
Since the value and pointer-based classes can be used together in most cases, we suggest that you write value-based code whenever possible. Then, when you can identify specific performance concerns, you can rewrite those parts of your application code using the pointer-based classes.
Specifically, the pointer layer is exposed through:
Class RWDBBoundExpr. This class allows you to bind program variables by pointer into DML classes, such as
RWDBInserter,
RWDBSelector, and so on. Internally, the pointer and its type are encapsulated by an
RWDBTBuffer<T> and stored for later binding. See
RWDBBoundExpr in the
SourcePro API Reference Guide Class RWDBCursor. Cursors allow you to bind program variables to result set columns. As the cursor scrolls through the result set, program variables are updated to reflect the values in that row.
RWDBTBuffer<T> is used internally to encapsulate the pointers to the program variables. See
RWDBCursor in the
SourcePro API Reference Guide.
The Bulk API. Class
RWDBTBuffer<T> allows you to work directly with buffers of data, for use with bulk API classes
RWDBBulkInserter and
RWDBBulkReader. See
Chapter 8, Bulk Reading and Writing. Open SQL. The Open SQL interface, which includes
RWDBTBuffer<T>, allows programmers to construct their own database-dependent SQL statements, and to explicitly bind buffers of data to placeholders and result set columns associated with the statement. Buffers can include either single entries or arrays of data. Open SQL is more difficult to use, but it is the most appropriate way to access the database in some applications. See
Chapter 15, Using the Open SQL Classes.