2020#include " arrow/result.h"
2121#include " arrow/util/utf8.h"
2222
23+ #include < iostream>
2324#include < sstream>
2425
2526namespace arrow ::flight::sql::odbc {
@@ -77,15 +78,24 @@ bool UnregisterDsn(const std::wstring& dsn) {
7778 * @return True on success and false on fail.
7879 */
7980bool 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
0 commit comments