Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions cpp/src/arrow/flight/sql/odbc/odbc_impl/config/configuration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,30 @@ void Configuration::LoadDsn(const std::string& dsn) {
Set(FlightSqlConnection::TOKEN, ReadDsnString(dsn, FlightSqlConnection::TOKEN));
Set(FlightSqlConnection::UID, ReadDsnString(dsn, FlightSqlConnection::UID));
Set(FlightSqlConnection::PWD, ReadDsnString(dsn, FlightSqlConnection::PWD));
Set(FlightSqlConnection::USE_ENCRYPTION,
ReadDsnString(dsn, FlightSqlConnection::USE_ENCRYPTION, DEFAULT_ENABLE_ENCRYPTION));
Set(FlightSqlConnection::TRUSTED_CERTS,
ReadDsnString(dsn, FlightSqlConnection::TRUSTED_CERTS));

#ifndef __APPLE__

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes more sense to do the #ifdef APPLE first and let windows and linux be covered by #else rather than the other way around. It is more consistent with the rest of the code.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup good point, I have addressed your comment

// Windows and Linux
Set(FlightSqlConnection::USE_ENCRYPTION,
ReadDsnString(dsn, FlightSqlConnection::USE_ENCRYPTION, DEFAULT_ENABLE_ENCRYPTION));
Set(FlightSqlConnection::USE_SYSTEM_TRUST_STORE,
ReadDsnString(dsn, FlightSqlConnection::USE_SYSTEM_TRUST_STORE,
DEFAULT_USE_CERT_STORE));
Set(FlightSqlConnection::DISABLE_CERTIFICATE_VERIFICATION,
ReadDsnString(dsn, FlightSqlConnection::DISABLE_CERTIFICATE_VERIFICATION,
DEFAULT_DISABLE_CERT_VERIFICATION));
#else
// macOS iODBC treats non-empty defaults as the real values when reading from system
// DSN, so we don't pass defaults on macOS.
// GH-49387 TODO: enable default values on macOS
Set(FlightSqlConnection::USE_ENCRYPTION,
ReadDsnString(dsn, FlightSqlConnection::USE_ENCRYPTION));
Set(FlightSqlConnection::USE_SYSTEM_TRUST_STORE,
ReadDsnString(dsn, FlightSqlConnection::USE_SYSTEM_TRUST_STORE));
Set(FlightSqlConnection::DISABLE_CERTIFICATE_VERIFICATION,
ReadDsnString(dsn, FlightSqlConnection::DISABLE_CERTIFICATE_VERIFICATION));
#endif

auto customKeys = ReadAllKeys(dsn);
RemoveAllKnownKeys(customKeys);
Expand Down
Loading