-
Notifications
You must be signed in to change notification settings - Fork 3.9k
GH-46098 : [C++][FlightRPC] ODBC Environment Attribute Implementation #47760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: rscales <[email protected]>
8d6f722
to
5da7b4f
Compare
namespace arrow::flight::sql::odbc { | ||
|
||
TEST(SQLGetEnvAttr, TestSQLGetEnvAttrODBCVersion) { | ||
// ODBC Environment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, but I don't think these comments add anything
if (!value_ptr && !str_len_ptr) { | ||
throw DriverException("Invalid null pointer for attribute.", "HY000"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test this case as well?
#ifdef _WIN32 | ||
# include <windows.h> | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use cpp/src/arrow/flight/sql/odbc/odbcabstraction/include/odbcabstraction/platform.h
instead?
// Allocate an environment handle | ||
SQLRETURN return_env = SQLAllocEnv(&env); | ||
|
||
EXPECT_EQ(SQL_SUCCESS, return_env); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use ASSERT_EQ()
not EXPECT_EQ()
?
Do we need to proceed this test even when this assertion is failed?
SQLRETURN return_set = | ||
SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, reinterpret_cast<void*>(SQL_OV_ODBC2), 0); | ||
|
||
EXPECT_EQ(SQL_SUCCESS, return_set); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is SQL_SUCCESS
expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we assert set value by SQLGetEnvAttr()
?
|
||
EXPECT_EQ(SQL_SUCCESS, return_env); | ||
|
||
// Attempt to set to unsupported version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment correct?
ARROW_LOG(DEBUG) << "SQLGetEnvAttr called with env: " << env << ", attr: " << attr | ||
<< ", value_ptr: " << value_ptr << ", buffer_length: " << buffer_length | ||
<< ", str_len_ptr: " << static_cast<const void*>(str_len_ptr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove this debug print now?
if (!value_ptr && !str_len_ptr) { | ||
throw DriverException("Invalid null pointer for attribute.", "HY000"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we check this out of this switch
?
Rationale for this change
ODBC driver needs to set and get environment attributes, such as ODBC driver version.
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?
No