MCPcopy Create free account
hub / github.com/apache/arrow / SetConnectAttr

Method SetConnectAttr

cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_connection.cc:414–527  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

412}
413
414void ODBCConnection::SetConnectAttr(SQLINTEGER attribute, SQLPOINTER value,
415 SQLINTEGER string_length, bool is_unicode) {
416 uint32_t attribute_to_write = 0;
417 bool successfully_written = false;
418 switch (attribute) {
419 // Internal connection attributes
420#ifdef SQL_ATR_ASYNC_DBC_EVENT
421 case SQL_ATTR_ASYNC_DBC_EVENT:
422 throw DriverException("Optional feature not supported.", "HYC00");
423#endif
424#ifdef SQL_ATTR_ASYNC_DBC_FUNCTIONS_ENABLE
425 case SQL_ATTR_ASYNC_DBC_FUNCTIONS_ENABLE:
426 throw DriverException("Optional feature not supported.", "HYC00");
427#endif
428#ifdef SQL_ATTR_ASYNC_PCALLBACK
429 case SQL_ATTR_ASYNC_DBC_PCALLBACK:
430 throw DriverException("Optional feature not supported.", "HYC00");
431#endif
432#ifdef SQL_ATTR_ASYNC_DBC_PCONTEXT
433 case SQL_ATTR_ASYNC_DBC_PCONTEXT:
434 throw DriverException("Optional feature not supported.", "HYC00");
435#endif
436 case SQL_ATTR_AUTO_IPD:
437 throw DriverException("Cannot set read-only attribute", "HY092");
438 case SQL_ATTR_AUTOCOMMIT:
439 CheckIfAttributeIsSetToOnlyValidValue(value,
440 static_cast<SQLUINTEGER>(SQL_AUTOCOMMIT_ON));
441 return;
442 case SQL_ATTR_CONNECTION_DEAD:
443 throw DriverException("Cannot set read-only attribute", "HY092");
444#ifdef SQL_ATTR_DBC_INFO_TOKEN
445 case SQL_ATTR_DBC_INFO_TOKEN:
446 throw DriverException("Optional feature not supported.", "HYC00");
447#endif
448 case SQL_ATTR_ENLIST_IN_DTC:
449 throw DriverException("Optional feature not supported.", "HYC00");
450 case SQL_ATTR_ODBC_CURSORS: // DM-only.
451 throw DriverException("Invalid attribute", "HY092");
452 case SQL_ATTR_QUIET_MODE:
453 throw DriverException("Cannot set read-only attribute", "HY092");
454 case SQL_ATTR_TRACE: // DM-only
455 throw DriverException("Cannot set read-only attribute", "HY092");
456 case SQL_ATTR_TRACEFILE:
457 throw DriverException("Optional feature not supported.", "HYC00");
458 case SQL_ATTR_TRANSLATE_LIB:
459 throw DriverException("Optional feature not supported.", "HYC00");
460 case SQL_ATTR_TRANSLATE_OPTION:
461 throw DriverException("Optional feature not supported.", "HYC00");
462 case SQL_ATTR_TXN_ISOLATION:
463 throw DriverException("Optional feature not supported.", "HYC00");
464
465 case SQL_ATTR_CURRENT_CATALOG: {
466 std::string catalog;
467 if (is_unicode) {
468 SetAttributeUTF8(value, string_length, catalog);
469 } else {
470 SetAttributeSQLWCHAR(value, string_length, catalog);
471 }

Callers 1

SQLSetConnectAttrFunction · 0.80

Calls 9

DriverExceptionClass · 0.85
SetAttributeUTF8Function · 0.85
SetAttributeSQLWCHARFunction · 0.85
SetAttributeFunction · 0.85
to_stringFunction · 0.85
SetStmtAttrMethod · 0.80
AddWarningMethod · 0.80
SetAttributeMethod · 0.45

Tested by

no test coverage detected