Skip to content

Latest commit

 

History

History
27 lines (21 loc) · 2.14 KB

sqlbindcol-cursor-library.md

File metadata and controls

27 lines (21 loc) · 2.14 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic helpviewer_keywords
SQLBindCol (Cursor Library)
SQLBindCol (Cursor Library)
David-Engel
davidengel
01/19/2017
sql
connectivity
reference
SQLAllocStmt function [ODBC], Cursor Library

SQLBindCol (Cursor Library)

Important

This feature will be removed in a future version of Windows. Avoid using this feature in new development work and plan to modify applications that currently use this feature. Microsoft recommends using the driver's cursor functionality.

This topic discusses the use of the SQLBindCol function in the cursor library. For general information about SQLBindCol, see SQLBindCol Function.

An application allocates one or more buffers for the cursor library to return the current rowset in. It calls SQLBindCol one or more times to bind these buffers to the result set.

An application can call SQLBindCol to rebind result set columns after it has called SQLExtendedFetch, SQLFetch, or SQLFetchScroll,as long as the C data type, column size, and decimal digits of the bound column remain the same. The application need not close the cursor to rebind columns to different addresses.

The cursor library supports setting the SQL_ATTR_ROW_BIND_OFFSET_PTR statement attribute to use bind offsets. (SQLBindCol does not have to be called for this rebinding to occur.) If the cursor library is used with an ODBC 3.x driver, the bind offset is not used when SQLFetch is called. The bind offset is used if SQLFetch is called when the cursor library is used with an ODBC 2.x driver because SQLFetch is then mapped to SQLExtendedFetch.

The cursor library supports calling SQLBindCol to bind the bookmark column.

When working with an ODBC 2.x driver, the cursor library returns SQLSTATE HY090 (Invalid string or buffer length) when SQLBindCol is called to set the buffer length for a bookmark column to a value not equal to 4. When working with an ODBC 3.x driver, the cursor library allows the buffer to be any size.