### Install sqlpp11 Core Component Source: https://github.com/rbock/sqlpp11/blob/main/CMakeLists.txt Installs the main sqlpp11 component, targeting the 'sqlpp11' executable and placing it in the specified directory. This is a core installation step. ```cmake install_component(NAME Sqlpp11 TARGETS sqlpp11 DIRECTORY) ``` -------------------------------- ### Install sqlpp11 using vcpkg Source: https://github.com/rbock/sqlpp11/blob/main/README.md Installs sqlpp11 using the vcpkg dependency manager. This involves cloning the vcpkg repository, bootstrapping it, integrating it with the system, and then installing sqlpp11 with a specific database feature, such as MySQL. ```bash git clone https://github.com/Microsoft/vcpkg.git cd vcpkg ./bootstrap-vcpkg.sh ./vcpkg integrate install ./vcpkg install 'sqlpp11[mysql]' ``` -------------------------------- ### Install sqlpp11 via Homebrew Source: https://github.com/rbock/sqlpp11/blob/main/README.md Installs sqlpp11 using the Homebrew package manager on macOS. This command adds a custom tap and installs the library. Users can refer to `brew info` for available connector options. ```bash brew install marvin182/zapfhahn/sqlpp11 ``` -------------------------------- ### Build and Install sqlpp11 Core Library Source: https://github.com/rbock/sqlpp11/blob/main/README.md Builds the core sqlpp11 library and installs it system-wide using CMake. Requires admin rights for system-wide installation. Optional variables can be set to customize the build, such as enabling specific connectors or disabling dependency checks and tests. ```bash cmake -B build cmake --build build --target install ``` -------------------------------- ### Include Usage Examples Subdirectory in CMake Source: https://github.com/rbock/sqlpp11/blob/main/tests/sqlite3/CMakeLists.txt This snippet shows how to include the 'usage' subdirectory in the CMake build system. This is typically used for organizing example code demonstrating the library's functionality. ```cmake add_subdirectory(usage) ``` -------------------------------- ### Start and Commit Transaction in C++ Source: https://github.com/rbock/sqlpp11/blob/main/docs/Transactions.md Demonstrates the basic usage of starting a transaction and committing it using sqlpp11. It assumes a valid connection object `db` is available. ```C++ auto tx = start_transaction(db); // do something tx.commit(); ``` -------------------------------- ### Install Package Version File Source: https://github.com/rbock/sqlpp11/blob/main/CMakeLists.txt Installs the generated package version file to the CMake installation directory. This file is crucial for package management and dependency resolution. ```cmake install(FILES ${CMAKE_CURRENT_BINARY_DIR}/SqlppConfigVersion.cmake DESTINATION ${SQLPP11_INSTALL_CMAKEDIR} ) ``` -------------------------------- ### CMake Project Configuration for sqlpp11 Source: https://github.com/rbock/sqlpp11/blob/main/examples/usage_find_package/CMakeLists.txt Configures a CMake project to use C++11 standards and find the sqlpp11 library. This setup is crucial for projects leveraging sqlpp11 for SQL query generation. ```cmake cmake_minimum_required(VERSION 3.14) project(Test VERSION 0.1 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) find_package(Sqlpp11 REQUIRED) add_subdirectory(src) ``` -------------------------------- ### Install sqlpp11 DDL Compiler Source: https://github.com/rbock/sqlpp11/blob/main/CMakeLists.txt Installs the ddl2cpp executable to the specified destination directory, renaming it to sqlpp11-ddl2cpp. This is part of the project's build and installation process. ```cmake install(PROGRAMS ${PROJECT_SOURCE_DIR}/scripts/ddl2cpp RENAME sqlpp11-ddl2cpp DESTINATION ${CMAKE_INSTALL_BINDIR} ) ``` -------------------------------- ### CMake Project Setup and Options Source: https://github.com/rbock/sqlpp11/blob/main/CMakeLists.txt Sets up the minimum CMake version, project name, and defines build options for various database connectors and dependency checking. These options control which components are built and whether external dependencies are checked. ```cmake cmake_minimum_required(VERSION 3.14) project(sqlpp11 VERSION 0.1 LANGUAGES CXX) 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 "\n Use find_package to find installed HowardHinnant's \n 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") ``` -------------------------------- ### Use sqlpp11 with CMake FetchContent Source: https://github.com/rbock/sqlpp11/blob/main/README.md Demonstrates how to use sqlpp11 with CMake's FetchContent module, which is the recommended method as it doesn't require prior installation. This approach provides the `sqlpp11::sqlpp11` target and targets for individual connectors. ```cmake add_subdirectory(. EXCLUDE_FROM_ALL INCLUDE_DISPATCH_FILE sqlpp11/include/sqlpp11/include_dispatch.h ) ``` -------------------------------- ### Install MariaDB Connector Component Source: https://github.com/rbock/sqlpp11/blob/main/CMakeLists.txt Conditionally installs the sqlpp11 MariaDB connector if BUILD_MARIADB_CONNECTOR is enabled. It targets the 'sqlpp11_mariadb' executable, places it in the 'mysql' directory, and installs the FindMariaDB.cmake module. ```cmake 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() ``` -------------------------------- ### Inserting data into a table in C++ Source: https://github.com/rbock/sqlpp11/blob/main/README.md Provides an example of performing an `INSERT` operation into a table, specifying the table, and setting values for columns. ```C++ // A sample insert db(insert_into(foo).set(foo.id = 17, foo.name = "bar", foo.hasFun = true)); ``` -------------------------------- ### Install MySQL Connector Component Source: https://github.com/rbock/sqlpp11/blob/main/CMakeLists.txt Conditionally installs the sqlpp11 MySQL connector if BUILD_MYSQL_CONNECTOR is enabled. It targets the 'sqlpp11_mysql' executable, places it in the 'mysql' directory, and installs the FindMySQL.cmake module. ```cmake 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() ``` -------------------------------- ### SQLPP11 Test Constraint Examples Source: https://github.com/rbock/sqlpp11/blob/main/tests/core/constraints/CMakeLists.txt Examples demonstrating the usage of the 'test_constraint' function to set up various test cases for sqlpp11, focusing on constraint violations related to aggregate functions and data manipulation. ```cmake # Compiling these is required to fail (testing some static_assert) test_constraint(count_of_count "count\(\) cannot be used on an aggregate function") test_constraint(max_of_max "max\(\) cannot be used on an aggregate function") test_constraint(require_insert "required column is missing") test_constraint(must_not_insert "one assignment is prohibited") test_constraint(must_not_update "one assignment is prohibited") ``` -------------------------------- ### Install PostgreSQL Connector Component Source: https://github.com/rbock/sqlpp11/blob/main/CMakeLists.txt Conditionally installs the sqlpp11 PostgreSQL connector if BUILD_POSTGRESQL_CONNECTOR is enabled. It targets the 'sqlpp11_postgresql' executable and places it in the 'postgresql' directory. ```cmake if(BUILD_POSTGRESQL_CONNECTOR) install_component(NAME Sqlpp11PostgreSQL TARGETS sqlpp11_postgresql DIRECTORY postgresql) endif() ``` -------------------------------- ### Add Executable and Link Libraries in CMake Source: https://github.com/rbock/sqlpp11/blob/main/examples/usage_fetch_content/src/CMakeLists.txt This snippet demonstrates how to define an executable target named 'Test' and link it against the sqlpp11 library using CMake. It also includes commented-out examples for linking against various sqlpp11 connectors like sqlite3, sqlcipher, mysql, mariadb, and postgresql. ```cmake 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 ) ``` -------------------------------- ### Generate Header with ddl2cpp (CMake - Commented) Source: https://github.com/rbock/sqlpp11/blob/main/tests/core/usage/CMakeLists.txt A commented-out example showing how to use the `ddl2cpp` script (likely Python) to generate a header file from a SQL schema. This demonstrates custom command usage in CMake. ```cmake # if you want to use the generator, you can do something like this: #find_package(PythonInterp REQUIRED) #add_custom_command( # OUTPUT "${CMAKE_CURRENT_LIST_DIR}/Sample.h" # COMMAND "${PYTHON_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/scripts/ddl2cpp" "${CMAKE_CURRENT_LIST_DIR}/sample.sql" Sample test # DEPENDS "${CMAKE_CURRENT_LIST_DIR}/sample.sql" # VERBATIM #) ``` -------------------------------- ### Set C++ Standard and Options (CMake) Source: https://github.com/rbock/sqlpp11/blob/main/examples/usage_fetch_content/CMakeLists.txt Configures the C++ standard to C++11 and enables standard compliance. It also disables C++ language extensions for better portability. This is a common setup for C++ projects. ```cmake set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) ``` -------------------------------- ### Build and Install sqlpp11 with Connectors and Customizations Source: https://github.com/rbock/sqlpp11/blob/main/README.md Builds the sqlpp11 library, including the PostgreSQL and SQLite3 connectors, while disabling dependency checks and testing. This command demonstrates how to selectively enable connectors and disable optional build features. ```bash cmake -B build -DBUILD_POSTGRESQL_CONNECTOR=ON -DBUILD_SQLITE3_CONNECTOR=ON -DDEPENDENCY_CHECK=OFF -DBUILD_TESTING=OFF cmake --build build --target install ``` -------------------------------- ### CMake Minimum Requirements and Project Setup Source: https://github.com/rbock/sqlpp11/blob/main/examples/connection_pool/CMakeLists.txt Sets the minimum required CMake version to 3.14 and configures the project with C++11 standard, requiring it and disabling extensions. ```cmake 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) ``` -------------------------------- ### Install SQLCipher Connector Component Source: https://github.com/rbock/sqlpp11/blob/main/CMakeLists.txt Conditionally installs the sqlpp11 SQLCipher connector if BUILD_SQLCIPHER_CONNECTOR is enabled. It targets the 'sqlpp11_sqlcipher' executable, places it in the 'sqlite3' directory, and installs the FindSQLCipher.cmake module. ```cmake 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() ``` -------------------------------- ### Get Connection from Pool and Execute Query Source: https://github.com/rbock/sqlpp11/blob/main/docs/Connection-Pools.md Illustrates fetching a database connection from a pool and executing a SQL query. Assumes a pre-configured connection pool object 'pool'. ```cpp auto db = pool.get(); for (row : db(select(....))) { .... } ``` -------------------------------- ### Install SQLi te3 Connector Component Source: https://github.com/rbock/sqlpp11/blob/main/CMakeLists.txt Conditionally installs the sqlpp11 SQLite3 connector if BUILD_SQLITE3_CONNECTOR is enabled. It targets the 'sqlpp11_sqlite3' executable and places it in the 'sqlite3' directory. ```cmake if(BUILD_SQLITE3_CONNECTOR) install_component(NAME Sqlpp11SQLite3 TARGETS sqlpp11_sqlite3 DIRECTORY sqlite3) endif() ``` -------------------------------- ### sqlpp11 Aggregate Functions Example Source: https://github.com/rbock/sqlpp11/blob/main/docs/Functions.md Illustrates how to use aggregate functions like 'avg()' in sqlpp11 queries. The example shows selecting a name and the average of a value from a table, filtering by ID, and grouping by name. It also shows a concise way to query row count using 'count(1)'. ```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; } const int64_t n = db(select(count(1)).from(tab).unconditionally()).front().count; ``` -------------------------------- ### Sub-Select Example with sqlpp11 Source: https://github.com/rbock/sqlpp11/blob/main/docs/Select.md Demonstrates using a SELECT statement with a single column as a sub-select within another SELECT statement. It also shows how to alias the sub-select column using `as()`. ```C++ SQLPP_ALIAS_PROVIDER(cheese_cake); // ... for (const auto& row : db( select(all_of(foo), select(sum(bar.value)).from(bar).where(bar.id > foo.id)), select(bar.value.as(cheese_cake)).from(bar).where(bar.id > foo.id)) .from(foo))){ const int x = row.id; const int64_t a = row.sum; const int b = row.cheese_cake; } ``` -------------------------------- ### Check for pyparsing and Configure Tests (CMake) Source: https://github.com/rbock/sqlpp11/blob/main/tests/scripts/CMakeLists.txt This CMake code checks if the 'pyparsing' Python module is installed. If not, it issues a warning and disables 'ddl2cpp' tests. If it is installed, it proceeds to define several tests that execute the 'ddl2cpp' script with different parameters and expected outcomes. ```cmake include(FindPython3) if (${Python3_Interpreter_FOUND}) execute_process( COMMAND ${Python3_EXECUTABLE} -c "import pyparsing" RESULT_VARIABLE PythonRESULT OUTPUT_VARIABLE PythonOUTPUT ERROR_VARIABLE PythonERROR ) if (${PythonRESULT}) message(WARNING "Pyparsing is not installed. Disabling ddl2cpp tests") else() message(STATUS "Pyparsing is installed: Enabling ddl2cpp tests.") add_test(NAME sqlpp11.scripts.ddl2cpp.parser COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../../scripts/ddl2cpp" "--test" test) add_test(NAME sqlpp11.scripts.ddl2cpp.bad_will_fail COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../../scripts/ddl2cpp" "${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_bad.sql" "${CMAKE_CURRENT_BINARY_DIR}/fail" test) set_tests_properties(sqlpp11.scripts.ddl2cpp.bad_will_fail PROPERTIES WILL_FAIL 1) add_test(NAME sqlpp11.scripts.ddl2cpp.bad_has_parse_error COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../../scripts/ddl2cpp" "${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_bad.sql" "${CMAKE_CURRENT_BINARY_DIR}/fail" test) set_tests_properties(sqlpp11.scripts.ddl2cpp.bad_has_parse_error PROPERTIES PASS_REGULAR_EXPRESSION "ERROR: Could not parse.*") add_test(NAME sqlpp11.scripts.ddl2cpp.good_succeeds COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../../scripts/ddl2cpp" "${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_good.sql" "${CMAKE_CURRENT_BINARY_DIR}/fail" test) include_directories(${CMAKE_CURRENT_BINARY_DIR}) foreach(sample_name sample sample_identity_naming) set(sqlpp.scripts.generated.sample.include "${CMAKE_CURRENT_BINARY_DIR}/${sample_name}") set(use_identity_naming) if(sample_name STREQUAL "sample_identity_naming") set(use_identity_naming -identity-naming) endif() add_custom_command( OUTPUT "${sqlpp.scripts.generated.sample.include}.h" COMMAND "${Python3_Executable}" "${CMAKE_CURRENT_LIST_DIR}/../../scripts/ddl2cpp" ${use_identity_naming} "${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_good.sql" "${sqlpp.scripts.generated.sample.include}" test DEPENDS "${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_good.sql" VERBATIM) add_executable(sqlpp.scripts.compiled.${sample_name} ${sample_name}.cpp "${sqlpp.scripts.generated.sample.include}.h") target_link_libraries(sqlpp.scripts.compiled.${sample_name} PRIVATE sqlpp11) endforeach() # Invalid .types names # TODO: Read the types from a text file and generate the input .sql files in the build directory foreach(bad_type "booltype" "invalid" "serial5" "typeint") ``` -------------------------------- ### SQL Table Definition Source: https://github.com/rbock/sqlpp11/blob/main/docs/Select.md Provides the SQL `CREATE TABLE` statement used as a basis for the C++ sqlpp11 examples. This defines the schema for the 'foo' table with columns 'id', 'name', and 'hasFun'. ```SQL CREATE TABLE foo ( id bigint, name varchar(50), hasFun bool ); ``` -------------------------------- ### Updating data in a table in C++ Source: https://github.com/rbock/sqlpp11/blob/main/README.md Shows an example of performing an `UPDATE` operation on a table, including setting a column to a modified value and specifying a `WHERE` clause. ```C++ // A sample update db(update(foo).set(foo.hasFun = not foo.hasFun).where(foo.name != "nobody")); ``` -------------------------------- ### Add Subdirectories for Build Configuration Source: https://github.com/rbock/sqlpp11/blob/main/tests/mysql/CMakeLists.txt This snippet demonstrates how to include subdirectories in the CMake build process. It is typically used to manage modularity within a project, allowing different components like serialization or usage examples to be built independently. ```cmake add_subdirectory(serialize) add_subdirectory(usage) ``` -------------------------------- ### Deleting data from a table in C++ Source: https://github.com/rbock/sqlpp11/blob/main/README.md Presents an example of performing a `DELETE` operation on a table, with a `WHERE` clause to specify which rows to remove. ```C++ // A sample delete db(remove_from(foo).where(not foo.hasFun)); ``` -------------------------------- ### SQLPP11 PostgreSQL Constraint Test Cases Source: https://github.com/rbock/sqlpp11/blob/main/tests/postgresql/constraints/CMakeLists.txt These are examples of how the `test_constraint` function is used to define specific tests for various PostgreSQL constraint scenarios in SQLPP11. Each call sets up a test with a unique name and a corresponding validation pattern. ```cmake test_constraint(OnConflictEmptyWhereDoUpdate "conflict_target specification is required with do_update") test_constraint(OnConflictInvalidAssignmentsDoUpdate "conflict_target specification is required with do_update") test_constraint(OnConflictInvalidParameter "only a column is supported as conflict_target specification") test_constraint(OnConflictInvalidWhereDoUpdate "conflict_target specification is required with do_update") test_constraint(OnConflictMissingAction "either do_nothing() or do_update(...) is required with on_conflict") test_constraint(OnConflictMissingAssignmentsDoUpdate "conflict_target specification is required with do_update") test_constraint(OnConflictMissingParameterDoUpdate "conflict_target specification is required with do_update") test_constraint(ReturningEmptyAssert "at least one returnable expression") test_constraint(ReturningInvalidArgument "at least one returning column requires a table which is otherwise not known in the statement") ``` -------------------------------- ### sqlpp11 value() Function for Constant Expressions Source: https://github.com/rbock/sqlpp11/blob/main/docs/Functions.md Shows how to use the 'value()' function in sqlpp11 to turn arguments into unnamed SQL expressions, useful for selecting constant values. The example demonstrates selecting a bigint constant with an alias. ```C++ for (const auto& row : select(sqlpp::value(7).as(sql::alias::a)).from(tab))) { int64_t a = row.a; } ``` -------------------------------- ### Fetch and Add sqlpp11 using CMake FetchContent Source: https://github.com/rbock/sqlpp11/blob/main/examples/usage_fetch_content/dependencies/CMakeLists.txt This snippet shows how to declare and fetch the sqlpp11 library from its GitHub repository using CMake's FetchContent module. It then adds the fetched library as a subdirectory to the current project, making its targets available for linking. ```cmake include(FetchContent) FetchContent_Declare(sqlpp11 GIT_REPOSITORY https://github.com/rbock/sqlpp11 GIT_TAG origin/main ) add_subdirectory(sqlpp11) ``` -------------------------------- ### Setting up sqlpp11 PostgreSQL Testing Library Source: https://github.com/rbock/sqlpp11/blob/main/tests/postgresql/usage/CMakeLists.txt Defines an interface library for sqlpp11 PostgreSQL testing and includes the current source directory for its headers. ```cmake add_library(sqlpp11_postgresql_testing INTERFACE) target_include_directories(sqlpp11_postgresql_testing INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) ``` -------------------------------- ### Project Initialization (CMake) Source: https://github.com/rbock/sqlpp11/blob/main/examples/usage_fetch_content/CMakeLists.txt Initializes the CMake build system, specifying the minimum required version and the project name along with its version. It also declares the programming languages to be used. ```cmake cmake_minimum_required(VERSION 3.14) project(Test VERSION 0.1 LANGUAGES CXX) ``` -------------------------------- ### Configure Test Library (CMake) Source: https://github.com/rbock/sqlpp11/blob/main/tests/core/usage/CMakeLists.txt Sets up an interface library for testing sqlpp11, including include directories and compiler options. It conditionally applies warnings based on the compiler. ```cmake add_library(sqlpp11_testing INTERFACE) target_include_directories(sqlpp11_testing INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) if (NOT MSVC) target_compile_options(sqlpp11_testing INTERFACE -Wall -Wextra -pedantic) else() target_compile_options(sqlpp11_testing INTERFACE -DNOMINMAX) endif () ``` -------------------------------- ### Prepare and Execute Statement in sqlpp11 Source: https://github.com/rbock/sqlpp11/blob/main/docs/Prepared-Statements.md Shows how to prepare an SQL statement (INSERT, UPDATE, REMOVE, SELECT) using the prepare() method on a database connection object. It then demonstrates setting parameters and executing the prepared statement multiple times within a loop. ```C++ auto prepared_statement = db.prepare(some_statement); ``` ```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); } ``` -------------------------------- ### Create PostgreSQL Connection Pool Source: https://github.com/rbock/sqlpp11/blob/main/docs/Connection-Pools.md Demonstrates the creation of a PostgreSQL connection pool with initial configuration and cache size. Requires the sqlpp library. ```cpp 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}; ``` -------------------------------- ### Initialize PostgreSQL Connection Pool Later Source: https://github.com/rbock/sqlpp11/blob/main/docs/Connection-Pools.md Shows how to create a connection pool object first and then initialize it with configuration and cache size. Requires the sqlpp library. ```cpp 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); ``` -------------------------------- ### Get Connection with Ping Check Source: https://github.com/rbock/sqlpp11/blob/main/docs/Connection-Pools.md Shows how to retrieve a connection from the pool with a 'ping' check to ensure its validity before use. This is useful for cached connections. ```cpp auto db = pool.get(sqlpp::connection_check::ping); for (row : db(select(....))) { .... } ``` -------------------------------- ### Specify Isolation Level in C++ Source: https://github.com/rbock/sqlpp11/blob/main/docs/Transactions.md Illustrates how to set a specific transaction isolation level, such as `repeatable_read`, when starting a transaction in sqlpp11. This controls how concurrent transactions affect each other. ```C++ auto tx = start_transaction(db, ::sqlpp::isolation_level::repeatable_read); ``` -------------------------------- ### Define Test Files and Executable (CMake) Source: https://github.com/rbock/sqlpp11/blob/main/tests/core/usage/CMakeLists.txt Lists the source files for tests and creates an executable target 'sqlpp11_core_tests'. It links against the main sqlpp11 library and the testing library. ```cmake set(test_files BooleanExpression.cpp CustomQuery.cpp DateTime.cpp DateTimeParser.cpp Interpret.cpp Insert.cpp Remove.cpp Update.cpp Select.cpp SelectType.cpp Function.cpp Prepared.cpp Minimalistic.cpp Result.cpp Union.cpp With.cpp ) find_package(Boost 1.50) if(Boost_FOUND) include_directories(${Boost_INCLUDE_DIRS}) list(APPEND test_files Ppgen.cpp) endif() create_test_sourcelist(test_sources test_main.cpp ${test_files}) add_executable(sqlpp11_core_tests ${test_sources}) target_link_libraries(sqlpp11_core_tests PRIVATE sqlpp11::sqlpp11 sqlpp11_testing) ``` -------------------------------- ### Create and Link Executable for Serialization Tests Source: https://github.com/rbock/sqlpp11/blob/main/tests/core/serialize/CMakeLists.txt Creates an executable target named 'sqlpp11_core_serialize' using the defined test source files. It links the main sqlpp11 library and the testing utilities. ```cmake create_test_sourcelist(test_sources test_serializer_main.cpp ${test_files}) add_executable(sqlpp11_core_serialize ${test_sources}) target_link_libraries(sqlpp11_core_serialize PRIVATE sqlpp11::sqlpp11 sqlpp11_testing) ``` -------------------------------- ### Define Test Files and Executable Target Source: https://github.com/rbock/sqlpp11/blob/main/tests/postgresql/serialize/CMakeLists.txt This snippet defines the source files for the tests and creates an executable target named 'sqlpp11_postgresql_serialize_tests'. It then links the necessary sqlpp11 libraries and testing utilities. Compiler options like -Wall, -Wextra, and -pedantic are added for non-MSVC builds. ```cmake set(test_files Float.cpp ) create_test_sourcelist(test_sources test_main.cpp ${test_files}) add_executable(sqlpp11_postgresql_serialize_tests ${test_sources}) target_link_libraries(sqlpp11_postgresql_serialize_tests PRIVATE sqlpp11::postgresql sqlpp11_testing sqlpp11_postgresql_testing) if(NOT MSVC) target_compile_options(sqlpp11_postgresql_serialize_tests PRIVATE -Wall -Wextra -pedantic) endif() ``` -------------------------------- ### Make sqlpp11 Available (CMake) Source: https://github.com/rbock/sqlpp11/blob/main/examples/usage_fetch_content/dependencies/sqlpp11/CMakeLists.txt This CMake command ensures that the sqlpp11 library is available for use within the project, typically by downloading and configuring it. ```cmake FetchContent_MakeAvailable(sqlpp11) ``` -------------------------------- ### Enable SQLpp11 Database Connectors (CMake) Source: https://github.com/rbock/sqlpp11/blob/main/examples/usage_fetch_content/dependencies/sqlpp11/CMakeLists.txt These CMake commands enable the building of specific database connectors for the sqlpp11 library. Users can uncomment the relevant lines to include support for MySQL, MariaDB, PostgreSQL, SQLite3, or SQLCipher. ```cmake 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) ``` -------------------------------- ### Define test files and create test executable (CMake) Source: https://github.com/rbock/sqlpp11/blob/main/tests/sqlite3/usage/CMakeLists.txt Defines a list of C++ source files for tests and uses a custom CMake macro 'create_test_sourcelist' to generate a source list for the main test executable 'sqlpp11_sqlite3_tests'. It then links necessary libraries for SQLite3 and testing. ```cmake set(test_files DateTime.cpp Sample.cpp Select.cpp Union.cpp With.cpp Attach.cpp DynamicSelect.cpp AutoIncrement.cpp Transaction.cpp FloatingPoint.cpp Integral.cpp Blob.cpp Connection.cpp ConnectionPool.cpp Execute.cpp ) create_test_sourcelist(test_sources test_main.cpp ${test_files}) add_executable(sqlpp11_sqlite3_tests ${test_sources}) target_link_libraries(sqlpp11_sqlite3_tests PRIVATE sqlpp11_testing sqlpp11_sqlite3_testing) ``` -------------------------------- ### Fetch Content for Date Library in CMake Source: https://github.com/rbock/sqlpp11/blob/main/dependencies/hinnant_date/CMakeLists.txt This snippet demonstrates how to use CMake's FetchContent module to make the 'date' library available. It also configures the 'date' library as a system library to avoid compilation warnings. ```cmake FetchContent_MakeAvailable(date) ``` ```cmake get_property(date_include_dirs TARGET date PROPERTY INTERFACE_INCLUDE_DIRECTORIES) set_property(TARGET date PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${date_include_dirs}") ``` -------------------------------- ### CMake Project Sources Definition Source: https://github.com/rbock/sqlpp11/blob/main/examples/connection_pool/CMakeLists.txt Specifies the source files for the application's executable target, including header and implementation files for database connections and global components, as well as the main entry point. ```cmake target_sources ( "${APP_NAME}" PRIVATE "src/db_connection.h" "src/db_connection.cpp" "src/db_global.h" "src/db_global.cpp" "src/main.cpp" ) ``` -------------------------------- ### Aliasing expressions in SELECT with C++ Source: https://github.com/rbock/sqlpp11/blob/main/docs/Select.md Illustrates how to use the `as()` method in sqlpp11 to provide an alias for an expression in a SELECT statement. This is useful for calculated columns or to avoid naming conflicts, particularly when joining tables. The example shows aliasing a computed column. ```C++ for (const auto& row : db(select(((foo.id + 17) * 4).as(foo.id)).from(tab).where(foo.id > 42)) { std::cout << row.id << std::endl; } ``` -------------------------------- ### Configure MySQL Test Execution with CMake Source: https://github.com/rbock/sqlpp11/blob/main/tests/mysql/usage/CMakeLists.txt This snippet demonstrates how to configure a CMake project to build and run tests for the sqlpp11 library with MySQL support. It includes finding required packages, defining interface libraries, listing test source files, creating an executable, linking necessary libraries (sqlpp11::mysql, sqlpp11_testing, sqlpp11_mysql_testing, Threads::Threads), setting compile options based on the compiler, and conditionally setting the C++ standard. ```cmake find_package(Threads REQUIRED) add_library(sqlpp11_mysql_testing INTERFACE) target_include_directories(sqlpp11_mysql_testing INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) set(test_files Json.cpp CustomQuery.cpp DateTime.cpp Sample.cpp Select.cpp Union.cpp DynamicSelect.cpp MoveConstructor.cpp Prepared.cpp Truncated.cpp Update.cpp Remove.cpp Connection.cpp ConnectionPool.cpp OnDuplicateKeyUpdate.cpp ) create_test_sourcelist(test_sources test_main.cpp ${test_files}) add_executable(sqlpp11_mysql_tests ${test_sources}) target_link_libraries(sqlpp11_mysql_tests PRIVATE sqlpp11::mysql sqlpp11_testing sqlpp11_mysql_testing) target_link_libraries(sqlpp11_mysql_tests PRIVATE Threads::Threads) if(NOT MSVC) target_compile_options(sqlpp11_mysql_tests PRIVATE -Wall -Wextra -pedantic) endif() # conditionally bump to a higher C++ standard to test compatibility if (SQLPP11_TESTS_CXX_STD) set_property(TARGET sqlpp11_mysql_tests PROPERTY CXX_STANDARD ${SQLPP11_TESTS_CXX_STD}) set_property(TARGET sqlpp11_mysql_tests PROPERTY CXX_STANDARD_REQUIRED yes) set_property(TARGET sqlpp11_mysql_tests PROPERTY CXX_EXTENSIONS no) endif() foreach(test_file IN LISTS test_files) get_filename_component(test ${test_file} NAME_WLE) add_test(NAME sqlpp11.mysql.usage.${test} COMMAND sqlpp11_mysql_tests ${test} ) endforeach() ``` -------------------------------- ### Specify Source Files in CMake Source: https://github.com/rbock/sqlpp11/blob/main/examples/usage_fetch_content/src/CMakeLists.txt This CMake snippet defines the source files for the 'Test' executable. It specifies that 'main.cpp' is a private source file for this target. ```cmake target_sources(Test PRIVATE main.cpp ) ``` -------------------------------- ### Include Subdirectories (CMake) Source: https://github.com/rbock/sqlpp11/blob/main/examples/usage_fetch_content/CMakeLists.txt Includes other CMake build configurations from subdirectories. 'dependencies' likely contains external library configurations, and 'src' contains the main project sources. ```cmake add_subdirectory(dependencies) add_subdirectory(src) ``` -------------------------------- ### Multi-row INSERT with various value types Source: https://github.com/rbock/sqlpp11/blob/main/docs/Insert.md Shows how to insert multiple rows into a table 't' using the 'insert_into' function. It includes examples with default values and null values, demonstrating type casting for specific columns like time points. ```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); ``` ```C++ 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())); ``` -------------------------------- ### Add Executable and Link sqlpp11 Library in CMake Source: https://github.com/rbock/sqlpp11/blob/main/examples/usage_find_package/src/CMakeLists.txt This snippet shows how to define a CMake executable target named 'Test' and link it against the sqlpp11 library. It also specifies the source files for the target. The commented lines indicate how to link against specific sqlpp11 components like sqlite3, sqlcipher, mysql, mariadb, or postgresql. ```cmake 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 ) ``` -------------------------------- ### Select All Columns with sqlpp11 Source: https://github.com/rbock/sqlpp11/blob/main/docs/Select.md Illustrates how to select all columns from a table using the `all_of()` function, similar to `SELECT *` in standard SQL. ```C++ select(all_of(foo)); ``` -------------------------------- ### Conditionally Fetch and Include Date Library with CMake Source: https://github.com/rbock/sqlpp11/blob/main/dependencies/CMakeLists.txt This CMake code snippet demonstrates how to conditionally include the 'date' library from a Git repository using FetchContent. It is executed only if USE_SYSTEM_DATE is not defined and TARGET date::date is not already defined. The 'date' library is fetched from a specific GitHub repository and tag, and then added as a subdirectory. ```cmake if(NOT USE_SYSTEM_DATE AND NOT TARGET date::date) include(FetchContent) FetchContent_Declare(date GIT_REPOSITORY https://github.com/HowardHinnant/date.git GIT_TAG v3.0.0 ) add_subdirectory(hinnant_date) endif() ``` -------------------------------- ### Add Tests for Each Source File (CMake) Source: https://github.com/rbock/sqlpp11/blob/main/tests/mysql/serialize/CMakeLists.txt Iterates through the list of test source files and adds a CMake test for each. Each test executes the 'sqlpp11_mysql_serialize_tests' executable with the specific test file as an argument. ```cmake foreach(test_file IN LISTS test_files) get_filename_component(test ${test_file} NAME_WLE) add_test(NAME sqlpp11.mysql.serialize.${test} COMMAND sqlpp11_mysql_serialize_tests ${test} ) endforeach() ``` -------------------------------- ### Dynamic loading test executable and linking (CMake) Source: https://github.com/rbock/sqlpp11/blob/main/tests/sqlite3/usage/CMakeLists.txt Creates a separate executable 'Sqlpp11Sqlite3DynamicLoadingTest' for dynamic loading tests. It links the 'sqlpp11-connector-sqlite3-dynamic' library and, on non-MSVC platforms, the 'dl' library, along with compiler options. ```cmake if (SQLPP_DYNAMIC_LOADING) add_executable(Sqlpp11Sqlite3DynamicLoadingTest "DynamicLoadingTest.cpp" ${sqlpp_headers}) target_link_libraries(Sqlpp11Sqlite3DynamicLoadingTest sqlpp11-connector-sqlite3-dynamic) if (NOT MSVC) target_link_libraries(Sqlpp11Sqlite3DynamicLoadingTest dl) target_compile_options(Sqlpp11Sqlite3DynamicLoadingTest INTERFACE -Wall -Wextra -pedantic) endif () add_test(NAME Sqlpp11Sqlite3DynamicLoadingTest COMMAND Sqlpp11Sqlite3DynamicLoadingTest) endif() ``` -------------------------------- ### Constructing a SELECT statement in C++ Source: https://github.com/rbock/sqlpp11/blob/main/docs/Select.md Shows the core syntax for building a SELECT statement in sqlpp11. This snippet focuses on the select, from, and where clauses. It's a building block for more complex queries. ```C++ select(foo.name, foo.hasFun) .from(foo) .where(foo.id > 17 and foo.name.like("%bar%")) ``` -------------------------------- ### Basic Table Selection with sqlpp11 Source: https://github.com/rbock/sqlpp11/blob/main/docs/Select.md Shows the most basic form of selecting from a table, including specifying the table and applying a WHERE clause. ```C++ select(all_of(foo)).from(foo).where(foo.id == 17); ``` -------------------------------- ### CMake Executable and Target Include Directories Source: https://github.com/rbock/sqlpp11/blob/main/examples/connection_pool/CMakeLists.txt Defines the executable target and specifies private include directories for the project, including generated headers and source directory. ```cmake add_executable ("${APP_NAME}") target_include_directories ("${APP_NAME}" PRIVATE "${GEN_HEADERS_DIR}" "${PROJECT_SOURCE_DIR}/src") ``` -------------------------------- ### Executing a Select Statement with sqlpp11 Source: https://github.com/rbock/sqlpp11/blob/main/docs/Select.md Shows how to execute a constructed SELECT statement by passing it to the database object `db` and how to capture the result. ```C++ db(select(all_of(foo)).from(foo).unconditionally()); ``` ```C++ auto result = db(select(all_of(foo)).from(foo).unconditionally()); ``` -------------------------------- ### Define SQLPP11 Compile Test Target Source: https://github.com/rbock/sqlpp11/blob/main/tests/core/helpers/CMakeLists.txt Defines a CMake function to compile a test executable for sqlpp11. It sets up the target name, links the necessary libraries (sqlpp11::sqlpp11 and sqlpp11_testing), and compiles the provided C++ source file. ```cmake function(test_compile name) set(target sqlpp11_helpers_${name}) add_executable(${target} ${name}.cpp) target_link_libraries(${target} PRIVATE sqlpp11::sqlpp11 sqlpp11_testing) endfunction() ``` -------------------------------- ### Define Test Files for sqlpp11 Serialization Source: https://github.com/rbock/sqlpp11/blob/main/tests/core/serialize/CMakeLists.txt Lists all the individual C++ files used for testing the serialization features of sqlpp11. These files cover various aspects of SQL query serialization. ```cmake set(test_files Any.cpp As.cpp Avg.cpp Blob.cpp Count.cpp CustomQuery.cpp DynamicWhere.cpp Exists.cpp Float.cpp ForUpdate.cpp From.cpp In.cpp Insert.cpp IsNotNull.cpp IsNull.cpp Lower.cpp Max.cpp Min.cpp Operator.cpp Over.cpp SelectAs.cpp Some.cpp Sum.cpp TableAlias.cpp Trim.cpp Upper.cpp Where.cpp ParameterizedVerbatim.cpp CurrentTimestamp.cpp CurrentTime.cpp CurrentDate.cpp ) ``` -------------------------------- ### Selecting all columns and iterating in C++ Source: https://github.com/rbock/sqlpp11/blob/main/README.md Shows how to select all columns of a table using `all_of()` and iterate over the results. It highlights the implicit conversion of numeric fields to C++ numeric types. ```C++ // 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 } ``` -------------------------------- ### Define Test Executable and Link Libraries (CMake) Source: https://github.com/rbock/sqlpp11/blob/main/tests/mysql/serialize/CMakeLists.txt Defines an executable target 'sqlpp11_mysql_serialize_tests' and links it with sqlpp11 MySQL, testing, and Threads libraries. It also conditionally applies compiler warnings for non-MSVC builds. ```cmake set(test_files Float.cpp ) create_test_sourcelist(test_sources test_main.cpp ${test_files}) add_executable(sqlpp11_mysql_serialize_tests ${test_sources}) target_link_libraries(sqlpp11_mysql_serialize_tests PRIVATE sqlpp11::mysql sqlpp11_testing sqlpp11_mysql_testing) target_link_libraries(sqlpp11_mysql_serialize_tests PRIVATE Threads::Threads) if(NOT MSVC) target_compile_options(sqlpp11_mysql_serialize_tests PRIVATE -Wall -Wextra -pedantic) endif() ``` -------------------------------- ### Creating Individual PostgreSQL Test Cases Source: https://github.com/rbock/sqlpp11/blob/main/tests/postgresql/usage/CMakeLists.txt Iterates through the defined test files to create individual CTest test cases, each executing the compiled PostgreSQL test executable with a specific test file as an argument. ```cmake foreach(test_file IN LISTS test_files) get_filename_component(test ${test_file} NAME_WLE) add_test(NAME sqlpp11.postgresql.usage.${test} COMMAND sqlpp11_postgresql_tests ${test} ) endforeach() ``` -------------------------------- ### sqlpp11 Parameter Overloads Source: https://github.com/rbock/sqlpp11/blob/main/docs/Prepared-Statements.md Demonstrates the two overloads for specifying parameters in sqlpp11: one using ValueType and AliasProvider, and another using NamedExpression. Value types include sqlpp::bigint, sqlpp::text, etc., while AliasProvider is generated via SQLPP_ALIAS_PROVIDER. ```C++ parameter(const ValueType&, const AliasProvider&); parameter(const NamedExpression&) ``` ```C++ SQLPP_ALIAS_PROVIDER(cheese); parameter(sqlpp::bigint(), cheese); parameter(tab.id); ``` -------------------------------- ### Define SQLpp11 Test Compilation Function (CMake) Source: https://github.com/rbock/sqlpp11/blob/main/tests/core/static_asserts/CMakeLists.txt Defines a CMake function `test_compile` to create an executable for testing SQLpp11 functionalities. It links against `sqlpp11::sqlpp11` and `sqlpp11_testing`. Optionally, it can set the C++ standard for compatibility testing. ```cmake function(test_compile name) set(target sqlpp11_assert_${name}) add_executable(${target} ${name}.cpp) target_link_libraries(${target} PRIVATE sqlpp11::sqlpp11 sqlpp11_testing) # conditionally bump to a higher C++ standard to test compatibility if (SQLPP11_TESTS_CXX_STD) set_property(TARGET sqlpp11_assert_${name} PROPERTY CXX_STANDARD ${SQLPP11_TESTS_CXX_STD}) set_property(TARGET sqlpp11_assert_${name} PROPERTY CXX_STANDARD_REQUIRED yes) set_property(TARGET sqlpp11_assert_${name} PROPERTY CXX_EXTENSIONS no) endif() endfunction() ``` -------------------------------- ### Basic INSERT into table Source: https://github.com/rbock/sqlpp11/blob/main/docs/Insert.md Demonstrates a basic INSERT statement into a table 'tab' setting the 'gamma' column to true, and into 'tabDateTime' setting 'colTimePoint' to the current system time. ```C++ db(insert_into(tab).set(tab.gamma = true)); db(insert_into(tabDateTime) .set(tabDateTime.colTimePoint = std::chrono::system_clock::now())); ``` -------------------------------- ### Define Individual Serialization Test Cases Source: https://github.com/rbock/sqlpp11/blob/main/tests/core/serialize/CMakeLists.txt Iterates through each test file to create a separate CTest entry. Each test is named according to its file and executed with the 'sqlpp11_core_serialize' executable. ```cmake foreach(test_file IN LISTS test_files) get_filename_component(test ${test_file} NAME_WLE) add_test(NAME sqlpp11.core.serialize.${test} COMMAND sqlpp11_core_serialize ${test} ) endforeach() ``` -------------------------------- ### Generate Package Version File Source: https://github.com/rbock/sqlpp11/blob/main/CMakeLists.txt Creates a basic package version file (SqlppConfigVersion.cmake) to manage version compatibility. It uses the SameMajorVersion compatibility rule. ```cmake write_basic_package_version_file(SqlppConfigVersion.cmake COMPATIBILITY SameMajorVersion ARCH_INDEPENDENT ) ``` -------------------------------- ### Compile SQLPP11 Test Executable (CMake) Source: https://github.com/rbock/sqlpp11/blob/main/tests/core/types/CMakeLists.txt Defines a CMake function `test_compile` to create a test executable for SQLPP11. It compiles a C++ source file, links it with the `sqlpp11::sqlpp11` and `sqlpp11_testing` libraries, and optionally sets the C++ standard for compatibility testing. ```cmake function(test_compile name) set(target sqlpp11_${name}) add_executable(${target} ${name}.cpp) target_link_libraries(${target} PRIVATE sqlpp11::sqlpp11 sqlpp11_testing) # conditionally bump to a higher C++ standard to test compatibility if (SQLPP11_TESTS_CXX_STD) set_property(TARGET sqlpp11_${name} PROPERTY CXX_STANDARD ${SQLPP11_TESTS_CXX_STD}) set_property(TARGET sqlpp11_${name} PROPERTY CXX_STANDARD_REQUIRED yes) set_property(TARGET sqlpp11_${name} PROPERTY CXX_EXTENSIONS no) endif() endfunction() test_compile(result_row) ``` -------------------------------- ### Compile SQLpp11 Tests (CMake) Source: https://github.com/rbock/sqlpp11/blob/main/tests/core/static_asserts/CMakeLists.txt Calls the `test_compile` function to compile various SQLpp11 test cases, including aggregates, case statements, FROM clauses, joins, WHERE clauses, update lists, HAVING clauses, INSERT statements, IN clauses, and date/time/text functionalities. ```cmake test_compile(aggregates) test_compile(case) test_compile(from) test_compile(join) test_compile(where) test_compile(update_list) test_compile(having) test_compile(insert) test_compile(in) test_compile(date) test_compile(date_time) test_compile(text) test_compile(no_self_compare) test_compile(unwrapped_bool) ```