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

Function GetOdbcErrorMessage

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

Source from the content-addressed store, hash-verified

518}
519
520std::string GetOdbcErrorMessage(SQLSMALLINT handle_type, SQLHANDLE handle) {
521 using ODBC::SqlWcharToString;
522
523 SQLWCHAR sql_state[7] = {};
524 SQLINTEGER native_code;
525
526 SQLWCHAR message[kOdbcBufferSize] = {};
527 SQLSMALLINT real_len = 0;
528
529 // On Windows, real_len is in bytes. On Linux, real_len is in chars.
530 // So, not using real_len
531 SQLGetDiagRec(handle_type, handle, 1, sql_state, &native_code, message, kOdbcBufferSize,
532 &real_len);
533
534 std::string res = SqlWcharToString(sql_state);
535
536 if (res.empty() || !message[0]) {
537 res = "Cannot find ODBC error message";
538 } else {
539 res.append(": ").append(SqlWcharToString(message));
540 }
541
542 return res;
543}
544
545bool WriteDSN(std::string connection_str) {
546 Connection::ConnPropertyMap properties;

Callers 5

ConnectWithStringMethod · 0.85
DisconnectMethod · 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