Skip to content

Commit

Permalink
Remaining C++11 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
anarthal committed Dec 4, 2023
1 parent 6a43eeb commit 5080414
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 16 deletions.
22 changes: 10 additions & 12 deletions bench/connection_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<task_nopool> conns;
coordinator coord;
Expand All @@ -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;

Expand Down
12 changes: 12 additions & 0 deletions example/connection_pool/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//

#include <boost/mysql/static_results.hpp>

#ifdef BOOST_MYSQL_CXX14

//[example_connection_pool_main_cpp

#include <boost/mysql/any_address.hpp>
Expand Down Expand Up @@ -130,3 +134,11 @@ int main(int argc, char* argv[])
}

//]

#else

#include <iostream>

int main() { std::cout << "Sorry, your compiler doesn't support C++14\n"; }

#endif
11 changes: 8 additions & 3 deletions example/connection_pool/repository.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <boost/mysql/static_results.hpp>

#include "repository.hpp"
#ifdef BOOST_MYSQL_CXX14

//[example_connection_pool_repository_cpp

#include <boost/mysql/diagnostics.hpp>
#include <boost/mysql/error_code.hpp>
Expand All @@ -21,6 +23,7 @@
#include <tuple>
#include <utility>

#include "repository.hpp"
#include "types.hpp"

using namespace notes;
Expand Down Expand Up @@ -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.
}

//]
//]

#endif
7 changes: 6 additions & 1 deletion example/connection_pool/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

//[example_connection_pool_server_cpp

#include "server.hpp"
#include <boost/mysql/static_results.hpp>

#ifdef BOOST_MYSQL_CXX14

#include <boost/mysql/connection_pool.hpp>
#include <boost/mysql/error_code.hpp>
Expand Down Expand Up @@ -46,6 +48,7 @@
#include <string>

#include "repository.hpp"
#include "server.hpp"
#include "types.hpp"

// This file contains all the boilerplate code to implement a HTTP
Expand Down Expand Up @@ -512,4 +515,6 @@ error_code notes::launch_server(
return error_code();
}

#endif

//]

0 comments on commit 5080414

Please sign in to comment.