From ee6f8caea94914ca885cd73f5c86c7878c3f5a18 Mon Sep 17 00:00:00 2001 From: Gulliver Date: Tue, 21 Mar 2023 16:05:31 +0100 Subject: [PATCH] fixed plugin loading test --- CMakeLists.txt | 2 +- src/library/CMakeLists.txt | 14 +++----------- src/library/sqlite3/sqlite3_backend.cpp | 2 +- src/tests/CMakeLists.txt | 6 +++++- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8261b16..a62314b 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,7 +59,7 @@ set(BACKEND_DL_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/src/library) if (LITESQL_WITH_SQLITE3) set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS HAVE_LIBSQLITE3) option(LITESQL_USE_SYSTEM_SQLITE "use sqlite3 lib provided by system" ON) - list(APPEND BACKEND_LIBRARIES litesql_sqlite) +# list(APPEND BACKEND_LIBRARIES litesql_sqlite3) endif (LITESQL_WITH_SQLITE3) if (LITESQL_WITH_MYSQL AND MYSQL_FOUND) diff --git a/src/library/CMakeLists.txt b/src/library/CMakeLists.txt index ff1745c..58f86b9 100755 --- a/src/library/CMakeLists.txt +++ b/src/library/CMakeLists.txt @@ -91,17 +91,9 @@ else(LITESQL_USE_SYSTEM_SQLITE AND SQLITE3_FOUND) endif(LITESQL_USE_SYSTEM_SQLITE AND SQLITE3_FOUND) if (LITESQL_WITH_SQLITE3) - target_sources(${LIBNAME} - PRIVATE - sqlite3/sqlite3_backend.cpp) - target_include_directories(${LIBNAME} - PRIVATE - ${SQLITE3_INCLUDE_DIR} - ) - target_link_directories(${LIBNAME} - PUBLIC - ${SQLITE3_LIBRARIY_DIR} - ) + target_sources(${LIBNAME} PRIVATE sqlite3/sqlite3_backend.cpp) + target_include_directories(${LIBNAME} PRIVATE ${SQLITE3_INCLUDE_DIR}) + target_link_directories(${LIBNAME} PUBLIC ${SQLITE3_LIBRARY_DIR}) target_link_libraries(${LIBNAME} PUBLIC ${SQLITE3_LIBRARIES}) # add_library(${LIBNAME}_sqlite STATIC diff --git a/src/library/sqlite3/sqlite3_backend.cpp b/src/library/sqlite3/sqlite3_backend.cpp index d66ca3b..4616db3 100644 --- a/src/library/sqlite3/sqlite3_backend.cpp +++ b/src/library/sqlite3/sqlite3_backend.cpp @@ -110,7 +110,7 @@ SQLite3::SQLite3(const string& connInfo) noexcept(false) //throw(DatabaseError) , beginTrans("BEGIN") { vector params = split(connInfo,";"); - string database = ":memory:"; + string database; for (size_t i = 0; i < params.size(); i++) { vector param = split(params[i], "="); if (param.size() == 1) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index b1d99f0..da6ee36 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -32,8 +32,12 @@ set_tests_properties(test-update-table PROPERTIES ) endif (UNIX AND NOT APPLE AND NOT WIN32) + +# backend plugin related tests +if(LITESQL_WITH_BACKEND_PLUGINS) add_executable(test-backend-loading test-backend-loading.cpp) target_link_libraries (test-backend-loading litesql litesql-util ${BACKEND_LIBRARIES}) +target_include_directories(test-backend-loading PRIVATE ../library) add_dependencies(test-backend-loading litesql_backend_sqlite3) add_test(test-backend-loading ${EXECUTABLE_OUTPUT_PATH}/test-backend-loading backend-loading) @@ -53,5 +57,5 @@ set_tests_properties(test-backend-loading PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=${BACKEND_DL_DIRECTORY}" ) endif (UNIX AND NOT APPLE AND NOT WIN32) +endif (LITESQL_WITH_BACKEND_PLUGINS) -INCLUDE_DIRECTORIES(../library)