Skip to content

Commit fe8b9ed

Browse files
committed
investigate
1 parent 677676b commit fe8b9ed

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

cpp/src/arrow/flight/sql/odbc/odbc_impl/system_dsn.cc

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "arrow/result.h"
2121
#include "arrow/util/utf8.h"
2222

23+
#include <iostream>
2324
#include <sstream>
2425

2526
namespace arrow::flight::sql::odbc {
@@ -77,15 +78,24 @@ bool UnregisterDsn(const std::wstring& dsn) {
7778
* @return True on success and false on fail.
7879
*/
7980
bool RegisterDsn(const Configuration& config, LPCWSTR driver) {
81+
std::cout << "Undahbile: Registering DSN: " << config.Get(FlightSqlConnection::DSN)
82+
<< std::endl;
83+
8084
const std::string& dsn = config.Get(FlightSqlConnection::DSN);
85+
std::cout << "Undahbile: Using dsn = " << dsn << std::endl;
86+
8187
auto wdsn_result = arrow::util::UTF8ToWideString(dsn);
88+
std::cout << "Undahbile: Converted wdsn_result" << std::endl;
8289
if (!wdsn_result.status().ok()) {
90+
std::cout << "Undahbile: Error converting wdsn_result" << std::endl;
8391
PostArrowUtilError(wdsn_result.status());
8492
return false;
8593
}
86-
std::wstring wdsn = wdsn_result.ValueOrDie();
8794

95+
std::wstring wdsn = wdsn_result.ValueOrDie();
96+
std::wcout << "Undahbile: Converted wdsn = " << wdsn << std::endl;
8897
if (!SQLWriteDSNToIni(wdsn.c_str(), driver)) {
98+
std::cout << "Undahbile: Error writing DSN to ini" << std::endl;
8999
PostLastInstallerError();
90100
return false;
91101
}
@@ -100,25 +110,28 @@ bool RegisterDsn(const Configuration& config, LPCWSTR driver) {
100110

101111
auto wkey_result = arrow::util::UTF8ToWideString(key);
102112
if (!wkey_result.status().ok()) {
113+
std::cout << "Undahbile: Error converting wkey_result = " << wkey_result.status().message() << std::endl;
103114
PostArrowUtilError(wkey_result.status());
104115
return false;
105116
}
106117
std::wstring wkey = wkey_result.ValueOrDie();
107118

108119
auto wvalue_result = arrow::util::UTF8ToWideString(it->second);
109120
if (!wvalue_result.status().ok()) {
121+
std::cout << "Undahbile: Error converting wvalue_result = " << wvalue_result.status().message() << std::endl;
110122
PostArrowUtilError(wvalue_result.status());
111123
return false;
112124
}
113125
std::wstring wvalue = wvalue_result.ValueOrDie();
114-
115126
if (!SQLWritePrivateProfileString(wdsn.c_str(), wkey.c_str(), wvalue.c_str(),
116127
L"ODBC.INI")) {
128+
std::cout << "Undahbile: Error writing private profile string" << std::endl;
117129
PostLastInstallerError();
118130
return false;
119131
}
120132
}
121133

134+
std::cout << "Undahbile: Successfully registered DSN" << std::endl;
122135
return true;
123136
}
124137
} // namespace arrow::flight::sql::odbc

cpp/src/arrow/flight/sql/odbc/tests/odbc_test_suite.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
#include "arrow/flight/sql/odbc/odbc_impl/encoding_utils.h"
2727
#include "arrow/flight/sql/odbc/odbc_impl/odbc_connection.h"
2828

29+
#include <iostream>
30+
2931
namespace arrow::flight::sql::odbc {
3032

3133
void ODBCRemoteTestBase::AllocEnvConnHandles(SQLINTEGER odbc_ver) {
@@ -42,12 +44,15 @@ void ODBCRemoteTestBase::AllocEnvConnHandles(SQLINTEGER odbc_ver) {
4244
}
4345

4446
void ODBCRemoteTestBase::Connect(SQLINTEGER odbc_ver) {
47+
std::cout << "Undahbile: ODBCRemoteTestBase::Connect()" << std::endl;
4548
ASSERT_NO_FATAL_FAILURE(AllocEnvConnHandles(odbc_ver));
4649
std::string connect_str = GetConnectionString();
4750
ASSERT_NO_FATAL_FAILURE(ConnectWithString(connect_str));
4851
}
4952

5053
void ODBCRemoteTestBase::ConnectWithString(std::string connect_str) {
54+
std::cout << "Undahbile: ODBCRemoteTestBase::ConnectWithString() with connect_str = " << connect_str << std::endl;
55+
5156
// Connect string
5257
std::vector<SQLWCHAR> connect_str0(connect_str.begin(), connect_str.end());
5358

@@ -61,6 +66,8 @@ void ODBCRemoteTestBase::ConnectWithString(std::string connect_str) {
6166
kOdbcBufferSize, &out_str_len, SQL_DRIVER_NOPROMPT))
6267
<< GetOdbcErrorMessage(SQL_HANDLE_DBC, conn);
6368

69+
std::cout << "Undahbile: Connected to ODBC server successfully" << std::endl;
70+
6471
ASSERT_EQ(SQL_SUCCESS, SQLAllocHandle(SQL_HANDLE_STMT, conn, &stmt));
6572
}
6673

@@ -370,7 +377,9 @@ void ODBCMockTestBase::SetUp() {
370377
}
371378

372379
void FlightSQLODBCMockTestBase::SetUp() {
380+
std::cout << "Undahbile: FlightSQLODBCMockTestBase::SetUp()" << std::endl;
373381
ODBCMockTestBase::SetUp();
382+
std::cout << "Undahbile: After ODBCMockTestBase::SetUp()" << std::endl;
374383
this->Connect();
375384
connected_ = true;
376385
}

0 commit comments

Comments
 (0)