DB Interface Module User’s Guide : PART IV Using Open SQL : Chapter 14 Defining Open SQL : Who Should Use Open SQL
Who Should Use Open SQL
Using Open SQL is somewhat more complicated than using the standard API of the DB Interface Module. While the alternative interface may increase control and performance, it may also decrease portability and ease of coding. For this reason, Open SQL is not recommended for all users, but you should consider it for any of the following operations:
To execute an SQL statement with direct control over parameter bindings and/or output bindings
To manage your own memory for input or output data for an SQL statement
To use vendor-specific data types to eliminate the need for the DB Interface Module to convert data
You should use Open SQL only if:
You want to create your own SQL statements for your own particular database. If not, the existing DML classes in the DB Interface Module, such as RWDBSelector and RWDBUpdater, provide SQL statements already.
You want to manage your own memory, or you want to explicitly specify the C++ datatype for input or output data. If not, the DML and result processing classes in the DB Interface Module, such as RWDBResult and RWDBReader, provide memory management and datatyping already.
In summary, by using Open SQL, you obtain direct control over the SQL that is executed and the data that is bound to it. Some parts of your application may also achieve better performance. However, these benefits might not be worth the decreased maintainability and increased complexity that result from direct execution of SQL statements.
As a guideline, if you can identify specific, performance-intensive sections in an application that perform database access, you should consider coding those sections using Open SQL.