DB Access Module for Microsoft SQL Server User’s Guide : Chapter 2 Technical Information : Open SQL and Microsoft SQL Server ODBC : RWDBDataCallback and Open SQL
RWDBDataCallback and Open SQL
The data callback classes can be used with Microsoft SQL Server 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, Microsoft SQL Server 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 Microsoft SQL Server 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 Microsoft SQL Server 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.
When using the SQL Server Native Client or ODBC Driver for SQL Server
The Microsoft SQL Server Native Client and ODBC Driver for SQL Server do not need the total length of the value, although there are potential performance benefits to using it. Therefore, overriding the RWDBDataCallback::getLength() method may be desirable but is not required.
When using the Microsoft SQL Server MDAC Client
The MDAC Client requires the total length of the insert value to insert data successfully. Therefore, the method RWDBDataCallback::getLength() must be overridden when inserting data.
Stored Procedures and RWDBDataCallback
Stored procedure execution is not supported with the data callback classes.