Closed mikepizzo closed 6 years ago
Proposal: Drivers should always try to reuse bindings, with the caveat that applications must, as always, be prepared for: -Multiple bindings of the same name (with the same or different types) -Unused bindings (DATA_UNAVAILABLE)
Rollback #64; just have SQL_ATTR_DYNAMIC_COLUMNS Boolean.
We initially said that a driver could either use the same descriptor record for dynamic columns of the same type or create new ones. This allows for an optimization where the driver knows that a particular dynamic column, for example, is either a string or an int. It can create two descriptor records and use the int when the record when the value is an int, and the string record when the value is an int. This also saves the application having to change their bindings.
Issue #64 asks whether the application has any way of knowing, or even controlling, whether new descriptor records are created or the type is changed, and introduced a change of SQL_ATTR_DYNAMIC_COLUMNS from a Boolean to a SQL_ATTR_DYNAMIC_BEHAVIOR option.
Issue #125 clarifies that this is only valid for dynamic columns; declared columns need to reuse the same descriptor record.
Question: is it worth the optimization of having the driver create new descriptor records for different types, or should we say that the driver always uses the same descriptor record for a given named dynamic column, once discovered, and only creates a subsequent descriptor record if another dynamic column with the same name is discovered on the same row (an unlikely scenario that we could even handle as an exception)?