microsoft / ODBC-Specification

Microsoft ODBC Specification
Other
122 stars 40 forks source link

Binding behavior for collection/structured/dynamic columns #109

Closed deata closed 7 years ago

deata commented 7 years ago

Can you bind these? if yes, what happens during fetch?

mikepizzo commented 7 years ago

Collections (array, multiset), structured columns (row, UDT), and untyped (variant) columns must be bound as data-at-exec.

mikepizzo commented 7 years ago

Updated section on retrieving structured and collection valued columns to clarify: 1) Client binds as DATA_AT_FETCH 2) If not bound, they are ignored 3) if bound other than as DATA_AT_FETCH, a type exception is raised (and handled, according to SQL_ATTR_TYPE_EXCEPTION_BEHAVIOR).

From 3.10.3, Response Extensions for Structured Columns:

To retrieve structured result columns, the client binds the column as SQL_DATA_AT_FETCH. When the driver returns SQL_DATA_AVAILABLE for the structured column, the client calls SQLGetNestedHandle to obtain a statement handle (HSTMT) on which the nested results can be described, bound, and fetched using the appropriate standard ODBC function calls. Structural columns not bound as SQL_DATA_AT_FETCH are not returned by the driver. Attempting to return a structural value for a column bound other than as SQL_DATA_AT_FETCH results in a type exception, which may be handled according to the value of SQL_ATTR_TYPE_EXCEPTION_BEHAVIOR.