Home | Previous Page | Next Page   Overview of IBM Informix ODBC Driver > Using the IBM Informix ODBC Driver API >

Buffers

An application passes data to the driver in an input buffer. The driver returns data to the application in an output buffer. The application must allocate memory for both input and output buffers. If the application uses the buffer to retrieve string data, the buffer must contain space for the null termination byte.

Some functions accept pointers to buffers that are used later by other functions. The application must ensure that these pointers remain valid until all applicable functions have used them. For example, the argument rgbValue in SQLBindCol points to an output buffer where SQLFetch returns the data for a column.

Input Buffers

An application passes the address and length of an input buffer to the driver. The length of the buffer must be one of the following values:

For character data that contains embedded null characters, the operation of IBM Informix ODBC Driver functions is undefined; for maximum interoperability, it is better not to use them. Informix database servers treat null characters as end-of-string markers or as indicators that no more data exists.

Unless it is specifically prohibited in a function description, the address of an input buffer can be a null pointer. In such cases, the value of the corresponding buffer-length argument is ignored. For more information about input buffers, see Converting Data from SQL to C.

Output Buffers

An application passes the following arguments to the driver so that the driver can return data in an output buffer:

If the output buffer is too small, the driver attempts to truncate the data. If the truncation does not cause a loss of significant data, the driver returns the truncated data in the output buffer, returns the length of the available data (as opposed to the length of the truncated data) in the length buffer, and returns SQL_SUCCESS_WITH_INFO. If the truncation causes a loss of significant data, the driver leaves the output and length buffers untouched and returns SQL_ERROR. The application calls SQLGetDiagRec to retrieve information about the truncation or the error.

For more information about output buffers, see Converting Data from SQL to C.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]