DB Access Module for DB2 CLI User’s Guide : Chapter 2 Technical Information : Open SQL and DB2 CLI : RWDBDataCallback and Open SQL
RWDBDataCallback and Open SQL
The data callback classes can be used with DB2 CLI to insert and fetch data. These classes are useful for very large data that may not fit in memory for a single database call and are described in Section 15.3, “The Data Callback Classes,” in the DB Interface Module User’s Guide.
When fetching data, the DB2 CLI requires that the columns bound to a data callback must be at the end of the select list. For example, if two columns of type integer and LOB are selected, the integer must come before the LOB in the select list in order to use a data callback for the LOB column.The DB Access Module for DB2 CLI will fetch only one row on each call to RWDBOSql::fetch().
Multiple rows can be inserted in one call to RWDBOSql::execute(). The number of rows is determined by the entries parameter passed to the constructor of a data callback class or an RWDBTBuffer instance. Please see Chapter 15, “Using the Open SQL Classes,” in the DB Interface Module User’s Guide for information about array input.
Piece Size Setting
The DB Access Module for DB2 CLI sets the piece size for inserting or fetching data to 32768. This value represents bytes in the case of binary data, and code units in the case of character data.
RWDBDataCallback::getLength()
When inserting data using data callbacks, DB2 CLI does not require the length of the data being inserted. Therefore, the method RWDBDataCallback::getLength() does not need to be overridden in derived classes.
Stored Procedures and RWDBDataCallback
Stored procedure execution is not supported with the data callback classes.