Performing a local fetch
HCL OneDB™ ODBC Driver performs a local fetch when you retrieve a row or collection from one location on the client computer to another location on the client computer.
About this task
A local fetch has the following limits on SQL data conversion:
- HCL OneDB ODBC Driver cannot convert extended data types for which the cast functions are on a database server.
- HCL OneDB ODBC Driver cannot convert data from one named row type to another. Only the database server can perform this type of conversion.
- HCL
OneDB ODBC Driver cannot
convert SQL data types when retrieving an entire row or collection.
Thus, HCL
OneDB ODBC Driver can
perform a local fetch of an entire row or collection only if the internal
structures for the source and destination are the same or if the destination
is an unfixed-type buffer.
For example, if you define a local collection as list (char(1) not null), the database server can put a list (int not null) value from the database server into the local collection. During this operation, the database server converts each integer into a string and constructs a new list to return to the client computer. You cannot perform this operation on the client computer where you retrieve a local list of integers into a list of characters.
To perform a local fetch:
Procedure
- Call ifx_rc_create() to allocate a row or collection buffer.
- Call SQLBindCol() to bind the buffer handle to the local row or collection.
- Execute a SELECT statement to transfer the row or collection data to the local buffer.
- For each element in the row or collection, call ifx_rc_fetch() to copy the value to the buffer.
- Use the row or collection buffer.
- Call ifx_rc_free() to deallocate the buffer.