microsoft / ODBC-Specification

Microsoft ODBC Specification
Other
122 stars 40 forks source link

How do 'abandoned' bindings get populated? #103

Closed matthew-wozniczka closed 7 years ago

matthew-wozniczka commented 7 years ago

Section 3.9.4.1 (Retrieving Dynamic Columns) says

the driver sets the str_len_or_indicator_ptr of unused bound columns to SQL_DATA_UNAVAILABLE when the entire fetch operation for the array of rows completes.

A given column may be re-bound multiple times during a single fetch (for example, if it's a variant column and changes type multiple times within the fetched rowset). Every time it's re-bound, the application has the opportunity to bind different buffers (for both data & length indicator).

Will the driver populate all length indicator buffers which were bound on a column in the course of the fetch? Or will it only fill the buffer 'in effect' at the time the fetch successfully completes?

mikepizzo commented 7 years ago

Good question...

I do wonder if it's worth allowing the client to rebind the column in the midst of the interrupted fetch, versus just saying that they call SQLGetData. That would mean they would have to "fix" the binding for subsequent fetches after SQLNextColumn returned SQL_SUCCESS and before the next call to Fetch/FetchScroll (meaning the client would have to "buffer" such changes), but it might keep the state machine of the driver simpler.

mikepizzo commented 7 years ago

See Proposed Resolution for Issue #104, which proposes to restrict rebinding if rowset size > 1.

mikepizzo commented 7 years ago

Applied as per Issue #104.