-
Notifications
You must be signed in to change notification settings - Fork 4k
GH-46574: [C++][FlightRPC] ODBC Driver Connectivity support #47971
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
Changes from all commits
c276d40
6f296a8
6d260ad
fec523c
3d95eee
c23ff57
2f88ba4
58cb05a
e06a5e0
cfcc956
f37d7e3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,17 +17,17 @@ | |
|
|
||
| #pragma once | ||
|
|
||
| #include <arrow/flight/sql/odbc/odbc_impl/diagnostics.h> | ||
| #include <arrow/flight/sql/odbc/odbc_impl/exceptions.h> | ||
| #include <arrow/flight/sql/odbc/odbc_impl/platform.h> | ||
| #include <sql.h> | ||
| #include <sqlext.h> | ||
| #include <algorithm> | ||
| #include <cstring> | ||
| #include <memory> | ||
| #include "arrow/flight/sql/odbc/odbc_impl/diagnostics.h" | ||
| #include "arrow/flight/sql/odbc/odbc_impl/encoding_utils.h" | ||
| #include "arrow/flight/sql/odbc/odbc_impl/exceptions.h" | ||
| #include "arrow/flight/sql/odbc/odbc_impl/platform.h" | ||
|
|
||
| #include <arrow/flight/sql/odbc/odbc_impl/encoding_utils.h> | ||
|
|
||
| // GH-48083 TODO: replace `namespace ODBC` with `namespace arrow::flight::sql::odbc` | ||
| namespace ODBC { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (maybe for a separate issue but) can we fix this namespace?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yea we can do it for a separate issue. Are we thinking of replacing
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have created issue #48083, @justing-bq please link this issue in the code, thanks!
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a link to the github issue. |
||
|
|
||
| using arrow::flight::sql::odbc::Diagnostics; | ||
|
|
@@ -48,12 +48,12 @@ inline void GetAttribute(T attribute_value, SQLPOINTER output, O output_size, | |
| } | ||
|
|
||
| template <typename O> | ||
| inline SQLRETURN GetAttributeUTF8(const std::string& attribute_value, SQLPOINTER output, | ||
| inline SQLRETURN GetAttributeUTF8(std::string_view attribute_value, SQLPOINTER output, | ||
| O output_size, O* output_len_ptr) { | ||
| if (output) { | ||
| size_t output_len_before_null = | ||
| std::min(static_cast<O>(attribute_value.size()), static_cast<O>(output_size - 1)); | ||
| memcpy(output, attribute_value.c_str(), output_len_before_null); | ||
| std::memcpy(output, attribute_value.data(), output_len_before_null); | ||
| reinterpret_cast<char*>(output)[output_len_before_null] = '\0'; | ||
| } | ||
|
|
||
|
|
@@ -68,7 +68,7 @@ inline SQLRETURN GetAttributeUTF8(const std::string& attribute_value, SQLPOINTER | |
| } | ||
|
|
||
| template <typename O> | ||
| inline SQLRETURN GetAttributeUTF8(const std::string& attribute_value, SQLPOINTER output, | ||
| inline SQLRETURN GetAttributeUTF8(std::string_view attribute_value, SQLPOINTER output, | ||
| O output_size, O* output_len_ptr, | ||
| Diagnostics& diagnostics) { | ||
| SQLRETURN result = | ||
|
|
@@ -80,7 +80,7 @@ inline SQLRETURN GetAttributeUTF8(const std::string& attribute_value, SQLPOINTER | |
| } | ||
|
|
||
| template <typename O> | ||
| inline SQLRETURN GetAttributeSQLWCHAR(const std::string& attribute_value, | ||
| inline SQLRETURN GetAttributeSQLWCHAR(std::string_view attribute_value, | ||
| bool is_length_in_bytes, SQLPOINTER output, | ||
| O output_size, O* output_len_ptr) { | ||
| size_t length = ConvertToSqlWChar( | ||
|
|
@@ -104,7 +104,7 @@ inline SQLRETURN GetAttributeSQLWCHAR(const std::string& attribute_value, | |
| } | ||
|
|
||
| template <typename O> | ||
| inline SQLRETURN GetAttributeSQLWCHAR(const std::string& attribute_value, | ||
| inline SQLRETURN GetAttributeSQLWCHAR(std::string_view attribute_value, | ||
| bool is_length_in_bytes, SQLPOINTER output, | ||
| O output_size, O* output_len_ptr, | ||
| Diagnostics& diagnostics) { | ||
|
|
@@ -117,7 +117,7 @@ inline SQLRETURN GetAttributeSQLWCHAR(const std::string& attribute_value, | |
| } | ||
|
|
||
| template <typename O> | ||
| inline SQLRETURN GetStringAttribute(bool is_unicode, const std::string& attribute_value, | ||
| inline SQLRETURN GetStringAttribute(bool is_unicode, std::string_view attribute_value, | ||
| bool is_length_in_bytes, SQLPOINTER output, | ||
| O output_size, O* output_len_ptr, | ||
| Diagnostics& diagnostics) { | ||
|
|
||
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.
As discussed in #48019, we will try to enable ODBC on MSVC, so I am removing ODBC build from MinGW here