Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e1f3d24
Draft code to reproduce
alinaliBQ Jun 18, 2025
6cc527c
Update .gitignore
alinaliBQ Jun 18, 2025
6ae2a5d
Attempt to fix spdlog issue
alinaliBQ Jun 18, 2025
bae63ab
Comment out odbc driver build
alinaliBQ Jun 19, 2025
542dd87
Run only connection test and flightsql-odbc test
alinaliBQ Jun 19, 2025
fb50e82
Revert "Comment out odbc driver build"
alinaliBQ Jun 19, 2025
b4f2dec
Remove unneeded lines in cmake
alinaliBQ Jun 19, 2025
a8291e3
Comment out unneeded runs
alinaliBQ Jun 19, 2025
ac305be
Attempt to fix SQL_ATTR_TRACEFILE issue
alinaliBQ Jun 19, 2025
b259caf
Attempt to fix conversion issue
alinaliBQ Jun 19, 2025
05bd1cf
Disable connection attribute tests to isolate seg fault
alinaliBQ Jun 19, 2025
0aa6783
Fix SQL_ATTR_QUIET_MODE output type
alinaliBQ Jun 19, 2025
98f2636
TestSQLSetConnectAttrAsyncDbcEventUnsupported enabled
alinaliBQ Jun 20, 2025
3775b29
Move ConnectAttr test to connection test
alinaliBQ Jun 20, 2025
6dde2ba
Move All ConnectAttr tests to connection test
alinaliBQ Jun 20, 2025
c5ef9ea
Add dummy test inside connect attr file
alinaliBQ Jun 20, 2025
32b716d
Switch dummy test to not use ODBC at all
alinaliBQ Jun 20, 2025
650ec72
Remove int main
alinaliBQ Jun 20, 2025
3290026
Add back int main
alinaliBQ Jun 20, 2025
3246fcd
Add DummyTestODBCRemote
alinaliBQ Jun 20, 2025
6bfca8a
Run Add DummyTestODBCMock only
alinaliBQ Jun 20, 2025
8de33ad
Run both DummyTestODBCMock and DummyTestODBCRemote
alinaliBQ Jun 20, 2025
687b688
Enable FlightSQLODBCTestBase
alinaliBQ Jun 20, 2025
034a654
Swap to have connection_attr_test before connection_test
alinaliBQ Jun 20, 2025
6ba21f6
Move tests back to connection_attr_test.cc
alinaliBQ Jun 20, 2025
86ece37
Remove comments
alinaliBQ Jun 20, 2025
95c6d9d
Update CMakeLists.txt
alinaliBQ Jun 20, 2025
d7ee20a
Rename to odbc test
alinaliBQ Jun 20, 2025
a174a6c
Remove extra sqwchar conversions
alinaliBQ Jun 20, 2025
294c8a6
Remove temp changes
alinaliBQ Jun 20, 2025
7ff2596
Update CMakeLists.txt
alinaliBQ Jun 20, 2025
1a0e972
Fix lint for cmake
alinaliBQ Jun 20, 2025
ac21f4a
Rename test executable to flight_sql_odbc_test
alinaliBQ Jun 20, 2025
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dependency-reduced-pom.xml
MANIFEST
compile_commands.json
build.ninja
build*/

# Generated Visual Studio files
*.vcxproj
Expand Down
12 changes: 11 additions & 1 deletion cpp/src/arrow/flight/sql/odbc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ endif()

add_definitions(-DUNICODE=1)

include(FetchContent)
fetchcontent_declare(spdlog
URL https://github.com/gabime/spdlog/archive/76fb40d95455f249bd70824ecfcae7a8f0930fa3.zip
CONFIGURE_COMMAND
""
BUILD_COMMAND
"")
fetchcontent_makeavailable(spdlog)

add_subdirectory(flight_sql)
add_subdirectory(odbcabstraction)
add_subdirectory(tests)
Expand Down Expand Up @@ -71,7 +80,8 @@ add_arrow_lib(arrow_flight_sql_odbc
${ODBC_LIBRARIES}
${ODBCINST}
odbcabstraction
arrow_odbc_spi_impl)
arrow_odbc_spi_impl
spdlog::spdlog)

foreach(LIB_TARGET ${ARROW_FLIGHT_SQL_ODBC_LIBRARIES})
target_compile_definitions(${LIB_TARGET} PRIVATE ARROW_FLIGHT_SQL_ODBC_EXPORTING)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void DsnConfigurationWindow::Create() {
throw odbcabstraction::DriverException(buf.str());
}
}
//-AL- fix this file next

void DsnConfigurationWindow::OnCreate() {
tabControl = CreateTabControl(ChildId::TAB_CONTROL);
tabControl->AddTab(L"Common", COMMON_TAB);
Expand Down
17 changes: 1 addition & 16 deletions cpp/src/arrow/flight/sql/odbc/odbcabstraction/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,4 @@ set_target_properties(odbcabstraction
RUNTIME_OUTPUT_DIRECTORY
${CMAKE_BINARY_DIR}/$<CONFIG>/lib)

include(FetchContent)
fetchcontent_declare(spdlog
URL https://github.com/gabime/spdlog/archive/76fb40d95455f249bd70824ecfcae7a8f0930fa3.zip
CONFIGURE_COMMAND
""
BUILD_COMMAND
"")
fetchcontent_getproperties(spdlog)
if(NOT spdlog_POPULATED)
fetchcontent_populate(spdlog)
endif()

add_library(spdlog INTERFACE)
target_include_directories(spdlog INTERFACE ${spdlog_SOURCE_DIR}/include)

target_link_libraries(odbcabstraction PUBLIC spdlog)
target_link_libraries(odbcabstraction PUBLIC spdlog::spdlog)
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ inline size_t ConvertToSqlWChar(const std::string_view& str, SQLWCHAR* buffer,
/// \param[in] msg_len Number of characters in wchar_msg
/// \return wchar_msg in std::string format
inline std::string SqlWcharToString(SQLWCHAR* wchar_msg, SQLSMALLINT msg_len = SQL_NTS) {
if (!wchar_msg || wchar_msg[0] == 0) {
if (!wchar_msg || wchar_msg[0] == 0 || msg_len == 0) {
return std::string();
}

Expand Down
5 changes: 3 additions & 2 deletions cpp/src/arrow/flight/sql/odbc/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ set(ARROW_FLIGHT_SQL_MOCK_SERVER_SRCS
../../example/sqlite_server.cc
../../example/sqlite_tables_schema_batch_reader.cc)

add_arrow_test(connection_test
Comment thread
alinaliBQ marked this conversation as resolved.
add_arrow_test(flight_sql_odbc_test
SOURCES
connection_test.cc
connection_attr_test.cc
# Connection test needs to be put last to resolve segfault issue
connection_test.cc
odbc_test_suite.cc
odbc_test_suite.h
${ARROW_FLIGHT_SQL_MOCK_SERVER_SRCS}
Expand Down
16 changes: 7 additions & 9 deletions cpp/src/arrow/flight/sql/odbc/tests/connection_attr_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@

#include "gtest/gtest.h"

namespace arrow {
namespace flight {
namespace odbc {
namespace integration_tests {
namespace arrow::flight::sql::odbc {

TYPED_TEST(FlightSQLODBCTestBase, TestSQLSetConnectAttrAsyncDbcEventUnsupported) {
this->connect();

Expand Down Expand Up @@ -272,6 +270,9 @@ TYPED_TEST(FlightSQLODBCTestBase, TestSQLGetConnectAttrTraceFileDMOnly) {
ODBC_BUFFER_SIZE, &outstrlen);

EXPECT_EQ(ret, SQL_SUCCESS);
// Length is returned in bytes for SQLGetConnectAttr,
// we want the number of characters
outstrlen /= driver::odbcabstraction::GetSqlWCharSize();
std::string out_connection_string =
ODBC::SqlWcharToString(outstr, static_cast<SQLSMALLINT>(outstrlen));
EXPECT_TRUE(!out_connection_string.empty());
Expand Down Expand Up @@ -429,7 +430,7 @@ TYPED_TEST(FlightSQLODBCTestBase, TestSQLGetConnectAttrEnlistInDtcDefault) {
TYPED_TEST(FlightSQLODBCTestBase, TestSQLGetConnectAttrQuietModeDefault) {
this->connect();

SQLPOINTER ptr = NULL;
HWND ptr = NULL;
SQLRETURN ret = SQLGetConnectAttr(this->conn, SQL_ATTR_QUIET_MODE, ptr, 0, 0);

EXPECT_EQ(ret, SQL_SUCCESS);
Expand Down Expand Up @@ -561,7 +562,4 @@ TYPED_TEST(FlightSQLODBCTestBase, TestSQLSetConnectAttrPacketSizeValid) {
this->disconnect();
}

} // namespace integration_tests
} // namespace odbc
} // namespace flight
} // namespace arrow
} // namespace arrow::flight::sql::odbc
11 changes: 3 additions & 8 deletions cpp/src/arrow/flight/sql/odbc/tests/connection_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@

#include "gtest/gtest.h"

namespace arrow {
namespace flight {
namespace odbc {
namespace integration_tests {
namespace arrow::flight::sql::odbc {

TEST(SQLAllocHandle, TestSQLAllocHandleEnv) {
// ODBC Environment
SQLHENV env;
Expand Down Expand Up @@ -1076,10 +1074,7 @@ TYPED_TEST(FlightSQLODBCTestBase, TestCloseConnectionWithOpenStatement) {
EXPECT_EQ(ret, SQL_SUCCESS);
}

} // namespace integration_tests
} // namespace odbc
} // namespace flight
} // namespace arrow
} // namespace arrow::flight::sql::odbc

int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
Expand Down
11 changes: 3 additions & 8 deletions cpp/src/arrow/flight/sql/odbc/tests/odbc_test_suite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@
#include "arrow/flight/sql/odbc/flight_sql/include/flight_sql/config/configuration.h"
#include "arrow/flight/sql/odbc/odbcabstraction/include/odbcabstraction/odbc_impl/odbc_connection.h"

namespace arrow {
namespace flight {
namespace odbc {
namespace integration_tests {
namespace arrow::flight::sql::odbc {

void FlightSQLODBCRemoteTestBase::allocEnvConnHandles() {
// Allocate an environment handle
Expand Down Expand Up @@ -272,7 +269,5 @@ bool writeDSN(Connection::ConnPropertyMap properties) {
std::wstring wDriver = arrow::util::UTF8ToWideString(driver).ValueOr(L"");
return RegisterDsn(config, wDriver.c_str());
}
} // namespace integration_tests
} // namespace odbc
} // namespace flight
} // namespace arrow

} // namespace arrow::flight::sql::odbc
10 changes: 2 additions & 8 deletions cpp/src/arrow/flight/sql/odbc/tests/odbc_test_suite.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@
#define TEST_CONNECT_STR "ARROW_FLIGHT_SQL_ODBC_CONN"
#define TEST_DSN "Apache Arrow Flight SQL Test DSN"

namespace arrow {
namespace flight {
namespace odbc {
namespace integration_tests {
namespace arrow::flight::sql::odbc {
using driver::odbcabstraction::Connection;

class FlightSQLODBCRemoteTestBase : public ::testing::Test {
Expand Down Expand Up @@ -177,7 +174,4 @@ bool writeDSN(std::string connection_str);
/// \param[in] properties map.
/// \return true on success
bool writeDSN(Connection::ConnPropertyMap properties);
} // namespace integration_tests
} // namespace odbc
} // namespace flight
} // namespace arrow
} // namespace arrow::flight::sql::odbc
Loading