| 84 | } |
| 85 | |
| 86 | void ODBCDescriptor::SetHeaderField(SQLSMALLINT field_identifier, SQLPOINTER value, |
| 87 | SQLINTEGER buffer_length) { |
| 88 | // Only these two fields can be set on the IRD. |
| 89 | if (!is_writable_ && field_identifier != SQL_DESC_ARRAY_STATUS_PTR && |
| 90 | field_identifier != SQL_DESC_ROWS_PROCESSED_PTR) { |
| 91 | throw DriverException("Cannot modify read-only descriptor", "HY016"); |
| 92 | } |
| 93 | |
| 94 | switch (field_identifier) { |
| 95 | case SQL_DESC_ALLOC_TYPE: |
| 96 | throw DriverException("Invalid descriptor field", "HY091"); |
| 97 | case SQL_DESC_ARRAY_SIZE: |
| 98 | SetAttribute(value, array_size_); |
| 99 | has_bindings_changed_ = true; |
| 100 | break; |
| 101 | case SQL_DESC_ARRAY_STATUS_PTR: |
| 102 | SetPointerAttribute(value, array_status_ptr_); |
| 103 | has_bindings_changed_ = true; |
| 104 | break; |
| 105 | case SQL_DESC_BIND_OFFSET_PTR: |
| 106 | SetPointerAttribute(value, bind_offset_ptr_); |
| 107 | has_bindings_changed_ = true; |
| 108 | break; |
| 109 | case SQL_DESC_BIND_TYPE: |
| 110 | SetAttribute(value, bind_type_); |
| 111 | has_bindings_changed_ = true; |
| 112 | break; |
| 113 | case SQL_DESC_ROWS_PROCESSED_PTR: |
| 114 | SetPointerAttribute(value, rows_processed_ptr_); |
| 115 | has_bindings_changed_ = true; |
| 116 | break; |
| 117 | case SQL_DESC_COUNT: { |
| 118 | SQLSMALLINT new_count; |
| 119 | SetAttribute(value, new_count); |
| 120 | records_.resize(new_count); |
| 121 | |
| 122 | if (is_app_descriptor_ && new_count <= highest_one_based_bound_record_) { |
| 123 | highest_one_based_bound_record_ = CalculateHighestBoundRecord(records_); |
| 124 | } else { |
| 125 | highest_one_based_bound_record_ = new_count; |
| 126 | } |
| 127 | has_bindings_changed_ = true; |
| 128 | break; |
| 129 | } |
| 130 | default: |
| 131 | throw DriverException("Invalid descriptor field", "HY091"); |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | void ODBCDescriptor::SetField(SQLSMALLINT record_number, SQLSMALLINT field_identifier, |
| 136 | SQLPOINTER value, SQLINTEGER buffer_length) { |
no test coverage detected