DB Access Module for ODBC User’s Guide : Chapter 2 Technical Information : Open SQL and ODBC : RWDBDataCallback and Open SQL
RWDBDataCallback and Open SQL
The data callback classes can be used with ODBC 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.
ODBC drivers vary in their capabilities. Some drivers do not support data callbacks used for columns in the select list before the last bound column. There may also be a restriction on the number of rows that can be fetched at one time from a result set, so that calls to RWDBOSql::fetch() may return only one row. Check the documentation for the SQL_GETDATA_EXTENSIONS supported by the ODBC driver for more information.
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 ODBC 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, some databases need to be provided the total length of the inserted value, which requires overriding the RWDBDataCallback::getLength() method.
For ODBC, some drivers require the total length of the data value prior to inserting the value when using data callbacks. Either check the ODBC driver documentation for the SQL_NEED_LONG_DATA_LEN option, or call the function SQLGetInfo() with the SQL_NEED_LONG_DATA_LEN option; if it returns “Y“, the method must be overridden in the derived classes.
Stored Procedures and RWDBDataCallback
Stored procedure execution is not supported with the data callback classes.