microsoft / ODBC-Specification

Microsoft ODBC Specification
Other
121 stars 40 forks source link

SQLCloseCursor returning SQL_DATA_AVAILABLE #67

Closed matthew-wozniczka closed 7 years ago

matthew-wozniczka commented 7 years ago

Section 3.9.4.1 (Retrieving Dynamic Columns) has the sentence

Returns SQL_DATA_AVAILABLE from SQLFetch, SQLFetchScroll, or SQLCloseCursor on a nested statement handle

When would SQLCloseCursor return SQL_DATA_AVAILABLE (What does it mean?). Does it only do this in the 'interrupted fetch' state, or whenever a nested statement handle is closed?

Does SQLFreeStmt(SQL_CLOSE) work in the same way?

If the intention is that it is returning that what calling SQLNextColumn on the parent statement handle will return, does this mean that SQLCloseCursor may also return SQL_METADATA_CHANGED or SQL_MORE_DATA? Since the application is obligated to call SQLNextColumn on the parent statement handle anyway to complete the interrupted fetch, I don't think this gives us anything, and only adds complexity.

mikepizzo commented 7 years ago

Yes; the intention was that the closing the child cursor continue the fetch operation on the parent (which, as you say, would also apply to SQLFreeStmt(SQL_CLOSE) -- however, (as you say) I don't think this buys us anything as the client already knows they have to call SQLNextColumn after processing the child.