| 535 | std::vector<DescriptorRecord>& ODBCDescriptor::GetRecords() { return records_; } |
| 536 | |
| 537 | void ODBCDescriptor::BindCol(SQLSMALLINT record_number, SQLSMALLINT c_type, |
| 538 | SQLPOINTER data_ptr, SQLLEN buffer_length, |
| 539 | SQLLEN* indicator_ptr) { |
| 540 | assert(is_app_descriptor_); |
| 541 | assert(is_writable_); |
| 542 | |
| 543 | // The set of records auto-expands to the supplied record number. |
| 544 | if (records_.size() < static_cast<size_t>(record_number)) { |
| 545 | records_.resize(record_number); |
| 546 | } |
| 547 | |
| 548 | SQLSMALLINT zero_based_record_index = record_number - 1; |
| 549 | DescriptorRecord& record = records_[zero_based_record_index]; |
| 550 | |
| 551 | record.type = c_type; |
| 552 | record.indicator_ptr = indicator_ptr; |
| 553 | record.length = buffer_length; |
| 554 | |
| 555 | // Initialize default precision and scale for SQL_C_NUMERIC. |
| 556 | if (record.type == SQL_C_NUMERIC) { |
| 557 | record.precision = 38; |
| 558 | record.scale = 0; |
| 559 | } |
| 560 | SetDataPtrOnRecord(data_ptr, record_number); |
| 561 | } |
| 562 | |
| 563 | void ODBCDescriptor::SetDataPtrOnRecord(SQLPOINTER data_ptr, SQLSMALLINT record_number) { |
| 564 | assert(static_cast<size_t>(record_number) <= records_.size()); |
no test coverage detected