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

Function GetOdbcErrorMessage

cpp/src/arrow/flight/sql/odbc/tests/odbc_test_suite.cc:447–470  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

445}
446
447std::string GetOdbcErrorMessage(SQLSMALLINT handle_type, SQLHANDLE handle) {
448 using ODBC::SqlWcharToString;
449
450 SQLWCHAR sql_state[7] = {};
451 SQLINTEGER native_code;
452
453 SQLWCHAR message[kOdbcBufferSize] = {};
454 SQLSMALLINT real_len = 0;
455
456 // On Windows, real_len is in bytes. On Linux, real_len is in chars.
457 // So, not using real_len
458 SQLGetDiagRec(handle_type, handle, 1, sql_state, &native_code, message, kOdbcBufferSize,
459 &real_len);
460
461 std::string res = SqlWcharToString(sql_state);
462
463 if (res.empty() || !message[0]) {
464 res = "Cannot find ODBC error message";
465 } else {
466 res.append(": ").append(SqlWcharToString(message));
467 }
468
469 return res;
470}
471
472bool WriteDSN(std::string connection_str) {
473 Connection::ConnPropertyMap properties;

Callers 7

TYPED_TESTFunction · 0.85
ConnectWithStringMethod · 0.85
DisconnectMethod · 0.85
TYPED_TESTFunction · 0.85
TYPED_TESTFunction · 0.85
TEST_FFunction · 0.85

Calls 4

SqlWcharToStringFunction · 0.85
SQLGetDiagRecFunction · 0.50
emptyMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected