From bb339b0317bfc93172be7e2e51ff3383f41062c9 Mon Sep 17 00:00:00 2001 From: tqcq <99722391+tqcq@users.noreply.github.com> Date: Sat, 6 Jan 2024 20:29:49 +0800 Subject: [PATCH 1/9] feat add sqlpp11 --- 3party/sqlpp11 | 1 + CMakeLists.txt | 1 + tests/3party/sqlpp11/sqlpp11_unittest.cpp | 1 + 3 files changed, 3 insertions(+) create mode 160000 3party/sqlpp11 create mode 100644 tests/3party/sqlpp11/sqlpp11_unittest.cpp diff --git a/3party/sqlpp11 b/3party/sqlpp11 new file mode 160000 index 0000000..7f04435 --- /dev/null +++ b/3party/sqlpp11 @@ -0,0 +1 @@ +Subproject commit 7f04435576036fc3f06d929760b5c7623485f069 diff --git a/CMakeLists.txt b/CMakeLists.txt index bd35944..d7379c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,6 +68,7 @@ set(FMT_USE_CPP11 OFF CACHE BOOL "Use C++11" FORCE) set(FMT_TEST OFF CACHE BOOL "Build tests" FORCE) set(FMT_USE_CPP11 OFF CACHE BOOL "Use C++11" FORCE) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/3party/fmt) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/3party/sqlpp11) set(JSONCPP_WITH_TESTS OFF) set(JSONCPP_WITH_POST_BUILD_UNITTEST OFF) diff --git a/tests/3party/sqlpp11/sqlpp11_unittest.cpp b/tests/3party/sqlpp11/sqlpp11_unittest.cpp new file mode 100644 index 0000000..2180533 --- /dev/null +++ b/tests/3party/sqlpp11/sqlpp11_unittest.cpp @@ -0,0 +1 @@ +#include From 1210282c7be05f2f09f58090a261e1ed2730d333 Mon Sep 17 00:00:00 2001 From: tqcq <99722391+tqcq@users.noreply.github.com> Date: Sat, 6 Jan 2024 20:37:09 +0800 Subject: [PATCH 2/9] fix miss .gitmodules --- .gitmodules | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitmodules b/.gitmodules index 2402d61..3f18805 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,3 +2,7 @@ path = 3party/googletest url = https://code.uocat.com/3party/googletest branch = release-1.7.0 +[submodule "3party/sqlpp11"] + path = 3party/sqlpp11 + url = https://code.uocat.com/3party/sqlpp11 + branch = 0.64 From e1d99b3a49de583c214a945de4a4ec69d7b5609e Mon Sep 17 00:00:00 2001 From: tqcq <99722391+tqcq@users.noreply.github.com> Date: Sat, 6 Jan 2024 20:44:29 +0800 Subject: [PATCH 3/9] feat update unittest --- CMakeLists.txt | 2 +- tests/3party/sqlpp11/sqlpp11_unittest.cpp | 4 ++++ tests/CMakeLists.txt | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d7379c9..64b36ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,7 +83,7 @@ target_sources(${PROJECT_NAME} PRIVATE src/ulib/log/log.cpp src/ulib/log/level.cpp ) -target_link_libraries(${PROJECT_NAME} PUBLIC fmt::fmt jsoncpp_static) +target_link_libraries(${PROJECT_NAME} PUBLIC fmt::fmt jsoncpp_static sqlpp11::sqlpp11) target_compile_definitions(${PROJECT_NAME} PRIVATE ULIB_LIBRARY_IMPL) target_include_directories(${PROJECT_NAME} PUBLIC 3party/inja diff --git a/tests/3party/sqlpp11/sqlpp11_unittest.cpp b/tests/3party/sqlpp11/sqlpp11_unittest.cpp index 2180533..69f04fa 100644 --- a/tests/3party/sqlpp11/sqlpp11_unittest.cpp +++ b/tests/3party/sqlpp11/sqlpp11_unittest.cpp @@ -1 +1,5 @@ #include +#include +#include + +TEST(sqlpp11, select) { select(sqlpp::value(false).as(sqlpp::alias::a)); } diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 779c746..7c653dd 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -14,6 +14,7 @@ add_executable(ulib_test ulib/system/timer_unittest.cpp 3party/inja/inja_unittest.cpp 3party/optional/optional_unittest.cpp + 3party/sqlpp11/sqlpp11_unittest.cpp ulib/utils/defer_unittest.cpp ) target_link_libraries(ulib_test PRIVATE From 50d24b9a4b15e32276bc39dee8d8f36d7a6f4506 Mon Sep 17 00:00:00 2001 From: tqcq <99722391+tqcq@users.noreply.github.com> Date: Sat, 6 Jan 2024 20:49:35 +0800 Subject: [PATCH 4/9] fix install git for ExternalProject --- .gitea/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index f2a623b..6fe40da 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -93,5 +93,5 @@ jobs: run: | cd ${{ github.workspace }} sudo apt-get update - sudo apt-get install -y libarchive-dev libssl-dev autoconf libtool pkg-config cmake make gcc g++ + sudo apt-get install -y libarchive-dev libssl-dev autoconf libtool pkg-config cmake make gcc g++ git ${{ env.build_command }} From 39b93792d2089b44ec00212b35b7a58cb7ec4810 Mon Sep 17 00:00:00 2001 From: tqcq <99722391+tqcq@users.noreply.github.com> Date: Sat, 6 Jan 2024 20:52:42 +0800 Subject: [PATCH 5/9] fix miss git --- .gitea/workflows/linux-hisiv500-gcc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/linux-hisiv500-gcc.yaml b/.gitea/workflows/linux-hisiv500-gcc.yaml index 024d0be..947e391 100644 --- a/.gitea/workflows/linux-hisiv500-gcc.yaml +++ b/.gitea/workflows/linux-hisiv500-gcc.yaml @@ -79,7 +79,7 @@ jobs: run: | cd ${{ github.workspace }} sudo apt-get update - sudo apt-get install -y libarchive-dev libssl-dev autoconf libtool pkg-config cmake make gcc g++ + sudo apt-get install -y libarchive-dev libssl-dev autoconf libtool pkg-config cmake make gcc g++ git cmake . -Bbuild -DCMAKE_TOOLCHAIN_FILE=toolchains/hisiv500.toolchain.cmake -DULIB_BUILD_TESTS=OFF -DCMAKE_CROSSCOMPILING_EMULATOR="qemu-arm;-L;/opt/hisi-linux/x86-arm/arm-hisiv500-linux/" cmake --build build --target all -- -j `nproc` From 9ec8eb952e8a8b8b541f5ace67530d3b02cd112d Mon Sep 17 00:00:00 2001 From: tqcq <99722391+tqcq@users.noreply.github.com> Date: Sat, 6 Jan 2024 21:51:10 +0800 Subject: [PATCH 6/9] fix use mirror repository of date --- .gitmodules | 4 - 3party/sqlpp11 | 1 - 3party/sqlpp11/.appveyor.yml | 31 + 3party/sqlpp11/.clang-format | 54 ++ 3party/sqlpp11/.gitignore | 2 + 3party/sqlpp11/.travis.yml | 45 + 3party/sqlpp11/CMakeLists.txt | 166 ++++ 3party/sqlpp11/CREDITS | 19 + 3party/sqlpp11/ChangeLog.md | 109 +++ 3party/sqlpp11/LICENSE | 23 + 3party/sqlpp11/README.md | 287 +++++++ 3party/sqlpp11/_config.yml | 1 + .../sqlpp11/cmake/Sqlpp11TargetHelper.cmake | 65 ++ .../sqlpp11/cmake/configs/Sqlpp11Config.cmake | 71 ++ .../cmake/configs/Sqlpp11MariaDBConfig.cmake | 2 + .../cmake/configs/Sqlpp11MySQLConfig.cmake | 2 + .../configs/Sqlpp11PostgreSQLConfig.cmake | 2 + .../configs/Sqlpp11SQLCipherConfig.cmake | 2 + .../cmake/configs/Sqlpp11SQLite3Config.cmake | 2 + .../sqlpp11/cmake/modules/FindMariaDB.cmake | 64 ++ 3party/sqlpp11/cmake/modules/FindMySQL.cmake | 71 ++ .../sqlpp11/cmake/modules/FindSQLCipher.cmake | 115 +++ 3party/sqlpp11/connector_api/bind_result.h | 89 ++ 3party/sqlpp11/connector_api/connection.h | 227 +++++ .../sqlpp11/connector_api/connection_pool.h | 39 + 3party/sqlpp11/connector_api/interpreter.h | 58 ++ .../connector_api/prepared_statement.h | 57 ++ 3party/sqlpp11/coveralls | 31 + 3party/sqlpp11/dependencies/CMakeLists.txt | 36 + .../dependencies/hinnant_date/CMakeLists.txt | 28 + 3party/sqlpp11/docs/Connection-Pools.md | 111 +++ 3party/sqlpp11/docs/Database.md | 16 + 3party/sqlpp11/docs/Dynamic-Insert.md | 33 + 3party/sqlpp11/docs/Dynamic-Select.md | 69 ++ 3party/sqlpp11/docs/Exception-Handling.md | 10 + 3party/sqlpp11/docs/Functions.md | 91 ++ 3party/sqlpp11/docs/Home.md | 27 + 3party/sqlpp11/docs/Insert.md | 42 + 3party/sqlpp11/docs/NULL.md | 100 +++ 3party/sqlpp11/docs/New-Features.md | 58 ++ 3party/sqlpp11/docs/Prepared-Statements.md | 48 ++ 3party/sqlpp11/docs/Remove.md | 20 + 3party/sqlpp11/docs/Select.md | 242 ++++++ 3party/sqlpp11/docs/Tables.md | 8 + 3party/sqlpp11/docs/Threads.md | 19 + 3party/sqlpp11/docs/Transactions.md | 44 + 3party/sqlpp11/docs/Update.md | 5 + .../examples/connection_pool/CMakeLists.txt | 48 ++ .../connection_pool/src/db_connection.cpp | 15 + .../connection_pool/src/db_connection.h | 31 + .../connection_pool/src/db_global.cpp | 12 + .../examples/connection_pool/src/db_global.h | 7 + .../examples/connection_pool/src/main.cpp | 38 + .../usage_fetch_content/CMakeLists.txt | 38 + .../dependencies/CMakeLists.txt | 32 + .../dependencies/sqlpp11/CMakeLists.txt | 34 + .../usage_fetch_content/src/CMakeLists.txt | 40 + .../examples/usage_fetch_content/src/main.cpp | 8 + .../usage_find_package/CMakeLists.txt | 42 + .../usage_find_package/src/CMakeLists.txt | 39 + .../examples/usage_find_package/src/main.cpp | 8 + .../sqlpp11/aggregate_function_operators.h | 39 + .../include/sqlpp11/aggregate_functions.h | 33 + .../include/sqlpp11/aggregate_functions/avg.h | 116 +++ .../sqlpp11/aggregate_functions/count.h | 119 +++ .../include/sqlpp11/aggregate_functions/max.h | 112 +++ .../include/sqlpp11/aggregate_functions/min.h | 112 +++ .../include/sqlpp11/aggregate_functions/sum.h | 116 +++ 3party/sqlpp11/include/sqlpp11/alias.h | 65 ++ .../sqlpp11/include/sqlpp11/alias_operators.h | 42 + .../sqlpp11/include/sqlpp11/alias_provider.h | 127 +++ 3party/sqlpp11/include/sqlpp11/all_of.h | 36 + 3party/sqlpp11/include/sqlpp11/any.h | 71 ++ 3party/sqlpp11/include/sqlpp11/assignment.h | 70 ++ 3party/sqlpp11/include/sqlpp11/auto_alias.h | 62 ++ .../sqlpp11/include/sqlpp11/bad_expression.h | 49 ++ .../sqlpp11/basic_expression_operators.h | 316 +++++++ .../include/sqlpp11/boolean_expression.h | 74 ++ 3party/sqlpp11/include/sqlpp11/case.h | 182 ++++ .../sqlpp11/include/sqlpp11/char_sequence.h | 76 ++ 3party/sqlpp11/include/sqlpp11/chrono.h | 54 ++ 3party/sqlpp11/include/sqlpp11/column.h | 119 +++ 3party/sqlpp11/include/sqlpp11/column_fwd.h | 33 + 3party/sqlpp11/include/sqlpp11/column_types.h | 29 + .../include/sqlpp11/compat/make_unique.h | 51 ++ 3party/sqlpp11/include/sqlpp11/connection.h | 158 ++++ .../sqlpp11/include/sqlpp11/connection_pool.h | 159 ++++ 3party/sqlpp11/include/sqlpp11/consistent.h | 40 + 3party/sqlpp11/include/sqlpp11/cte.h | 275 ++++++ 3party/sqlpp11/include/sqlpp11/custom_query.h | 147 ++++ 3party/sqlpp11/include/sqlpp11/data_types.h | 38 + .../sqlpp11/include/sqlpp11/data_types/blob.h | 39 + .../data_types/blob/column_operators.h | 55 ++ .../sqlpp11/data_types/blob/data_type.h | 48 ++ .../data_types/blob/expression_operators.h | 68 ++ .../include/sqlpp11/data_types/blob/operand.h | 80 ++ .../sqlpp11/data_types/blob/parameter_value.h | 50 ++ .../sqlpp11/data_types/blob/result_field.h | 84 ++ .../sqlpp11/data_types/blob/wrap_operand.h | 49 ++ .../include/sqlpp11/data_types/boolean.h | 35 + .../data_types/boolean/column_operators.h | 39 + .../sqlpp11/data_types/boolean/data_type.h | 43 + .../data_types/boolean/expression_operators.h | 61 ++ .../sqlpp11/data_types/boolean/operand.h | 69 ++ .../data_types/boolean/parameter_value.h | 48 ++ .../sqlpp11/data_types/boolean/result_field.h | 53 ++ .../sqlpp11/data_types/boolean/wrap_operand.h | 40 + .../sqlpp11/data_types/column_operators.h | 38 + .../include/sqlpp11/data_types/day_point.h | 35 + .../data_types/day_point/column_operators.h | 42 + .../sqlpp11/data_types/day_point/data_type.h | 46 ++ .../day_point/expression_operators.h | 40 + .../sqlpp11/data_types/day_point/operand.h | 68 ++ .../data_types/day_point/parameter_value.h | 50 ++ .../data_types/day_point/result_field.h | 70 ++ .../data_types/day_point/wrap_operand.h | 43 + .../sqlpp11/data_types/floating_point.h | 35 + .../floating_point/column_operators.h | 78 ++ .../data_types/floating_point/data_type.h | 41 + .../floating_point/expression_operators.h | 84 ++ .../data_types/floating_point/operand.h | 65 ++ .../floating_point/parameter_value.h | 50 ++ .../data_types/floating_point/result_field.h | 54 ++ .../data_types/floating_point/wrap_operand.h | 41 + .../include/sqlpp11/data_types/integral.h | 35 + .../data_types/integral/column_operators.h | 79 ++ .../sqlpp11/data_types/integral/data_type.h | 46 ++ .../integral/expression_operators.h | 148 ++++ .../sqlpp11/data_types/integral/operand.h | 67 ++ .../data_types/integral/parameter_value.h | 48 ++ .../data_types/integral/result_field.h | 53 ++ .../data_types/integral/wrap_operand.h | 43 + .../include/sqlpp11/data_types/no_value.h | 35 + .../data_types/no_value/column_operators.h | 39 + .../sqlpp11/data_types/no_value/data_type.h | 41 + .../no_value/expression_operators.h | 39 + .../sqlpp11/data_types/no_value/operand.h | 27 + .../data_types/no_value/parameter_value.h | 27 + .../data_types/no_value/result_field.h | 70 ++ .../data_types/no_value/wrap_operand.h | 27 + .../sqlpp11/data_types/parameter_value.h | 38 + .../sqlpp11/data_types/parameter_value_base.h | 91 ++ .../sqlpp11/include/sqlpp11/data_types/text.h | 39 + .../data_types/text/column_operators.h | 55 ++ .../include/sqlpp11/data_types/text/concat.h | 94 +++ .../sqlpp11/data_types/text/data_type.h | 46 ++ .../data_types/text/expression_operators.h | 70 ++ .../include/sqlpp11/data_types/text/like.h | 89 ++ .../include/sqlpp11/data_types/text/operand.h | 80 ++ .../sqlpp11/data_types/text/parameter_value.h | 70 ++ .../sqlpp11/data_types/text/result_field.h | 87 ++ .../data_types/text/return_type_like.h | 41 + .../sqlpp11/data_types/text/wrap_operand.h | 53 ++ .../include/sqlpp11/data_types/time_of_day.h | 35 + .../data_types/time_of_day/column_operators.h | 42 + .../data_types/time_of_day/data_type.h | 42 + .../time_of_day/expression_operators.h | 41 + .../sqlpp11/data_types/time_of_day/operand.h | 69 ++ .../data_types/time_of_day/parameter_value.h | 50 ++ .../data_types/time_of_day/result_field.h | 70 ++ .../data_types/time_of_day/wrap_operand.h | 39 + .../include/sqlpp11/data_types/time_point.h | 35 + .../data_types/time_point/column_operators.h | 42 + .../sqlpp11/data_types/time_point/data_type.h | 42 + .../time_point/expression_operators.h | 41 + .../sqlpp11/data_types/time_point/operand.h | 72 ++ .../data_types/time_point/parameter_value.h | 50 ++ .../data_types/time_point/result_field.h | 73 ++ .../data_types/time_point/wrap_operand.h | 39 + .../sqlpp11/data_types/unsigned_integral.h | 35 + .../unsigned_integral/column_operators.h | 79 ++ .../data_types/unsigned_integral/data_type.h | 46 ++ .../unsigned_integral/expression_operators.h | 129 +++ .../data_types/unsigned_integral/operand.h | 67 ++ .../unsigned_integral/parameter_value.h | 48 ++ .../unsigned_integral/result_field.h | 53 ++ .../unsigned_integral/wrap_operand.h | 43 + .../sqlpp11/include/sqlpp11/default_value.h | 47 ++ .../include/sqlpp11/detail/circular_buffer.h | 150 ++++ .../sqlpp11/detail/column_tuple_merge.h | 55 ++ .../include/sqlpp11/detail/enable_if.h | 38 + .../sqlpp11/detail/float_safe_ostringstream.h | 72 ++ .../include/sqlpp11/detail/get_first.h | 54 ++ .../sqlpp11/include/sqlpp11/detail/get_last.h | 54 ++ .../include/sqlpp11/detail/index_sequence.h | 60 ++ .../include/sqlpp11/detail/parse_date_time.h | 265 ++++++ .../sqlpp11/include/sqlpp11/detail/pick_arg.h | 54 ++ .../sqlpp11/include/sqlpp11/detail/type_set.h | 278 +++++++ .../include/sqlpp11/detail/type_vector.h | 86 ++ 3party/sqlpp11/include/sqlpp11/detail/void.h | 42 + 3party/sqlpp11/include/sqlpp11/dynamic_join.h | 57 ++ .../include/sqlpp11/dynamic_pre_join.h | 163 ++++ .../sqlpp11/dynamic_select_column_list.h | 102 +++ 3party/sqlpp11/include/sqlpp11/eval.h | 63 ++ 3party/sqlpp11/include/sqlpp11/exception.h | 43 + 3party/sqlpp11/include/sqlpp11/exists.h | 93 +++ 3party/sqlpp11/include/sqlpp11/expression.h | 200 +++++ .../sqlpp11/include/sqlpp11/expression_fwd.h | 281 +++++++ .../include/sqlpp11/expression_operators.h | 38 + .../include/sqlpp11/expression_return_types.h | 158 ++++ 3party/sqlpp11/include/sqlpp11/field_spec.h | 84 ++ 3party/sqlpp11/include/sqlpp11/for_update.h | 170 ++++ 3party/sqlpp11/include/sqlpp11/from.h | 314 +++++++ 3party/sqlpp11/include/sqlpp11/functions.h | 138 ++++ 3party/sqlpp11/include/sqlpp11/group_by.h | 279 +++++++ 3party/sqlpp11/include/sqlpp11/having.h | 315 +++++++ 3party/sqlpp11/include/sqlpp11/hidden.h | 56 ++ 3party/sqlpp11/include/sqlpp11/in.h | 118 +++ 3party/sqlpp11/include/sqlpp11/in_fwd.h | 35 + 3party/sqlpp11/include/sqlpp11/inconsistent.h | 42 + 3party/sqlpp11/include/sqlpp11/insert.h | 126 +++ 3party/sqlpp11/include/sqlpp11/insert_value.h | 113 +++ .../include/sqlpp11/insert_value_list.h | 688 +++++++++++++++ .../sqlpp11/include/sqlpp11/interpret_tuple.h | 87 ++ .../sqlpp11/include/sqlpp11/interpretable.h | 101 +++ .../include/sqlpp11/interpretable_list.h | 93 +++ 3party/sqlpp11/include/sqlpp11/into.h | 205 +++++ .../include/sqlpp11/is_equal_to_or_null.h | 76 ++ 3party/sqlpp11/include/sqlpp11/is_not_null.h | 79 ++ 3party/sqlpp11/include/sqlpp11/is_null.h | 79 ++ 3party/sqlpp11/include/sqlpp11/is_null_fwd.h | 35 + 3party/sqlpp11/include/sqlpp11/join.h | 91 ++ 3party/sqlpp11/include/sqlpp11/join_types.h | 70 ++ 3party/sqlpp11/include/sqlpp11/limit.h | 318 +++++++ 3party/sqlpp11/include/sqlpp11/logic.h | 87 ++ 3party/sqlpp11/include/sqlpp11/lower.h | 96 +++ .../include/sqlpp11/mysql/bind_result.h | 416 ++++++++++ .../include/sqlpp11/mysql/char_result.h | 198 +++++ .../include/sqlpp11/mysql/char_result_row.h | 44 + .../include/sqlpp11/mysql/connection.h | 527 ++++++++++++ .../include/sqlpp11/mysql/connection_config.h | 62 ++ .../include/sqlpp11/mysql/connection_pool.h | 39 + .../sqlpp11/mysql/detail/connection_handle.h | 124 +++ .../mysql/detail/prepared_statement_handle.h | 107 +++ .../sqlpp11/mysql/detail/result_handle.h | 62 ++ 3party/sqlpp11/include/sqlpp11/mysql/mysql.h | 32 + .../sqlpp11/mysql/prepared_statement.h | 219 +++++ 3party/sqlpp11/include/sqlpp11/mysql/remove.h | 68 ++ .../include/sqlpp11/mysql/serializer.h | 48 ++ .../include/sqlpp11/mysql/sqlpp_mysql.h | 39 + 3party/sqlpp11/include/sqlpp11/mysql/update.h | 60 ++ .../include/sqlpp11/named_interpretable.h | 112 +++ 3party/sqlpp11/include/sqlpp11/no_data.h | 40 + 3party/sqlpp11/include/sqlpp11/no_name.h | 34 + 3party/sqlpp11/include/sqlpp11/noop.h | 92 +++ 3party/sqlpp11/include/sqlpp11/noop_fwd.h | 35 + 3party/sqlpp11/include/sqlpp11/not_in.h | 118 +++ 3party/sqlpp11/include/sqlpp11/null.h | 47 ++ 3party/sqlpp11/include/sqlpp11/offset.h | 332 ++++++++ 3party/sqlpp11/include/sqlpp11/on.h | 78 ++ .../sqlpp11/include/sqlpp11/operand_check.h | 72 ++ 3party/sqlpp11/include/sqlpp11/order_by.h | 277 +++++++ 3party/sqlpp11/include/sqlpp11/over.h | 63 ++ 3party/sqlpp11/include/sqlpp11/parameter.h | 81 ++ .../sqlpp11/include/sqlpp11/parameter_list.h | 67 ++ .../include/sqlpp11/parameterized_verbatim.h | 77 ++ .../sqlpp11/include/sqlpp11/policy_update.h | 69 ++ .../include/sqlpp11/portable_static_assert.h | 95 +++ .../include/sqlpp11/postgresql/bind_result.h | 338 ++++++++ .../include/sqlpp11/postgresql/connection.h | 616 ++++++++++++++ .../sqlpp11/postgresql/connection_config.h | 93 +++ .../sqlpp11/postgresql/connection_pool.h | 39 + .../postgresql/detail/connection_handle.h | 244 ++++++ .../detail/prepared_statement_handle.h | 180 ++++ .../sqlpp11/postgresql/dynamic_libpq.h | 151 ++++ .../include/sqlpp11/postgresql/exception.h | 438 ++++++++++ .../include/sqlpp11/postgresql/insert.h | 66 ++ .../include/sqlpp11/postgresql/on_conflict.h | 261 ++++++ .../postgresql/on_conflict_do_nothing.h | 124 +++ .../postgresql/on_conflict_do_update.h | 229 +++++ .../include/sqlpp11/postgresql/postgresql.h | 35 + .../sqlpp11/postgresql/prepared_statement.h | 256 ++++++ .../include/sqlpp11/postgresql/result.h | 357 ++++++++ .../include/sqlpp11/postgresql/result_field.h | 120 +++ .../include/sqlpp11/postgresql/returning.h | 173 ++++ .../postgresql/returning_column_list.h | 493 +++++++++++ .../include/sqlpp11/postgresql/serializer.h | 74 ++ .../include/sqlpp11/postgresql/update.h | 54 ++ .../include/sqlpp11/postgresql/visibility.h | 57 ++ 3party/sqlpp11/include/sqlpp11/ppgen.h | 219 +++++ .../sqlpp11/ppgen/colops/auto_increment.h | 34 + .../include/sqlpp11/ppgen/colops/blob.h | 49 ++ .../include/sqlpp11/ppgen/colops/bool.h | 34 + .../include/sqlpp11/ppgen/colops/comment.h | 34 + .../include/sqlpp11/ppgen/colops/datetime.h | 39 + .../include/sqlpp11/ppgen/colops/default.h | 34 + .../sqlpp11/ppgen/colops/floating_point.h | 44 + .../sqlpp11/ppgen/colops/foreign_key.h | 34 + .../include/sqlpp11/ppgen/colops/index.h | 34 + .../include/sqlpp11/ppgen/colops/integer.h | 49 ++ .../include/sqlpp11/ppgen/colops/not_null.h | 34 + .../include/sqlpp11/ppgen/colops/null.h | 34 + .../sqlpp11/ppgen/colops/primary_key.h | 34 + .../include/sqlpp11/ppgen/colops/text.h | 34 + .../include/sqlpp11/ppgen/colops/timestamp.h | 34 + .../sqlpp11/ppgen/colops/unique_index.h | 34 + .../sqlpp11/ppgen/colops/unsigned_integer.h | 49 ++ .../include/sqlpp11/ppgen/colops/varchar.h | 34 + .../sqlpp11/ppgen/tblops/character_set.h | 34 + .../include/sqlpp11/ppgen/tblops/comment.h | 34 + .../include/sqlpp11/ppgen/tblops/default.h | 34 + .../include/sqlpp11/ppgen/tblops/engine.h | 34 + .../sqlpp11/ppgen/tools/tuple_pop_front.h | 46 ++ .../include/sqlpp11/ppgen/tools/wrap_seq.h | 37 + 3party/sqlpp11/include/sqlpp11/pre_join.h | 208 +++++ .../include/sqlpp11/prepared_execute.h | 59 ++ .../sqlpp11/include/sqlpp11/prepared_insert.h | 59 ++ .../sqlpp11/include/sqlpp11/prepared_remove.h | 59 ++ .../sqlpp11/include/sqlpp11/prepared_select.h | 62 ++ .../sqlpp11/include/sqlpp11/prepared_update.h | 59 ++ 3party/sqlpp11/include/sqlpp11/remove.h | 124 +++ 3party/sqlpp11/include/sqlpp11/result.h | 171 ++++ 3party/sqlpp11/include/sqlpp11/result_field.h | 62 ++ .../include/sqlpp11/result_field_base.h | 114 +++ 3party/sqlpp11/include/sqlpp11/result_row.h | 364 ++++++++ .../sqlpp11/include/sqlpp11/result_row_fwd.h | 36 + 3party/sqlpp11/include/sqlpp11/schema.h | 44 + .../include/sqlpp11/schema_qualified_table.h | 85 ++ 3party/sqlpp11/include/sqlpp11/select.h | 107 +++ .../include/sqlpp11/select_column_list.h | 451 ++++++++++ .../include/sqlpp11/select_flag_list.h | 266 ++++++ 3party/sqlpp11/include/sqlpp11/select_flags.h | 78 ++ .../include/sqlpp11/select_pseudo_table.h | 82 ++ 3party/sqlpp11/include/sqlpp11/serialize.h | 49 ++ .../include/sqlpp11/serializer_context.h | 65 ++ .../sqlpp11/include/sqlpp11/simple_column.h | 61 ++ 3party/sqlpp11/include/sqlpp11/single_table.h | 198 +++++ 3party/sqlpp11/include/sqlpp11/some.h | 71 ++ 3party/sqlpp11/include/sqlpp11/sort_order.h | 66 ++ .../include/sqlpp11/sqlite3/bind_result.h | 231 ++++++ .../include/sqlpp11/sqlite3/connection.h | 566 +++++++++++++ .../sqlpp11/sqlite3/connection_config.h | 70 ++ .../include/sqlpp11/sqlite3/connection_pool.h | 39 + .../sqlite3/detail/connection_handle.h | 119 +++ .../detail/prepared_statement_handle.h | 94 +++ .../sqlpp11/sqlite3/dynamic_libsqlite3.h | 236 ++++++ .../sqlpp11/include/sqlpp11/sqlite3/export.h | 15 + .../include/sqlpp11/sqlite3/insert_or.h | 151 ++++ .../sqlpp11/sqlite3/prepared_statement.h | 255 ++++++ .../include/sqlpp11/sqlite3/serializer.h | 137 +++ .../sqlpp11/include/sqlpp11/sqlite3/sqlite3.h | 32 + 3party/sqlpp11/include/sqlpp11/sqlpp11.h | 40 + 3party/sqlpp11/include/sqlpp11/statement.h | 318 +++++++ .../sqlpp11/include/sqlpp11/statement_fwd.h | 33 + 3party/sqlpp11/include/sqlpp11/table.h | 108 +++ 3party/sqlpp11/include/sqlpp11/table_alias.h | 116 +++ 3party/sqlpp11/include/sqlpp11/table_ref.h | 52 ++ 3party/sqlpp11/include/sqlpp11/transaction.h | 122 +++ 3party/sqlpp11/include/sqlpp11/trim.h | 97 +++ 3party/sqlpp11/include/sqlpp11/type_traits.h | 568 +++++++++++++ .../sqlpp11/include/sqlpp11/unconditional.h | 34 + 3party/sqlpp11/include/sqlpp11/union.h | 268 ++++++ 3party/sqlpp11/include/sqlpp11/union_data.h | 59 ++ 3party/sqlpp11/include/sqlpp11/union_flags.h | 61 ++ 3party/sqlpp11/include/sqlpp11/update.h | 113 +++ 3party/sqlpp11/include/sqlpp11/update_list.h | 304 +++++++ 3party/sqlpp11/include/sqlpp11/upper.h | 96 +++ 3party/sqlpp11/include/sqlpp11/using.h | 254 ++++++ 3party/sqlpp11/include/sqlpp11/value.h | 48 ++ .../sqlpp11/include/sqlpp11/value_or_null.h | 85 ++ 3party/sqlpp11/include/sqlpp11/value_type.h | 36 + .../sqlpp11/include/sqlpp11/value_type_fwd.h | 53 ++ 3party/sqlpp11/include/sqlpp11/verbatim.h | 75 ++ .../sqlpp11/include/sqlpp11/verbatim_table.h | 88 ++ 3party/sqlpp11/include/sqlpp11/where.h | 418 ++++++++++ 3party/sqlpp11/include/sqlpp11/with.h | 216 +++++ .../include/sqlpp11/without_table_check.h | 60 ++ 3party/sqlpp11/include/sqlpp11/wrap_operand.h | 39 + 3party/sqlpp11/include/sqlpp11/wrong.h | 46 ++ 3party/sqlpp11/pre-commit | 70 ++ 3party/sqlpp11/scripts/ddl2cpp | 781 ++++++++++++++++++ 3party/sqlpp11/scripts/sqlite2cpp.py | 206 +++++ 3party/sqlpp11/tests/CMakeLists.txt | 38 + 3party/sqlpp11/tests/core/CMakeLists.txt | 30 + .../sqlpp11/tests/core/compat/CMakeLists.txt | 38 + .../sqlpp11/tests/core/compat/make_unique.cpp | 35 + .../tests/core/constraints/CMakeLists.txt | 47 ++ .../tests/core/constraints/count_of_count.cpp | 43 + .../tests/core/constraints/max_of_max.cpp | 43 + .../core/constraints/must_not_insert.cpp | 43 + .../core/constraints/must_not_update.cpp | 42 + .../tests/core/constraints/require_insert.cpp | 43 + .../sqlpp11/tests/core/helpers/CMakeLists.txt | 32 + .../tests/core/helpers/circular_buffer.cpp | 345 ++++++++ 3party/sqlpp11/tests/core/serialize/Any.cpp | 39 + 3party/sqlpp11/tests/core/serialize/As.cpp | 56 ++ 3party/sqlpp11/tests/core/serialize/Avg.cpp | 48 ++ 3party/sqlpp11/tests/core/serialize/Blob.cpp | 72 ++ .../tests/core/serialize/CMakeLists.txt | 71 ++ 3party/sqlpp11/tests/core/serialize/Count.cpp | 48 ++ .../tests/core/serialize/CustomQuery.cpp | 91 ++ .../tests/core/serialize/DynamicWhere.cpp | 53 ++ .../sqlpp11/tests/core/serialize/Exists.cpp | 40 + 3party/sqlpp11/tests/core/serialize/Float.cpp | 83 ++ .../tests/core/serialize/ForUpdate.cpp | 62 ++ 3party/sqlpp11/tests/core/serialize/From.cpp | 136 +++ 3party/sqlpp11/tests/core/serialize/In.cpp | 64 ++ .../sqlpp11/tests/core/serialize/Insert.cpp | 58 ++ .../tests/core/serialize/IsNotNull.cpp | 48 ++ .../sqlpp11/tests/core/serialize/IsNull.cpp | 48 ++ 3party/sqlpp11/tests/core/serialize/Lower.cpp | 45 + 3party/sqlpp11/tests/core/serialize/Max.cpp | 48 ++ 3party/sqlpp11/tests/core/serialize/Min.cpp | 48 ++ .../sqlpp11/tests/core/serialize/Operator.cpp | 50 ++ 3party/sqlpp11/tests/core/serialize/Over.cpp | 50 ++ .../core/serialize/ParameterizedVerbatim.cpp | 43 + 3party/sqlpp11/tests/core/serialize/Some.cpp | 39 + 3party/sqlpp11/tests/core/serialize/Sum.cpp | 48 ++ .../tests/core/serialize/TableAlias.cpp | 50 ++ 3party/sqlpp11/tests/core/serialize/Trim.cpp | 45 + 3party/sqlpp11/tests/core/serialize/Upper.cpp | 45 + 3party/sqlpp11/tests/core/serialize/Where.cpp | 78 ++ 3party/sqlpp11/tests/core/serialize/compare.h | 53 ++ .../tests/core/static_asserts/AssertTables.h | 312 +++++++ .../core/static_asserts/AssertTables.sql | 43 + .../tests/core/static_asserts/CMakeLists.txt | 50 ++ .../tests/core/static_asserts/aggregates.cpp | 129 +++ .../tests/core/static_asserts/case.cpp | 159 ++++ .../tests/core/static_asserts/date.cpp | 91 ++ .../tests/core/static_asserts/date_time.cpp | 91 ++ .../tests/core/static_asserts/from.cpp | 169 ++++ .../tests/core/static_asserts/having.cpp | 193 +++++ .../sqlpp11/tests/core/static_asserts/in.cpp | 88 ++ .../tests/core/static_asserts/insert.cpp | 173 ++++ .../tests/core/static_asserts/join.cpp | 279 +++++++ .../core/static_asserts/no_self_compare.cpp | 85 ++ .../tests/core/static_asserts/text.cpp | 113 +++ .../core/static_asserts/unwrapped_bool.cpp | 114 +++ .../tests/core/static_asserts/update_list.cpp | 138 ++++ .../tests/core/static_asserts/where.cpp | 151 ++++ .../sqlpp11/tests/core/types/CMakeLists.txt | 37 + .../sqlpp11/tests/core/types/result_row.cpp | 235 ++++++ .../tests/core/usage/BooleanExpression.cpp | 44 + .../sqlpp11/tests/core/usage/CMakeLists.txt | 81 ++ .../sqlpp11/tests/core/usage/CustomQuery.cpp | 121 +++ 3party/sqlpp11/tests/core/usage/DateTime.cpp | 84 ++ .../tests/core/usage/DateTimeParser.cpp | 330 ++++++++ 3party/sqlpp11/tests/core/usage/Function.cpp | 443 ++++++++++ 3party/sqlpp11/tests/core/usage/Insert.cpp | 119 +++ 3party/sqlpp11/tests/core/usage/Interpret.cpp | 210 +++++ .../sqlpp11/tests/core/usage/Minimalistic.cpp | 6 + 3party/sqlpp11/tests/core/usage/MockDb.h | 496 +++++++++++ 3party/sqlpp11/tests/core/usage/Ppgen.cpp | 96 +++ 3party/sqlpp11/tests/core/usage/Prepared.cpp | 147 ++++ 3party/sqlpp11/tests/core/usage/Remove.cpp | 72 ++ 3party/sqlpp11/tests/core/usage/Result.cpp | 69 ++ 3party/sqlpp11/tests/core/usage/Sample.h | 350 ++++++++ 3party/sqlpp11/tests/core/usage/Select.cpp | 214 +++++ .../sqlpp11/tests/core/usage/SelectType.cpp | 421 ++++++++++ 3party/sqlpp11/tests/core/usage/Union.cpp | 74 ++ 3party/sqlpp11/tests/core/usage/Update.cpp | 78 ++ 3party/sqlpp11/tests/core/usage/With.cpp | 77 ++ 3party/sqlpp11/tests/core/usage/is_regular.h | 59 ++ 3party/sqlpp11/tests/core/usage/sample.sql | 50 ++ .../tests/include/ConnectionPoolTests.h | 290 +++++++ .../sqlpp11/tests/include/ConnectionTests.h | 69 ++ 3party/sqlpp11/tests/include/TabDepartment.h | 79 ++ 3party/sqlpp11/tests/mysql/CMakeLists.txt | 26 + .../tests/mysql/serialize/CMakeLists.txt | 51 ++ .../sqlpp11/tests/mysql/serialize/Float.cpp | 36 + .../sqlpp11/tests/mysql/serialize/compare.h | 69 ++ .../sqlpp11/tests/mysql/usage/CMakeLists.txt | 67 ++ .../sqlpp11/tests/mysql/usage/Connection.cpp | 39 + .../tests/mysql/usage/ConnectionPool.cpp | 56 ++ .../sqlpp11/tests/mysql/usage/CustomQuery.cpp | 92 +++ 3party/sqlpp11/tests/mysql/usage/DateTime.cpp | 150 ++++ .../tests/mysql/usage/DynamicSelect.cpp | 78 ++ 3party/sqlpp11/tests/mysql/usage/Json.cpp | 94 +++ .../tests/mysql/usage/MoveConstructor.cpp | 84 ++ 3party/sqlpp11/tests/mysql/usage/Prepared.cpp | 97 +++ 3party/sqlpp11/tests/mysql/usage/Remove.cpp | 68 ++ 3party/sqlpp11/tests/mysql/usage/Sample.cpp | 201 +++++ 3party/sqlpp11/tests/mysql/usage/Select.cpp | 165 ++++ 3party/sqlpp11/tests/mysql/usage/TabJson.h | 47 ++ 3party/sqlpp11/tests/mysql/usage/TabJson.sql | 3 + 3party/sqlpp11/tests/mysql/usage/TabSample.h | 260 ++++++ .../sqlpp11/tests/mysql/usage/TabSample.sql | 5 + .../sqlpp11/tests/mysql/usage/Truncated.cpp | 96 +++ 3party/sqlpp11/tests/mysql/usage/Union.cpp | 70 ++ 3party/sqlpp11/tests/mysql/usage/Update.cpp | 68 ++ .../tests/mysql/usage/make_test_connection.h | 65 ++ .../sqlpp11/tests/postgresql/CMakeLists.txt | 27 + .../postgresql/constraints/CMakeLists.txt | 51 ++ .../OnConflictEmptyWhereDoUpdate.cpp | 47 ++ .../OnConflictInvalidAssignmentsDoUpdate.cpp | 48 ++ .../OnConflictInvalidParameter.cpp | 44 + .../OnConflictInvalidWhereDoUpdate.cpp | 48 ++ .../constraints/OnConflictMissingAction.cpp | 46 ++ .../OnConflictMissingAssignmentsDoUpdate.cpp | 48 ++ .../OnConflictMissingParameterDoUpdate.cpp | 48 ++ .../constraints/ReturningEmptyAssert.cpp | 57 ++ .../constraints/ReturningInvalidArgument.cpp | 48 ++ .../tests/postgresql/serialize/CMakeLists.txt | 48 ++ .../tests/postgresql/serialize/Float.cpp | 36 + .../tests/postgresql/serialize/compare.h | 56 ++ .../sqlpp11/tests/postgresql/usage/Basic.cpp | 53 ++ .../postgresql/usage/BasicConstConfig.cpp | 58 ++ .../sqlpp11/tests/postgresql/usage/Blob.cpp | 121 +++ .../tests/postgresql/usage/BlobSample.h | 64 ++ .../tests/postgresql/usage/BlobSample.sql | 5 + .../tests/postgresql/usage/CMakeLists.txt | 65 ++ .../tests/postgresql/usage/Connection.cpp | 40 + .../tests/postgresql/usage/ConnectionPool.cpp | 56 ++ .../sqlpp11/tests/postgresql/usage/Date.cpp | 146 ++++ .../tests/postgresql/usage/DateTime.cpp | 129 +++ .../tests/postgresql/usage/Exceptions.cpp | 94 +++ .../postgresql/usage/InsertOnConflict.cpp | 89 ++ .../tests/postgresql/usage/Returning.cpp | 64 ++ .../sqlpp11/tests/postgresql/usage/Select.cpp | 143 ++++ .../sqlpp11/tests/postgresql/usage/TabBar.h | 58 ++ .../tests/postgresql/usage/TabDateTime.h | 109 +++ .../sqlpp11/tests/postgresql/usage/TabFoo.h | 184 +++++ .../tests/postgresql/usage/TabSample.h | 245 ++++++ .../tests/postgresql/usage/TimeZone.cpp | 165 ++++ .../tests/postgresql/usage/Transaction.cpp | 130 +++ .../sqlpp11/tests/postgresql/usage/Type.cpp | 130 +++ .../tests/postgresql/usage/assertThrow.h | 15 + .../postgresql/usage/make_test_connection.h | 75 ++ 3party/sqlpp11/tests/scripts/CMakeLists.txt | 113 +++ 3party/sqlpp11/tests/scripts/custom_types.csv | 9 + .../tests/scripts/ddl2cpp_sample_bad.sql | 18 + .../tests/scripts/ddl2cpp_sample_good.sql | 49 ++ .../ddl2cpp_sample_good_custom_type.cpp | 32 + .../ddl2cpp_sample_good_custom_type.sql | 54 ++ 3party/sqlpp11/tests/scripts/sample.cpp | 15 + .../tests/scripts/sample_identity_naming.cpp | 15 + 3party/sqlpp11/tests/sqlite3/CMakeLists.txt | 26 + .../tests/sqlite3/serialize/CMakeLists.txt | 54 ++ .../sqlpp11/tests/sqlite3/serialize/Float.cpp | 36 + .../sqlpp11/tests/sqlite3/serialize/compare.h | 60 ++ 3party/sqlpp11/tests/sqlite3/usage/Attach.cpp | 75 ++ .../tests/sqlite3/usage/AutoIncrement.cpp | 69 ++ 3party/sqlpp11/tests/sqlite3/usage/Blob.cpp | 102 +++ .../sqlpp11/tests/sqlite3/usage/BlobSample.h | 77 ++ .../tests/sqlite3/usage/BlobSample.sql | 4 + .../tests/sqlite3/usage/CMakeLists.txt | 81 ++ .../tests/sqlite3/usage/Connection.cpp | 43 + .../tests/sqlite3/usage/ConnectionPool.cpp | 59 ++ .../sqlpp11/tests/sqlite3/usage/DateTime.cpp | 130 +++ .../sqlite3/usage/DynamicLoadingTest.cpp | 88 ++ .../tests/sqlite3/usage/DynamicSelect.cpp | 86 ++ .../tests/sqlite3/usage/FloatingPoint.cpp | 126 +++ 3party/sqlpp11/tests/sqlite3/usage/FpSample.h | 77 ++ .../sqlpp11/tests/sqlite3/usage/FpSample.sql | 4 + .../sqlpp11/tests/sqlite3/usage/Integral.cpp | 119 +++ .../tests/sqlite3/usage/IntegralSample.h | 76 ++ 3party/sqlpp11/tests/sqlite3/usage/Sample.cpp | 209 +++++ 3party/sqlpp11/tests/sqlite3/usage/Select.cpp | 171 ++++ .../sqlpp11/tests/sqlite3/usage/TabSample.h | 247 ++++++ .../sqlpp11/tests/sqlite3/usage/TabSample.sql | 5 + .../tests/sqlite3/usage/Transaction.cpp | 84 ++ 3party/sqlpp11/tests/sqlite3/usage/Union.cpp | 67 ++ 3party/sqlpp11/tests/sqlite3/usage/With.cpp | 71 ++ 3party/sqlpp11/wishlist.md | 73 ++ 554 files changed, 52720 insertions(+), 5 deletions(-) delete mode 160000 3party/sqlpp11 create mode 100644 3party/sqlpp11/.appveyor.yml create mode 100644 3party/sqlpp11/.clang-format create mode 100644 3party/sqlpp11/.gitignore create mode 100644 3party/sqlpp11/.travis.yml create mode 100644 3party/sqlpp11/CMakeLists.txt create mode 100644 3party/sqlpp11/CREDITS create mode 100644 3party/sqlpp11/ChangeLog.md create mode 100644 3party/sqlpp11/LICENSE create mode 100644 3party/sqlpp11/README.md create mode 100644 3party/sqlpp11/_config.yml create mode 100644 3party/sqlpp11/cmake/Sqlpp11TargetHelper.cmake create mode 100644 3party/sqlpp11/cmake/configs/Sqlpp11Config.cmake create mode 100644 3party/sqlpp11/cmake/configs/Sqlpp11MariaDBConfig.cmake create mode 100644 3party/sqlpp11/cmake/configs/Sqlpp11MySQLConfig.cmake create mode 100644 3party/sqlpp11/cmake/configs/Sqlpp11PostgreSQLConfig.cmake create mode 100644 3party/sqlpp11/cmake/configs/Sqlpp11SQLCipherConfig.cmake create mode 100644 3party/sqlpp11/cmake/configs/Sqlpp11SQLite3Config.cmake create mode 100644 3party/sqlpp11/cmake/modules/FindMariaDB.cmake create mode 100644 3party/sqlpp11/cmake/modules/FindMySQL.cmake create mode 100644 3party/sqlpp11/cmake/modules/FindSQLCipher.cmake create mode 100644 3party/sqlpp11/connector_api/bind_result.h create mode 100644 3party/sqlpp11/connector_api/connection.h create mode 100644 3party/sqlpp11/connector_api/connection_pool.h create mode 100644 3party/sqlpp11/connector_api/interpreter.h create mode 100644 3party/sqlpp11/connector_api/prepared_statement.h create mode 100755 3party/sqlpp11/coveralls create mode 100644 3party/sqlpp11/dependencies/CMakeLists.txt create mode 100644 3party/sqlpp11/dependencies/hinnant_date/CMakeLists.txt create mode 100644 3party/sqlpp11/docs/Connection-Pools.md create mode 100644 3party/sqlpp11/docs/Database.md create mode 100644 3party/sqlpp11/docs/Dynamic-Insert.md create mode 100644 3party/sqlpp11/docs/Dynamic-Select.md create mode 100644 3party/sqlpp11/docs/Exception-Handling.md create mode 100644 3party/sqlpp11/docs/Functions.md create mode 100644 3party/sqlpp11/docs/Home.md create mode 100644 3party/sqlpp11/docs/Insert.md create mode 100644 3party/sqlpp11/docs/NULL.md create mode 100644 3party/sqlpp11/docs/New-Features.md create mode 100644 3party/sqlpp11/docs/Prepared-Statements.md create mode 100644 3party/sqlpp11/docs/Remove.md create mode 100644 3party/sqlpp11/docs/Select.md create mode 100644 3party/sqlpp11/docs/Tables.md create mode 100644 3party/sqlpp11/docs/Threads.md create mode 100644 3party/sqlpp11/docs/Transactions.md create mode 100644 3party/sqlpp11/docs/Update.md create mode 100644 3party/sqlpp11/examples/connection_pool/CMakeLists.txt create mode 100644 3party/sqlpp11/examples/connection_pool/src/db_connection.cpp create mode 100644 3party/sqlpp11/examples/connection_pool/src/db_connection.h create mode 100644 3party/sqlpp11/examples/connection_pool/src/db_global.cpp create mode 100644 3party/sqlpp11/examples/connection_pool/src/db_global.h create mode 100644 3party/sqlpp11/examples/connection_pool/src/main.cpp create mode 100644 3party/sqlpp11/examples/usage_fetch_content/CMakeLists.txt create mode 100644 3party/sqlpp11/examples/usage_fetch_content/dependencies/CMakeLists.txt create mode 100644 3party/sqlpp11/examples/usage_fetch_content/dependencies/sqlpp11/CMakeLists.txt create mode 100644 3party/sqlpp11/examples/usage_fetch_content/src/CMakeLists.txt create mode 100644 3party/sqlpp11/examples/usage_fetch_content/src/main.cpp create mode 100644 3party/sqlpp11/examples/usage_find_package/CMakeLists.txt create mode 100644 3party/sqlpp11/examples/usage_find_package/src/CMakeLists.txt create mode 100644 3party/sqlpp11/examples/usage_find_package/src/main.cpp create mode 100644 3party/sqlpp11/include/sqlpp11/aggregate_function_operators.h create mode 100644 3party/sqlpp11/include/sqlpp11/aggregate_functions.h create mode 100644 3party/sqlpp11/include/sqlpp11/aggregate_functions/avg.h create mode 100644 3party/sqlpp11/include/sqlpp11/aggregate_functions/count.h create mode 100644 3party/sqlpp11/include/sqlpp11/aggregate_functions/max.h create mode 100644 3party/sqlpp11/include/sqlpp11/aggregate_functions/min.h create mode 100644 3party/sqlpp11/include/sqlpp11/aggregate_functions/sum.h create mode 100644 3party/sqlpp11/include/sqlpp11/alias.h create mode 100644 3party/sqlpp11/include/sqlpp11/alias_operators.h create mode 100644 3party/sqlpp11/include/sqlpp11/alias_provider.h create mode 100644 3party/sqlpp11/include/sqlpp11/all_of.h create mode 100644 3party/sqlpp11/include/sqlpp11/any.h create mode 100644 3party/sqlpp11/include/sqlpp11/assignment.h create mode 100644 3party/sqlpp11/include/sqlpp11/auto_alias.h create mode 100644 3party/sqlpp11/include/sqlpp11/bad_expression.h create mode 100644 3party/sqlpp11/include/sqlpp11/basic_expression_operators.h create mode 100644 3party/sqlpp11/include/sqlpp11/boolean_expression.h create mode 100644 3party/sqlpp11/include/sqlpp11/case.h create mode 100644 3party/sqlpp11/include/sqlpp11/char_sequence.h create mode 100644 3party/sqlpp11/include/sqlpp11/chrono.h create mode 100644 3party/sqlpp11/include/sqlpp11/column.h create mode 100644 3party/sqlpp11/include/sqlpp11/column_fwd.h create mode 100644 3party/sqlpp11/include/sqlpp11/column_types.h create mode 100644 3party/sqlpp11/include/sqlpp11/compat/make_unique.h create mode 100644 3party/sqlpp11/include/sqlpp11/connection.h create mode 100644 3party/sqlpp11/include/sqlpp11/connection_pool.h create mode 100644 3party/sqlpp11/include/sqlpp11/consistent.h create mode 100644 3party/sqlpp11/include/sqlpp11/cte.h create mode 100644 3party/sqlpp11/include/sqlpp11/custom_query.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/blob.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/blob/column_operators.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/blob/data_type.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/blob/expression_operators.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/blob/operand.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/blob/parameter_value.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/blob/result_field.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/blob/wrap_operand.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/boolean.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/boolean/column_operators.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/boolean/data_type.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/boolean/expression_operators.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/boolean/operand.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/boolean/parameter_value.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/boolean/result_field.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/boolean/wrap_operand.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/column_operators.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/day_point.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/day_point/column_operators.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/day_point/data_type.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/day_point/expression_operators.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/day_point/operand.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/day_point/parameter_value.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/day_point/result_field.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/day_point/wrap_operand.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/floating_point.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/floating_point/column_operators.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/floating_point/data_type.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/floating_point/expression_operators.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/floating_point/operand.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/floating_point/parameter_value.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/floating_point/result_field.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/floating_point/wrap_operand.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/integral.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/integral/column_operators.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/integral/data_type.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/integral/expression_operators.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/integral/operand.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/integral/parameter_value.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/integral/result_field.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/integral/wrap_operand.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/no_value.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/no_value/column_operators.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/no_value/data_type.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/no_value/expression_operators.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/no_value/operand.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/no_value/parameter_value.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/no_value/result_field.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/no_value/wrap_operand.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/parameter_value.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/parameter_value_base.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/text.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/text/column_operators.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/text/concat.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/text/data_type.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/text/expression_operators.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/text/like.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/text/operand.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/text/parameter_value.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/text/result_field.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/text/return_type_like.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/text/wrap_operand.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/time_of_day.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/time_of_day/column_operators.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/time_of_day/data_type.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/time_of_day/expression_operators.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/time_of_day/operand.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/time_of_day/parameter_value.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/time_of_day/result_field.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/time_of_day/wrap_operand.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/time_point.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/time_point/column_operators.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/time_point/data_type.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/time_point/expression_operators.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/time_point/operand.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/time_point/parameter_value.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/time_point/result_field.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/time_point/wrap_operand.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/unsigned_integral.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/unsigned_integral/column_operators.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/unsigned_integral/data_type.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/unsigned_integral/expression_operators.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/unsigned_integral/operand.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/unsigned_integral/parameter_value.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/unsigned_integral/result_field.h create mode 100644 3party/sqlpp11/include/sqlpp11/data_types/unsigned_integral/wrap_operand.h create mode 100644 3party/sqlpp11/include/sqlpp11/default_value.h create mode 100644 3party/sqlpp11/include/sqlpp11/detail/circular_buffer.h create mode 100644 3party/sqlpp11/include/sqlpp11/detail/column_tuple_merge.h create mode 100644 3party/sqlpp11/include/sqlpp11/detail/enable_if.h create mode 100644 3party/sqlpp11/include/sqlpp11/detail/float_safe_ostringstream.h create mode 100644 3party/sqlpp11/include/sqlpp11/detail/get_first.h create mode 100644 3party/sqlpp11/include/sqlpp11/detail/get_last.h create mode 100644 3party/sqlpp11/include/sqlpp11/detail/index_sequence.h create mode 100644 3party/sqlpp11/include/sqlpp11/detail/parse_date_time.h create mode 100644 3party/sqlpp11/include/sqlpp11/detail/pick_arg.h create mode 100644 3party/sqlpp11/include/sqlpp11/detail/type_set.h create mode 100644 3party/sqlpp11/include/sqlpp11/detail/type_vector.h create mode 100644 3party/sqlpp11/include/sqlpp11/detail/void.h create mode 100644 3party/sqlpp11/include/sqlpp11/dynamic_join.h create mode 100644 3party/sqlpp11/include/sqlpp11/dynamic_pre_join.h create mode 100644 3party/sqlpp11/include/sqlpp11/dynamic_select_column_list.h create mode 100644 3party/sqlpp11/include/sqlpp11/eval.h create mode 100644 3party/sqlpp11/include/sqlpp11/exception.h create mode 100644 3party/sqlpp11/include/sqlpp11/exists.h create mode 100644 3party/sqlpp11/include/sqlpp11/expression.h create mode 100644 3party/sqlpp11/include/sqlpp11/expression_fwd.h create mode 100644 3party/sqlpp11/include/sqlpp11/expression_operators.h create mode 100644 3party/sqlpp11/include/sqlpp11/expression_return_types.h create mode 100644 3party/sqlpp11/include/sqlpp11/field_spec.h create mode 100644 3party/sqlpp11/include/sqlpp11/for_update.h create mode 100644 3party/sqlpp11/include/sqlpp11/from.h create mode 100644 3party/sqlpp11/include/sqlpp11/functions.h create mode 100644 3party/sqlpp11/include/sqlpp11/group_by.h create mode 100644 3party/sqlpp11/include/sqlpp11/having.h create mode 100644 3party/sqlpp11/include/sqlpp11/hidden.h create mode 100644 3party/sqlpp11/include/sqlpp11/in.h create mode 100644 3party/sqlpp11/include/sqlpp11/in_fwd.h create mode 100644 3party/sqlpp11/include/sqlpp11/inconsistent.h create mode 100644 3party/sqlpp11/include/sqlpp11/insert.h create mode 100644 3party/sqlpp11/include/sqlpp11/insert_value.h create mode 100644 3party/sqlpp11/include/sqlpp11/insert_value_list.h create mode 100644 3party/sqlpp11/include/sqlpp11/interpret_tuple.h create mode 100644 3party/sqlpp11/include/sqlpp11/interpretable.h create mode 100644 3party/sqlpp11/include/sqlpp11/interpretable_list.h create mode 100644 3party/sqlpp11/include/sqlpp11/into.h create mode 100644 3party/sqlpp11/include/sqlpp11/is_equal_to_or_null.h create mode 100644 3party/sqlpp11/include/sqlpp11/is_not_null.h create mode 100644 3party/sqlpp11/include/sqlpp11/is_null.h create mode 100644 3party/sqlpp11/include/sqlpp11/is_null_fwd.h create mode 100644 3party/sqlpp11/include/sqlpp11/join.h create mode 100644 3party/sqlpp11/include/sqlpp11/join_types.h create mode 100644 3party/sqlpp11/include/sqlpp11/limit.h create mode 100644 3party/sqlpp11/include/sqlpp11/logic.h create mode 100644 3party/sqlpp11/include/sqlpp11/lower.h create mode 100644 3party/sqlpp11/include/sqlpp11/mysql/bind_result.h create mode 100644 3party/sqlpp11/include/sqlpp11/mysql/char_result.h create mode 100644 3party/sqlpp11/include/sqlpp11/mysql/char_result_row.h create mode 100644 3party/sqlpp11/include/sqlpp11/mysql/connection.h create mode 100644 3party/sqlpp11/include/sqlpp11/mysql/connection_config.h create mode 100644 3party/sqlpp11/include/sqlpp11/mysql/connection_pool.h create mode 100644 3party/sqlpp11/include/sqlpp11/mysql/detail/connection_handle.h create mode 100644 3party/sqlpp11/include/sqlpp11/mysql/detail/prepared_statement_handle.h create mode 100644 3party/sqlpp11/include/sqlpp11/mysql/detail/result_handle.h create mode 100644 3party/sqlpp11/include/sqlpp11/mysql/mysql.h create mode 100644 3party/sqlpp11/include/sqlpp11/mysql/prepared_statement.h create mode 100644 3party/sqlpp11/include/sqlpp11/mysql/remove.h create mode 100644 3party/sqlpp11/include/sqlpp11/mysql/serializer.h create mode 100644 3party/sqlpp11/include/sqlpp11/mysql/sqlpp_mysql.h create mode 100644 3party/sqlpp11/include/sqlpp11/mysql/update.h create mode 100644 3party/sqlpp11/include/sqlpp11/named_interpretable.h create mode 100644 3party/sqlpp11/include/sqlpp11/no_data.h create mode 100644 3party/sqlpp11/include/sqlpp11/no_name.h create mode 100644 3party/sqlpp11/include/sqlpp11/noop.h create mode 100644 3party/sqlpp11/include/sqlpp11/noop_fwd.h create mode 100644 3party/sqlpp11/include/sqlpp11/not_in.h create mode 100644 3party/sqlpp11/include/sqlpp11/null.h create mode 100644 3party/sqlpp11/include/sqlpp11/offset.h create mode 100644 3party/sqlpp11/include/sqlpp11/on.h create mode 100644 3party/sqlpp11/include/sqlpp11/operand_check.h create mode 100644 3party/sqlpp11/include/sqlpp11/order_by.h create mode 100644 3party/sqlpp11/include/sqlpp11/over.h create mode 100644 3party/sqlpp11/include/sqlpp11/parameter.h create mode 100644 3party/sqlpp11/include/sqlpp11/parameter_list.h create mode 100644 3party/sqlpp11/include/sqlpp11/parameterized_verbatim.h create mode 100644 3party/sqlpp11/include/sqlpp11/policy_update.h create mode 100644 3party/sqlpp11/include/sqlpp11/portable_static_assert.h create mode 100644 3party/sqlpp11/include/sqlpp11/postgresql/bind_result.h create mode 100644 3party/sqlpp11/include/sqlpp11/postgresql/connection.h create mode 100644 3party/sqlpp11/include/sqlpp11/postgresql/connection_config.h create mode 100644 3party/sqlpp11/include/sqlpp11/postgresql/connection_pool.h create mode 100644 3party/sqlpp11/include/sqlpp11/postgresql/detail/connection_handle.h create mode 100644 3party/sqlpp11/include/sqlpp11/postgresql/detail/prepared_statement_handle.h create mode 100644 3party/sqlpp11/include/sqlpp11/postgresql/dynamic_libpq.h create mode 100644 3party/sqlpp11/include/sqlpp11/postgresql/exception.h create mode 100644 3party/sqlpp11/include/sqlpp11/postgresql/insert.h create mode 100644 3party/sqlpp11/include/sqlpp11/postgresql/on_conflict.h create mode 100644 3party/sqlpp11/include/sqlpp11/postgresql/on_conflict_do_nothing.h create mode 100644 3party/sqlpp11/include/sqlpp11/postgresql/on_conflict_do_update.h create mode 100644 3party/sqlpp11/include/sqlpp11/postgresql/postgresql.h create mode 100644 3party/sqlpp11/include/sqlpp11/postgresql/prepared_statement.h create mode 100644 3party/sqlpp11/include/sqlpp11/postgresql/result.h create mode 100644 3party/sqlpp11/include/sqlpp11/postgresql/result_field.h create mode 100644 3party/sqlpp11/include/sqlpp11/postgresql/returning.h create mode 100644 3party/sqlpp11/include/sqlpp11/postgresql/returning_column_list.h create mode 100644 3party/sqlpp11/include/sqlpp11/postgresql/serializer.h create mode 100644 3party/sqlpp11/include/sqlpp11/postgresql/update.h create mode 100644 3party/sqlpp11/include/sqlpp11/postgresql/visibility.h create mode 100644 3party/sqlpp11/include/sqlpp11/ppgen.h create mode 100644 3party/sqlpp11/include/sqlpp11/ppgen/colops/auto_increment.h create mode 100644 3party/sqlpp11/include/sqlpp11/ppgen/colops/blob.h create mode 100644 3party/sqlpp11/include/sqlpp11/ppgen/colops/bool.h create mode 100644 3party/sqlpp11/include/sqlpp11/ppgen/colops/comment.h create mode 100644 3party/sqlpp11/include/sqlpp11/ppgen/colops/datetime.h create mode 100644 3party/sqlpp11/include/sqlpp11/ppgen/colops/default.h create mode 100644 3party/sqlpp11/include/sqlpp11/ppgen/colops/floating_point.h create mode 100644 3party/sqlpp11/include/sqlpp11/ppgen/colops/foreign_key.h create mode 100644 3party/sqlpp11/include/sqlpp11/ppgen/colops/index.h create mode 100644 3party/sqlpp11/include/sqlpp11/ppgen/colops/integer.h create mode 100644 3party/sqlpp11/include/sqlpp11/ppgen/colops/not_null.h create mode 100644 3party/sqlpp11/include/sqlpp11/ppgen/colops/null.h create mode 100644 3party/sqlpp11/include/sqlpp11/ppgen/colops/primary_key.h create mode 100644 3party/sqlpp11/include/sqlpp11/ppgen/colops/text.h create mode 100644 3party/sqlpp11/include/sqlpp11/ppgen/colops/timestamp.h create mode 100644 3party/sqlpp11/include/sqlpp11/ppgen/colops/unique_index.h create mode 100644 3party/sqlpp11/include/sqlpp11/ppgen/colops/unsigned_integer.h create mode 100644 3party/sqlpp11/include/sqlpp11/ppgen/colops/varchar.h create mode 100644 3party/sqlpp11/include/sqlpp11/ppgen/tblops/character_set.h create mode 100644 3party/sqlpp11/include/sqlpp11/ppgen/tblops/comment.h create mode 100644 3party/sqlpp11/include/sqlpp11/ppgen/tblops/default.h create mode 100644 3party/sqlpp11/include/sqlpp11/ppgen/tblops/engine.h create mode 100644 3party/sqlpp11/include/sqlpp11/ppgen/tools/tuple_pop_front.h create mode 100644 3party/sqlpp11/include/sqlpp11/ppgen/tools/wrap_seq.h create mode 100644 3party/sqlpp11/include/sqlpp11/pre_join.h create mode 100644 3party/sqlpp11/include/sqlpp11/prepared_execute.h create mode 100644 3party/sqlpp11/include/sqlpp11/prepared_insert.h create mode 100644 3party/sqlpp11/include/sqlpp11/prepared_remove.h create mode 100644 3party/sqlpp11/include/sqlpp11/prepared_select.h create mode 100644 3party/sqlpp11/include/sqlpp11/prepared_update.h create mode 100644 3party/sqlpp11/include/sqlpp11/remove.h create mode 100644 3party/sqlpp11/include/sqlpp11/result.h create mode 100644 3party/sqlpp11/include/sqlpp11/result_field.h create mode 100644 3party/sqlpp11/include/sqlpp11/result_field_base.h create mode 100644 3party/sqlpp11/include/sqlpp11/result_row.h create mode 100644 3party/sqlpp11/include/sqlpp11/result_row_fwd.h create mode 100644 3party/sqlpp11/include/sqlpp11/schema.h create mode 100644 3party/sqlpp11/include/sqlpp11/schema_qualified_table.h create mode 100644 3party/sqlpp11/include/sqlpp11/select.h create mode 100644 3party/sqlpp11/include/sqlpp11/select_column_list.h create mode 100644 3party/sqlpp11/include/sqlpp11/select_flag_list.h create mode 100644 3party/sqlpp11/include/sqlpp11/select_flags.h create mode 100644 3party/sqlpp11/include/sqlpp11/select_pseudo_table.h create mode 100644 3party/sqlpp11/include/sqlpp11/serialize.h create mode 100644 3party/sqlpp11/include/sqlpp11/serializer_context.h create mode 100644 3party/sqlpp11/include/sqlpp11/simple_column.h create mode 100644 3party/sqlpp11/include/sqlpp11/single_table.h create mode 100644 3party/sqlpp11/include/sqlpp11/some.h create mode 100644 3party/sqlpp11/include/sqlpp11/sort_order.h create mode 100644 3party/sqlpp11/include/sqlpp11/sqlite3/bind_result.h create mode 100644 3party/sqlpp11/include/sqlpp11/sqlite3/connection.h create mode 100644 3party/sqlpp11/include/sqlpp11/sqlite3/connection_config.h create mode 100644 3party/sqlpp11/include/sqlpp11/sqlite3/connection_pool.h create mode 100644 3party/sqlpp11/include/sqlpp11/sqlite3/detail/connection_handle.h create mode 100644 3party/sqlpp11/include/sqlpp11/sqlite3/detail/prepared_statement_handle.h create mode 100644 3party/sqlpp11/include/sqlpp11/sqlite3/dynamic_libsqlite3.h create mode 100644 3party/sqlpp11/include/sqlpp11/sqlite3/export.h create mode 100644 3party/sqlpp11/include/sqlpp11/sqlite3/insert_or.h create mode 100644 3party/sqlpp11/include/sqlpp11/sqlite3/prepared_statement.h create mode 100644 3party/sqlpp11/include/sqlpp11/sqlite3/serializer.h create mode 100644 3party/sqlpp11/include/sqlpp11/sqlite3/sqlite3.h create mode 100644 3party/sqlpp11/include/sqlpp11/sqlpp11.h create mode 100644 3party/sqlpp11/include/sqlpp11/statement.h create mode 100644 3party/sqlpp11/include/sqlpp11/statement_fwd.h create mode 100644 3party/sqlpp11/include/sqlpp11/table.h create mode 100644 3party/sqlpp11/include/sqlpp11/table_alias.h create mode 100644 3party/sqlpp11/include/sqlpp11/table_ref.h create mode 100644 3party/sqlpp11/include/sqlpp11/transaction.h create mode 100644 3party/sqlpp11/include/sqlpp11/trim.h create mode 100644 3party/sqlpp11/include/sqlpp11/type_traits.h create mode 100644 3party/sqlpp11/include/sqlpp11/unconditional.h create mode 100644 3party/sqlpp11/include/sqlpp11/union.h create mode 100644 3party/sqlpp11/include/sqlpp11/union_data.h create mode 100644 3party/sqlpp11/include/sqlpp11/union_flags.h create mode 100644 3party/sqlpp11/include/sqlpp11/update.h create mode 100644 3party/sqlpp11/include/sqlpp11/update_list.h create mode 100644 3party/sqlpp11/include/sqlpp11/upper.h create mode 100644 3party/sqlpp11/include/sqlpp11/using.h create mode 100644 3party/sqlpp11/include/sqlpp11/value.h create mode 100644 3party/sqlpp11/include/sqlpp11/value_or_null.h create mode 100644 3party/sqlpp11/include/sqlpp11/value_type.h create mode 100644 3party/sqlpp11/include/sqlpp11/value_type_fwd.h create mode 100644 3party/sqlpp11/include/sqlpp11/verbatim.h create mode 100644 3party/sqlpp11/include/sqlpp11/verbatim_table.h create mode 100644 3party/sqlpp11/include/sqlpp11/where.h create mode 100644 3party/sqlpp11/include/sqlpp11/with.h create mode 100644 3party/sqlpp11/include/sqlpp11/without_table_check.h create mode 100644 3party/sqlpp11/include/sqlpp11/wrap_operand.h create mode 100644 3party/sqlpp11/include/sqlpp11/wrong.h create mode 100755 3party/sqlpp11/pre-commit create mode 100755 3party/sqlpp11/scripts/ddl2cpp create mode 100644 3party/sqlpp11/scripts/sqlite2cpp.py create mode 100644 3party/sqlpp11/tests/CMakeLists.txt create mode 100644 3party/sqlpp11/tests/core/CMakeLists.txt create mode 100644 3party/sqlpp11/tests/core/compat/CMakeLists.txt create mode 100644 3party/sqlpp11/tests/core/compat/make_unique.cpp create mode 100644 3party/sqlpp11/tests/core/constraints/CMakeLists.txt create mode 100644 3party/sqlpp11/tests/core/constraints/count_of_count.cpp create mode 100644 3party/sqlpp11/tests/core/constraints/max_of_max.cpp create mode 100644 3party/sqlpp11/tests/core/constraints/must_not_insert.cpp create mode 100644 3party/sqlpp11/tests/core/constraints/must_not_update.cpp create mode 100644 3party/sqlpp11/tests/core/constraints/require_insert.cpp create mode 100644 3party/sqlpp11/tests/core/helpers/CMakeLists.txt create mode 100644 3party/sqlpp11/tests/core/helpers/circular_buffer.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/Any.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/As.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/Avg.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/Blob.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/CMakeLists.txt create mode 100644 3party/sqlpp11/tests/core/serialize/Count.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/CustomQuery.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/DynamicWhere.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/Exists.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/Float.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/ForUpdate.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/From.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/In.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/Insert.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/IsNotNull.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/IsNull.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/Lower.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/Max.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/Min.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/Operator.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/Over.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/ParameterizedVerbatim.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/Some.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/Sum.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/TableAlias.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/Trim.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/Upper.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/Where.cpp create mode 100644 3party/sqlpp11/tests/core/serialize/compare.h create mode 100644 3party/sqlpp11/tests/core/static_asserts/AssertTables.h create mode 100644 3party/sqlpp11/tests/core/static_asserts/AssertTables.sql create mode 100644 3party/sqlpp11/tests/core/static_asserts/CMakeLists.txt create mode 100644 3party/sqlpp11/tests/core/static_asserts/aggregates.cpp create mode 100644 3party/sqlpp11/tests/core/static_asserts/case.cpp create mode 100644 3party/sqlpp11/tests/core/static_asserts/date.cpp create mode 100644 3party/sqlpp11/tests/core/static_asserts/date_time.cpp create mode 100644 3party/sqlpp11/tests/core/static_asserts/from.cpp create mode 100644 3party/sqlpp11/tests/core/static_asserts/having.cpp create mode 100644 3party/sqlpp11/tests/core/static_asserts/in.cpp create mode 100644 3party/sqlpp11/tests/core/static_asserts/insert.cpp create mode 100644 3party/sqlpp11/tests/core/static_asserts/join.cpp create mode 100644 3party/sqlpp11/tests/core/static_asserts/no_self_compare.cpp create mode 100644 3party/sqlpp11/tests/core/static_asserts/text.cpp create mode 100644 3party/sqlpp11/tests/core/static_asserts/unwrapped_bool.cpp create mode 100644 3party/sqlpp11/tests/core/static_asserts/update_list.cpp create mode 100644 3party/sqlpp11/tests/core/static_asserts/where.cpp create mode 100644 3party/sqlpp11/tests/core/types/CMakeLists.txt create mode 100644 3party/sqlpp11/tests/core/types/result_row.cpp create mode 100644 3party/sqlpp11/tests/core/usage/BooleanExpression.cpp create mode 100644 3party/sqlpp11/tests/core/usage/CMakeLists.txt create mode 100644 3party/sqlpp11/tests/core/usage/CustomQuery.cpp create mode 100644 3party/sqlpp11/tests/core/usage/DateTime.cpp create mode 100644 3party/sqlpp11/tests/core/usage/DateTimeParser.cpp create mode 100644 3party/sqlpp11/tests/core/usage/Function.cpp create mode 100644 3party/sqlpp11/tests/core/usage/Insert.cpp create mode 100644 3party/sqlpp11/tests/core/usage/Interpret.cpp create mode 100644 3party/sqlpp11/tests/core/usage/Minimalistic.cpp create mode 100644 3party/sqlpp11/tests/core/usage/MockDb.h create mode 100644 3party/sqlpp11/tests/core/usage/Ppgen.cpp create mode 100644 3party/sqlpp11/tests/core/usage/Prepared.cpp create mode 100644 3party/sqlpp11/tests/core/usage/Remove.cpp create mode 100644 3party/sqlpp11/tests/core/usage/Result.cpp create mode 100644 3party/sqlpp11/tests/core/usage/Sample.h create mode 100644 3party/sqlpp11/tests/core/usage/Select.cpp create mode 100644 3party/sqlpp11/tests/core/usage/SelectType.cpp create mode 100644 3party/sqlpp11/tests/core/usage/Union.cpp create mode 100644 3party/sqlpp11/tests/core/usage/Update.cpp create mode 100644 3party/sqlpp11/tests/core/usage/With.cpp create mode 100644 3party/sqlpp11/tests/core/usage/is_regular.h create mode 100644 3party/sqlpp11/tests/core/usage/sample.sql create mode 100644 3party/sqlpp11/tests/include/ConnectionPoolTests.h create mode 100644 3party/sqlpp11/tests/include/ConnectionTests.h create mode 100644 3party/sqlpp11/tests/include/TabDepartment.h create mode 100644 3party/sqlpp11/tests/mysql/CMakeLists.txt create mode 100644 3party/sqlpp11/tests/mysql/serialize/CMakeLists.txt create mode 100644 3party/sqlpp11/tests/mysql/serialize/Float.cpp create mode 100644 3party/sqlpp11/tests/mysql/serialize/compare.h create mode 100644 3party/sqlpp11/tests/mysql/usage/CMakeLists.txt create mode 100644 3party/sqlpp11/tests/mysql/usage/Connection.cpp create mode 100644 3party/sqlpp11/tests/mysql/usage/ConnectionPool.cpp create mode 100644 3party/sqlpp11/tests/mysql/usage/CustomQuery.cpp create mode 100644 3party/sqlpp11/tests/mysql/usage/DateTime.cpp create mode 100644 3party/sqlpp11/tests/mysql/usage/DynamicSelect.cpp create mode 100644 3party/sqlpp11/tests/mysql/usage/Json.cpp create mode 100644 3party/sqlpp11/tests/mysql/usage/MoveConstructor.cpp create mode 100644 3party/sqlpp11/tests/mysql/usage/Prepared.cpp create mode 100644 3party/sqlpp11/tests/mysql/usage/Remove.cpp create mode 100644 3party/sqlpp11/tests/mysql/usage/Sample.cpp create mode 100644 3party/sqlpp11/tests/mysql/usage/Select.cpp create mode 100644 3party/sqlpp11/tests/mysql/usage/TabJson.h create mode 100644 3party/sqlpp11/tests/mysql/usage/TabJson.sql create mode 100644 3party/sqlpp11/tests/mysql/usage/TabSample.h create mode 100644 3party/sqlpp11/tests/mysql/usage/TabSample.sql create mode 100644 3party/sqlpp11/tests/mysql/usage/Truncated.cpp create mode 100644 3party/sqlpp11/tests/mysql/usage/Union.cpp create mode 100644 3party/sqlpp11/tests/mysql/usage/Update.cpp create mode 100644 3party/sqlpp11/tests/mysql/usage/make_test_connection.h create mode 100644 3party/sqlpp11/tests/postgresql/CMakeLists.txt create mode 100644 3party/sqlpp11/tests/postgresql/constraints/CMakeLists.txt create mode 100644 3party/sqlpp11/tests/postgresql/constraints/OnConflictEmptyWhereDoUpdate.cpp create mode 100644 3party/sqlpp11/tests/postgresql/constraints/OnConflictInvalidAssignmentsDoUpdate.cpp create mode 100644 3party/sqlpp11/tests/postgresql/constraints/OnConflictInvalidParameter.cpp create mode 100644 3party/sqlpp11/tests/postgresql/constraints/OnConflictInvalidWhereDoUpdate.cpp create mode 100644 3party/sqlpp11/tests/postgresql/constraints/OnConflictMissingAction.cpp create mode 100644 3party/sqlpp11/tests/postgresql/constraints/OnConflictMissingAssignmentsDoUpdate.cpp create mode 100644 3party/sqlpp11/tests/postgresql/constraints/OnConflictMissingParameterDoUpdate.cpp create mode 100644 3party/sqlpp11/tests/postgresql/constraints/ReturningEmptyAssert.cpp create mode 100644 3party/sqlpp11/tests/postgresql/constraints/ReturningInvalidArgument.cpp create mode 100644 3party/sqlpp11/tests/postgresql/serialize/CMakeLists.txt create mode 100644 3party/sqlpp11/tests/postgresql/serialize/Float.cpp create mode 100644 3party/sqlpp11/tests/postgresql/serialize/compare.h create mode 100644 3party/sqlpp11/tests/postgresql/usage/Basic.cpp create mode 100644 3party/sqlpp11/tests/postgresql/usage/BasicConstConfig.cpp create mode 100644 3party/sqlpp11/tests/postgresql/usage/Blob.cpp create mode 100644 3party/sqlpp11/tests/postgresql/usage/BlobSample.h create mode 100644 3party/sqlpp11/tests/postgresql/usage/BlobSample.sql create mode 100644 3party/sqlpp11/tests/postgresql/usage/CMakeLists.txt create mode 100644 3party/sqlpp11/tests/postgresql/usage/Connection.cpp create mode 100644 3party/sqlpp11/tests/postgresql/usage/ConnectionPool.cpp create mode 100644 3party/sqlpp11/tests/postgresql/usage/Date.cpp create mode 100644 3party/sqlpp11/tests/postgresql/usage/DateTime.cpp create mode 100644 3party/sqlpp11/tests/postgresql/usage/Exceptions.cpp create mode 100644 3party/sqlpp11/tests/postgresql/usage/InsertOnConflict.cpp create mode 100644 3party/sqlpp11/tests/postgresql/usage/Returning.cpp create mode 100644 3party/sqlpp11/tests/postgresql/usage/Select.cpp create mode 100644 3party/sqlpp11/tests/postgresql/usage/TabBar.h create mode 100644 3party/sqlpp11/tests/postgresql/usage/TabDateTime.h create mode 100644 3party/sqlpp11/tests/postgresql/usage/TabFoo.h create mode 100644 3party/sqlpp11/tests/postgresql/usage/TabSample.h create mode 100644 3party/sqlpp11/tests/postgresql/usage/TimeZone.cpp create mode 100644 3party/sqlpp11/tests/postgresql/usage/Transaction.cpp create mode 100644 3party/sqlpp11/tests/postgresql/usage/Type.cpp create mode 100644 3party/sqlpp11/tests/postgresql/usage/assertThrow.h create mode 100644 3party/sqlpp11/tests/postgresql/usage/make_test_connection.h create mode 100644 3party/sqlpp11/tests/scripts/CMakeLists.txt create mode 100644 3party/sqlpp11/tests/scripts/custom_types.csv create mode 100644 3party/sqlpp11/tests/scripts/ddl2cpp_sample_bad.sql create mode 100644 3party/sqlpp11/tests/scripts/ddl2cpp_sample_good.sql create mode 100644 3party/sqlpp11/tests/scripts/ddl2cpp_sample_good_custom_type.cpp create mode 100644 3party/sqlpp11/tests/scripts/ddl2cpp_sample_good_custom_type.sql create mode 100644 3party/sqlpp11/tests/scripts/sample.cpp create mode 100644 3party/sqlpp11/tests/scripts/sample_identity_naming.cpp create mode 100644 3party/sqlpp11/tests/sqlite3/CMakeLists.txt create mode 100644 3party/sqlpp11/tests/sqlite3/serialize/CMakeLists.txt create mode 100644 3party/sqlpp11/tests/sqlite3/serialize/Float.cpp create mode 100644 3party/sqlpp11/tests/sqlite3/serialize/compare.h create mode 100644 3party/sqlpp11/tests/sqlite3/usage/Attach.cpp create mode 100644 3party/sqlpp11/tests/sqlite3/usage/AutoIncrement.cpp create mode 100644 3party/sqlpp11/tests/sqlite3/usage/Blob.cpp create mode 100644 3party/sqlpp11/tests/sqlite3/usage/BlobSample.h create mode 100644 3party/sqlpp11/tests/sqlite3/usage/BlobSample.sql create mode 100644 3party/sqlpp11/tests/sqlite3/usage/CMakeLists.txt create mode 100644 3party/sqlpp11/tests/sqlite3/usage/Connection.cpp create mode 100644 3party/sqlpp11/tests/sqlite3/usage/ConnectionPool.cpp create mode 100644 3party/sqlpp11/tests/sqlite3/usage/DateTime.cpp create mode 100644 3party/sqlpp11/tests/sqlite3/usage/DynamicLoadingTest.cpp create mode 100644 3party/sqlpp11/tests/sqlite3/usage/DynamicSelect.cpp create mode 100644 3party/sqlpp11/tests/sqlite3/usage/FloatingPoint.cpp create mode 100644 3party/sqlpp11/tests/sqlite3/usage/FpSample.h create mode 100644 3party/sqlpp11/tests/sqlite3/usage/FpSample.sql create mode 100644 3party/sqlpp11/tests/sqlite3/usage/Integral.cpp create mode 100644 3party/sqlpp11/tests/sqlite3/usage/IntegralSample.h create mode 100644 3party/sqlpp11/tests/sqlite3/usage/Sample.cpp create mode 100644 3party/sqlpp11/tests/sqlite3/usage/Select.cpp create mode 100644 3party/sqlpp11/tests/sqlite3/usage/TabSample.h create mode 100644 3party/sqlpp11/tests/sqlite3/usage/TabSample.sql create mode 100644 3party/sqlpp11/tests/sqlite3/usage/Transaction.cpp create mode 100644 3party/sqlpp11/tests/sqlite3/usage/Union.cpp create mode 100644 3party/sqlpp11/tests/sqlite3/usage/With.cpp create mode 100644 3party/sqlpp11/wishlist.md diff --git a/.gitmodules b/.gitmodules index 3f18805..2402d61 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,7 +2,3 @@ path = 3party/googletest url = https://code.uocat.com/3party/googletest branch = release-1.7.0 -[submodule "3party/sqlpp11"] - path = 3party/sqlpp11 - url = https://code.uocat.com/3party/sqlpp11 - branch = 0.64 diff --git a/3party/sqlpp11 b/3party/sqlpp11 deleted file mode 160000 index 7f04435..0000000 --- a/3party/sqlpp11 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7f04435576036fc3f06d929760b5c7623485f069 diff --git a/3party/sqlpp11/.appveyor.yml b/3party/sqlpp11/.appveyor.yml new file mode 100644 index 0000000..7c6f8ae --- /dev/null +++ b/3party/sqlpp11/.appveyor.yml @@ -0,0 +1,31 @@ +os: + - Visual Studio 2015 + - Visual Studio 2017 + +platform: + - x64 + +configuration: + #- Debug + - Release + +matrix: + fast_finish: true + +build_script: + - CD + - cd .. + - CD + - git clone https://github.com/HowardHinnant/date + - cd date + - git checkout tags/v2.4 + - cd .. + - cd sqlpp11 + - CD + - echo %configuration% + - mkdir build + - cd build + - cmake --version + - cmake .. -DCMAKE_CXX_FLAGS="/EHsc /wd4503" -DCMAKE_PREFIX_PATH="C:\projects\date" + - cmake --build . --config %configuration% + - ctest . --build-config %configuration% --output-on-failure diff --git a/3party/sqlpp11/.clang-format b/3party/sqlpp11/.clang-format new file mode 100644 index 0000000..c0ffae2 --- /dev/null +++ b/3party/sqlpp11/.clang-format @@ -0,0 +1,54 @@ +Language: Cpp +AccessModifierOffset: -2 +ConstructorInitializerIndentWidth: 4 +AlignEscapedNewlinesLeft: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: false +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AlwaysBreakTemplateDeclarations: true +AlwaysBreakBeforeMultilineStrings: false +BreakBeforeBinaryOperators: false +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BinPackParameters: false +ColumnLimit: 120 +ConstructorInitializerAllOnOneLineOrOnePerLine: true +DerivePointerAlignment: false +ExperimentalAutoDetectBinPacking: false +IndentCaseLabels: true +IndentWrappedFunctionNames: false +IndentFunctionDeclarationAfterType: false +MaxEmptyLinesToKeep: 1 +KeepEmptyLinesAtTheStartOfBlocks: false +NamespaceIndentation: All +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: false +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyBreakComment: 300 +PenaltyBreakString: 1000 +PenaltyBreakFirstLessLess: 120 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Left +SpacesBeforeTrailingComments: 2 +Cpp11BracedListStyle: true +Standard: Cpp11 +IndentWidth: 2 +TabWidth: 2 +UseTab: Never +BreakBeforeBraces: Allman +SpacesInParentheses: false +SpacesInAngles: false +SpaceInEmptyParentheses: false +SpacesInCStyleCastParentheses: false +SpacesInContainerLiterals: true +SpaceBeforeAssignmentOperators: true +ContinuationIndentWidth: 4 +CommentPragmas: '^ IWYU pragma:' +ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] +SpaceBeforeParens: ControlStatements +DisableFormat: false +SortIncludes: false diff --git a/3party/sqlpp11/.gitignore b/3party/sqlpp11/.gitignore new file mode 100644 index 0000000..c844e26 --- /dev/null +++ b/3party/sqlpp11/.gitignore @@ -0,0 +1,2 @@ +.idea +CMakeLists.txt.user diff --git a/3party/sqlpp11/.travis.yml b/3party/sqlpp11/.travis.yml new file mode 100644 index 0000000..e143ced --- /dev/null +++ b/3party/sqlpp11/.travis.yml @@ -0,0 +1,45 @@ +language: cpp + +os: + - linux + +dist: focal +sudo: required + +services: + - mysql + +addons: + apt: + packages: + - sqlite3 + - libboost-dev + - python-pyparsing + +compiler: + - clang + - gcc + +env: + - CONFIG=Release + - CONFIG=Release TESTS_CXX_STD=17 + #- CONFIG=Debug + +notifications: + email: + on_success: change + on_failure: always + +before_script: + - mysql --version + - (while ! mysqladmin -u root status ; do sleep 1; done) # wait for mysql to start + - mysqladmin -u root create sqlpp_mysql + - if [[ "$CXX" = "g++" && "$CONFIG" = "Debug" && "$TRAVIS_OS_NAME" = "linux" ]]; then export CXXFLAGS="--coverage"; fi + - cmake -B build -DCMAKE_BUILD_TYPE=$CONFIG -DBUILD_MYSQL_CONNECTOR=ON -DBUILD_SQLITE3_CONNECTOR=ON + +script: + - cmake --build . --config $CONFIG + - ctest --output-on-failure + +after_script: + - ../coveralls diff --git a/3party/sqlpp11/CMakeLists.txt b/3party/sqlpp11/CMakeLists.txt new file mode 100644 index 0000000..bb05cd8 --- /dev/null +++ b/3party/sqlpp11/CMakeLists.txt @@ -0,0 +1,166 @@ +# Copyright (c) 2013-2021, Roland Bock +# Copyright (c) 2016 Christian Dávid +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above copyright notice, this +# list of conditions and the following disclaimer in the documentation and/or +# other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +### Preamble +cmake_minimum_required(VERSION 3.14) +project(sqlpp11 VERSION 0.1 LANGUAGES CXX) + +### Project Wide Setup +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules) + +include(GNUInstallDirs) +include(CTest) + +option(BUILD_MYSQL_CONNECTOR "Build MySQL Connector" OFF) +option(BUILD_MARIADB_CONNECTOR "Build MariaDB Connector" OFF) +option(BUILD_POSTGRESQL_CONNECTOR "Build PostgreSQL Connector" OFF) +option(BUILD_SQLITE3_CONNECTOR "Build SQLite3 Connector" OFF) +option(BUILD_SQLCIPHER_CONNECTOR "Build SQLite3 Connector with SQLCipher" OFF) + +option(DEPENDENCY_CHECK "Check for dependencies of connector and the library" ON) + +option(USE_SYSTEM_DATE "\ + Use find_package to find installed HowardHinnant's \ + date library instead of fetching it from github" OFF +) + +set(SQLPP11_INSTALL_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/Sqlpp11 CACHE STRING "Path to sqlpp11 cmake files") + +### Dependencies +if(DEPENDENCY_CHECK AND BUILD_MYSQL_CONNECTOR) + find_package(MySQL REQUIRED) +endif() + +if(DEPENDENCY_CHECK AND BUILD_MARIADB_CONNECTOR) + find_package(MariaDB REQUIRED) +endif() + +if(DEPENDENCY_CHECK AND BUILD_POSTGRESQL_CONNECTOR) + find_package(PostgreSQL REQUIRED) +endif() + +if(DEPENDENCY_CHECK AND BUILD_SQLITE3_CONNECTOR) + find_package(SQLite3 REQUIRED) +endif() + +if(DEPENDENCY_CHECK AND BUILD_SQLCIPHER_CONNECTOR) + find_package(SQLCipher REQUIRED) +endif() + +if(DEPENDENCY_CHECK AND USE_SYSTEM_DATE) + find_package(date REQUIRED) +endif() + +add_subdirectory(dependencies) + +### Core targets +include(Sqlpp11TargetHelper) + +add_library(sqlpp11 INTERFACE) +add_library(sqlpp11::sqlpp11 ALIAS sqlpp11) + +target_link_libraries(sqlpp11 INTERFACE date::date) +target_include_directories(sqlpp11 INTERFACE + $ +) +target_compile_features(sqlpp11 INTERFACE cxx_std_11) + + +if(BUILD_SQLITE3_CONNECTOR) + add_component(NAME sqlite3 DEPENDENCIES SQLite::SQLite3) +endif() + +if(BUILD_SQLCIPHER_CONNECTOR) + add_component(NAME sqlcipher DEPENDENCIES SQLCipher::SQLCipher) + target_compile_definitions(sqlpp11_sqlcipher INTERFACE SQLPP_USE_SQLCIPHER) +endif() + +if(BUILD_MYSQL_CONNECTOR) + add_component(NAME mysql DEPENDENCIES MySQL::MySQL) +endif() + +if(BUILD_MARIADB_CONNECTOR) + add_component(NAME mariadb DEPENDENCIES MariaDB::MariaDB) +endif() + +if(BUILD_POSTGRESQL_CONNECTOR) + add_component(NAME postgresql DEPENDENCIES PostgreSQL::PostgreSQL) +endif() + +### Packaging +install(PROGRAMS ${PROJECT_SOURCE_DIR}/scripts/ddl2cpp + RENAME sqlpp11-ddl2cpp + DESTINATION ${CMAKE_INSTALL_BINDIR} +) + +write_basic_package_version_file(Sqlpp11ConfigVersion.cmake + COMPATIBILITY SameMajorVersion + ARCH_INDEPENDENT +) + +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Sqlpp11ConfigVersion.cmake + DESTINATION ${SQLPP11_INSTALL_CMAKEDIR} +) + +install_component(NAME Sqlpp11 TARGETS sqlpp11 DIRECTORY) + +if(BUILD_SQLITE3_CONNECTOR) + install_component(NAME Sqlpp11SQLite3 TARGETS sqlpp11_sqlite3 DIRECTORY sqlite3) +endif() + +if(BUILD_SQLCIPHER_CONNECTOR) + install_component(NAME Sqlpp11SQLCipher TARGETS sqlpp11_sqlcipher DIRECTORY sqlite3) + + install(FILES ${PROJECT_SOURCE_DIR}/cmake/modules/FindSQLCipher.cmake + DESTINATION ${SQLPP11_INSTALL_CMAKEDIR} + ) +endif() + +if(BUILD_MYSQL_CONNECTOR) + install_component(NAME Sqlpp11MySQL TARGETS sqlpp11_mysql DIRECTORY mysql) + + install(FILES ${PROJECT_SOURCE_DIR}/cmake/modules/FindMySQL.cmake + DESTINATION ${SQLPP11_INSTALL_CMAKEDIR} + ) +endif() + +if(BUILD_MARIADB_CONNECTOR) + install_component(NAME Sqlpp11MariaDB TARGETS sqlpp11_mariadb DIRECTORY mysql) + + install(FILES ${PROJECT_SOURCE_DIR}/cmake/modules/FindMariaDB.cmake + DESTINATION ${SQLPP11_INSTALL_CMAKEDIR} + ) +endif() + +if(BUILD_POSTGRESQL_CONNECTOR) + install_component(NAME Sqlpp11PostgreSQL TARGETS sqlpp11_postgresql DIRECTORY postgresql) +endif() + + +### Tests +if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) + add_subdirectory(tests) +endif() diff --git a/3party/sqlpp11/CREDITS b/3party/sqlpp11/CREDITS new file mode 100644 index 0000000..fdfc9b5 --- /dev/null +++ b/3party/sqlpp11/CREDITS @@ -0,0 +1,19 @@ +Credits: +======== +This library evolved through several stages and would probably not exist without input from other people: + + * Michael Gmelin: Interface and requirements discussions + * Paul Körbitz: Feedback and extensions + * Peter Knoblach: Initial ideas + * Ulrich Küttler: Feedback and extensions + * Daniel Pfeifer: Buildsystem, Travis, Coveralls + + + * Metafeed GmbH: Production code using a forerunner version + * PPRO Financial Ltd: Production code using sqlpp11 and a forerunner version + * The boost community: Invaluable suggestions and critiques + + * Meeting C++ Munich: Hosted the first talk about sqlpp11 + + +If you miss your name of this list, please let me know. diff --git a/3party/sqlpp11/ChangeLog.md b/3party/sqlpp11/ChangeLog.md new file mode 100644 index 0000000..e3e97c2 --- /dev/null +++ b/3party/sqlpp11/ChangeLog.md @@ -0,0 +1,109 @@ +Important changes in sqlpp11 +============================ + +Breaking changes in 0.36: +------------------------- +__Abstract__: + +One of the main motivations of sqlpp11 is to prevent SQL programming mistakes at compile time. The following changes prevent reported mishaps. + * `from(a,b)` not allowed anymore, please use explicit joins + * `where(true)` not allowed anymore, please use `.unconditionally()` or sqlpp::value(true) + * `some_sql_expression and true` not allowed anymore, please use `tab.col == sqlpp::value(true)` if you really want to express this. + * `having(expression)` requires `expression` to be made of aggregates, e.g. columns named in `group_by()` or aggregate functions like `count()` or constant values. + * `where()` and `having` accept only one parameter + +__Explicit joins required__: + +Up until sqlpp11-0.35 you could write something like + +``` +auto result = db(select(all_of(a), all_of(b)) + .from(a,b) + .where(someCondition)); +``` + +Using this syntax in `from()`, it was expected to have the join condition implicitly in the `where()` call. +But there is no reliable way to tell whether or not that condition is there. Or, if there definitely is none, whether +it was omitted on purpose or by accident. +In one case, an accidentally omitted join condition in the `where()` brought a production system to a screeching halt. + +In order to prevent this in the future, sqlpp11 now requires you to join table explicitly, including an explicit join condition, e.g. + +``` +auto result = db(select(all_of(a), all_of(b)) + .from(a.join(b).on(a.b == b.id)) + .where(someCondition)); +``` + +Most joins, (`join`/`inner_join`, `left_outer_join`, `right_outer_join` and `outer_join`) require a join condition to given via `on()`. +The join condition has to be some sqlpp11 boolean expression. + +In those rare cases, when you really need a cross join, you can also use `cross_join()` which has no join condition, of course. + +``` +auto result = db(select(all_of(a), all_of(b)) + .from(a.cross_join(b)) + .where(someCondition)); +``` + +__Use `.unconditionally()`__ + +If you want to select/update/remove all rows, earlier versions of sqlpp11 required the use of `where(true)`. Since version 0.36, use `unconditionally()`, for instance: +``` +auto result = db(select(all_of(t)).from(t).unconditionally()); +``` + +__Use `sqlpp::value()` to wrap bool values in boolean expressions__ + +Lets say you had + +``` +struct X +{ + int a; + int b; +}; +auto x = X{}; +``` + +Then earlier versions of sqlpp11 would compile the following expression: + +``` +select(all_of(t)).from(t).where(x.a == x.a or t.b == t.b); +``` + +What you probably meant was: + +``` +select(all_of(t)).from(t).where(t.a == x.a and t.b == x.b); +``` + +In order to prevent this kind of mistake, boolean operators in sql expressions require sqlpp boolean expressions as operators. +The library also requires the types of the left/right hand side operands of a comparison to be different, so that `t.a < t.a` does not compile any more. + +In the rare case you really have a bool value that you want to use a boolean sql expression, you have to wrap it in sqlpp::value(x), e.g. + +``` +select(all_of(t)).from(t).where(sqlpp::value(x.a == 17) and t.b == x.b); +``` + +__`having()` requires aggregate expressions__ + +In older versions, the following code was allowed: + +``` +select(all_of(t)).from(t).where(t.a > 7).having(t.b != ""); +``` + +As of sqlpp11-0.36, the having argument must be made of aggregate columns or functions, e.g. + +``` +select(all_of(t)).from(t).unconditionally().group_by(t.b).having(t.b != "", avg(t.c) < 42); +``` + +__`where()` and `having` accept only one expression__ + +In older versions, `where()` and `having()` would accept more than one argument and combine those arguments with `and`. +I am not sure this was ever used. So it just made life harder for the compiler. + +As of version 0.36, `where()` and `having()` accept only one parameter. diff --git a/3party/sqlpp11/LICENSE b/3party/sqlpp11/LICENSE new file mode 100644 index 0000000..bfe399c --- /dev/null +++ b/3party/sqlpp11/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2013-2016, Roland Bock +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/3party/sqlpp11/README.md b/3party/sqlpp11/README.md new file mode 100644 index 0000000..53acf38 --- /dev/null +++ b/3party/sqlpp11/README.md @@ -0,0 +1,287 @@ +sqlpp11 +======= +A type safe embedded domain specific language for SQL queries and results in C++. + +```diff +!If you are a tenured user of sqlpp11, please note that +! - with 0.61 the connector libraries for mysql/sqlite/postgresql got merged into the main repo. +! - master has been renamed to main and is now the default branch +``` + +Documentation is found in [docs](docs/Home.md). + +So what is this about? +---------------------- +SQL and C++ are both strongly typed languages. Still, most C/C++ interfaces to SQL are based on constructing queries as strings and on interpreting arrays or maps of strings as results. + +sqlpp11 is a templated library representing an embedded domain specific language (EDSL) that allows you to + + * define types representing tables and columns, + * construct type safe queries checked at compile time for syntax errors, type errors, name errors and even some semantic errors, + * interpret results by iterating over query-specific structs with appropriately named and typed members. + +This results in several benefits, e.g. + + * the library user operates comfortably on structs and functions, + * the compiler reports many kinds of errors long before the code enters unit testing or production, + * the library hides the gory details of string construction for queries and interpreting results returned by select calls. + +The library supports both static and dynamic queries. The former offers greater benefit in terms of type and consistency checking. The latter makes it easier to construct queries in flight. + +sqlpp11’s core is vendor-neutral. +Specific traits of databases (e.g. unsupported or non-standard features) are handled by connector libraries. +Connector libraries can inform the developer of missing features at compile time. +They also interpret expressions specifically where needed. +For example, the connector could use the operator|| or the concat method for string concatenation without the developer being required to change the statement. + +Connectors for MariaDB, MySQL, PostgreSQL, sqlite3, sqlcipher are included in this repository. + +The library is already used in production but it is certainly not complete yet. Feature requests, bug reports, contributions to code or documentation are most welcome. + +Examples: +--------- +For the examples, lets assume you have a table class representing something like + +```SQL +CREATE TABLE foo ( + id bigint, + name varchar(50), + hasFun bool +); +``` + +And we assume to have a database connection object: + +```C++ +TabFoo foo; +Db db(/* some arguments*/); + +// selecting zero or more results, iterating over the results +for (const auto& row : db(select(foo.name, foo.hasFun).from(foo).where(foo.id > 17 and foo.name.like("%bar%")))) +{ + if (row.name.is_null()) + std::cerr << "name is null, will convert to empty string" << std::endl; + std::string name = row.name; // string-like fields are implicitly convertible to string + bool hasFun = row.hasFun; // bool fields are implicitly convertible to bool +} + +// selecting ALL columns of a table +for (const auto& row : db(select(all_of(foo)).from(foo).where(foo.hasFun or foo.name == "joker"))) +{ + int64_t id = row.id; // numeric fields are implicitly convertible to numeric c++ types +} + +// selecting zero or one row, showing off with an alias: +SQLPP_ALIAS_PROVIDER(cheese); +if (const auto& row = db(select(foo.name.as(cheese)).from(foo).where(foo.id == 17))) +{ + std::cerr << "found: " << row.cheese << std::endl; +} + +// selecting a single row with a single result: +return db(select(count(foo.id)).from(foo).unconditionally()).front().count; + +Of course there are joins and subqueries, more functions, order_by, group_by etc. +These will be documented soon. + +// A sample insert +db(insert_into(foo).set(foo.id = 17, foo.name = "bar", foo.hasFun = true)); + +// A sample update +db(update(foo).set(foo.hasFun = not foo.hasFun).where(foo.name != "nobody")); + +// A sample delete +db(remove_from(foo).where(not foo.hasFun)); +``` + +License: +------------- +sqlpp11 is distributed under the [BSD 2-Clause License](https://github.com/rbock/sqlpp11/blob/master/LICENSE). + +Status: +------- +Branch / Compiler | clang, gcc | MSVC | Test Coverage +------------------|-------------|--------|--------------- +master | [![Build Status](https://travis-ci.com/rbock/sqlpp11.svg?branch=master)](https://travis-ci.com/rbock/sqlpp11?branch=master) | [![Build status](https://ci.appveyor.com/api/projects/status/eid7mwqgavo0h61h/branch/master?svg=true)](https://ci.appveyor.com/project/rbock/sqlpp11/branch/master) | [![Coverage Status](https://coveralls.io/repos/rbock/sqlpp11/badge.svg?branch=master)](https://coveralls.io/r/rbock/sqlpp11?branch=master) +develop | [![Build Status](https://travis-ci.com/rbock/sqlpp11.svg?branch=develop)](https://travis-ci.com/rbock/sqlpp11?branch=develop) | [![Build status](https://ci.appveyor.com/api/projects/status/eid7mwqgavo0h61h/branch/develop?svg=true)](https://ci.appveyor.com/project/rbock/sqlpp11/branch/develop) | [![Coverage Status](https://coveralls.io/repos/rbock/sqlpp11/badge.svg?branch=develop)](https://coveralls.io/r/rbock/sqlpp11?branch=develop) + +Additional information available: +--------------------------------- +Past talks about sqlpp11 and some coding concepts used within the library: + + * [CppCast:](http://cppcast.com) + * 2015-05-07: http://cppcast.com/2015/05/roland-bock/ + * [CppCon:](http://cppcon.org) + * 2015-09-24: [Pruning Error Messages From Your C++ Template Code](https://www.youtube.com/watch?v=2ISqFW9fRws), with examples from sqlpp11 + * 2014-09-11: [sqlpp11, An SQL Library Worthy Of Modern C++](https://www.youtube.com/watch?v=cJPAjhBm-HQ) + * [Meeting C++:](http://meetingcpp.com) + * 2014-12-05: [sqlpp11, An EDSL For Type-Safe SQL In C++11](https://www.youtube.com/watch?v=9Hjfg9IfzhU) + * [MUC++:](http://www.meetup.com/MUCplusplus/) + * 2014-02-27: [Selected C++11 Template Toffees From sqlpp11, Part1](https://www.youtube.com/watch?v=hXnGFYNbmXg), [Part2](https://www.youtube.com/watch?v=WPCV6dvxZ_U), [Part 3](https://www.youtube.com/watch?v=eB7hd_KjTig), [Part 4](https://www.youtube.com/watch?v=NBfqzcN0_EQ) + + +Requirements: +------------- +__Compiler:__ +sqlpp11 makes heavy use of C++11 and requires a recent compiler and STL. The following compilers are known to compile the test programs: + + * clang-3.4+ on Ubuntu-12.4 + * g++-4.8+ on Ubuntu-12.4 + * g++-4.8+ on cygwin 64bit + * g++-4.9+ on Debian Unstable + * Xcode-7 on OS X + * MSVC 2015 Update 1 on Windows Server 2012 + +__Database Connector:__ +sqlpp11 requires a certain api in order to connect with the database, see database/api.h. + +This repository includes the following connectors: + +* MySQL +* MariaDB +* SQLite3 +* SQLCipher +* PostgreSQL + +Other connectors can be found here: + + * ODBC: https://github.com/Erroneous1/sqlpp11-connector-odbc (experimental) + +__Date Library:__ +sqlpp11 requires [Howard Hinnant’s date library](https://github.com/HowardHinnant/date) for `date` and `date_time` data types. By default, sqlpp11 uses FetchContent to pull the library automatically in the project. If you want to use an already installed version of the library with `find_package`, set `USE_SYSTEM_DATE` option to `ON`. + +Build and Install +----------------- + +**Note**: Depending on how you use the lib, you might not need to install it (see Basic Usage) + +__Build from Source:__ + +Download and unpack the latest release from https://github.com/rbock/sqlpp11/releases or clone the repository. Inside the directory run the following commands: + +```bash +cmake -B build +cmake --build build --target install +``` + +The last step will build the library and install it system wide, therefore it might need admins rights. + +By default only the core library will be installed. To also install connectors set the appropriate variable to `ON`: + +* `BUILD_MYSQL_CONNECTOR` +* `BUILD_MARIADB_CONNECTOR` +* `BUILD_POSTGRESQL_CONNECTOR` +* `BUILD_SQLITE3_CONNECTOR` +* `BUILD_SQLCIPHER_CONNECTOR` + +The library will check if all required dependencies are installed on the system. If connectors should be installed even if the dependencies are not yet available on the system, set `DEPENDENCY_CHECK` to `OFF`. + +Example: Install the core library, sqlite3 connector and postgresql connector. Don’t check if the dependencies such as Sqlite3 are installed and don’t build any tests: + +```bash +cmake -B build -DBUILD_POSTGRESQL_CONNECTOR=ON -DBUILD_SQLITE3_CONNECTOR=ON -DDEPENDENCY_CHECK=OFF -DBUILD_TESTING=OFF +cmake --build build --target install +``` + +__Install via Homebrew (MacOS):__ + +```bash +brew install marvin182/zapfhahn/sqlpp11 +``` + +Some connectors can be installed with the formula. See `brew info marvin182/zapfhahn/sqlpp11` for available options. + +__Build via vcpkg:__ + +You can download and install sqlpp11 using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager: + +```bash +git clone https://github.com/Microsoft/vcpkg.git +cd vcpkg +./bootstrap-vcpkg.sh +./vcpkg integrate install +vcpkg install sqlpp11 +``` + +The sqlpp11 port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository. + +The following connector libraries for sqlpp11 are maintained as a separate package in vcpkg: + + * [sqlpp11-connector-sqlite3](https://github.com/microsoft/vcpkg/tree/master/ports/sqlpp11-connector-sqlite3) + * [sqlpp11-connector-mysql](https://github.com/microsoft/vcpkg/tree/master/ports/sqlpp11-connector-mysql) + +Basic usage: +------------- +__Use with cmake__: +The library officially supports two ways how it can be used with cmake. +You can find examples for both methods in the examples folder. + +1. FetchContent (Recommended, no installation required) +1. FindPackage (installation required, see above) + +Both methods will provide the `sqlpp11::sqlpp11` target as well as targets for each connector: + +* sqlpp11::mysql +* sqlpp11::mariadb +* sqlpp11::sqlite3 +* sqlpp11::sqlcipher +* sqlpp11::postgresql + +These targets will make sure all required dependencies are available and correctly linked and include directories are set correctly. + +__Create DDL files__: +``` +mysql: 'show create table MyDatabase.MyTable' #or +mysqldump --no-data MyDatabase > MyDatabase.sql + +``` +Create headers for them with provided Python script: +``` +%sqlpp11_dir%/scripts/ddl2cpp ~/temp/MyTable.ddl ~/temp/MyTable %DatabaseNamespaceForExample% +``` + +In case you’re getting notes about unsupported column type consider: + - Take a look at the other datatypes in sqlpp11/data_types. They are not hard to implement. + - Use the `--datatype-file` command line argument as described below. + +Include generated header (MyTable.h), that’s all. + +If you prefer Ruby over Python, you might want to take a look at https://github.com/douyw/sqlpp11gen + +Unsupported column types: +------------- +__Map unsupported column types to supported column types with a csv file__: + +One can use the `--datatype-file` command line argument for the ddl2cpp script to map unsupported column types to supported column types. + +The format of the csv file is: +``` +, , +, +``` + +Where `` is one or more of the following internal types: + + - `Boolean` + - `Integer` + - `Serial` + - `FloatingPoint` + - `Text` + - `Blob` + - `Date` + - `DateTime` + - `Time` + +Example: + +``` +Boolean, one_or_zero +Text, url, uuid +``` + +Contact: +-------- + * Issues at https://github.com/rbock/sqlpp11/issues + * email at rbock at eudoxos dot de + * [![Join the chat at https://gitter.im/sqlpp11/Lobby](https://badges.gitter.im/sqlpp11/Lobby.svg)](https://gitter.im/sqlpp11/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + diff --git a/3party/sqlpp11/_config.yml b/3party/sqlpp11/_config.yml new file mode 100644 index 0000000..2f7efbe --- /dev/null +++ b/3party/sqlpp11/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-minimal \ No newline at end of file diff --git a/3party/sqlpp11/cmake/Sqlpp11TargetHelper.cmake b/3party/sqlpp11/cmake/Sqlpp11TargetHelper.cmake new file mode 100644 index 0000000..3306393 --- /dev/null +++ b/3party/sqlpp11/cmake/Sqlpp11TargetHelper.cmake @@ -0,0 +1,65 @@ +# Copyright (c) 2021, Leon De Andrade +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this +# list of conditions and the following disclaimer in the documentation and/or +# other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +include(GNUInstallDirs) +include(CMakePackageConfigHelpers) + +function(add_component) + set(options) + set(oneValueArgs NAME) + set(multiValueArgs DEPENDENCIES) + cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + add_library(sqlpp11_${ARG_NAME} INTERFACE) + add_library(sqlpp11::${ARG_NAME} ALIAS sqlpp11_${ARG_NAME}) + set_target_properties(sqlpp11_${ARG_NAME} PROPERTIES EXPORT_NAME ${ARG_NAME}) + target_link_libraries(sqlpp11_${ARG_NAME} INTERFACE sqlpp11 ${ARG_DEPENDENCIES}) +endfunction() + +function(install_component) + set(options) + set(oneValueArgs NAME DIRECTORY) + set(multiValueArgs TARGETS) + cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + install(FILES ${PROJECT_SOURCE_DIR}/cmake/configs/${ARG_NAME}Config.cmake + DESTINATION ${SQLPP11_INSTALL_CMAKEDIR} + ) + + install(TARGETS ${ARG_TARGETS} + EXPORT Sqlpp11Targets + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + ) + + install(EXPORT Sqlpp11Targets + DESTINATION ${SQLPP11_INSTALL_CMAKEDIR} + NAMESPACE sqlpp11:: + ) + + install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/sqlpp11/${ARG_DIRECTORY} + DESTINATION include/sqlpp11 + FILES_MATCHING + PATTERN *.h + ) +endfunction() \ No newline at end of file diff --git a/3party/sqlpp11/cmake/configs/Sqlpp11Config.cmake b/3party/sqlpp11/cmake/configs/Sqlpp11Config.cmake new file mode 100644 index 0000000..bf340d6 --- /dev/null +++ b/3party/sqlpp11/cmake/configs/Sqlpp11Config.cmake @@ -0,0 +1,71 @@ +# Copyright (c) 2016, Christian David +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +# Temporarly prepend CMAKE_MODULE_PATH with current directory to find helper scripts such as FindPackage scripts +set(CMAKE_MODULE_PATH_save ${CMAKE_MODULE_PATH}) +list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +include(CMakeFindDependencyMacro) +find_dependency(Threads) +find_dependency(date REQUIRED) + +# Work out the set of components to load +if(${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS) + set(${CMAKE_FIND_PACKAGE_NAME}_comps ${${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS}) +endif() + +# Check all required components are available before trying to load any +foreach(comp IN LISTS ${CMAKE_FIND_PACKAGE_NAME}_comps) + if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_${comp} AND NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/Sqlpp11${comp}Config.cmake) + set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "Sqlpp11 missing required component: ${comp}") + set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE) + return() + endif() +endforeach() + +# Add the target file +include(${CMAKE_CURRENT_LIST_DIR}/Sqlpp11Targets.cmake) + +# Load any optional components +foreach(comp IN LISTS ${CMAKE_FIND_PACKAGE_NAME}_comps) + include(${CMAKE_CURRENT_LIST_DIR}/Sqlpp11${comp}Config.cmake OPTIONAL) +endforeach() + +# Import "ddl2cpp" script +if(NOT TARGET sqlpp11::ddl2cpp) + get_filename_component(sqlpp11_ddl2cpp_location "${CMAKE_CURRENT_LIST_DIR}/../../../bin/sqlpp11-ddl2cpp" REALPATH) + if(NOT EXISTS "${sqlpp11_ddl2cpp_location}") + message(FATAL_ERROR "The imported target sqlpp11::ddl2cpp references the file '${sqlpp11_ddl2cpp_location}' but this file does not exists.") + endif() + add_executable(sqlpp11::ddl2cpp IMPORTED) + set_target_properties(sqlpp11::ddl2cpp PROPERTIES + IMPORTED_LOCATION "${sqlpp11_ddl2cpp_location}" + ) + unset(sqlpp11_ddl2cpp_location) +endif() + +# Resture module path +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH_save}) +unset(CMAKE_MODULE_PATH_save) \ No newline at end of file diff --git a/3party/sqlpp11/cmake/configs/Sqlpp11MariaDBConfig.cmake b/3party/sqlpp11/cmake/configs/Sqlpp11MariaDBConfig.cmake new file mode 100644 index 0000000..32a594a --- /dev/null +++ b/3party/sqlpp11/cmake/configs/Sqlpp11MariaDBConfig.cmake @@ -0,0 +1,2 @@ +include(CMakeFindDependencyMacro) +find_dependency(MariaDB) \ No newline at end of file diff --git a/3party/sqlpp11/cmake/configs/Sqlpp11MySQLConfig.cmake b/3party/sqlpp11/cmake/configs/Sqlpp11MySQLConfig.cmake new file mode 100644 index 0000000..0d2a5b3 --- /dev/null +++ b/3party/sqlpp11/cmake/configs/Sqlpp11MySQLConfig.cmake @@ -0,0 +1,2 @@ +include(CMakeFindDependencyMacro) +find_dependency(MySQL) \ No newline at end of file diff --git a/3party/sqlpp11/cmake/configs/Sqlpp11PostgreSQLConfig.cmake b/3party/sqlpp11/cmake/configs/Sqlpp11PostgreSQLConfig.cmake new file mode 100644 index 0000000..9e4fffa --- /dev/null +++ b/3party/sqlpp11/cmake/configs/Sqlpp11PostgreSQLConfig.cmake @@ -0,0 +1,2 @@ +include(CMakeFindDependencyMacro) +find_dependency(PostgreSQL) \ No newline at end of file diff --git a/3party/sqlpp11/cmake/configs/Sqlpp11SQLCipherConfig.cmake b/3party/sqlpp11/cmake/configs/Sqlpp11SQLCipherConfig.cmake new file mode 100644 index 0000000..0892631 --- /dev/null +++ b/3party/sqlpp11/cmake/configs/Sqlpp11SQLCipherConfig.cmake @@ -0,0 +1,2 @@ +include(CMakeFindDependencyMacro) +find_dependency(SQLCipher) \ No newline at end of file diff --git a/3party/sqlpp11/cmake/configs/Sqlpp11SQLite3Config.cmake b/3party/sqlpp11/cmake/configs/Sqlpp11SQLite3Config.cmake new file mode 100644 index 0000000..cf1098b --- /dev/null +++ b/3party/sqlpp11/cmake/configs/Sqlpp11SQLite3Config.cmake @@ -0,0 +1,2 @@ +include(CMakeFindDependencyMacro) +find_dependency(SQLite3) \ No newline at end of file diff --git a/3party/sqlpp11/cmake/modules/FindMariaDB.cmake b/3party/sqlpp11/cmake/modules/FindMariaDB.cmake new file mode 100644 index 0000000..3f8f858 --- /dev/null +++ b/3party/sqlpp11/cmake/modules/FindMariaDB.cmake @@ -0,0 +1,64 @@ +# Copyright (c) 2016, Christian David +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +if(DEFINED MSVC) + set(SEARCH_PATHS + "$ENV{ProgramFiles}/MariaDB/*" + "$ENV{ProgramFiles\(x86\)}/MariaDB/*" + ) + find_path(MariaDB_INCLUDE_DIR + NAMES mariadb_version.h + PATHS ${SEARCH_PATHS} + PATH_SUFFIXES include + ) + find_library(MariaDB_LIBRARY + NAMES libmariadb + PATHS ${SEARCH_PATHS} + PATH_SUFFIXES lib + ) +else() + find_path(MariaDB_INCLUDE_DIR + NAMES mariadb_version.h + PATH_SUFFIXES mariadb mysql + ) + find_library(MariaDB_LIBRARY NAMES mariadb) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + MariaDB + MariaDB_INCLUDE_DIR + MariaDB_LIBRARY +) + +if(MariaDB_FOUND AND NOT TARGET MariaDB::MariaDB) + add_library(MariaDB::MariaDB UNKNOWN IMPORTED) + target_include_directories(MariaDB::MariaDB INTERFACE "${MariaDB_INCLUDE_DIR}") + set_target_properties(MariaDB::MariaDB PROPERTIES + IMPORTED_LOCATION "${MariaDB_LIBRARY}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C") +endif() + +mark_as_advanced(MariaDB_INCLUDE_DIR MariaDB_LIBRARY) \ No newline at end of file diff --git a/3party/sqlpp11/cmake/modules/FindMySQL.cmake b/3party/sqlpp11/cmake/modules/FindMySQL.cmake new file mode 100644 index 0000000..9cb25da --- /dev/null +++ b/3party/sqlpp11/cmake/modules/FindMySQL.cmake @@ -0,0 +1,71 @@ +# Copyright (c) 2016, Christian David +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +if(DEFINED MSVC) + set(SEARCH_PATHS + "$ENV{ProgramFiles}/MySQL/MySQL Server 8.0" + "$ENV{ProgramFiles}/MySQL/MySQL Server 5.7" + "$ENV{ProgramFiles}/MySQL/MySQL Server 5.6" + "$ENV{ProgramFiles\(x86\)}/MySQL/MySQL Server 8.0" + "$ENV{ProgramFiles\(x86\)}/MySQL/MySQL Server 5.7" + "$ENV{ProgramFiles\(x86\)}/MySQL/MySQL Server 5.6" + ) + find_path(MySQL_INCLUDE_DIR + NAMES mysql_version.h + PATHS ${SEARCH_PATHS} + PATH_SUFFIXES include + ) + find_library(MySQL_LIBRARY + NAMES libmysql + PATHS ${SEARCH_PATHS} + PATH_SUFFIXES lib + ) +else() + find_path(MySQL_INCLUDE_DIR + NAMES mysql_version.h + PATH_SUFFIXES mysql + ) + find_library(MySQL_LIBRARY + NAMES mysqlclient mysqlclient_r + PATH_SUFFIXES mysql # for CentOS 7 + ) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + MySQL + MySQL_INCLUDE_DIR + MySQL_LIBRARY +) + +if(MySQL_FOUND AND NOT TARGET MySQL::MySQL) + add_library(MySQL::MySQL UNKNOWN IMPORTED) + target_include_directories(MySQL::MySQL INTERFACE "${MySQL_INCLUDE_DIR}") + set_target_properties(MySQL::MySQL PROPERTIES + IMPORTED_LOCATION "${MySQL_LIBRARY}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C") +endif() + +mark_as_advanced(MySQL_INCLUDE_DIR MySQL_LIBRARY) \ No newline at end of file diff --git a/3party/sqlpp11/cmake/modules/FindSQLCipher.cmake b/3party/sqlpp11/cmake/modules/FindSQLCipher.cmake new file mode 100644 index 0000000..d509f18 --- /dev/null +++ b/3party/sqlpp11/cmake/modules/FindSQLCipher.cmake @@ -0,0 +1,115 @@ +# - Try to find SQLCipher +# Once done this will define +# +# SQLCIPHER_FOUND - system has SQLCipher +# SQLCIPHER_INCLUDE_DIR - the SQLCipher include directory +# SQLCIPHER_LIBRARIES - Link these to use SQLCipher +# SQLCIPHER_DEFINITIONS - Compiler switches required for using SQLCipher +# SQLCIPHER_VERSION - This is set to major.minor.revision (e.g. 3.4.1) +# +# Hints to find SQLCipher +# +# Set SQLCIPHER_ROOT_DIR to the root directory of a SQLCipher installation +# +# The following variables may be set +# +# SQLCIPHER_USE_OPENSSL - Set to ON/OFF to specify whether to search and use OpenSSL. +# Default is OFF. +# SQLCIPHER_OPENSSL_USE_ZLIB - Set to ON/OFF to specify whether to search and use Zlib in OpenSSL +# Default is OFF. + +# Redistribution and use is allowed according to the terms of the BSD license. + +# Copyright (c) 2008, Gilles Caulier, +# Copyright (c) 2014, Christian Dávid, +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# use pkg-config to get the directories and then use these values +# in the FIND_PATH() and FIND_LIBRARY() calls +if( NOT WIN32 ) + find_package(PkgConfig) + + pkg_check_modules(PC_SQLCIPHER QUIET sqlcipher) + + set(SQLCIPHER_DEFINITIONS ${PC_SQLCIPHER_CFLAGS_OTHER}) +endif( NOT WIN32 ) + +find_path(SQLCIPHER_INCLUDE_DIR NAMES sqlcipher/sqlite3.h + PATHS + ${SQLCIPHER_ROOT_DIR} + ${PC_SQLCIPHER_INCLUDEDIR} + ${PC_SQLCIPHER_INCLUDE_DIRS} + ${CMAKE_INCLUDE_PATH} + PATH_SUFFIXES "include" +) + +find_library(SQLCIPHER_LIBRARY NAMES sqlcipher + PATHS + ${PC_SQLCIPHER_LIBDIR} + ${PC_SQLCIPHER_LIBRARY_DIRS} + ${SQLCIPHER_ROOT_DIR} + PATH_SUFFIXES "lib" +) + +set(SQLCIPHER_LIBRARIES ${SQLCIPHER_LIBRARY}) +set(SQLCIPHER_INCLUDE_DIRS ${SQLCIPHER_INCLUDE_DIR}) + +if (SQLCIPHER_USE_OPENSSL) + find_package(OpenSSL REQUIRED COMPONENTS Crypto) + if (SQLCIPHER_OPENSSL_USE_ZLIB) + find_package(ZLIB REQUIRED) + # Official FindOpenSSL.cmake does not support Zlib + set_target_properties(OpenSSL::Crypto PROPERTIES INTERFACE_LINK_LIBRARIES ZLIB::ZLIB) + endif() + + list(APPEND SQLCIPHER_LIBRARIES ${OPENSSL_LIBRARIES}) + list(APPEND SQLCIPHER_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIRS}) +endif() + + +include(FindPackageHandleStandardArgs) + +find_package_handle_standard_args(SQLCipher + DEFAULT_MSG SQLCIPHER_INCLUDE_DIR SQLCIPHER_LIBRARY) + +# show the SQLCIPHER_INCLUDE_DIR and SQLCIPHER_LIBRARIES variables only in the advanced view +mark_as_advanced(SQLCIPHER_INCLUDE_DIR SQLCIPHER_LIBRARY) + +if (NOT TARGET SQLCipher::SQLCipher) + add_library(SQLCipher::SQLCipher UNKNOWN IMPORTED) + + set_property(TARGET SQLCipher::SQLCipher PROPERTY INTERFACE_COMPILE_DEFINITIONS SQLITE_HAS_CODEC) + set_property(TARGET SQLCipher::SQLCipher APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS "SQLITE_TEMPSTORE=2") + set_target_properties(SQLCipher::SQLCipher PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SQLCIPHER_INCLUDE_DIRS}" + IMPORTED_INTERFACE_LINK_LANGUAGES "C" + IMPORTED_LOCATION "${SQLCIPHER_LIBRARY}") + + if (SQLCIPHER_USE_OPENSSL) + set_target_properties(SQLCipher::SQLCipher PROPERTIES + INTERFACE_LINK_LIBRARIES OpenSSL::Crypto) + set_property(TARGET SQLCipher::SQLCipher APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS "SQLCIPHER_CRYPTO_OPENSSL") + endif() +endif() diff --git a/3party/sqlpp11/connector_api/bind_result.h b/3party/sqlpp11/connector_api/bind_result.h new file mode 100644 index 0000000..17df579 --- /dev/null +++ b/3party/sqlpp11/connector_api/bind_result.h @@ -0,0 +1,89 @@ +#pragma once + +/* + * Copyright (c) 2013-2015, Roland Bock + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +namespace sqlpp +{ + namespace database + { + /* + * bind_result_t binds values of a sqlpp11 result row + * to the results of a statement + */ + class bind_result_t + { + public: + bind_result_t(); // default constructor for a result that will not yield a valid row + bind_result_t(...); + bind_result_t(const bind_result_t&) = delete; + bind_result_t(bind_result_t&& rhs); + bind_result_t& operator=(const bind_result_t&) = delete; + bind_result_t& operator=(bind_result_t&&); + ~bind_result_t(); + + bool operator==(const bind_result_t& rhs) const; + + template + void next(ResultRow& result_row); + + // something similar to this: + /* + { + if (!_handle) + { + result_row.invalidate(); + return; + } + + if (next_impl()) + { + if (not result_row) + { + result_row.validate(); + } + result_row._bind(*this); // bind result row values to results + } + else + { + if (result_row) + result_row.invalidate(); + } + }; + */ + + // These are called by the result row to bind individual result values + // More will be added over time + void _bind_boolean_result(size_t index, signed char* value, bool* is_null); + void _bind_floating_point_result(size_t index, double* value, bool* is_null); + void _bind_integral_result(size_t index, int64_t* value, bool* is_null); + void _bind_text_result(size_t index, const char** text, size_t* len); + ... + }; + } +} diff --git a/3party/sqlpp11/connector_api/connection.h b/3party/sqlpp11/connector_api/connection.h new file mode 100644 index 0000000..18fc8d0 --- /dev/null +++ b/3party/sqlpp11/connector_api/connection.h @@ -0,0 +1,227 @@ +#pragma once + +/* + * Copyright (c) 2013-2015, Roland Bock + * Copyright (c) 2023, Vesselin Atanasov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include // You may use char result or bind result or both +#include // to represent results of select and prepared select + +namespace sqlpp +{ + namespace database + { + // Connection configuration that is used to create new database connections + struct connection_config + { + // Put the configuration properties here, e.g. + // + // std::string host; + // unsigned port; + // std::string username; + // std::string password; + // std::string db_name; + }; + + // The connection handle is a low-level representation of a database connection. + // Pre-connected handles are stored in the connection pool and are used to create + // full connection objects on request. + class connection_handle + { + public: + // Connection handles can be created from connection configurations + connection_handle(const std::shared_ptr& config); + + // Connection handles cannot be copied + connection_handle(const connection_handle&) = delete; + connection_handle& operator=(const connection_handle&) = delete; + + // Connection handles can be moved + connection_handle(connection_handle&&); + connection_handle& operator=(connection_handle&&); + + // Used by the connection pool to check if the connection handle is still + // connected to the database server. + bool is_connected(); + + // Send a dummy request to the server to check if the connection is still alive + bool ping_server(); + + // Optional method that returns a native (low-level) database handle. + // Used by the test code to test the connection pool + native_db_handle native_handle(); + }; + + // The context is not a requirement, but if the database requires + // any deviations from the SQL standard, you should use your own + // context in order to specialize the behaviour, see also interpreter.h + struct context_t + { + template + std::ostream& operator<<(T t); + + std::string escape(std::string arg); + }; + + // The base database-specific connection class. Non-pooled and pooled connection classes derive from it + class connection_base : public sqlpp::connection // this inheritance helps with ADL for dynamic_select, for instance + { + public: + // Base configuration + using _connection_base_t = connection_base; + + // Type of configuration instances + using _config_t = connection_config; + + // Shared pointer wrapping a configuration instance + using _config_ptr_t = std::shared_ptr; + + // Type of connection handles + using _handle_t = connection_handle; + + // Unique pointer wrapping a connection handle + using _handle_ptr_t = std::unique_ptr<_handle_t>; + + using _traits = ::sqlpp::make_traits< + ::sqlpp::no_value_t, + ::sqlpp::tag::enforce_null_result_treatment // If that is what you really want, leave it out otherwise + >; + + using _prepared_statement_t = << handle to a prepared statement of the database >> ; + using _serializer_context_t = << This context is used to serialize a statement >> using _interpreter_context_t = + << This context is used interpret a statement >> + ; + // serializer and interpreter are typically the same for string based connectors + // the types are required for dynamic statement components, see sqlpp11/interpretable.h + + //! "direct" select + template + << bind_result_t >> + select(const Select& s); + + //! prepared select + template + _prepared_statement_t prepare_select(Select& s); + + template + << bind_result_t >> + run_prepared_select(const PreparedSelect& s); // call s._bind_params() + + //! "direct insert + template + size_t insert(const Insert& i); + + //! prepared insert + template + _prepared_statement_t prepare_insert(Insert& i); + + template + size_t run_prepared_insert(const PreparedInsert& i); // call i._bind_params() + + //! "direct" update + template + size_t update(const Update& u); + + //! "prepared" update + template + _prepared_statement_t prepare_update(Update& u); + + template + size_t run_prepared_update(const PreparedUpdate& u); // call u._bind_params() + + //! "direct" remove + template + size_t remove(const Remove& r) + + //! prepared remove + template + _prepared_statement_t prepare_remove(Remove& r); + + template + size_t run_prepared_remove(const PreparedRemove& r); // call r._bind_params() + + //! call run on the argument + template + auto operator()(const T& t) -> decltype(t._run(*this)) + { + return t._run(*this); + } + + //! call prepare on the argument + template + auto prepare(const T& t) -> decltype(t._prepare(*this)) + { + return t._prepare(*this); + } + + + //! set the transaction isolation level for the current connection + /// time of effect is connector-specific, for most is will only affect new transactions + void set_default_isolation_level(sqlpp::isolation_level); + + //! read the default transaction isolation level for the current connection + sqlpp::isolation_level get_default_isolation_level(); + + //! start transaction + void start_transaction(); + + //! start transaction with defined isolation level (optional only for connectors that support it) + void start_transaction(isolation_level isolation /* = isolation_level::undefined */); + + //! commit transaction (or throw transaction if the transaction has been finished already) + void commit_transaction(); + + //! rollback transaction with or without reporting the rollback (or throw if the transaction has been finished + // already) + void rollback_transaction(bool report); + + //! report a rollback failure (will be called by transactions in case of a rollback failure in the destructor) + void report_rollback_failure(const std::string message) noexcept; + + protected: + // Low-level connection handle + _handle_ptr_t _handle; + + // The constructors are private because the base class instances are never created directly, + // The constructors are called from the constructors of the derived classes + connection_base() = default; + connection_base(_handle_ptr_t&& handle) : _handle{std::move(handle)} + { + } + }; + + // Normal non-pooled connections. + using connection = sqlpp::normal_connection; + + // Pooled connections that are created by the thread pool + using pooled_connection = sqlpp::pooled_connection; + } // namespace database +} // namespace sqlpp + +#include diff --git a/3party/sqlpp11/connector_api/connection_pool.h b/3party/sqlpp11/connector_api/connection_pool.h new file mode 100644 index 0000000..cbf7120 --- /dev/null +++ b/3party/sqlpp11/connector_api/connection_pool.h @@ -0,0 +1,39 @@ +#pragma once + +/* +Copyright (c) 2017 - 2018, Roland Bock +Copyright (c) 2023, Vesselin Atanasov +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include +#include + +namespace sqlpp +{ + namespace database + { + using connection_pool = sqlpp::connection_pool; + } // namespace database +} // namespace sqlpp diff --git a/3party/sqlpp11/connector_api/interpreter.h b/3party/sqlpp11/connector_api/interpreter.h new file mode 100644 index 0000000..8f02da1 --- /dev/null +++ b/3party/sqlpp11/connector_api/interpreter.h @@ -0,0 +1,58 @@ +#pragma once + +/* + * Copyright (c) 2013-2015, Roland Bock + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +/* + * sqlpp11 offers an interpreter that can be used to serialize the expression tree + * into a standard SQL string. + * + * The connector library can specialize the interpreter template to partially or + * completely change the way the expression tree is interpreted. + * + * For example, this specialization will produce indexed parameters instead of just '?' + */ +namespace sqlpp +{ + namespace vendor + { + template + struct interpreter_t> + { + using T = parameter_t; + + static database::context_t& _(const T& t, database::context_t& context) + { + context << "?" << context.count(); + context.pop_count(); + return context; + } + }; + } +} diff --git a/3party/sqlpp11/connector_api/prepared_statement.h b/3party/sqlpp11/connector_api/prepared_statement.h new file mode 100644 index 0000000..f719614 --- /dev/null +++ b/3party/sqlpp11/connector_api/prepared_statement.h @@ -0,0 +1,57 @@ +#pragma once + +/* + * Copyright (c) 2013-2015, Roland Bock + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +namespace sqlpp +{ + namespace database + { + class prepared_statement_t + { + public: + prepared_statement_t() = delete; + prepared_statement_t(...); + prepared_statement_t(const prepared_statement_t&) = delete; + prepared_statement_t(prepared_statement_t&& rhs); + prepared_statement_t& operator=(const prepared_statement_t&) = delete; + prepared_statement_t& operator=(prepared_statement_t&&); + ~prepared_statement_t(); + + bool operator==(const prepared_statement_t& rhs) const; + + // These are called by the sqlpp11::prepared_*_t to bind the individual parameters + // More will be added over time + void _bind_boolean_parameter(size_t index, const signed char* value, bool is_null); + void _bind_floating_point_parameter(size_t index, const double* value, bool is_null); + void _bind_integral_parameter(size_t index, const int64_t* value, bool is_null); + void _bind_text_parameter(size_t index, const std::string* value, bool is_null); + }; + } +} diff --git a/3party/sqlpp11/coveralls b/3party/sqlpp11/coveralls new file mode 100755 index 0000000..301d67f --- /dev/null +++ b/3party/sqlpp11/coveralls @@ -0,0 +1,31 @@ +#!/bin/bash + +if [ 0 -eq $(find -iname *.gcda | wc -l) ] +then + exit 0 +fi + +gcov --source-prefix ${TRAVIS_BUILD_DIR} --preserve-paths --relative-only $(find -iname *.gcda) 1>/dev/null || exit 0 + +cat >coverage.json <>coverage.json <coverage.json <(head -n -1 coverage.json.tmp) <(echo -e " }\n ]\n}") +curl -F json_file=@coverage.json https://coveralls.io/api/v1/jobs diff --git a/3party/sqlpp11/dependencies/CMakeLists.txt b/3party/sqlpp11/dependencies/CMakeLists.txt new file mode 100644 index 0000000..2dda27b --- /dev/null +++ b/3party/sqlpp11/dependencies/CMakeLists.txt @@ -0,0 +1,36 @@ +# Copyright (c) 2020, Leon De Andrade +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above copyright notice, this +# list of conditions and the following disclaimer in the documentation and/or +# other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +if(NOT USE_SYSTEM_DATE AND NOT TARGET date::date) + include(FetchContent) + + FetchContent_Declare(date + # GIT_REPOSITORY https://github.com/HowardHinnant/date.git + GIT_REPOSITORY https://code.uocat.com/3party/date.git + GIT_TAG v3.0.0 + ) + + add_subdirectory(hinnant_date) +endif() diff --git a/3party/sqlpp11/dependencies/hinnant_date/CMakeLists.txt b/3party/sqlpp11/dependencies/hinnant_date/CMakeLists.txt new file mode 100644 index 0000000..d15b176 --- /dev/null +++ b/3party/sqlpp11/dependencies/hinnant_date/CMakeLists.txt @@ -0,0 +1,28 @@ +# Copyright (c) 2020, Leon De Andrade +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above copyright notice, this +# list of conditions and the following disclaimer in the documentation and/or +# other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +FetchContent_MakeAvailable(date) + +# Make date a system library (no warnings for date headers when compiling) +get_property(date_include_dirs TARGET date PROPERTY INTERFACE_INCLUDE_DIRECTORIES) +set_property(TARGET date PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${date_include_dirs}") \ No newline at end of file diff --git a/3party/sqlpp11/docs/Connection-Pools.md b/3party/sqlpp11/docs/Connection-Pools.md new file mode 100644 index 0000000..dcc98c9 --- /dev/null +++ b/3party/sqlpp11/docs/Connection-Pools.md @@ -0,0 +1,111 @@ +# Introduction + +SQLPP11 has support for connection pools which are centralized caches of database connections. When you need a database connection, you can fetch one from the connection pool, use the connection to make SQL +queries and when you no longer need the connection object, destroy it, usually by letting it go out of scope. When a connection object is destroyed, the actual connection to the database server is not closed, +but put in a cache instead and next time when you need a database connection object, you will be handed one that reuses a cached connection. If there are no connections is the cache, then a new connection +will be created, wrapped in a connection object and handed to you. + +## Creating connection pools + +Each connector has its own connection pool class. Currently we have + +* sqlpp::mysql::connection_pool +* sqlpp::postgresql::connection_pool +* sqlpp::sqlite3::connection_pool + +The connection pool constructors accept two parameters + +* Shared pointer to a configuration object. This is the same configuration as the one that you use when creating regular (non-pooled) database connections. +* An integer specifying the initial size of the connection cache. This cache size grows automatically when necessary, so this value is not very important as pretty much any small positive value will do. In our example below we use 5. + +In this example we create a PostgreSQL connection pool: + +``` +auto config = std::make_shared(); +config->dbname = "my_database"; +config->user = "my_user"; +config->password = "my_password"; +config->debug = true; +auto pool = sqlpp::postgresql::connection_pool{config, 5}; +``` +You can also create a pool object without a configuration and initialize it later. + +``` +auto pool = sqlpp::postgresql::connection_pool{} +.... +.... +.... +auto config = std::make_shared(); +config->dbname = "my_database"; +config->user = "my_user"; +config->password = "my_password"; +config->debug = true; +pool.initialize(config, 5); +``` +## Getting connections from the connection pool + +Once the connection pool object is established we can use the _get()_ method to fetch connections + +``` +auto db = pool.get(); +for (row : db(select(....))) { + .... +} +``` + +## Returning connections to the connection pool + +We don't really need to do anything to return the connection to the pool. Once the connection object's destructor is called the connection is not really destroyed but instead is returned automatically to the connection +pool's cache. This means that we can use the connection pool in the following way + +``` +for (row : pool.get()(select(....))) { + .... +} +``` +In the above example we fetch a connection from the pool, use it to make an SQL query and then return the connection to the pool. + +## Ensuring that connections handed out by the connection pool are valid + +Connection pools handle out connections that are either newly created or fetched from the connection cache. For connections that are fetched from the cache an optional check can be made to ensure that the connection is still active. +If the cached connection is no longer active, then it is discarded and the user is handed a newly created connection. + +The check type is specified as an optional parameter of the _get()_ method. Currently the following check types are supported: + +* **sqlpp::connection_check::none** Don't check the connection +* **sqlpp::connection_check::passive** A passive check which does not send anything to the server but just checks if the server side has already closed their side of the connection. This check type is supported only for PostgreSQL, for the other connector types it is treated as _none_. +* **sqlpp::connection_check::ping** Send a dummy request to the server to check if the connection is still alive. For MySQL connections this check uses the `mysql_ping` library function. For the other connector types +this check sends `SELECT 1` to the server. + +For example: + +``` +auto db = pool.get(sqlpp::connection_check::ping); +for (row : db(select(....))) { + .... +} +``` + +## Working around connection thread-safety issues + +Connection pools can be used to work around [thread-safety issues](Threads.md) by ensuring that no connection is used simultaneously by multiple threads. + +### Getting a new connection for each request + +One possible usage pattern is getting a new connection handle for each request. For example: + +``` +for (row : pool.get()(select(....))) { + .... +} +pool.get()(insert_into(mytable)....) +pool.get()(remove_from(mytable)....) +``` + +This usage pattern works well provided that you don't use transactions. If you use transactions then you must make sure that the transaction object and all queries inside the transaction use the same database connection. + +### Using one connection per thread + +Another usage pattern that works around the multi-threading problems is keeping a connection handle in a global thread_local object. This global object is not a real connection, but a wrapper which lazily fetches a connection from the +thread pool the first time when it is used to execute a database query. The wrapper will expose all the relevant methods and will forward them to the real connection. This way each thread can use the global wrapper as a database +connection and the thread_local storage class specifier will make sure that each thread accesses its own database connection. You can see examples/connection_pool as an example of this usage pattern. diff --git a/3party/sqlpp11/docs/Database.md b/3party/sqlpp11/docs/Database.md new file mode 100644 index 0000000..04b932d --- /dev/null +++ b/3party/sqlpp11/docs/Database.md @@ -0,0 +1,16 @@ +# Database Connectors + +Using sqlpp11 requires of three logical parts: +1. The actual tables of a database are represented structs, usually generated by sql2cpp. These structs contain compile-time information about each colum such as name and data type. +2. The core library provides SQL as embedded language for C++. It allows you to write SQL statements for those tables and analyse results in a compile-time checked manner. +3. The connector library that allows you to connect to an actual database, send queries and obtain results. + +Three connector libraries are included in this repository: + + * MySQL / MariaDB + * sqlite3 / SQLCipher + * PostgreSQL + +If you want to use other databases, you would have to write your own connector. Don't worry, it is not that hard. + +The api is documented [here](https://github.com/rbock/sqlpp11/blob/master/connector_api/connection.h). diff --git a/3party/sqlpp11/docs/Dynamic-Insert.md b/3party/sqlpp11/docs/Dynamic-Insert.md new file mode 100644 index 0000000..905e1f1 --- /dev/null +++ b/3party/sqlpp11/docs/Dynamic-Insert.md @@ -0,0 +1,33 @@ +# Introduction +_This page explains dynamic insert statements. Before studying this page, you should read about [static insert statements](Insert.md)._ + +If you know the exact structure of your inserts at compile time, statically constructed insert statements are perfect. But if the structure depends on runtime information like user input, you will need dynamic insert statements. For those only provide part fields of table schema, leave others to default value or NULL, dynamic insert statement is a must. Depending on your needs, you can choose the required dosage. + +# A Basic Example +So let us construct insert statement with a dynamic part +```C++ +auto s = dynamic_insert_into(db, foo).dynamic_set( + foo.name = name, +); +s.insert_list.add(foo.id = runtimeStatement.id); +s.insert_list.add(foo.hasFun = runtimeStatement.hasFun); +const int64_t result = db(s); +``` +Admittedly, a rather simplistic example (please suggest nicer ones), but anyway, this is what's happening: +```C++ +dynamic_insert_into(db, table) +``` +This initializes a dynamic insert. One major difference between `dynamic_insert_into` and `insert_into` is the first argument of `dynamic_insert_into`: a database connection. This is used to evaluate the dynamic parts of the statement as they are added. + +```C++ +.dynamic_set(...); +... +s.insert_list.add(foo.id = runtimeStatement.id); +s.insert_list.add(foo.hasFun = runtimeStatement.hasFun); +``` +The first part creates a new insert object that accepts a dynamically constructed set expression. In this case the user can determine whether to search for a certain id or a certain hasFun, or neither or both. + +```C++ +const int64_t result = db(s); +``` +Finally use `db(s)` to execute the insert statement, and returns a `int64_t` value. If `foo.id` column is a `AUTO INCREMENT` (auto generated) id field, this will returns the auto generated id, for others this will returns 0. diff --git a/3party/sqlpp11/docs/Dynamic-Select.md b/3party/sqlpp11/docs/Dynamic-Select.md new file mode 100644 index 0000000..f6ce6ff --- /dev/null +++ b/3party/sqlpp11/docs/Dynamic-Select.md @@ -0,0 +1,69 @@ +# Introduction +_This page explains dynamic select statements. Before studying this page, you should read about [static select statements](Select.md)._ + +If you know the exact structure of your queries at compile time, statically constructed select statements are perfect. But if the structure depends on runtime information like user input, you will need dynamic select statements. Depending on your needs, you can choose the required dosage. + +# A Basic Example +So let us construct select query with a dynamic part +```C++ +auto s = dynamic_select(db, all_of(foo)).from(foo).dynamic_where(); +if (runtimeQuery.id) + s.where.add(foo.id == runtimeQuery.id); +if (!runtimeQuery.name.empty()) + s.where.add(foo.name == runtimeQuery.name); +``` +Admittedly, a rather lame example (please suggest nicer ones), but anyway, this is what's happening: +```C++ +dynamic_select(db, ...) +``` +This initializes a dynamic select. One major difference between `dynamic_select` and `select` is the first argument of `dynamic_select`: a database connection. This is used to evaluate the dynamic parts of the query as they are added. + +```C++ +.dynamic_where(); +... +s.where.add(foo.name == runtimeQuery.name); +s.where.add(foo.id == runtimeQuery.id); +``` +The first part creates a new select object that accepts a dynamically constructed where expression. In this case the user can determine whether to search for a certain name or a certain id, or neither or both. + +# Dynamic Select +## Dynamic Columns +If the (some) selected columns are not known at compile time, you can do something like this: +```C++ +auto s = dynamic_select(db).dynamic_columns(foo.id).from(foo).unconditionally(); +if (someCondition) + s.selected_columns.add(foo.name); +if (someOtherCondition) + s.selected_columns.add(foo.hasFun); +``` +In this example, the column id is always selected. The other two columns may or may not be selected. This is determined at runtime. This impacts the way the results are accessed because the type of the result row is not known at the same level of detail as in the static case. The dynamic fields can be accessed via name lookup like in a map: +```C++ +for (const auto& row : db(s)) +{ + long id = row.id; + if (someCondition) + std::string name = row.at("name"); + if (someOtherCondition) + std::string hasFun = row.at("hasFun"); +} +``` +This also shows another difference. Dynamic fields are of text type. It would be possible to add conversion methods for other types as well, but this has not been coded yet. Please let me know you wishes. + +## Dynamic From +In a static query the compiler can verify whether the `from()` clause is sufficient to support all other aspects of the query. + +With a dynamic from, the compile cannot know tables that going into the `from()`. Such checks would therefore be impossible. But it allows you to add joins at runtime! + +```C++ +auto s = dynamic_select(db, all_of(foo)).dynamic_from(foo).dynamic_where(); +if (someOtherCondition) + s.from.add(dynamic_join(bar).on(foo.barId == bar.id)); +``` + +In this example, the user may want to include `bar` into the query. + +## Dynamic Where +As shown in other examples, the where condition can be constructed dynamically using the methods `dynamic_where()` and `where.add()`. The former prepares the select to accept dynamic where conditions, the latter adds a condition. Several calls to add_where will be combined into one condition by `and`. + +## Dynamic Having, Group By, OrderBy, Limit and Offset +Similar to the dynamic where, you can use `dynamic_having`, `dynamic_group_by`, `dynamic_order_by`, `dynamic_limit` and `dynamic_offset` to prepare the select statement to accept certain dynamic aspects. Using `having.add`, `group_by.add`, `order_by.add`, `limit.set` and `offset.set` you can then adjust those query parts according to the runtime information. diff --git a/3party/sqlpp11/docs/Exception-Handling.md b/3party/sqlpp11/docs/Exception-Handling.md new file mode 100644 index 0000000..b041185 --- /dev/null +++ b/3party/sqlpp11/docs/Exception-Handling.md @@ -0,0 +1,10 @@ +## When to expect an exception + +sqlpp11 connectors throw the majority of `sqlpp::exception`s so check your connector's documentation. Generally, you should expect an exception when: + +- Connecting to a database +- Preparing a statement +- Executing a statement +- Retrieving and iterating through result rows + +Additionally, the date library used by sqlpp11 may throw `std::runtime_error`. As of 2017-04-08 this only happens when formatting a date using a format string. \ No newline at end of file diff --git a/3party/sqlpp11/docs/Functions.md b/3party/sqlpp11/docs/Functions.md new file mode 100644 index 0000000..a74f4af --- /dev/null +++ b/3party/sqlpp11/docs/Functions.md @@ -0,0 +1,91 @@ +sqlpp11 offers equivalents for quite a few SQL functions. It also has some additional functions to make the developer's life easier, see [Misc Functions](#Misc-Functions). + +If functions can be used as select columns, the column's name is the name of the function. You can use `.as()` of course to give it another name, see [Select](Select.md). There are just a few exceptions like `any()` which cannot be named. + +# Member Functions +## in and not_in +The methods `in()` and `not_in()` can be used are available for pretty much any expression. They take zero or more value expressions. You can make the list dynamic by using a container of values. + +```C++ +tab.a.in(); // not valid SQL but certainly useful for generic code, evaluates to a false expression (version 0.35 and later). +tab.a.in(x, ...); // x, ... being one or more value expressions +tab.a.in(sub_select); // sub_select being a select expression with one result column of appropriate type. +tab.a.in(sqlpp::value_list(some_container_of_values)); // evaluates to a false expression in case of an empty container +``` + +## is_null +## like + +# Aggregate Functions +The following aggregate functions are supported + * avg + * count + * max + * min + * sum + +For example: +```C++ +for (const auto& row : db(select(tab.name, avg(tab.value)) + .from(tab) + .where(tab.id > 17) + .group_by(tab.name))) +{ + std::cerr << row.name << ": " << row.avg << std::endl; +} +``` + +Use `count(1)` for simply query row count: +```C++ +const int64_t n = db(select(count(1)).from(tab).unconditionally()).front().count; +``` + +# Text Functions +## concat +Just use the + operator :-) + +# Sub-Query Functions +## exists +## any +## some + +# Misc Functions +sqlpp11 offers a few functions that do not mimic SQL but are there to make your life easier. + +## value +The `value` function turns the argument into an unnamed SQL expression, e.g. an `int` into an `sqlpp::integral` or a `std::string` into an `sqlpp::text`. You probably don't need to use this function too often, because in most cases, sqlpp expressions do the conversion themselves. For instance +```C++ +tab.foo + 17 +``` +is a perfectly valid expression if `tab.foo` represents an SQL integral value. But when doing some generic query programming you might get into the situation that you want to select a constant value. For instance: +```C++ +for (const auto& row : select(sqlpp::value(7).as(sql::alias::a)).from(tab))) +{ + int64_t a = row.a; +} +``` + +##value_list +`value_list` is a helper function that takes a container of values and turns it into an sqlpp11 construct that is understood by the `in()` member function of expressions, see above. + +## verbatim +sqlpp11 supports quite a few aspects of SQL. But it does certainly not cover everything, nor will it ever. So what if you need to use something that is not supported? At least for expressions there is an easy way to use unsupported features, the `verbatim()` method. It requires a template parameter to determine the SQL type and a string argument containing the expression, for instance: +```C++ +select(all_of(tab)).from(tab).where(tab.foo == 42 and sqlpp::verbatim("mighty special feature")); +``` +_Use with care_, as sqlpp11 does not bother to look into the string you provide. That means you have to handle type checking, syntax checking, escaping of injected evil data from your users, etc. + +## flatten +Say `tab.foo` and `tab.bar` represent two bigint columns. Then the type of `tab.foo` and `tab.bar` is different. Also `tab.foo + 17` and `tab.bar + 17` are expressions of different type. This is because the expression carries information about required tables for instance (and that is going to be used to check if `from()` contains all the required tables. +The expression templates can get in your way though, if you want to create parts of your query dynamically: +```C++ +auto e = (tab.foo == 17); +if (userWantsBar) + e = (tab.bar == 17); // won't compile +``` +You can use [dynamic select](Dynamic-Select.md), but there is an alternative, the `flatten()` method, which turns the expression into a more generic expression type (it just "remembers" whether it is a text, boolean etc). +```C++ +auto e = flatten(tab.foo == 17); +if (userWantsBar) + e = flatten(tab.bar == 17); // will compile +``` diff --git a/3party/sqlpp11/docs/Home.md b/3party/sqlpp11/docs/Home.md new file mode 100644 index 0000000..6fc18dc --- /dev/null +++ b/3party/sqlpp11/docs/Home.md @@ -0,0 +1,27 @@ +# Introduction +Let's see: +* You know C++? +* You know some SQL? +* You want to use SQL in your C++ program? +* You think C++ and SQL should play well together? +* You know which tables you want to use in a database? +* You can cope with a few template error messages in case something is wrong? + +You have come to the right place! + +sqlpp11 offers you to code SQL in C++ almost naturally. You can use tables, columns and functions. Everything has strong types which allow the compiler to help you a lot. At compile time, it will tell about most of those pesky oversight errors you can make (typos, comparing apples with oranges, forgetting tables in a select statement, etc). And it does not stop at query construction. Results have ranges, and strongly typed members, so that you can browse through results in a type-safe manner, worthy of modern C++. + +The following pages will tell you how to use it: +* [Database Connectors](Database.md) +* [Tables](Tables.md) +* [Insert](Insert.md) +* [Select](Select.md) <- You might want to read this first as an appetizer +* [Update](Update.md) +* [Remove](Remove.md) +* [Functions](Functions.md) +* [Prepared Statements](Prepared-Statements.md) +* [Transactions](Transactions.md) +* [Thread Safety](Threads.md) +* [NULL](NULL.md) +* [Connection Pools](Connection-Pools.md) +* [New Features](New-Features.md) diff --git a/3party/sqlpp11/docs/Insert.md b/3party/sqlpp11/docs/Insert.md new file mode 100644 index 0000000..e8656f0 --- /dev/null +++ b/3party/sqlpp11/docs/Insert.md @@ -0,0 +1,42 @@ +# Introduction +_This page explains insert statements with a static structure. If you want to learn about constructing insert statements at runtime, you should still read this page first and then move on to [dynamic insert statements](Dynamic-Insert.md)._ + +# A Basic example + +Haven't found the time to document this in any detail, yet, but this is an example: + +```C++ +db(insert_into(tab).set(tab.gamma = true)); +db(insert_into(tabDateTime) + .set(tabDateTime.colTimePoint = std::chrono::system_clock::now())); +``` + +This is how you could insert multiple rows at a time: + +```C++ +auto multi_insert = insert_into(t).columns(t.gamma, t.beta, t.delta); +multi_insert.values.add(t.gamma = true, t.beta = "cheesecake", t.delta = 1); +multi_insert.values.add(t.gamma = sqlpp::default_value, t.beta = sqlpp::default_value, + t.delta = sqlpp::default_value); +multi_insert.values.add(t.gamma = sqlpp::value_or_null(true), + t.beta = sqlpp::value_or_null("pie"), + t.delta = sqlpp::value_or_null(sqlpp::null)); +db(multi_insert); +``` + +Note that `add` currently requires precise value types, equal to the respective column's value +type. For instance, time point columns are represented as +`std::chrono::time_point`. + +Thus, when using such a column in a `multi_insert`, you might have to cast to the right +time point. + +``` + auto multi_time_insert = insert_into(tabDateTime).columns(tabDateTime.colTimePoint); + multi_time_insert.values.add(tabDateTime.colTimePoint = std::chrono::time_point_cast( + std::chrono::system_clock::now())); +``` + +Similar for other data types. + +See also [dynamic insert statements](Dynamic-Insert.md). \ No newline at end of file diff --git a/3party/sqlpp11/docs/NULL.md b/3party/sqlpp11/docs/NULL.md new file mode 100644 index 0000000..6b8a7d8 --- /dev/null +++ b/3party/sqlpp11/docs/NULL.md @@ -0,0 +1,100 @@ +# Introduction +Database NULL is a strange beast. It can be compared to anything but that comparison never returns true. It also never returns false, it returns NULL. Even + +```SQL +NULL != NULL -> NULL +NULL = NULL -> NULL +``` + +A value like that would be pretty unusual in C++. Especially since fields in a result could be either a decent value or NULL. And this can change from result row to result row. + +Also, in `where` or `having` conditions, you have to change the expression (not just parameters) if you want to NULL instead of a value: + +```SQL +a = 7 +a IS NULL +``` + +# Obtaining potential NULL values from a select +sqlpp11 can determine whether a result field can be null, based on the columns involved and the structure of your query. If in doubt (for instance due to dynamic parts), it will assume that a field can be NULL. + +You can check if a field is NULL by calling the `is_null()` method. That's easy. + +When it comes to accessing the value, there are two options, though. These can be controlled by the connection class and the columns of your tables. + +## Option 1: No conversion operator +```C++ +class connection: public sqlpp::connection +{ + public: + using _traits = ::sqlpp::make_traits<::sqlpp::no_value_t, + ::sqlpp::tag::enforce_null_result_treatment + >; +``` +If this tag is used in the connection's traits and the respective column does not override it, then there is no conversion operator for fields that can be NULL. You have to access the value through the `value()` method. +If the field is NULL, this method will throw an `sqlpp::exception`. + +## Option 2: Conversion operator, converting NULL to trivial value +If the `tag::enforce_null_result_treatment` is not used in the connection class or the respective column uses `tag::enforce_null_result_treatment`, then there is a conversion operator. Both the conversion operator and the `value()` method will not throw in case of a NULL value. Instead, the will return the trivial value for the field's type, e.g. 0 for numbers or "" for texts. + +## Alternatives: +One often discussed alternative would be boost::optional or (in the future) std::optional. There is one drawbacks (correct me if I am wrong, please): + +`optional` cannot be used for binding result values because it is unclear whether there already is a value to bind to. + +# Handling NULL in statements +When adding potential NULL values to a statement, you have two options: + +## Manually +```C++ +auto s = dynamic_select(db, all_of(tab)).from(tab).dynamic_where(); +if (i_do_have_a_decent_value_of_alpha) + s.add_where(tab.alpha == alpha); +else + s.add_where(tab.alpha.is_null()); +``` + +## tvin() +`tvin()` is a free function that can be used with `std::string` and build-in types like `int` or `float` or `bool`. `tvin` stands for Trivial Value Is NULL. It is used in combination with `operator==()`, `operator!=()` and `operator=()`. These operators will behave the way they should, e.g. + +```C++ +select(all_of(tab)).from(tab).where(tab.alpha == sqlpp::tvin(a)); +``` + +This will evaluate to + +```SQL +SELECT tab.* FROM tab WHERE alpha = 7; +-- OR +SELECT tab.* FROM tab WHERE alpha IS NULL; +``` + +Similar with insert: + +```C++ +insert_into(tab).set(tab.alpha = sqlpp::tvin(a)); +``` + +This will evaluate to + +```SQL +INSERT INTO tab (alpha) VALUES(7); +-- OR +INSERT INTO tab (alpha) VALUES(NULL); +``` + +## Using Column Type +Like to accessing values in select results, setting values can be controlled via the column type: + +```C++ +struct Alpha +{ + struct _name_t; + using _traits = sqlpp::make_traits; +}; +``` +With this tag, you do not need to use `tvin()` for operators `=`, `==`, `!=`. It is used automatically. It translates operator `!` into `IS NULL`. + +**Hint**: Please be aware that trivial_value_is_null will not work with parameters in prepared statements. \ No newline at end of file diff --git a/3party/sqlpp11/docs/New-Features.md b/3party/sqlpp11/docs/New-Features.md new file mode 100644 index 0000000..0d28b41 --- /dev/null +++ b/3party/sqlpp11/docs/New-Features.md @@ -0,0 +1,58 @@ +# New Features + +There are a bunch of new features, that are not fully documented yet. If you would like to contribute documentation, please let me know. + +## Preprocessor generator for columns/tables +You'll need boost 1.50 or greater to use this feature by niXman: + +```C++ +#include +SQLPP_DECLARE_TABLE( + (tab_person) + , + (id , int , SQLPP_AUTO_INCREMENT) + (name , varchar(255), SQLPP_NOT_NULL ) + (feature, int , SQLPP_NOT_NULL ) +) +``` + +See `examples/ppgen.hpp`. + +## Union +Unions are now supported. The arguments need to have the same names and types in their columns. + +```C++ +db(select(t.alpha).from(t).where(true) + .union_distinct(select(f.epsilon.as(t.alpha)).from(f).where(true))); +db(select(t.alpha).from(t).where(true) + .union_all(select(f.epsilon.as(t.alpha)).from(f).where(true))); +``` + +## With +sqlpp11 supports common table expressions: + +```C++ +auto x = sqlpp::cte(sqlpp::alias::x).as(select(all_of(t)).from(t)); + +db(with(x)(select(x.alpha).from(x).where(true))); +``` +## Custom Queries +This allows you to combine building blocks of sqlpp11 into custom queries, for instance a SELECT..INTO which is not supported yet. + +```C++ +// A custom (select ... into) with adjusted return type +// The first argument with a return type is the select, +// but the custom query is really an insert. Thus, we tell it so. +db(custom_query(select(all_of(t)).from(t), into(f)) + .with_result_type_of(insert_into(f))); +``` + +## Schema-qualified tables +sqlpp11 assumes that you're connection addresses one database, normally. But you can tell it about other databases using the `sqlpp::schema_t` and instantiating schema-qualified tables with it: + +```C++ +auto schema = db.attach("lorem_ipsum"); +auto s = schema_qualified_table(schema, TabSample{}).as(sqlpp::alias::x) +// s now represents "lorem_ipsum.tab_sample as x" +// s can be used like any other table in the code +``` diff --git a/3party/sqlpp11/docs/Prepared-Statements.md b/3party/sqlpp11/docs/Prepared-Statements.md new file mode 100644 index 0000000..5398110 --- /dev/null +++ b/3party/sqlpp11/docs/Prepared-Statements.md @@ -0,0 +1,48 @@ +# Introduction +Executing a statement in a database is typically done in two phases: First, the statement is prepared (parsed, compiled, optimized). Then, it is run against the database. Since statements often differ only in parameters, not in structure, many databases offer to store prepared statements. These prepared statements can then be executed repeatedly, typically with some parameters. + +sqlpp11 supports prepared statements. + +## Parameters +Currently there are two overloads to specify a parameter: + +```C++ +parameter(const ValueType&, const AliasProvider&); + +parameter(const NamedExpression&) +``` + +Value types are sqlpp::bigint, sqlpp::text, etc., Alias providers can be generated by using the SQLPP_ALIAS_PROVIDER macro, and named expressions are combinations of the former, e.g. columns of a table. + +For instance, you could use: +```C++ +SQLPP_ALIAS_PROVIDER(cheese); +parameter(sqlpp::bigint(), cheese); + +parameter(tab.id); +``` + +## Prepare and execute statements +insert, update, remove and select statements can be prepared by calling the `prepare()` method of a database connection object. + +```C++ +auto prepared_statement = db.prepare(some_statement); +``` + +You can now set the parameters and execute the prepared statement multiple times, e.g. + +```C++ +auto prepared_insert = db.prepare( + insert_into(tab).set( + tab.alpha = parameter(tab.alpha), + tab.beta = parameter(sqlpp::text(), cheese) + )); +for (const auto& input : input_values) +{ + prepared_insert.params.alpha = input.first; + prepared_insert.params.cheese = input.second; + db(prepared_insert); +} +``` + +Note: need nicer examples... diff --git a/3party/sqlpp11/docs/Remove.md b/3party/sqlpp11/docs/Remove.md new file mode 100644 index 0000000..c2251e7 --- /dev/null +++ b/3party/sqlpp11/docs/Remove.md @@ -0,0 +1,20 @@ +Since `delete` is keyword in C++ that has a different meaning than `delete` in SQL, sqlpp11 calls the method remove. There is no detailed documentation available yet, but here is an example that might help if you have read about [select statements](Select.md) already: + +```C++ +db(remove_from(tab).where(tab.alpha == tab.alpha + 3)); +``` + +## Removing using multiple tables as condition: + +```C++ +test_sqlpp::Users usr; +test_sqlpp::UsersForms usr_forms; +test_sqlpp::Forms form_; + +db(remove_from(usr_forms).using_(usr, form_, usr_forms).where( + usr_forms.iduser == usr.id + and usr.username == username + and usr_forms.idform == form_.id + and form_.name == form_name + )); +``` diff --git a/3party/sqlpp11/docs/Select.md b/3party/sqlpp11/docs/Select.md new file mode 100644 index 0000000..ac2e24b --- /dev/null +++ b/3party/sqlpp11/docs/Select.md @@ -0,0 +1,242 @@ +# Introduction +_This page explains select statements with a static structure. If you want to learn about constructing select statements at runtime, you should still read this page first and then move on to [dynamic select statements](Dynamic-Select.md)._ + +Lets assume we have a table representing + +```SQL +CREATE TABLE foo ( + id bigint, + name varchar(50), + hasFun bool +); +``` +(This is SQL for brevity, not C++, see [here](Tables.md) for details on how to define types representing the tables and columns you want to work with) + +Lets also assume we have an object `db` representing a connection to your [database](Database.md). + +# A Basic example +This shows how you can select some data from table and iterate over the results: +```C++ +for (const auto& row : db(select(foo.name, foo.hasFun) + .from(foo) + .where(foo.id > 17 and foo.name.like("%bar%")))) +{ + if (row.name.is_null()) + std::cerr << "name is null" << std::endl; + else + std::string name = row.name; // string-like fields are implicitly convertible to string + bool hasFun = row.hasFun; // bool fields are implicitly convertible to bool +} +``` +So, what's happening here? Lets ignore the gory details for a moment. Well, there is a select statement. +```C++ +select(foo.name, foo.hasFun) + .from(foo) + .where(foo.id > 17 and foo.name.like("%bar%")) +``` +It selects two columns `name` and `hasFun` from table `foo` for rows which match the criteria given in the where condition. That's about as close to _real_ SQL as it can get... + +The select expression is fed into the call operator of the connection object `db`. This method sends the select statement to the database and returns an object representing the results. In the case of select statements, the result object represents zero or more rows. + +One way of accessing the rows is to iterate over them in a range-based for loop. + +```C++ +for (const auto& row : ...) +``` +Ok, so the variable row is an object that represents a single result row. You really want to use `auto` here, because you don't want to write down the actual type. Trust me. But the wonderful thing about the `row` object is that it has appropriately named and typed members representing the columns you selected. This is one of the utterly cool parts of this library. + +# The Select Statement +## Select +The `select` method takes zero or more named expression arguments. + +Named expressions are expressions with a name. No surprise there. But what kind of expressions have a name? Table columns, for instance. In our example, that would be `foo.id`, `foo.name` and `foo.hasFun`. Most [function](Functions.md) calls also result in named expressions, like `count(foo.id)`. + +So what about unnamed expressions? Results of binary operators like `(foo.id + 17) * 4` have no name. But you can give them a name using the `as(alias)` method. The easiest way is to use a named expression as alias, for instance `((foo.id + 17) * 4).as(foo.id)`, e.g. + +```C++ +for (const auto& row : db(select(((foo.id + 17) * 4).as(foo.id)).from(tab))) +{ + std::cout << row.id << std::endl; +} +``` + +Another option is to define an alias like this: + +```C++ +SQLPP_ALIAS_PROVIDER(total); +for (const auto& row : db(select(sum(id).as(total)).as(foo.id)).from(tab))) +{ + std::cout << row.total << std::endl; +} +``` +Using aliases also comes in handy when you join tables and have several columns of the same name, because no two named expressions in a select must have the same name. So if you want to do something like + +```C++ +select(foo.id, bar.id); // compile error +``` + +One of the columns needs an alias. +```C++ +SQLPP_ALIAS_PROVIDER(barId); +select(foo.id, bar.id.as(barId)); +``` +### Select Columns +All examples above called the `select()` function with one or more arguments, but `select()` can also be called with no arguments. In that case, the selected columns have to be added afterwards + +```C++ +sqlpp::select().columns(foo.id, foo.name); +``` + +See also [dynamic select statements](Dynamic-Select.md). + +### Select Flags +The following flags are currently supported: + +* sqlpp::all +* sqlpp::distinct + +Flags are added via the `flags()` method: + +```C++ +sqlpp::select().flags(sqlpp::all).columns(foo.id, foo.name); +``` + +or + +```C++ +select(foo.id, foo.name).flags(sqlpp::all); +``` + +The latter is shorter than the former, but the former is closer to SQL syntax and probably easier to read. + +### Sub-Select +A select statement with one column also is named expression. This means you can use one select as a sub-select column of another select. For example: +``` +for (const auto& row : db( + select(all_of(foo), + select(sum(bar.value)).from(bar).where(bar.id > foo.id)) + .from(foo))) +{ + int x = row.id; + int a = row.sum; + } +``` +The name of the sub select is the name of the one column. If required, you can rename it using `as()`, as usual. + +### Select All Columns +Statements like `SELECT * from foo` is used pretty often in SQL. sqlpp11 offers something similar: + +```C++ +select(all_of(foo)); +``` + +## From +The `from` method expects one argument. The following subsections expand on the types of valid arguments: +* tables +* tables with an alias (via the `as` method) +* sub-selects with an alias +* joins + +### Tables +This is the most simple case. +```C++ +select(all_of(foo)).from(foo); +``` + +### Aliased Tables +Table aliases are useful in self-joins. +```C++ +SQLPP_ALIAS_PROVIDER(left); +SQLPP_ALIAS_PROVIDER(right); +auto l = foo.as(left); +auto r = foo.as(right); +select(all_of(l)).from(l.join(r).on(l.x == r.y)); +``` +Aliased tables might also be used to increase the readability of generated SQL code, for instance if you have very long table names. + +### Aliased Sub-Select +A select can be used as a pseudo table in another select. You just have to give it a name. +```C++ +SQLPP_ALIAS_PROVIDER(sub); +auto sub_select = select(all_of(foo)).from(foo).as(sub); +``` +The variable `sub_select` can be used as a table now. + +### Joins +You can join two tables like this: +```C++ +foo.join(bar).on(foo.id == bar.foo); +``` +If you want to join more tables, you can chain joins. +```C++ +foo.join(bar).on(foo.id == bar.foo).left_outer_join(baz).on(bar.id == baz.ref); +``` +_Hint_: Omitting the call to `on` will result in mildly horrible error messages... + +## Where +The where condition can be set via the `where` method, which takes a boolean expression argument, for instance: +```C++ +select(all_of(foo)).from(foo).where(foo.id != 17 and foo.name.like("%cake")); +``` + +## Group By +The method `group_by` takes one or more expression arguments, for instance: +```C++ +select(all_of(foo)).from(foo).group_by(foo.name); +``` + +## Having +The having condition can be set via the `having` method, just like the `where` method. + +## Order By +The `order_by` method takes one of more order expression, which are normal expression adorned with `.asc()` or `.desc()`, e.g. +```C++ +select(all_of(foo)).from(foo).order_by(foo.name.asc()); +``` + +## Limit And Offset +The methods `limit` and `offset` take a size_t argument, for instance: +```C++ +select(all_of(foo)).from(foo).limit(10u).offset(20u); +``` +## For Update +The `for_update` method modifies the query with a simplified "FOR UPDATE" clause without columns. +```C++ +select(all_of(foo)).from(foo).where(foo.id != 17).for_update(); +``` + +# Running The Statement +OK, so now we know how to create a select statement. But the statement does not really do anything unless we hand it over to the database: +```C++ +db(select(all_of(foo)).from(foo)); +``` +This call returns a result object of a pretty complex type. Thus, you would normally want to use `auto`: + +```C++ +auto result = db(select(all_of(foo)).from(foo)); +``` + +# Accessing The Results +The `result` object created by executing a `select` query is a container of result rows. + +## Range-based For Loops +Not surprisingly, you can iterate over the rows using a range-based for-loop like this: +```C++ +for (const auto& row : db(select(all_of(foo)).from(foo))) +{ + std::cerr << row.id << std::endl; + std::cerr << row.name << std::endl; +} +``` +Lovely, isn't it? The row objects have types specifically tailored for the select query you wrote. You can access their member by name, and these members have the expected type. + +## Function-based Access +If for some reason, you don't want to use range-based for-loops, you can use `front()` and `pop_front()` on the result, like this: +```C++ +while(!result.empty()) +{ + const auto& row = result.front(); + std::cerr << row.id << std::endl; + std::cerr << row.name << std::endl; + result.pop_front(); +} diff --git a/3party/sqlpp11/docs/Tables.md b/3party/sqlpp11/docs/Tables.md new file mode 100644 index 0000000..53c5bbb --- /dev/null +++ b/3party/sqlpp11/docs/Tables.md @@ -0,0 +1,8 @@ +# Tables + +In order to build meaningful SQL statements with sqlpp11, you need to represent tables and their columns as structs that can be understood by the library. + +The default way to do so is by using a code generator to translate DDL to C++. A code generator covering a lot of use cases can be found [here](https://github.com/rbock/sqlpp11/blob/main/scripts/ddl2cpp). There is also a specific one for [sqlite3](https://github.com/rbock/sqlpp11/blob/main/scripts/sqlite2cpp.py). + +If you look at the output, you will see why a generator is helpful. Here is a [sample](https://github.com/rbock/sqlpp11/blob/main/tests/core/usage/Sample.h). + diff --git a/3party/sqlpp11/docs/Threads.md b/3party/sqlpp11/docs/Threads.md new file mode 100644 index 0000000..3ab526a --- /dev/null +++ b/3party/sqlpp11/docs/Threads.md @@ -0,0 +1,19 @@ +# Thread Safety + +sqlpp11 aspires to have no influence on thread safety itself, but offers +no particular guarantees (PRs welcome). This means that in the general case +your program may have problems if it does one of the following + +* Creates a connection in one thread and then uses it in another thread.. +* Uses the same connection simultaneously in multiple threads. + +The exact level of thread-safety depends on the underlying client library, for +example with MySQL, PostgreSQL and SQLite3 it is generally safe to create a +connection in one thread and then use it in another thread, but attempting to +use the same connection simultaneously in multiple threads causes crashes, +lock-ups and SQL errors. + +The recommendation therefore is to **not share** connections between threads +and to read about thread safety of the underlying database for more +information. You may also look into [Connection Pools](Connection-Pools.md) +as a way to make SQL queries simultaneously in multiple threads. diff --git a/3party/sqlpp11/docs/Transactions.md b/3party/sqlpp11/docs/Transactions.md new file mode 100644 index 0000000..76e7443 --- /dev/null +++ b/3party/sqlpp11/docs/Transactions.md @@ -0,0 +1,44 @@ +# Transactions + +Transactions are simple in sqlpp11. Assuming you have a connection called `db`, +you can start and commit a transaction just like this: + +```C++ +auto tx = start_transaction(db); +// do something +tx.commit(); +``` + +If you need to rollback the transaction, you can call it's `rollback()` member, +for instance like this: + +```C++ +auto tx = start_transaction(db); +try +{ + // do something + tx.commit(); +} +catch (...) +{ + tx.rollback(); +} +``` + +In case you call neither `commit()` nor `rollback()` on a transaction before it +goes out of scope, it will call `rollback()` in its destructor. This automatic +rollback will be reported by the connection. + +## More options +You can turn off reporting for automatic rollback in the destructor by passing +`sqlpp::quiet_auto_rollback`. + +```C++ +auto tx = start_transaction(db, sqlpp::quiet_auto_rollback); +``` + +You can also specify the isolation level for the transaction: + +```C++ +auto tx = start_transaction(db, ::sqlpp::isolation_level::repeatable_read); +``` diff --git a/3party/sqlpp11/docs/Update.md b/3party/sqlpp11/docs/Update.md new file mode 100644 index 0000000..bd4c10a --- /dev/null +++ b/3party/sqlpp11/docs/Update.md @@ -0,0 +1,5 @@ +The detailed documentation is still missing here, but here is an example that might help if you have read about [select statements](Select.md). + +```C++ +db(update(tab).set(tab.gamma = false).where(tab.alpha.in(1))); +``` diff --git a/3party/sqlpp11/examples/connection_pool/CMakeLists.txt b/3party/sqlpp11/examples/connection_pool/CMakeLists.txt new file mode 100644 index 0000000..e65e093 --- /dev/null +++ b/3party/sqlpp11/examples/connection_pool/CMakeLists.txt @@ -0,0 +1,48 @@ +# Copyright (c) 2023, Vesselin Atanasov +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above copyright notice, this +# list of conditions and the following disclaimer in the documentation and/or +# other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +cmake_minimum_required(VERSION 3.14) +set (APP_NAME "connection_pool") +project ("${APP_NAME}" CXX) +set (CMAKE_CXX_STANDARD 11) +set (CMAKE_CXX_STANDARD_REQUIRED true) +set (CMAKE_CXX_EXTENSIONS false) + +# Executable file and its build settings +add_executable ("${APP_NAME}") +target_include_directories ("${APP_NAME}" PRIVATE "${GEN_HEADERS_DIR}" "${PROJECT_SOURCE_DIR}/src") + +# Linked libraries +find_package (Sqlpp11 REQUIRED COMPONENTS PostgreSQL) +target_link_libraries ("${APP_NAME}" PRIVATE sqlpp11::postgresql) + +# Project sources +target_sources ( + "${APP_NAME}" PRIVATE + "src/db_connection.h" + "src/db_connection.cpp" + "src/db_global.h" + "src/db_global.cpp" + "src/main.cpp" +) diff --git a/3party/sqlpp11/examples/connection_pool/src/db_connection.cpp b/3party/sqlpp11/examples/connection_pool/src/db_connection.cpp new file mode 100644 index 0000000..66ac857 --- /dev/null +++ b/3party/sqlpp11/examples/connection_pool/src/db_connection.cpp @@ -0,0 +1,15 @@ +#include +#include + +db_connection::pq_conn& db_connection::fetch() +{ + if (m_conn_ptr == nullptr) + { + m_conn_ptr = sqlpp::compat::make_unique(m_pool.get()); + } + return *m_conn_ptr; +} + +db_connection::db_connection(sqlpp::postgresql::connection_pool& pool) : m_pool{pool}, m_conn_ptr{nullptr} +{ +} diff --git a/3party/sqlpp11/examples/connection_pool/src/db_connection.h b/3party/sqlpp11/examples/connection_pool/src/db_connection.h new file mode 100644 index 0000000..1306a21 --- /dev/null +++ b/3party/sqlpp11/examples/connection_pool/src/db_connection.h @@ -0,0 +1,31 @@ +#pragma once + +#include + +class db_connection +{ +private: + using pq_conn = sqlpp::postgresql::pooled_connection; + + sqlpp::postgresql::connection_pool& m_pool; + // For C++17 or newer just use std::optional m_conn; + std::unique_ptr m_conn_ptr; + + pq_conn& fetch(); + +public: + db_connection(sqlpp::postgresql::connection_pool& pool); + db_connection(const db_connection&) = delete; + db_connection(db_connection&&) = delete; + + db_connection& operator=(const db_connection&) = delete; + db_connection& operator=(db_connection&&) = delete; + + // Delegate any methods of sqlpp::postgresql::connection that you may need + + template + auto operator()(const T& t) -> decltype(fetch()(t)) + { + return fetch()(t); + } +}; diff --git a/3party/sqlpp11/examples/connection_pool/src/db_global.cpp b/3party/sqlpp11/examples/connection_pool/src/db_global.cpp new file mode 100644 index 0000000..b5c7840 --- /dev/null +++ b/3party/sqlpp11/examples/connection_pool/src/db_global.cpp @@ -0,0 +1,12 @@ +#include + +#include + +static sqlpp::postgresql::connection_pool g_db_pool{}; + +thread_local db_connection g_dbc{g_db_pool}; + +void db_global_init(std::shared_ptr config) +{ + g_db_pool.initialize(config, 5); +} diff --git a/3party/sqlpp11/examples/connection_pool/src/db_global.h b/3party/sqlpp11/examples/connection_pool/src/db_global.h new file mode 100644 index 0000000..e9edebd --- /dev/null +++ b/3party/sqlpp11/examples/connection_pool/src/db_global.h @@ -0,0 +1,7 @@ +#pragma once + +#include + +extern thread_local db_connection g_dbc; + +void db_global_init(std::shared_ptr config); diff --git a/3party/sqlpp11/examples/connection_pool/src/main.cpp b/3party/sqlpp11/examples/connection_pool/src/main.cpp new file mode 100644 index 0000000..dea2191 --- /dev/null +++ b/3party/sqlpp11/examples/connection_pool/src/main.cpp @@ -0,0 +1,38 @@ +#include + +#include +#include + +#include +#include + +int main() +{ + // Initialize the global connection variable + auto config = std::make_shared(); + config->dbname = "my_database"; + config->user = "my_username"; + config->password = "my_password"; + config->debug = false; + db_global_init(config); + + // Spawn 10 threads and make them send SQL queries in parallel + int num_threads = 10; + int num_queries = 5; + std::vector threads {}; + for (int i = 0; i < num_threads; ++i) + { + threads.push_back(std::thread([&] () { + for (int j = 0; j < num_queries; ++j) + { + g_dbc(select (sqlpp::value (1).as(sqlpp::alias::a))); + } + })); + } + for (auto&& t : threads) + { + t.join(); + } + + return 0; +} diff --git a/3party/sqlpp11/examples/usage_fetch_content/CMakeLists.txt b/3party/sqlpp11/examples/usage_fetch_content/CMakeLists.txt new file mode 100644 index 0000000..10ca104 --- /dev/null +++ b/3party/sqlpp11/examples/usage_fetch_content/CMakeLists.txt @@ -0,0 +1,38 @@ +# Copyright (c) 2020, Leon De Andrade +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above copyright notice, this +# list of conditions and the following disclaimer in the documentation and/or +# other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +### Preamble ### +cmake_minimum_required(VERSION 3.14) +project(Test VERSION 0.1 LANGUAGES CXX) + +##### Project wide setup #### +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +### Dependencies ### +add_subdirectory(dependencies) + +### Main Targets ### +add_subdirectory(src) \ No newline at end of file diff --git a/3party/sqlpp11/examples/usage_fetch_content/dependencies/CMakeLists.txt b/3party/sqlpp11/examples/usage_fetch_content/dependencies/CMakeLists.txt new file mode 100644 index 0000000..79e9e37 --- /dev/null +++ b/3party/sqlpp11/examples/usage_fetch_content/dependencies/CMakeLists.txt @@ -0,0 +1,32 @@ +# Copyright (c) 2020, Leon De Andrade +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above copyright notice, this +# list of conditions and the following disclaimer in the documentation and/or +# other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +include(FetchContent) + +FetchContent_Declare(sqlpp11 + GIT_REPOSITORY https://github.com/rbock/sqlpp11 + GIT_TAG origin/main +) + +add_subdirectory(sqlpp11) \ No newline at end of file diff --git a/3party/sqlpp11/examples/usage_fetch_content/dependencies/sqlpp11/CMakeLists.txt b/3party/sqlpp11/examples/usage_fetch_content/dependencies/sqlpp11/CMakeLists.txt new file mode 100644 index 0000000..6f08262 --- /dev/null +++ b/3party/sqlpp11/examples/usage_fetch_content/dependencies/sqlpp11/CMakeLists.txt @@ -0,0 +1,34 @@ +# Copyright (c) 2020, Leon De Andrade +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above copyright notice, this +# list of conditions and the following disclaimer in the documentation and/or +# other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Configure the project here as needed +# set(BUILD_MYSQL_CONNECTOR ON) +# set(BUILD_MARIADB_CONNECTOR ON) +# set(BUILD_POSTGRESQL_CONNECTOR ON) +# set(BUILD_SQLITE3_CONNECTOR ON) +# set(BUILD_SQLCIPHER_CONNECTOR ON) + +# set(USE_SYSTEM_DATE ON) + +FetchContent_MakeAvailable(sqlpp11) \ No newline at end of file diff --git a/3party/sqlpp11/examples/usage_fetch_content/src/CMakeLists.txt b/3party/sqlpp11/examples/usage_fetch_content/src/CMakeLists.txt new file mode 100644 index 0000000..ebe64c7 --- /dev/null +++ b/3party/sqlpp11/examples/usage_fetch_content/src/CMakeLists.txt @@ -0,0 +1,40 @@ +# Copyright (c) 2020, Leon De Andrade +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above copyright notice, this +# list of conditions and the following disclaimer in the documentation and/or +# other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +add_executable(Test) +target_link_libraries(Test + PRIVATE + sqlpp11::sqlpp11 + # Corresponding targets for the connectors. These connectors need to be enabled in the the dependencies/sqlpp11 folder. These targets automatically link against sqlpp11::sqlpp11 and therefore sqlpp11::sqlpp11 doesn't need to be linked manually again + # sqlpp11::sqlite3 + # sqlpp11::sqlcipher + # sqlpp11::mysql + # sqlpp11::mariadb + # sqlpp11::postgresql +) + +target_sources(Test + PRIVATE + main.cpp +) \ No newline at end of file diff --git a/3party/sqlpp11/examples/usage_fetch_content/src/main.cpp b/3party/sqlpp11/examples/usage_fetch_content/src/main.cpp new file mode 100644 index 0000000..13f814d --- /dev/null +++ b/3party/sqlpp11/examples/usage_fetch_content/src/main.cpp @@ -0,0 +1,8 @@ +#include +#include + +int main() +{ + select(sqlpp::value(false).as(sqlpp::alias::a)); + return 0; +} \ No newline at end of file diff --git a/3party/sqlpp11/examples/usage_find_package/CMakeLists.txt b/3party/sqlpp11/examples/usage_find_package/CMakeLists.txt new file mode 100644 index 0000000..262f36b --- /dev/null +++ b/3party/sqlpp11/examples/usage_find_package/CMakeLists.txt @@ -0,0 +1,42 @@ +# Copyright (c) 2020, Leon De Andrade +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above copyright notice, this +# list of conditions and the following disclaimer in the documentation and/or +# other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +### Preamble ### +cmake_minimum_required(VERSION 3.14) +project(Test VERSION 0.1 LANGUAGES CXX) + +##### Project wide setup #### +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +### Dependencies ### +find_package(Sqlpp11 + # Optionally specify connectors needed to get corresponding targets. Only possible if connectors have been installed on the system as documented in the README + # COMPONENTS SQLite3 SQLCipher MySQL MariaDB PostgreSQL + REQUIRED +) + +### Main Targets ### +add_subdirectory(src) \ No newline at end of file diff --git a/3party/sqlpp11/examples/usage_find_package/src/CMakeLists.txt b/3party/sqlpp11/examples/usage_find_package/src/CMakeLists.txt new file mode 100644 index 0000000..9c17c3f --- /dev/null +++ b/3party/sqlpp11/examples/usage_find_package/src/CMakeLists.txt @@ -0,0 +1,39 @@ +# Copyright (c) 2020, Leon De Andrade +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above copyright notice, this +# list of conditions and the following disclaimer in the documentation and/or +# other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +add_executable(Test) +target_link_libraries(Test + PRIVATE + sqlpp11::sqlpp11 + # Corresponding targets for the Components specified in the find_package call + # sqlpp11::sqlite3 + # sqlpp11::sqlcipher + # sqlpp11::mysql + # sqlpp11::mariadb + # sqlpp11::postgresql +) +target_sources(Test + PRIVATE + main.cpp +) \ No newline at end of file diff --git a/3party/sqlpp11/examples/usage_find_package/src/main.cpp b/3party/sqlpp11/examples/usage_find_package/src/main.cpp new file mode 100644 index 0000000..13f814d --- /dev/null +++ b/3party/sqlpp11/examples/usage_find_package/src/main.cpp @@ -0,0 +1,8 @@ +#include +#include + +int main() +{ + select(sqlpp::value(false).as(sqlpp::alias::a)); + return 0; +} \ No newline at end of file diff --git a/3party/sqlpp11/include/sqlpp11/aggregate_function_operators.h b/3party/sqlpp11/include/sqlpp11/aggregate_function_operators.h new file mode 100644 index 0000000..d090df4 --- /dev/null +++ b/3party/sqlpp11/include/sqlpp11/aggregate_function_operators.h @@ -0,0 +1,39 @@ +#pragma once + +/* + * Copyright (c) 2013-2020, Roland Bock, MacDue + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +namespace sqlpp +{ + template + struct aggregate_function_operators + { + over_t over() const + { + return {*static_cast(this)}; + } + }; +} // namespace sqlpp diff --git a/3party/sqlpp11/include/sqlpp11/aggregate_functions.h b/3party/sqlpp11/include/sqlpp11/aggregate_functions.h new file mode 100644 index 0000000..f39903e --- /dev/null +++ b/3party/sqlpp11/include/sqlpp11/aggregate_functions.h @@ -0,0 +1,33 @@ +#pragma once + +/* + * Copyright (c) 2013-2015, Roland Bock + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include diff --git a/3party/sqlpp11/include/sqlpp11/aggregate_functions/avg.h b/3party/sqlpp11/include/sqlpp11/aggregate_functions/avg.h new file mode 100644 index 0000000..158760e --- /dev/null +++ b/3party/sqlpp11/include/sqlpp11/aggregate_functions/avg.h @@ -0,0 +1,116 @@ +#pragma once + +/* + * Copyright (c) 2013-2020, Roland Bock, MacDue + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +namespace sqlpp +{ + struct avg_alias_t + { + struct _alias_t + { + static constexpr const char _literal[] = "avg_"; + using _name_t = sqlpp::make_char_sequence; + template + struct _member_t + { + T avg; + T& operator()() + { + return avg; + } + const T& operator()() const + { + return avg; + } + }; + }; + }; + + template + struct avg_t : public expression_operators, floating_point>, + public aggregate_function_operators>, + public alias_operators> + { + using _traits = make_traits; + using _nodes = detail::type_vector; + using _can_be_null = std::true_type; + using _is_aggregate_expression = std::true_type; + + static_assert(is_noop::value or std::is_same::value, + "avg() used with flag other than 'distinct'"); + static_assert(is_numeric_t::value, "avg() requires a value expression as argument"); + + using _auto_alias_t = avg_alias_t; + + avg_t(Expr expr) : _expr(expr) + { + } + + avg_t(const avg_t&) = default; + avg_t(avg_t&&) = default; + avg_t& operator=(const avg_t&) = default; + avg_t& operator=(avg_t&&) = default; + ~avg_t() = default; + + Expr _expr; + }; + + template + Context& serialize(const avg_t& t, Context& context) + { + context << "AVG("; + if (std::is_same::value) + { + serialize(Flag(), context); + context << ' '; + } + serialize_operand(t._expr, context); + context << ")"; + return context; + } + + template + auto avg(T t) -> avg_t> + { + static_assert(not contains_aggregate_function_t>::value, + "avg() cannot be used on an aggregate function"); + static_assert(is_numeric_t>::value, "avg() requires a numeric value expression as argument"); + return {t}; + } + + template + auto avg(const distinct_t& /*unused*/, T t) -> avg_t> + { + static_assert(not contains_aggregate_function_t>::value, + "avg() cannot be used on an aggregate function"); + static_assert(is_numeric_t>::value, "avg() requires a numeric value expression as argument"); + return {t}; + } +} // namespace sqlpp diff --git a/3party/sqlpp11/include/sqlpp11/aggregate_functions/count.h b/3party/sqlpp11/include/sqlpp11/aggregate_functions/count.h new file mode 100644 index 0000000..cf77e23 --- /dev/null +++ b/3party/sqlpp11/include/sqlpp11/aggregate_functions/count.h @@ -0,0 +1,119 @@ +#pragma once + +/* + * Copyright (c) 2013-2020, Roland Bock, MacDue + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include + +namespace sqlpp +{ + struct count_alias_t + { + struct _alias_t + { + static constexpr const char _literal[] = "count_"; + using _name_t = sqlpp::make_char_sequence; + template + struct _member_t + { + T count; + T& operator()() + { + return count; + } + const T& operator()() const + { + return count; + } + }; + }; + }; + + template + struct count_t : public expression_operators, integral>, + public aggregate_function_operators>, + public alias_operators> + { + using _traits = make_traits; + + using _nodes = detail::type_vector; + using _can_be_null = std::false_type; + using _is_aggregate_expression = std::true_type; + + static_assert(is_noop::value or std::is_same::value, + "count() used with flag other than 'distinct'"); + + using _auto_alias_t = count_alias_t; + + count_t(const Expr expr) : _expr(expr) + { + } + + count_t(const count_t&) = default; + count_t(count_t&&) = default; + count_t& operator=(const count_t&) = default; + count_t& operator=(count_t&&) = default; + ~count_t() = default; + + Expr _expr; + }; + + template + Context& serialize(const count_t& t, Context& context) + { + context << "COUNT("; + if (std::is_same::value) + { + serialize(Flag(), context); + context << ' '; + } + serialize_operand(t._expr, context); + context << ")"; + return context; + } + + template + auto count(T t) -> count_t> + { + static_assert(not contains_aggregate_function_t>::value, + "count() cannot be used on an aggregate function"); + static_assert(is_expression_t>::value, "count() requires an expression as argument"); + return {t}; + } + + template + auto count(const distinct_t& /*unused*/, T t) -> count_t> + { + static_assert(not contains_aggregate_function_t>::value, + "count() cannot be used on an aggregate function"); + static_assert(is_expression_t>::value, "count() requires an expression as argument"); + return {t}; + } +} // namespace sqlpp diff --git a/3party/sqlpp11/include/sqlpp11/aggregate_functions/max.h b/3party/sqlpp11/include/sqlpp11/aggregate_functions/max.h new file mode 100644 index 0000000..b6d7227 --- /dev/null +++ b/3party/sqlpp11/include/sqlpp11/aggregate_functions/max.h @@ -0,0 +1,112 @@ +#pragma once + +/* + * Copyright (c) 2013-2020, Roland Bock, MacDue + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +namespace sqlpp +{ + struct max_alias_t + { + struct _alias_t + { + static constexpr const char _literal[] = "max_"; + using _name_t = sqlpp::make_char_sequence; + template + struct _member_t + { + T max; + T& operator()() + { + return max; + } + const T& operator()() const + { + return max; + } + }; + }; + }; + + template + struct max_t : public expression_operators, value_type_of>, + public aggregate_function_operators>, + public alias_operators> + { + using _traits = make_traits, tag::is_expression, tag::is_selectable>; + using _nodes = detail::type_vector; + using _can_be_null = std::true_type; + using _is_aggregate_expression = std::true_type; + + using _auto_alias_t = max_alias_t; + + max_t(Expr expr) : _expr(expr) + { + } + + max_t(const max_t&) = default; + max_t(max_t&&) = default; + max_t& operator=(const max_t&) = default; + max_t& operator=(max_t&&) = default; + ~max_t() = default; + + Expr _expr; + }; + + template + Context& serialize(const max_t& t, Context& context) + { + context << "MAX("; + if (std::is_same::value) + { + serialize(Flag(), context); + context << ' '; + } + serialize_operand(t._expr, context); + context << ")"; + return context; + } + + template + auto max(T t) -> max_t> + { + static_assert(not contains_aggregate_function_t>::value, + "max() cannot be used on an aggregate function"); + static_assert(is_expression_t>::value, "max() requires an expression as argument"); + return {t}; + } + + template + auto max(const distinct_t& /*unused*/, T t) -> max_t> + { + static_assert(not contains_aggregate_function_t>::value, + "max() cannot be used on an aggregate function"); + static_assert(is_expression_t>::value, "max() requires an expression as argument"); + return {t}; + } +} // namespace sqlpp diff --git a/3party/sqlpp11/include/sqlpp11/aggregate_functions/min.h b/3party/sqlpp11/include/sqlpp11/aggregate_functions/min.h new file mode 100644 index 0000000..d3bb825 --- /dev/null +++ b/3party/sqlpp11/include/sqlpp11/aggregate_functions/min.h @@ -0,0 +1,112 @@ +#pragma once + +/* + * Copyright (c) 2013-2020, Roland Bock, MacDue + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +namespace sqlpp +{ + struct min_alias_t + { + struct _alias_t + { + static constexpr const char _literal[] = "min_"; + using _name_t = sqlpp::make_char_sequence; + template + struct _member_t + { + T min; + T& operator()() + { + return min; + } + const T& operator()() const + { + return min; + } + }; + }; + }; + + template + struct min_t : public expression_operators, value_type_of>, + public aggregate_function_operators>, + public alias_operators> + { + using _traits = make_traits, tag::is_expression, tag::is_selectable>; + using _nodes = detail::type_vector; + using _can_be_null = std::true_type; + using _is_aggregate_expression = std::true_type; + + using _auto_alias_t = min_alias_t; + + min_t(Expr expr) : _expr(expr) + { + } + + min_t(const min_t&) = default; + min_t(min_t&&) = default; + min_t& operator=(const min_t&) = default; + min_t& operator=(min_t&&) = default; + ~min_t() = default; + + Expr _expr; + }; + + template + Context& serialize(const min_t& t, Context& context) + { + context << "MIN("; + if (std::is_same::value) + { + serialize(Flag(), context); + context << ' '; + } + serialize_operand(t._expr, context); + context << ")"; + return context; + } + + template + auto min(T t) -> min_t> + { + static_assert(not contains_aggregate_function_t>::value, + "min() cannot be used on an aggregate function"); + static_assert(is_expression_t>::value, "min() requires an expression as argument"); + return {t}; + } + + template + auto min(const distinct_t& /*unused*/, T t) -> min_t> + { + static_assert(not contains_aggregate_function_t>::value, + "min() cannot be used on an aggregate function"); + static_assert(is_expression_t>::value, "min() requires an expression as argument"); + return {t}; + } +} // namespace sqlpp diff --git a/3party/sqlpp11/include/sqlpp11/aggregate_functions/sum.h b/3party/sqlpp11/include/sqlpp11/aggregate_functions/sum.h new file mode 100644 index 0000000..05f5866 --- /dev/null +++ b/3party/sqlpp11/include/sqlpp11/aggregate_functions/sum.h @@ -0,0 +1,116 @@ +#pragma once + +/* + * Copyright (c) 2013-2020, Roland Bock, MacDue + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +namespace sqlpp +{ + struct sum_alias_t + { + struct _alias_t + { + static constexpr const char _literal[] = "sum_"; + using _name_t = sqlpp::make_char_sequence; + template + struct _member_t + { + T sum; + T& operator()() + { + return sum; + } + const T& operator()() const + { + return sum; + } + }; + }; + }; + + template + struct sum_t : public expression_operators, value_type_of>, + public aggregate_function_operators>, + public alias_operators> + { + using _traits = make_traits, tag::is_expression, tag::is_selectable>; + using _nodes = detail::type_vector; + using _can_be_null = std::true_type; + using _is_aggregate_expression = std::true_type; + + static_assert(is_noop::value or std::is_same::value, + "sum() used with flag other than 'distinct'"); + static_assert(is_numeric_t::value, "sum() requires a numeric expression as argument"); + + using _auto_alias_t = sum_alias_t; + + sum_t(Expr expr) : _expr(expr) + { + } + + sum_t(const sum_t&) = default; + sum_t(sum_t&&) = default; + sum_t& operator=(const sum_t&) = default; + sum_t& operator=(sum_t&&) = default; + ~sum_t() = default; + + Expr _expr; + }; + + template + Context& serialize(const sum_t& t, Context& context) + { + context << "SUM("; + if (std::is_same::value) + { + serialize(Flag(), context); + context << ' '; + } + serialize_operand(t._expr, context); + context << ")"; + return context; + } + + template + auto sum(T t) -> sum_t> + { + static_assert(not contains_aggregate_function_t>::value, + "sum() cannot be used on an aggregate function"); + static_assert(is_numeric_t>::value, "sum() requires a numeric expression as argument"); + return {t}; + } + + template + auto sum(const distinct_t& /*unused*/, T t) -> sum_t> + { + static_assert(not contains_aggregate_function_t>::value, + "sum() cannot be used on an aggregate function"); + static_assert(is_numeric_t>::value, "sum() requires a numeric expression as argument"); + return {t}; + } +} // namespace sqlpp diff --git a/3party/sqlpp11/include/sqlpp11/alias.h b/3party/sqlpp11/include/sqlpp11/alias.h new file mode 100644 index 0000000..e0df5ba --- /dev/null +++ b/3party/sqlpp11/include/sqlpp11/alias.h @@ -0,0 +1,65 @@ +#pragma once + +/* + * Copyright (c) 2013-2015, Roland Bock + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +namespace sqlpp +{ + template + struct expression_alias_t + { + using _traits = make_traits, tag::is_selectable, tag::is_alias>; + using _nodes = detail::type_vector; + + static_assert(is_expression_t::value, "invalid argument for an expression alias"); + static_assert(not is_alias_t::value, "cannot create an alias of an alias"); + + using _alias_t = typename AliasProvider::_alias_t; + + expression_alias_t(Expression expression) : _expression(expression) + { + } + + expression_alias_t(const expression_alias_t&) = default; + expression_alias_t(expression_alias_t&&) = default; + expression_alias_t& operator=(const expression_alias_t&) = default; + expression_alias_t& operator=(expression_alias_t&&) = default; + ~expression_alias_t() = default; + + Expression _expression; + }; + + template + Context& serialize(const expression_alias_t& t, Context& context) + { + serialize_operand(t._expression, context); + context << " AS "; + context << name_of>::template char_ptr(); + return context; + } +} // namespace sqlpp diff --git a/3party/sqlpp11/include/sqlpp11/alias_operators.h b/3party/sqlpp11/include/sqlpp11/alias_operators.h new file mode 100644 index 0000000..023a4ec --- /dev/null +++ b/3party/sqlpp11/include/sqlpp11/alias_operators.h @@ -0,0 +1,42 @@ +#pragma once + +/* + * Copyright (c) 2013-2015, Roland Bock + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +namespace sqlpp +{ + template + struct alias_operators + { + template + expression_alias_t as(const alias_provider& /*unused*/) const + { + return {*static_cast(this)}; + } + }; +} // namespace sqlpp diff --git a/3party/sqlpp11/include/sqlpp11/alias_provider.h b/3party/sqlpp11/include/sqlpp11/alias_provider.h new file mode 100644 index 0000000..d3e2535 --- /dev/null +++ b/3party/sqlpp11/include/sqlpp11/alias_provider.h @@ -0,0 +1,127 @@ +#pragma once + +/* + * Copyright (c) 2013-2016, Roland Bock + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +#define SQLPP_ALIAS_PROVIDER(name) \ + struct name##_t \ + { \ + struct _alias_t \ + { \ + static constexpr const char _literal[] = #name; \ + using _name_t = sqlpp::make_char_sequence; \ + template \ + struct _member_t \ + { \ + T name; \ + T& operator()() \ + { \ + return name; \ + } \ + const T& operator()() const \ + { \ + return name; \ + } \ + }; \ + }; \ + }; \ + constexpr name##_t name = {}; + +#define SQLPP_QUOTED_ALIAS_PROVIDER(name) \ + struct name##_t \ + { \ + struct _alias_t \ + { \ + static constexpr const char _literal[] = "!" #name; \ + using _name_t = sqlpp::make_char_sequence; \ + template \ + struct _member_t \ + { \ + T name; \ + T& operator()() \ + { \ + return name; \ + } \ + const T& operator()() const \ + { \ + return name; \ + } \ + }; \ + }; \ + }; \ + constexpr name##_t name = {}; + +namespace sqlpp +{ + template + struct is_alias_provider_t + { + static constexpr bool value = false; + }; + + template + struct is_alias_provider_t< + T, + typename std::enable_if>::value, void>::type> + { + static constexpr bool value = true; + }; + + namespace alias + { + SQLPP_ALIAS_PROVIDER(a) + SQLPP_ALIAS_PROVIDER(b) + SQLPP_ALIAS_PROVIDER(c) + SQLPP_ALIAS_PROVIDER(d) + SQLPP_ALIAS_PROVIDER(e) + SQLPP_ALIAS_PROVIDER(f) + SQLPP_ALIAS_PROVIDER(g) + SQLPP_ALIAS_PROVIDER(h) + SQLPP_ALIAS_PROVIDER(i) + SQLPP_ALIAS_PROVIDER(j) + SQLPP_ALIAS_PROVIDER(k) + SQLPP_ALIAS_PROVIDER(l) + SQLPP_ALIAS_PROVIDER(m) + SQLPP_ALIAS_PROVIDER(n) + SQLPP_ALIAS_PROVIDER(o) + SQLPP_ALIAS_PROVIDER(p) + SQLPP_ALIAS_PROVIDER(q) + SQLPP_ALIAS_PROVIDER(r) + SQLPP_ALIAS_PROVIDER(s) + SQLPP_ALIAS_PROVIDER(t) + SQLPP_ALIAS_PROVIDER(u) + SQLPP_ALIAS_PROVIDER(v) + SQLPP_ALIAS_PROVIDER(w) + SQLPP_ALIAS_PROVIDER(x) + SQLPP_ALIAS_PROVIDER(y) + SQLPP_ALIAS_PROVIDER(z) + SQLPP_ALIAS_PROVIDER(left) + SQLPP_ALIAS_PROVIDER(right) + } // namespace alias +} // namespace sqlpp diff --git a/3party/sqlpp11/include/sqlpp11/all_of.h b/3party/sqlpp11/include/sqlpp11/all_of.h new file mode 100644 index 0000000..61dec81 --- /dev/null +++ b/3party/sqlpp11/include/sqlpp11/all_of.h @@ -0,0 +1,36 @@ +#pragma once + +/* + * Copyright (c) 2013-2021, Roland Bock + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +namespace sqlpp +{ + template + auto all_of(Table /*unused*/) -> typename Table::_column_tuple_t + { + return {}; + } +} // namespace sqlpp diff --git a/3party/sqlpp11/include/sqlpp11/any.h b/3party/sqlpp11/include/sqlpp11/any.h new file mode 100644 index 0000000..e7ee88e --- /dev/null +++ b/3party/sqlpp11/include/sqlpp11/any.h @@ -0,0 +1,71 @@ +#pragma once + +/* + * Copyright (c) 2013-2015, Roland Bock + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include + +namespace sqlpp +{ + template + struct any_t + { + using _traits = make_traits, tag::is_multi_expression>; + using _nodes = detail::type_vector& t, Context& context) + { + context << "ANY"; + serialize_operand(t._select, context); + return context; + } + + template + auto any(T t) -> any_t> + { + static_assert(is_select_t>::value, "any() requires a select expression as argument"); + static_assert(is_expression_t>::value, + "any() requires a single column select expression as argument"); + // FIXME: can we accept non-values like NULL here? + return {t}; + } +} // namespace sqlpp diff --git a/3party/sqlpp11/include/sqlpp11/assignment.h b/3party/sqlpp11/include/sqlpp11/assignment.h new file mode 100644 index 0000000..5fc5872 --- /dev/null +++ b/3party/sqlpp11/include/sqlpp11/assignment.h @@ -0,0 +1,70 @@ +#pragma once + +/* + * Copyright (c) 2013-2015, Roland Bock + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include + +namespace sqlpp +{ + template + struct assignment_t + { + using _traits = make_traits; + using _lhs_t = Lhs; + using _rhs_t = Rhs; + using _nodes = detail::type_vector<_lhs_t, _rhs_t>; + + static_assert(can_be_null_t<_lhs_t>::value ? true + : not std::is_same<_rhs_t, null_t>::value, + "column must not be null"); + + assignment_t(_lhs_t lhs, _rhs_t rhs) : _lhs(lhs), _rhs(rhs) + { + } + + assignment_t(const assignment_t&) = default; + assignment_t(assignment_t&&) = default; + assignment_t& operator=(const assignment_t&) = default; + assignment_t& operator=(assignment_t&&) = default; + ~assignment_t() = default; + + _lhs_t _lhs; + _rhs_t _rhs; + }; + + template + Context& serialize(const assignment_t& t, Context& context) + { + serialize(simple_column(t._lhs), context); + context << "="; + serialize_operand(t._rhs, context); + return context; + } +} // namespace sqlpp diff --git a/3party/sqlpp11/include/sqlpp11/auto_alias.h b/3party/sqlpp11/include/sqlpp11/auto_alias.h new file mode 100644 index 0000000..831ea38 --- /dev/null +++ b/3party/sqlpp11/include/sqlpp11/auto_alias.h @@ -0,0 +1,62 @@ +#pragma once + +/* + * Copyright (c) 2013-2015, Roland Bock + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +namespace sqlpp +{ + template + struct has_auto_alias_t + { + static constexpr bool value = false; + }; + + template + struct has_auto_alias_t::value>::type> + { + static constexpr bool value = true; + }; + + namespace detail + { + template + struct auto_alias_impl + { + using type = T; + }; + + template + struct auto_alias_impl::value>::type> + { + using type = expression_alias_t; + }; + } // namespace detail + + template + using auto_alias_t = typename detail::auto_alias_impl::type; +} // namespace sqlpp diff --git a/3party/sqlpp11/include/sqlpp11/bad_expression.h b/3party/sqlpp11/include/sqlpp11/bad_expression.h new file mode 100644 index 0000000..7e0a88f --- /dev/null +++ b/3party/sqlpp11/include/sqlpp11/bad_expression.h @@ -0,0 +1,49 @@ +#pragma once + +/* + * Copyright (c) 2013-2015, Roland Bock + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +namespace sqlpp +{ + SQLPP_PORTABLE_STATIC_ASSERT(assert_valid_operands, "Invalid operand(s)"); + + template + struct bad_expression + { + template + bad_expression(T&&... /*unused*/) + { + } + using _traits = make_traits; + using _nodes = detail::type_vector<>; + }; + + template + Context serialize(const bad_expression& t, Context& context); +} // namespace sqlpp diff --git a/3party/sqlpp11/include/sqlpp11/basic_expression_operators.h b/3party/sqlpp11/include/sqlpp11/basic_expression_operators.h new file mode 100644 index 0000000..27e56a7 --- /dev/null +++ b/3party/sqlpp11/include/sqlpp11/basic_expression_operators.h @@ -0,0 +1,316 @@ +#pragma once + +/* + * Copyright (c) 2013-2016, Roland Bock + * Copyright (c) 2016, Aaron Bishop + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace sqlpp +{ + SQLPP_PORTABLE_STATIC_ASSERT(assert_comparison_rhs_is_expression_t, "rhs operand in comparison is not an expression"); + SQLPP_PORTABLE_STATIC_ASSERT(assert_comparison_rhs_is_valid_operand_t, "invalid rhs operand in comparison"); + SQLPP_PORTABLE_STATIC_ASSERT(assert_comparison_lhs_rhs_differ_t, "identical lhs and rhs operands in comparison"); + + template + using check_comparison_impl = static_combined_check_t< + static_check_t::value, is_multi_expression_t::value>::value, + assert_comparison_rhs_is_expression_t>, + static_check_t::template _is_valid_operand::value, + assert_comparison_rhs_is_valid_operand_t>, + static_check_t::value, assert_comparison_lhs_rhs_differ_t>>; + + template + using check_comparison_t = check_comparison_impl>; + + template + using check_in_impl = static_combined_check_t< + static_check_t::value...>::value, assert_comparison_rhs_is_expression_t>, + static_check_t::template _is_valid_operand::value...>::value, + assert_comparison_rhs_is_valid_operand_t>, + static_check_t::value...>::value, + assert_comparison_lhs_rhs_differ_t>>; + + template + using check_in_t = check_in_impl::type...>; + + namespace detail + { + template class Expr, typename Lhs, typename Rhs> + struct comparison_expression_impl + { + using type = bad_expression; + }; + + template