| 527 | } |
| 528 | |
| 529 | SQLRETURN ODBCConnection::GetConnectAttr(SQLINTEGER attribute, SQLPOINTER value, |
| 530 | SQLINTEGER buffer_length, |
| 531 | SQLINTEGER* output_length, bool is_unicode) { |
| 532 | std::optional<Connection::Attribute> spi_attribute; |
| 533 | |
| 534 | switch (attribute) { |
| 535 | // Internal connection attributes |
| 536 | #ifdef SQL_ATTR_ASYNC_DBC_EVENT |
| 537 | case SQL_ATTR_ASYNC_DBC_EVENT: |
| 538 | GetAttribute(static_cast<SQLPOINTER>(NULL), value, buffer_length, output_length); |
| 539 | return SQL_SUCCESS; |
| 540 | #endif |
| 541 | #ifdef SQL_ATTR_ASYNC_DBC_FUNCTIONS_ENABLE |
| 542 | case SQL_ATTR_ASYNC_DBC_FUNCTIONS_ENABLE: |
| 543 | GetAttribute(static_cast<SQLUINTEGER>(SQL_ASYNC_DBC_ENABLE_OFF), value, |
| 544 | buffer_length, output_length); |
| 545 | return SQL_SUCCESS; |
| 546 | #endif |
| 547 | #ifdef SQL_ATTR_ASYNC_DBC_PCALLBACK |
| 548 | case SQL_ATTR_ASYNC_DBC_PCALLBACK: |
| 549 | GetAttribute(static_cast<SQLPOINTER>(NULL), value, buffer_length, output_length); |
| 550 | return SQL_SUCCESS; |
| 551 | #endif |
| 552 | #ifdef SQL_ATTR_ASYNC_DBC_PCONTEXT |
| 553 | case SQL_ATTR_ASYNC_DBC_PCONTEXT: |
| 554 | GetAttribute(static_cast<SQLPOINTER>(NULL), value, buffer_length, output_length); |
| 555 | return SQL_SUCCESS; |
| 556 | #endif |
| 557 | case SQL_ATTR_ASYNC_ENABLE: |
| 558 | GetAttribute(static_cast<SQLULEN>(SQL_ASYNC_ENABLE_OFF), value, buffer_length, |
| 559 | output_length); |
| 560 | return SQL_SUCCESS; |
| 561 | case SQL_ATTR_AUTO_IPD: |
| 562 | GetAttribute(static_cast<SQLUINTEGER>(SQL_FALSE), value, buffer_length, |
| 563 | output_length); |
| 564 | return SQL_SUCCESS; |
| 565 | case SQL_ATTR_AUTOCOMMIT: |
| 566 | GetAttribute(static_cast<SQLUINTEGER>(SQL_AUTOCOMMIT_ON), value, buffer_length, |
| 567 | output_length); |
| 568 | return SQL_SUCCESS; |
| 569 | #ifdef SQL_ATTR_DBC_INFO_TOKEN |
| 570 | case SQL_ATTR_DBC_INFO_TOKEN: |
| 571 | throw DriverException("Cannot read set-only attribute", "HY092"); |
| 572 | #endif |
| 573 | case SQL_ATTR_ENLIST_IN_DTC: |
| 574 | GetAttribute(static_cast<SQLPOINTER>(NULL), value, buffer_length, output_length); |
| 575 | return SQL_SUCCESS; |
| 576 | case SQL_ATTR_ODBC_CURSORS: // DM-only. |
| 577 | throw DriverException("Invalid attribute", "HY092"); |
| 578 | case SQL_ATTR_QUIET_MODE: |
| 579 | GetAttribute(static_cast<SQLPOINTER>(NULL), value, buffer_length, output_length); |
| 580 | return SQL_SUCCESS; |
| 581 | case SQL_ATTR_TRACE: // DM-only |
| 582 | throw DriverException("Invalid attribute", "HY092"); |
| 583 | case SQL_ATTR_TRACEFILE: |
| 584 | throw DriverException("Optional feature not supported.", "HYC00"); |
| 585 | case SQL_ATTR_TRANSLATE_LIB: |
| 586 | throw DriverException("Optional feature not supported.", "HYC00"); |
no test coverage detected