Hitachi

Hitachi Advanced Database Application Development Guide


16.9.5 SQLBindCol

Organization of this subsection

(1) Function

This ODBC function associates an application data area with a column in the result set.

(2) Format

SQLRETURN SQLBindCol
(
  SQLHSTMT        StatementHandle,        /* In */
  SQLUSMALLINT    ColumnNumber,           /* In */
  SQLSMALLINT     TargetType,             /* In */
  SQLPOINTER      TargetValuePtr,         /* Out */
  SQLLEN          BufferLength,           /* In */
  SQLLEN        * StrLen_or_IndPtr        /* Out */
)

(3) Arguments

StatementHandle

Specifies a statement handle.

ColumnNumber

Specifies the number of the result set column to be associated.

The column numbering begins with 1 because HADB does not support bookmarks.

TargetType

Specifies the C data type identifier of the area pointed to by TargetValuePtr or specifies SQL_C_DEFAULT. If SQL_C_DEFAULT is specified, the driver assumes the default C data type.

TargetValuePtr

Specifies a pointer to the area that is associated with the result set column.

To release the association, specify a null pointer.

BufferLength

Specifies the length (in bytes) of the area pointed to by TargetValuePtr.

StrLen_or_IndPtr

Specifies a pointer to the area in which the data length or indicator is returned by the HADB ODBC driver.

If the executed SQLFetch function returns SQL_SUCCESS or SQL_SUCCESS_WITH_INFO, the HADB ODBC driver returns the data length or indicator.

If the column data is a null value, the return value is SQL_NULL_DATA.

(4) Return value

This ODBC function returns SQL_SUCCESS, SQL_ERROR, or SQL_INVALID_HANDLE.

(5) SQLSTATE

This ODBC function returns one of the following SQLSTATE values:

SQLSTATE

Description

Remarks

Returned

01000

General warning

--

N

07006

Restricted data type attribute violation

The value specified in ColumnNumber is 0, but the value specified in TargetType is neither SQL_C_BOOKMARK nor SQL_C_VARBOOKMARK.

N

07009

Invalid descriptor index

The value specified in ColumnNumber is greater than the maximum number of columns in the result set.

N

HY000

General error

--

N

HY001

Memory allocation error

Y

HY003

Invalid application buffer data type

The value specified in TargetType is neither a valid data type nor SQL_C_DEFAULT.

N

HY010

Function sequence error

The asynchronously executing function that was called for StatementHandle was still executing when this function was called.

N

HY013

Memory management error

The function call could not be processed because the memory object could not be accessed.

N

HY090

Invalid string or buffer length

The following conditions are both satisfied:

  • The value specified in TargetValuePtr is not a null pointer.

  • The value specified in BufferLength is less than 0.

Y

HYC00

Optional feature not implemented

Zero was specified in ColumnNumber, but the driver does not support bookmarks.

Y

HYT01

Connection timeout expired

A connection timeout occurred before the data source responded to the request. The connection timeout value can be specified by using SQL_ATTR_CONNECTION_TIMEOUT in SQLSetConnectAttr or SQLSetConnectAttrW.

N

IM001

Driver does not support this function

--

N

Legend:

Y: This SQLSTATE might be returned by the HADB ODBC driver.

N: This SQLSTATE is not returned by the HADB ODBC driver.

--: None

(6) Notes

This ODBC function does not support the following functions: