From 5080414b482c7b58a54dee739cf28447fd669cf1 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Mon, 4 Dec 2023 13:22:36 +0100 Subject: [PATCH] Remaining C++11 fixes --- bench/connection_pool.cpp | 22 ++++++++++------------ example/connection_pool/main.cpp | 12 ++++++++++++ example/connection_pool/repository.cpp | 11 ++++++++--- example/connection_pool/server.cpp | 7 ++++++- 4 files changed, 36 insertions(+), 16 deletions(-) diff --git a/bench/connection_pool.cpp b/bench/connection_pool.cpp index f4e3ce4dc..c221e1ed3 100644 --- a/bench/connection_pool.cpp +++ b/bench/connection_pool.cpp @@ -206,12 +206,11 @@ void run_nopool(mysql::any_address server_addr, bool use_ssl) { // Setup asio::io_context ctx; - mysql::connect_params params{ - std::move(server_addr), - "example_user", - "example_password", - "boost_mysql_examples", - }; + mysql::connect_params params; + params.server_address = std::move(server_addr); + params.username = "example_user"; + params.password = "example_password"; + params.database = "boost_mysql_examples"; params.ssl = use_ssl ? mysql::ssl_mode::require : mysql::ssl_mode::disable; std::vector conns; coordinator coord; @@ -236,12 +235,11 @@ void run_pool(mysql::any_address server_addr, bool use_ssl) { // Setup asio::io_context ctx; - mysql::pool_params params{ - std::move(server_addr), - "example_user", - "example_password", - "boost_mysql_examples", - }; + mysql::pool_params params; + params.server_address = std::move(server_addr); + params.username = "example_user"; + params.password = "example_password"; + params.database = "boost_mysql_examples"; params.max_size = num_parallel; params.ssl = use_ssl ? mysql::ssl_mode::require : mysql::ssl_mode::disable; diff --git a/example/connection_pool/main.cpp b/example/connection_pool/main.cpp index 742a569a9..a2908c697 100644 --- a/example/connection_pool/main.cpp +++ b/example/connection_pool/main.cpp @@ -5,6 +5,10 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // +#include + +#ifdef BOOST_MYSQL_CXX14 + //[example_connection_pool_main_cpp #include @@ -130,3 +134,11 @@ int main(int argc, char* argv[]) } //] + +#else + +#include + +int main() { std::cout << "Sorry, your compiler doesn't support C++14\n"; } + +#endif diff --git a/example/connection_pool/repository.cpp b/example/connection_pool/repository.cpp index 41880f982..b83ebc366 100644 --- a/example/connection_pool/repository.cpp +++ b/example/connection_pool/repository.cpp @@ -5,9 +5,11 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -//[example_connection_pool_repository_cpp +#include -#include "repository.hpp" +#ifdef BOOST_MYSQL_CXX14 + +//[example_connection_pool_repository_cpp #include #include @@ -21,6 +23,7 @@ #include #include +#include "repository.hpp" #include "types.hpp" using namespace notes; @@ -215,4 +218,6 @@ bool note_repository::delete_note(std::int64_t note_id, boost::asio::yield_conte // pooled_connection's destructor takes care of it. } -//] \ No newline at end of file +//] + +#endif diff --git a/example/connection_pool/server.cpp b/example/connection_pool/server.cpp index 1a34d2104..04b0d1ac9 100644 --- a/example/connection_pool/server.cpp +++ b/example/connection_pool/server.cpp @@ -7,7 +7,9 @@ //[example_connection_pool_server_cpp -#include "server.hpp" +#include + +#ifdef BOOST_MYSQL_CXX14 #include #include @@ -46,6 +48,7 @@ #include #include "repository.hpp" +#include "server.hpp" #include "types.hpp" // This file contains all the boilerplate code to implement a HTTP @@ -512,4 +515,6 @@ error_code notes::launch_server( return error_code(); } +#endif + //] \ No newline at end of file