From afdc3bfd19b8bd0faa4207a1f08481d2d3ca745d Mon Sep 17 00:00:00 2001 From: ruben Date: Thu, 19 Mar 2020 17:19:43 +0000 Subject: [PATCH] Moved all names into namespace boost::mysql --- TODO.txt | 11 ++-- examples/metadata.cpp | 16 ++--- examples/prepared_statements.cpp | 18 +++--- examples/query_async.cpp | 40 ++++++------ examples/query_sync.cpp | 14 ++--- include/boost/mysql/collation.hpp | 7 ++- include/boost/mysql/connection.hpp | 7 ++- .../auth/impl/mysql_native_password.ipp | 4 +- .../detail/auth/mysql_native_password.hpp | 18 +++--- .../mysql/detail/aux/container_equals.hpp | 14 ++--- include/boost/mysql/detail/aux/stringize.hpp | 12 ++-- include/boost/mysql/detail/aux/tmp.hpp | 13 ++-- include/boost/mysql/detail/basic_types.hpp | 13 ++-- .../network_algorithms/close_statement.hpp | 12 ++-- .../detail/network_algorithms/common.hpp | 13 ++-- .../network_algorithms/execute_generic.hpp | 12 ++-- .../network_algorithms/execute_query.hpp | 8 +-- .../network_algorithms/execute_statement.hpp | 12 ++-- .../detail/network_algorithms/handshake.hpp | 12 ++-- .../impl/close_statement.hpp | 6 +- .../impl/execute_generic.hpp | 18 +++--- .../network_algorithms/impl/execute_query.hpp | 6 +- .../impl/execute_statement.hpp | 18 +++--- .../network_algorithms/impl/handshake.hpp | 15 +++-- .../impl/prepare_statement.hpp | 20 +++--- .../network_algorithms/impl/read_row.hpp | 15 +++-- .../network_algorithms/prepare_statement.hpp | 14 ++--- .../detail/network_algorithms/read_row.hpp | 12 ++-- .../protocol/binary_deserialization.hpp | 12 ++-- .../detail/protocol/binary_serialization.hpp | 12 ++-- .../mysql/detail/protocol/capabilities.hpp | 13 ++-- .../boost/mysql/detail/protocol/channel.hpp | 12 ++-- .../boost/mysql/detail/protocol/constants.hpp | 13 ++-- .../protocol/impl/binary_deserialization.ipp | 16 ++--- .../protocol/impl/binary_serialization.ipp | 34 +++++------ .../mysql/detail/protocol/impl/channel.hpp | 26 ++++---- .../mysql/detail/protocol/impl/messages.ipp | 39 ++++++------ .../protocol/impl/text_deserialization.ipp | 16 ++--- .../boost/mysql/detail/protocol/messages.hpp | 8 +-- .../detail/protocol/null_bitmap_traits.hpp | 13 ++-- .../mysql/detail/protocol/serialization.hpp | 13 ++-- .../detail/protocol/text_deserialization.hpp | 12 ++-- include/boost/mysql/error.hpp | 7 ++- include/boost/mysql/field_type.hpp | 7 ++- include/boost/mysql/impl/connection.hpp | 37 +++++------ include/boost/mysql/impl/error.hpp | 21 +++---- include/boost/mysql/impl/metadata.ipp | 16 ++--- .../boost/mysql/impl/prepared_statement.hpp | 14 ++--- include/boost/mysql/impl/resultset.hpp | 24 ++++---- include/boost/mysql/impl/value.hpp | 23 +++---- include/boost/mysql/metadata.hpp | 8 +-- include/boost/mysql/prepared_statement.hpp | 7 ++- include/boost/mysql/resultset.hpp | 7 ++- include/boost/mysql/row.hpp | 7 ++- include/boost/mysql/value.hpp | 7 ++- test/common/serialization_test_common.hpp | 18 +++--- test/common/test_common.hpp | 12 ++-- test/integration/close_statement.cpp | 4 +- test/integration/database_types.cpp | 38 ++++++------ test/integration/execute_statement.cpp | 16 ++--- test/integration/handshake.cpp | 15 ++--- test/integration/integration_test_common.hpp | 12 ++-- test/integration/metadata_validator.cpp | 6 +- test/integration/metadata_validator.hpp | 12 ++-- test/integration/network_functions.cpp | 61 ++++++++++--------- test/integration/network_functions.hpp | 13 ++-- test/integration/prepare_statement.cpp | 12 ++-- .../prepared_statement_lifecycle.cpp | 6 +- test/integration/query.cpp | 17 +++--- test/integration/resultset.cpp | 25 ++++---- .../detail/auth/mysql_native_password.cpp | 2 +- .../protocol/binary_deserialization.cpp | 20 +++--- test/unit/detail/protocol/capabilities.cpp | 2 +- test/unit/detail/protocol/channel.cpp | 23 +++---- .../detail/protocol/null_bitmap_traits.cpp | 8 +-- test/unit/detail/protocol/serialization.cpp | 10 +-- .../detail/protocol/text_deserialization.cpp | 28 ++++----- test/unit/error.cpp | 4 +- test/unit/metadata.cpp | 23 ++++--- test/unit/prepared_statement.cpp | 6 +- test/unit/row.cpp | 4 +- test/unit/value.cpp | 35 +++++------ 82 files changed, 621 insertions(+), 615 deletions(-) diff --git a/TODO.txt b/TODO.txt index 96c51d97..c168b32e 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,3 +1,8 @@ +Name change + Refactor file structucture for serialization and tests + Deserialize common should be in namespace mysql::test, not in detail + Rename (De)SerializationContext + Rename Error Multiresultset Text protocol Binary protocol (stored procedures) @@ -31,10 +36,7 @@ Technical debt Force the same number of values in each row as in fields() CMake exporting? Integration test for network errors (e.g. host unreachable) - Refactor file structucture for serialization and tests - Deserialize common should be in namespace mysql::test, not in detail Take fetch_many() algorithm out into network_algorithms (e.g. read_many_rows) - Rename (De)SerializationContext Test zero dates clear_errors() function to clear error_info and error_code at once Rework deserialize_row_fn to allow cursors @@ -42,5 +44,4 @@ Technical debt More thorough testing for several NULLs in integration testing Query and statement tests for DELETEs prepared_statement::execute(): static_assert(), handle value&, const value&, anything convertible - Test for too many connections: do we have a buffer overrun there? (error msg shows incomplete) - Add a connection quit in integ tests: they may fail under Windows otherwise \ No newline at end of file + Test for too many connections: do we have a buffer overrun there? (error msg shows incomplete) \ No newline at end of file diff --git a/examples/metadata.cpp b/examples/metadata.cpp index c1f18e10..736424a0 100644 --- a/examples/metadata.cpp +++ b/examples/metadata.cpp @@ -25,12 +25,12 @@ void main_impl(int argc, char** argv) } // Connection params (host, port, user, password, database) - boost::asio::ip::tcp::endpoint ep (boost::asio::ip::address_v4::loopback(), mysql::default_port); - mysql::connection_params params (argv[1], argv[2], "mysql_asio_examples"); + boost::asio::ip::tcp::endpoint ep (boost::asio::ip::address_v4::loopback(), boost::mysql::default_port); + boost::mysql::connection_params params (argv[1], argv[2], "mysql_asio_examples"); // TCP and MySQL level connect boost::asio::io_context ctx; - mysql::tcp_connection conn (ctx); + boost::mysql::tcp_connection conn (ctx); conn.next_level().connect(ep); conn.handshake(params); @@ -40,7 +40,7 @@ void main_impl(int argc, char** argv) FROM employee emp JOIN company comp ON (comp.id = emp.company_id) )"; - mysql::tcp_resultset result = conn.query(sql); + boost::mysql::tcp_resultset result = conn.query(sql); /** * Resultsets allow you to access metadata about the fields in the query @@ -51,24 +51,24 @@ void main_impl(int argc, char** argv) */ assert(result.fields().size() == 2); - [[maybe_unused]] const mysql::field_metadata& company_name = result.fields()[0]; + [[maybe_unused]] const boost::mysql::field_metadata& company_name = result.fields()[0]; assert(company_name.database() == "mysql_asio_examples"); // database name assert(company_name.table() == "comp"); // the alias we assigned to the table in the query assert(company_name.original_table() == "company"); // the original table name assert(company_name.field_name() == "company_name"); // the name of the field in the query assert(company_name.original_field_name() == "name"); // the name of the physical field in the table - assert(company_name.type() == mysql::field_type::varchar); // we created the field as a VARCHAR + assert(company_name.type() == boost::mysql::field_type::varchar); // we created the field as a VARCHAR assert(!company_name.is_primary_key()); // field is not a primary key assert(!company_name.is_auto_increment()); // field is not AUTO_INCREMENT assert(company_name.is_not_null()); // field may not be NULL - [[maybe_unused]] const mysql::field_metadata& employee_id = result.fields()[1]; + [[maybe_unused]] const boost::mysql::field_metadata& employee_id = result.fields()[1]; assert(employee_id.database() == "mysql_asio_examples");// database name assert(employee_id.table() == "emp"); // the alias we assigned to the table in the query assert(employee_id.original_table() == "employee"); // the original table name assert(employee_id.field_name() == "employee_id"); // the name of the field in the query assert(employee_id.original_field_name() == "id"); // the name of the physical field in the table - assert(employee_id.type() == mysql::field_type::int_); // we created the field as INT + assert(employee_id.type() == boost::mysql::field_type::int_); // we created the field as INT assert(employee_id.is_primary_key()); // field is a primary key assert(employee_id.is_auto_increment()); // we declared the field as AUTO_INCREMENT assert(employee_id.is_not_null()); // field cannot be NULL diff --git a/examples/prepared_statements.cpp b/examples/prepared_statements.cpp index 9cf1a137..66de5bd1 100644 --- a/examples/prepared_statements.cpp +++ b/examples/prepared_statements.cpp @@ -27,9 +27,9 @@ void main_impl(int argc, char** argv) // Connection parameters boost::asio::ip::tcp::endpoint ep ( boost::asio::ip::address_v4::loopback(), // host - mysql::default_port // port + boost::mysql::default_port // port ); - mysql::connection_params params ( + boost::mysql::connection_params params ( argv[1], // username argv[2], // password "mysql_asio_examples" // database to use; leave empty or omit the parameter for no database @@ -38,7 +38,7 @@ void main_impl(int argc, char** argv) boost::asio::io_context ctx; // Declare the connection object and authenticate to the server - mysql::tcp_connection conn (ctx); + boost::mysql::tcp_connection conn (ctx); conn.next_level().connect(ep); // next_level() returns a boost::asio::ip::tcp::socket conn.handshake(params); // Authenticates to the MySQL server @@ -57,11 +57,11 @@ void main_impl(int argc, char** argv) * We prepare two statements, a SELECT and an UPDATE. */ const char* salary_getter_sql = "SELECT salary FROM employee WHERE first_name = ?"; - mysql::tcp_prepared_statement salary_getter = conn.prepare_statement(salary_getter_sql); + boost::mysql::tcp_prepared_statement salary_getter = conn.prepare_statement(salary_getter_sql); assert(salary_getter.num_params() == 1); // num_params() returns the number of parameters (question marks) const char* salary_updater_sql = "UPDATE employee SET salary = ? WHERE first_name = ?"; - mysql::tcp_prepared_statement salary_updater = conn.prepare_statement(salary_updater_sql); + boost::mysql::tcp_prepared_statement salary_updater = conn.prepare_statement(salary_updater_sql); assert(salary_updater.num_params() == 2); /* @@ -81,8 +81,8 @@ void main_impl(int argc, char** argv) * which creates a std::array with the passed in values converted to mysql::value's. * An iterator version of execute() is also available. */ - mysql::tcp_resultset result = salary_getter.execute(mysql::make_values("Efficient")); - std::vector salaries = result.fetch_all(); // Get all the results + boost::mysql::tcp_resultset result = salary_getter.execute(boost::mysql::make_values("Efficient")); + std::vector salaries = result.fetch_all(); // Get all the results assert(salaries.size() == 1); [[maybe_unused]] auto salary = std::get(salaries[0].values().at(0)); // First row, first column assert(salary == 30000); @@ -96,14 +96,14 @@ void main_impl(int argc, char** argv) * column is declared as a DOUBLE. The MySQL server will do * the right thing for us. */ - salary_updater.execute(mysql::make_values(35000, "Efficient")); + salary_updater.execute(boost::mysql::make_values(35000, "Efficient")); /** * Execute the select again. We can execute a prepared statement * as many times as we want. We do NOT need to call * connection::prepare_statement() again. */ - result = salary_getter.execute(mysql::make_values("Efficient")); + result = salary_getter.execute(boost::mysql::make_values("Efficient")); salaries = result.fetch_all(); assert(salaries.size() == 1); salary = std::get(salaries[0].values().at(0)); diff --git a/examples/query_async.cpp b/examples/query_async.cpp index b8ff0683..fe9bf9ba 100644 --- a/examples/query_async.cpp +++ b/examples/query_async.cpp @@ -6,6 +6,9 @@ #include #include +using boost::mysql::error_code; +using boost::mysql::error_info; + /** * For this example, we will be using the 'mysql_asio_examples' database. * You can get this database by running db_setup.sql. @@ -18,16 +21,19 @@ * please have a look to the query_sync.cpp example. */ -void print_employee(const mysql::row& employee) +void print_employee(const boost::mysql::row& employee) { - using mysql::operator<<; // Required for mysql::value objects to be streamable, due to ADL rules + using boost::mysql::operator<<; // Required for mysql::value objects to be streamable, due to ADL rules std::cout << "Employee '" << employee.values()[0] << " " // first_name (type std::string_view) << employee.values()[1] << "' earns " // last_name (type std::string_view) << employee.values()[2] << " dollars yearly\n"; // salary (type double) } -void die_on_error(const mysql::error_code& err, const mysql::error_info& info = mysql::error_info()) +void die_on_error( + const error_code& err, + const boost::mysql::error_info& info = boost::mysql::error_info() +) { if (err) { @@ -39,13 +45,13 @@ void die_on_error(const mysql::error_code& err, const mysql::error_info& info = class application { boost::asio::ip::tcp::endpoint ep; - mysql::connection_params conn_params; + boost::mysql::connection_params conn_params; boost::asio::io_context ctx; - mysql::tcp_connection connection; - mysql::tcp_resultset resultset; + boost::mysql::tcp_connection connection; + boost::mysql::tcp_resultset resultset; public: application(const char* username, const char* password) : - ep (boost::asio::ip::address_v4::loopback(), mysql::default_port), + ep (boost::asio::ip::address_v4::loopback(), boost::mysql::default_port), conn_params(username, password, "mysql_asio_examples"), connection(ctx) { @@ -55,9 +61,9 @@ public: void connect() { - connection.next_level().async_connect(ep, [this](mysql::error_code err) { + connection.next_level().async_connect(ep, [this](error_code err) { die_on_error(err); - connection.async_handshake(conn_params, [this](mysql::error_code err, const mysql::error_info& info) { + connection.async_handshake(conn_params, [this](error_code err, const error_info& info) { die_on_error(err, info); query_employees(); }); @@ -67,12 +73,12 @@ public: void query_employees() { const char* sql = "SELECT first_name, last_name, salary FROM employee WHERE company_id = 'HGS'"; - connection.async_query(sql, [this](mysql::error_code err, const mysql::error_info& info, - mysql::tcp_resultset&& result + connection.async_query(sql, [this](error_code err, const error_info& info, + boost::mysql::tcp_resultset&& result ) { die_on_error(err, info); resultset = std::move(result); - resultset.async_fetch_all([this](mysql::error_code err, const mysql::error_info& info, const auto& rows) { + resultset.async_fetch_all([this](error_code err, const error_info& info, const auto& rows) { die_on_error(err, info); for (const auto& employee: rows) { @@ -86,8 +92,8 @@ public: void update_slacker() { const char* sql = "UPDATE employee SET salary = 15000 WHERE last_name = 'Slacker'"; - connection.async_query(sql, [this](mysql::error_code err, const mysql::error_info& info, - [[maybe_unused]] mysql::tcp_resultset&& result) { + connection.async_query(sql, [this](error_code err, const error_info& info, + [[maybe_unused]] boost::mysql::tcp_resultset&& result) { die_on_error(err, info); assert(result.fields().size() == 0); query_intern(); @@ -97,11 +103,11 @@ public: void query_intern() { const char* sql = "SELECT salary FROM employee WHERE last_name = 'Slacker'"; - connection.async_query(sql, [this](const mysql::error_code& err, mysql::error_info info, - mysql::tcp_resultset&& result) { + connection.async_query(sql, [this](const error_code& err, error_info info, + boost::mysql::tcp_resultset&& result) { die_on_error(err, info); resultset = std::move(result); - resultset.async_fetch_all([](const mysql::error_code& err, mysql::error_info info, const auto& rows) { + resultset.async_fetch_all([](const error_code& err, error_info info, const auto& rows) { die_on_error(err, info); assert(rows.size() == 1); [[maybe_unused]] auto salary = std::get(rows[0].values()[0]); diff --git a/examples/query_sync.cpp b/examples/query_sync.cpp index 8fc38746..4d902396 100644 --- a/examples/query_sync.cpp +++ b/examples/query_sync.cpp @@ -23,9 +23,9 @@ * row::values() has the same number of elements as fields are in the SQL query, * and in the same order. */ -void print_employee(const mysql::row& employee) +void print_employee(const boost::mysql::row& employee) { - using mysql::operator<<; // Required for mysql::value objects to be streamable, due to ADL rules + using boost::mysql::operator<<; // Required for mysql::value objects to be streamable, due to ADL rules std::cout << "Employee '" << employee.values()[0] << " " // first_name (type std::string_view) << employee.values()[1] << "' earns " // last_name (type std::string_view) @@ -48,9 +48,9 @@ void main_impl(int argc, char** argv) */ boost::asio::ip::tcp::endpoint ep ( boost::asio::ip::address_v4::loopback(), // host - mysql::default_port // port + boost::mysql::default_port // port ); - mysql::connection_params params ( + boost::mysql::connection_params params ( argv[1], // username argv[2], // password "mysql_asio_examples" // database to use; leave empty or omit the parameter for no database @@ -64,7 +64,7 @@ void main_impl(int argc, char** argv) * - Establishing the TCP-level session. * - Authenticating to the MySQL server. */ - mysql::tcp_connection conn (ctx); + boost::mysql::tcp_connection conn (ctx); conn.next_level().connect(ep); // next_level() returns a boost::asio::ip::tcp::socket conn.handshake(params); // Authenticates to the MySQL server @@ -80,10 +80,10 @@ void main_impl(int argc, char** argv) * We will get all employees working for 'High Growth Startup'. */ const char* sql = "SELECT first_name, last_name, salary FROM employee WHERE company_id = 'HGS'"; - mysql::tcp_resultset result = conn.query(sql); + boost::mysql::tcp_resultset result = conn.query(sql); // Get all the rows in the resultset - std::vector employees = result.fetch_all(); + std::vector employees = result.fetch_all(); for (const auto& employee: employees) { print_employee(employee); diff --git a/include/boost/mysql/collation.hpp b/include/boost/mysql/collation.hpp index dfb4ed9a..fc2774b0 100644 --- a/include/boost/mysql/collation.hpp +++ b/include/boost/mysql/collation.hpp @@ -3,8 +3,8 @@ #include -namespace mysql -{ +namespace boost { +namespace mysql { /** * \brief A character set and a collation. @@ -237,7 +237,8 @@ enum class collation : std::uint16_t gb18030_unicode_520_ci = 250 }; -} +} // mysql +} // boost diff --git a/include/boost/mysql/connection.hpp b/include/boost/mysql/connection.hpp index c9d71ce9..c4b0afb1 100644 --- a/include/boost/mysql/connection.hpp +++ b/include/boost/mysql/connection.hpp @@ -9,8 +9,8 @@ #include "boost/mysql/prepared_statement.hpp" #include -namespace mysql -{ +namespace boost { +namespace mysql { /** * \brief Parameters defining how to authenticate to a MySQL server. @@ -154,7 +154,8 @@ using tcp_connection = connection; /// The default TCP port for the MySQL protocol. constexpr unsigned short default_port = 3306; -} +} // mysql +} // boost #include "boost/mysql/impl/connection.hpp" diff --git a/include/boost/mysql/detail/auth/impl/mysql_native_password.ipp b/include/boost/mysql/detail/auth/impl/mysql_native_password.ipp index 6fabf94e..a716c958 100644 --- a/include/boost/mysql/detail/auth/impl/mysql_native_password.ipp +++ b/include/boost/mysql/detail/auth/impl/mysql_native_password.ipp @@ -5,7 +5,7 @@ #include // SHA1( password ) XOR SHA1( "20-bytes random data from server" SHA1( SHA1( password ) ) ) -inline void mysql::detail::mysql_native_password::compute_auth_string( +inline void boost::mysql::detail::mysql_native_password::compute_auth_string( std::string_view password, const void* challenge, void* output @@ -35,4 +35,4 @@ inline void mysql::detail::mysql_native_password::compute_auth_string( -#endif \ No newline at end of file +#endif diff --git a/include/boost/mysql/detail/auth/mysql_native_password.hpp b/include/boost/mysql/detail/auth/mysql_native_password.hpp index 14f19738..92b488b2 100644 --- a/include/boost/mysql/detail/auth/mysql_native_password.hpp +++ b/include/boost/mysql/detail/auth/mysql_native_password.hpp @@ -5,13 +5,10 @@ #include #include -namespace mysql -{ -namespace detail -{ - -namespace mysql_native_password -{ +namespace boost { +namespace mysql { +namespace detail { +namespace mysql_native_password { constexpr const char* plugin_name = "mysql_native_password"; constexpr std::size_t challenge_length = 20; @@ -21,13 +18,12 @@ constexpr std::size_t response_length = 20; // output must point to response_length bytes of data inline void compute_auth_string(std::string_view password, const void* challenge, void* output); + } // mysql_native_password - - - } // detail } // mysql +} // boost #include "boost/mysql/detail/auth/impl/mysql_native_password.ipp" -#endif \ No newline at end of file +#endif diff --git a/include/boost/mysql/detail/aux/container_equals.hpp b/include/boost/mysql/detail/aux/container_equals.hpp index 5e1919bf..1ee1e348 100644 --- a/include/boost/mysql/detail/aux/container_equals.hpp +++ b/include/boost/mysql/detail/aux/container_equals.hpp @@ -4,10 +4,9 @@ #include #include -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { template inline bool container_equals( @@ -23,9 +22,10 @@ inline bool container_equals( ); } -} -} +} // detail +} // mysql +} // boost -#endif \ No newline at end of file +#endif diff --git a/include/boost/mysql/detail/aux/stringize.hpp b/include/boost/mysql/detail/aux/stringize.hpp index 238f3015..1b5930be 100644 --- a/include/boost/mysql/detail/aux/stringize.hpp +++ b/include/boost/mysql/detail/aux/stringize.hpp @@ -4,10 +4,9 @@ #include #include -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { template std::string stringize(const Types&... inputs) @@ -17,8 +16,9 @@ std::string stringize(const Types&... inputs) return ss.str(); } -} -} +} // detail +} // mysql +} // boost diff --git a/include/boost/mysql/detail/aux/tmp.hpp b/include/boost/mysql/detail/aux/tmp.hpp index 55f09a64..bca5349c 100644 --- a/include/boost/mysql/detail/aux/tmp.hpp +++ b/include/boost/mysql/detail/aux/tmp.hpp @@ -3,10 +3,9 @@ #include -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { template struct is_one_of @@ -24,9 +23,9 @@ struct is_one_of template constexpr bool is_one_of_v = is_one_of::value; -} -} - +} // detail +} // mysql +} // boost #endif /* INCLUDE_BOOST_MYSQL_DETAIL_AUX_TMP_HPP_ */ diff --git a/include/boost/mysql/detail/basic_types.hpp b/include/boost/mysql/detail/basic_types.hpp index 80f5f6d8..385128c4 100644 --- a/include/boost/mysql/detail/basic_types.hpp +++ b/include/boost/mysql/detail/basic_types.hpp @@ -7,10 +7,9 @@ #include #include -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { using ReadIterator = const std::uint8_t*; using WriteIterator = std::uint8_t*; @@ -62,8 +61,8 @@ using basic_bytestring = std::vector; using bytestring = std::vector; -} -} - +} // detail +} // mysql +} // boost #endif diff --git a/include/boost/mysql/detail/network_algorithms/close_statement.hpp b/include/boost/mysql/detail/network_algorithms/close_statement.hpp index c9cef171..b06651bc 100644 --- a/include/boost/mysql/detail/network_algorithms/close_statement.hpp +++ b/include/boost/mysql/detail/network_algorithms/close_statement.hpp @@ -3,10 +3,9 @@ #include "boost/mysql/detail/network_algorithms/common.hpp" -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { template void close_statement( @@ -24,8 +23,9 @@ async_close_statement( CompletionToken&& token ); -} -} +} // detail +} // mysql +} // boost #include "boost/mysql/detail/network_algorithms/impl/close_statement.hpp" diff --git a/include/boost/mysql/detail/network_algorithms/common.hpp b/include/boost/mysql/detail/network_algorithms/common.hpp index 93f2595a..f8c3da54 100644 --- a/include/boost/mysql/detail/network_algorithms/common.hpp +++ b/include/boost/mysql/detail/network_algorithms/common.hpp @@ -8,10 +8,9 @@ #include "boost/mysql/detail/protocol/channel.hpp" #include "boost/mysql/detail/protocol/messages.hpp" -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { using deserialize_row_fn = error_code (*)( DeserializationContext&, @@ -19,9 +18,9 @@ using deserialize_row_fn = error_code (*)( std::vector& ); -} -} - +} // detail +} // mysql +} // boost #endif /* INCLUDE_BOOST_MYSQL_DETAIL_NETWORK_ALGORITHMS_COMMON_HPP_ */ diff --git a/include/boost/mysql/detail/network_algorithms/execute_generic.hpp b/include/boost/mysql/detail/network_algorithms/execute_generic.hpp index 38738d47..e6315634 100644 --- a/include/boost/mysql/detail/network_algorithms/execute_generic.hpp +++ b/include/boost/mysql/detail/network_algorithms/execute_generic.hpp @@ -5,10 +5,9 @@ #include "boost/mysql/resultset.hpp" #include -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { template void execute_generic( @@ -29,8 +28,9 @@ async_execute_generic( CompletionToken&& token ); -} -} +} // detail +} // mysql +} // boost #include "boost/mysql/detail/network_algorithms/impl/execute_generic.hpp" diff --git a/include/boost/mysql/detail/network_algorithms/execute_query.hpp b/include/boost/mysql/detail/network_algorithms/execute_query.hpp index eb2b282d..7aee8b07 100644 --- a/include/boost/mysql/detail/network_algorithms/execute_query.hpp +++ b/include/boost/mysql/detail/network_algorithms/execute_query.hpp @@ -5,10 +5,9 @@ #include "boost/mysql/resultset.hpp" #include -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { template void execute_query( @@ -27,6 +26,7 @@ async_execute_query( CompletionToken&& token ); +} } } diff --git a/include/boost/mysql/detail/network_algorithms/execute_statement.hpp b/include/boost/mysql/detail/network_algorithms/execute_statement.hpp index 0261b357..5001b748 100644 --- a/include/boost/mysql/detail/network_algorithms/execute_statement.hpp +++ b/include/boost/mysql/detail/network_algorithms/execute_statement.hpp @@ -5,10 +5,9 @@ #include "boost/mysql/resultset.hpp" #include "boost/mysql/value.hpp" -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { template void execute_statement( @@ -31,8 +30,9 @@ async_execute_statement( CompletionToken&& token ); -} -} +} // detail +} // mysql +} // boost #include "boost/mysql/detail/network_algorithms/impl/execute_statement.hpp" diff --git a/include/boost/mysql/detail/network_algorithms/handshake.hpp b/include/boost/mysql/detail/network_algorithms/handshake.hpp index 163606bf..74311b6c 100644 --- a/include/boost/mysql/detail/network_algorithms/handshake.hpp +++ b/include/boost/mysql/detail/network_algorithms/handshake.hpp @@ -6,10 +6,9 @@ #include "boost/mysql/detail/basic_types.hpp" #include "boost/mysql/collation.hpp" -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { struct handshake_params { @@ -35,8 +34,9 @@ async_handshake( CompletionToken&& token ); -} -} +} // detail +} // mysql +} // boost #include "boost/mysql/detail/network_algorithms/impl/handshake.hpp" diff --git a/include/boost/mysql/detail/network_algorithms/impl/close_statement.hpp b/include/boost/mysql/detail/network_algorithms/impl/close_statement.hpp index 6a135b25..35085801 100644 --- a/include/boost/mysql/detail/network_algorithms/impl/close_statement.hpp +++ b/include/boost/mysql/detail/network_algorithms/impl/close_statement.hpp @@ -5,7 +5,7 @@ #include template -void mysql::detail::close_statement( +void boost::mysql::detail::close_statement( channel& chan, std::uint32_t statement_id, error_code& errc, @@ -24,8 +24,8 @@ void mysql::detail::close_statement( } template -BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void(mysql::error_code, mysql::error_info)) -mysql::detail::async_close_statement( +BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void(boost::mysql::error_code, boost::mysql::error_info)) +boost::mysql::detail::async_close_statement( channel& chan, std::uint32_t statement_id, CompletionToken&& token diff --git a/include/boost/mysql/detail/network_algorithms/impl/execute_generic.hpp b/include/boost/mysql/detail/network_algorithms/impl/execute_generic.hpp index d0801b28..cad156dd 100644 --- a/include/boost/mysql/detail/network_algorithms/impl/execute_generic.hpp +++ b/include/boost/mysql/detail/network_algorithms/impl/execute_generic.hpp @@ -6,10 +6,9 @@ #include #include -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { template class execute_processor @@ -109,11 +108,12 @@ public: auto& get_buffer() { return buffer_; } }; -} -} +} // detail +} // mysql +} // boost template -void mysql::detail::execute_generic( +void boost::mysql::detail::execute_generic( deserialize_row_fn deserializer, channel& channel, const Serializable& request, @@ -162,9 +162,9 @@ void mysql::detail::execute_generic( template BOOST_ASIO_INITFN_RESULT_TYPE( CompletionToken, - void(mysql::error_code, mysql::error_info, mysql::resultset) + void(boost::mysql::error_code, boost::mysql::error_info, boost::mysql::resultset) ) -mysql::detail::async_execute_generic( +boost::mysql::detail::async_execute_generic( deserialize_row_fn deserializer, channel& chan, const Serializable& request, diff --git a/include/boost/mysql/detail/network_algorithms/impl/execute_query.hpp b/include/boost/mysql/detail/network_algorithms/impl/execute_query.hpp index 624ac1a3..eaad1118 100644 --- a/include/boost/mysql/detail/network_algorithms/impl/execute_query.hpp +++ b/include/boost/mysql/detail/network_algorithms/impl/execute_query.hpp @@ -5,7 +5,7 @@ #include "boost/mysql/detail/protocol/text_deserialization.hpp" template -void mysql::detail::execute_query( +void boost::mysql::detail::execute_query( channel& channel, std::string_view query, resultset& output, @@ -21,9 +21,9 @@ void mysql::detail::execute_query( template BOOST_ASIO_INITFN_RESULT_TYPE( CompletionToken, - void(mysql::error_code, mysql::error_info, mysql::resultset) + void(boost::mysql::error_code, boost::mysql::error_info, boost::mysql::resultset) ) -mysql::detail::async_execute_query( +boost::mysql::detail::async_execute_query( channel& chan, std::string_view query, CompletionToken&& token diff --git a/include/boost/mysql/detail/network_algorithms/impl/execute_statement.hpp b/include/boost/mysql/detail/network_algorithms/impl/execute_statement.hpp index c38968b5..147ffdaf 100644 --- a/include/boost/mysql/detail/network_algorithms/impl/execute_statement.hpp +++ b/include/boost/mysql/detail/network_algorithms/impl/execute_statement.hpp @@ -4,10 +4,9 @@ #include "boost/mysql/detail/network_algorithms/execute_generic.hpp" #include "boost/mysql/detail/protocol/binary_deserialization.hpp" -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { template com_stmt_execute_packet make_stmt_execute_packet( @@ -26,11 +25,12 @@ com_stmt_execute_packet make_stmt_execute_packet( }; } -} -} +} // detail +} // mysql +} // boost template -void mysql::detail::execute_statement( +void boost::mysql::detail::execute_statement( channel& chan, std::uint32_t statement_id, ForwardIterator params_begin, @@ -47,9 +47,9 @@ void mysql::detail::execute_statement( template BOOST_ASIO_INITFN_RESULT_TYPE( CompletionToken, - void(mysql::error_code, mysql::error_info, mysql::resultset) + void(boost::mysql::error_code, boost::mysql::error_info, boost::mysql::resultset) ) -mysql::detail::async_execute_statement( +boost::mysql::detail::async_execute_statement( channel& chan, std::uint32_t statement_id, ForwardIterator params_begin, diff --git a/include/boost/mysql/detail/network_algorithms/impl/handshake.hpp b/include/boost/mysql/detail/network_algorithms/impl/handshake.hpp index 5006daa9..d0cbc8b5 100644 --- a/include/boost/mysql/detail/network_algorithms/impl/handshake.hpp +++ b/include/boost/mysql/detail/network_algorithms/impl/handshake.hpp @@ -7,10 +7,9 @@ #include "boost/mysql/detail/network_algorithms/common.hpp" #include -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { inline std::uint8_t get_collation_first_byte(collation value) { @@ -222,10 +221,10 @@ public: } // detail } // mysql - +} // boost template -void mysql::detail::hanshake( +void boost::mysql::detail::hanshake( channel& channel, const handshake_params& params, error_code& err, @@ -277,8 +276,8 @@ void mysql::detail::hanshake( } template -BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void(mysql::error_code, mysql::error_info)) -mysql::detail::async_handshake( +BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void(boost::mysql::error_code, boost::mysql::error_info)) +boost::mysql::detail::async_handshake( channel& chan, const handshake_params& params, CompletionToken&& token diff --git a/include/boost/mysql/detail/network_algorithms/impl/prepare_statement.hpp b/include/boost/mysql/detail/network_algorithms/impl/prepare_statement.hpp index 5219bea0..84fb8183 100644 --- a/include/boost/mysql/detail/network_algorithms/impl/prepare_statement.hpp +++ b/include/boost/mysql/detail/network_algorithms/impl/prepare_statement.hpp @@ -3,10 +3,9 @@ #include -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { template class prepare_statement_processor @@ -54,13 +53,12 @@ public: } }; - - -} -} +} // detail +} // mysql +} // boost template -void mysql::detail::prepare_statement( +void boost::mysql::detail::prepare_statement( channel& channel, std::string_view statement, error_code& err, @@ -99,9 +97,9 @@ void mysql::detail::prepare_statement( template BOOST_ASIO_INITFN_RESULT_TYPE( CompletionToken, - void(mysql::error_code, mysql::error_info, mysql::prepared_statement) + void(boost::mysql::error_code, boost::mysql::error_info, boost::mysql::prepared_statement) ) -mysql::detail::async_prepare_statement( +boost::mysql::detail::async_prepare_statement( channel& chan, std::string_view statement, CompletionToken&& token diff --git a/include/boost/mysql/detail/network_algorithms/impl/read_row.hpp b/include/boost/mysql/detail/network_algorithms/impl/read_row.hpp index 5d24f605..c21e659f 100644 --- a/include/boost/mysql/detail/network_algorithms/impl/read_row.hpp +++ b/include/boost/mysql/detail/network_algorithms/impl/read_row.hpp @@ -4,10 +4,9 @@ #include "boost/mysql/detail/protocol/text_deserialization.hpp" #include -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { inline read_row_result process_read_message( deserialize_row_fn deserializer, @@ -52,11 +51,11 @@ inline read_row_result process_read_message( } // detail } // mysql - +} // boost template -mysql::detail::read_row_result mysql::detail::read_row( +boost::mysql::detail::read_row_result boost::mysql::detail::read_row( deserialize_row_fn deserializer, channel& channel, const std::vector& meta, @@ -87,9 +86,9 @@ mysql::detail::read_row_result mysql::detail::read_row( template BOOST_ASIO_INITFN_RESULT_TYPE( CompletionToken, - void(mysql::error_code, mysql::error_info, mysql::detail::read_row_result) + void(boost::mysql::error_code, boost::mysql::error_info, boost::mysql::detail::read_row_result) ) -mysql::detail::async_read_row( +boost::mysql::detail::async_read_row( deserialize_row_fn deserializer, channel& chan, const std::vector& meta, diff --git a/include/boost/mysql/detail/network_algorithms/prepare_statement.hpp b/include/boost/mysql/detail/network_algorithms/prepare_statement.hpp index 8252baa6..7f248dc8 100644 --- a/include/boost/mysql/detail/network_algorithms/prepare_statement.hpp +++ b/include/boost/mysql/detail/network_algorithms/prepare_statement.hpp @@ -4,14 +4,13 @@ #include "boost/mysql/detail/network_algorithms/common.hpp" #include "boost/mysql/prepared_statement.hpp" -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { template void prepare_statement( - channel& channel, + ::boost::mysql::detail::channel& channel, std::string_view statement, error_code& err, error_info& info, @@ -26,8 +25,9 @@ async_prepare_statement( CompletionToken&& token ); -} -} +} // detail +} // mysql +} // boost #include "boost/mysql/detail/network_algorithms/impl/prepare_statement.hpp" diff --git a/include/boost/mysql/detail/network_algorithms/read_row.hpp b/include/boost/mysql/detail/network_algorithms/read_row.hpp index aef57b6f..d6565260 100644 --- a/include/boost/mysql/detail/network_algorithms/read_row.hpp +++ b/include/boost/mysql/detail/network_algorithms/read_row.hpp @@ -6,10 +6,9 @@ #include #include -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { enum class read_row_result { @@ -43,8 +42,9 @@ async_read_row( ); -} -} +} // detail +} // mysql +} // boost #include "boost/mysql/detail/network_algorithms/impl/read_row.hpp" diff --git a/include/boost/mysql/detail/protocol/binary_deserialization.hpp b/include/boost/mysql/detail/protocol/binary_deserialization.hpp index f3c379f0..442a7efe 100644 --- a/include/boost/mysql/detail/protocol/binary_deserialization.hpp +++ b/include/boost/mysql/detail/protocol/binary_deserialization.hpp @@ -7,10 +7,9 @@ #include "boost/mysql/metadata.hpp" #include -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { inline Error deserialize_binary_value( DeserializationContext& ctx, @@ -24,8 +23,9 @@ inline error_code deserialize_binary_row( std::vector& output ); -} -} +} // detail +} // mysql +} // boost #include "boost/mysql/detail/protocol/impl/binary_deserialization.ipp" diff --git a/include/boost/mysql/detail/protocol/binary_serialization.hpp b/include/boost/mysql/detail/protocol/binary_serialization.hpp index c2795ed7..eeb404b4 100644 --- a/include/boost/mysql/detail/protocol/binary_serialization.hpp +++ b/include/boost/mysql/detail/protocol/binary_serialization.hpp @@ -6,10 +6,9 @@ // (de)serialization overloads for date/time types and mysql::value -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { inline std::size_t get_size(const date& input, const SerializationContext& ctx) noexcept; inline void serialize(const date& input, SerializationContext& ctx) noexcept; @@ -26,8 +25,9 @@ inline Error deserialize(time& output, DeserializationContext& ctx) noexcept; inline std::size_t get_size(const value& input, const SerializationContext& ctx) noexcept; inline void serialize(const value& input, SerializationContext& ctx) noexcept; -} -} +} // detail +} // mysql +} // boost #include "boost/mysql/detail/protocol/impl/binary_serialization.ipp" diff --git a/include/boost/mysql/detail/protocol/capabilities.hpp b/include/boost/mysql/detail/protocol/capabilities.hpp index 2a57f375..22cbed8b 100644 --- a/include/boost/mysql/detail/protocol/capabilities.hpp +++ b/include/boost/mysql/detail/protocol/capabilities.hpp @@ -3,10 +3,9 @@ #include -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { // Server/client capabilities constexpr std::uint32_t CLIENT_LONG_PASSWORD = 1; // Use the improved version of Old Password Authentication @@ -101,9 +100,9 @@ constexpr capabilities mandatory_capabilities { constexpr capabilities optional_capabilities {0}; -} -} - +} // detail +} // mysql +} // boost #endif diff --git a/include/boost/mysql/detail/protocol/channel.hpp b/include/boost/mysql/detail/protocol/channel.hpp index cb48c736..0569cfe1 100644 --- a/include/boost/mysql/detail/protocol/channel.hpp +++ b/include/boost/mysql/detail/protocol/channel.hpp @@ -8,10 +8,9 @@ #include #include -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { template class channel @@ -61,8 +60,9 @@ public: template using channel_stream_type = typename ChannelType::stream_type; -} -} +} // detail +} // mysql +} // boost #include "boost/mysql/detail/protocol/impl/channel.hpp" diff --git a/include/boost/mysql/detail/protocol/constants.hpp b/include/boost/mysql/detail/protocol/constants.hpp index 32a29881..da5ec5cd 100644 --- a/include/boost/mysql/detail/protocol/constants.hpp +++ b/include/boost/mysql/detail/protocol/constants.hpp @@ -3,10 +3,9 @@ #include "boost/mysql/detail/basic_types.hpp" -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { enum class protocol_field_type : std::uint8_t { @@ -96,9 +95,9 @@ constexpr std::uint8_t scrollable = 4; } -} -} - +} // detail +} // mysql +} // boost #endif diff --git a/include/boost/mysql/detail/protocol/impl/binary_deserialization.ipp b/include/boost/mysql/detail/protocol/impl/binary_deserialization.ipp index b2a98dbc..00256114 100644 --- a/include/boost/mysql/detail/protocol/impl/binary_deserialization.ipp +++ b/include/boost/mysql/detail/protocol/impl/binary_deserialization.ipp @@ -5,10 +5,9 @@ #include "boost/mysql/detail/protocol/null_bitmap_traits.hpp" #include "boost/mysql/detail/aux/tmp.hpp" -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { using binary_protocol_value = std::variant< int1, @@ -83,10 +82,11 @@ inline binary_protocol_value get_deserializable_type( } } -} -} +} // detail +} // mysql +} // boost -inline mysql::Error mysql::detail::deserialize_binary_value( +inline boost::mysql::Error boost::mysql::detail::deserialize_binary_value( DeserializationContext& ctx, const field_metadata& meta, value& output @@ -116,7 +116,7 @@ inline mysql::Error mysql::detail::deserialize_binary_value( }, protocol_value); } -inline mysql::error_code mysql::detail::deserialize_binary_row( +inline boost::mysql::error_code boost::mysql::detail::deserialize_binary_row( DeserializationContext& ctx, const std::vector& meta, std::vector& output diff --git a/include/boost/mysql/detail/protocol/impl/binary_serialization.ipp b/include/boost/mysql/detail/protocol/impl/binary_serialization.ipp index 8426b7a3..798f2b1c 100644 --- a/include/boost/mysql/detail/protocol/impl/binary_serialization.ipp +++ b/include/boost/mysql/detail/protocol/impl/binary_serialization.ipp @@ -3,10 +3,9 @@ #include -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { // Performs a mapping from T to a type that can be serialized template @@ -128,11 +127,12 @@ struct broken_time } }; -} -} +} // detail +} // mysql +} // boost // date -inline std::size_t mysql::detail::get_size( +inline std::size_t boost::mysql::detail::get_size( const date&, const SerializationContext& ) noexcept @@ -141,7 +141,7 @@ inline std::size_t mysql::detail::get_size( return 5; // length, year, month, day } -inline void mysql::detail::serialize( +inline void boost::mysql::detail::serialize( const date& input, SerializationContext& ctx ) noexcept @@ -151,7 +151,7 @@ inline void mysql::detail::serialize( serialize_binary_ymd(::date::year_month_day (input), ctx); } -inline mysql::Error mysql::detail::deserialize( +inline boost::mysql::Error boost::mysql::detail::deserialize( date& output, DeserializationContext& ctx ) noexcept @@ -163,7 +163,7 @@ inline mysql::Error mysql::detail::deserialize( } // datetime -inline std::size_t mysql::detail::get_size( +inline std::size_t boost::mysql::detail::get_size( const datetime& input, const SerializationContext& ) noexcept @@ -172,7 +172,7 @@ inline std::size_t mysql::detail::get_size( return dt.binary_serialized_length() + 1; // extra length prefix byte } -inline void mysql::detail::serialize( +inline void boost::mysql::detail::serialize( const datetime& input, SerializationContext& ctx ) noexcept @@ -200,7 +200,7 @@ inline void mysql::detail::serialize( } } -inline mysql::Error mysql::detail::deserialize( +inline boost::mysql::Error boost::mysql::detail::deserialize( datetime& output, DeserializationContext& ctx ) noexcept @@ -238,7 +238,7 @@ inline mysql::Error mysql::detail::deserialize( } // time -inline std::size_t mysql::detail::get_size( +inline std::size_t boost::mysql::detail::get_size( const time& input, const SerializationContext& ) noexcept @@ -246,7 +246,7 @@ inline std::size_t mysql::detail::get_size( return broken_time(input).binary_serialized_length() + 1; // length byte } -inline void mysql::detail::serialize( +inline void boost::mysql::detail::serialize( const time& input, SerializationContext& ctx ) noexcept @@ -273,7 +273,7 @@ inline void mysql::detail::serialize( } } -inline mysql::Error mysql::detail::deserialize( +inline boost::mysql::Error boost::mysql::detail::deserialize( time& output, DeserializationContext& ctx ) noexcept @@ -319,7 +319,7 @@ inline mysql::Error mysql::detail::deserialize( } // mysql::value -inline std::size_t mysql::detail::get_size( +inline std::size_t boost::mysql::detail::get_size( const value& input, const SerializationContext& ctx ) noexcept @@ -329,7 +329,7 @@ inline std::size_t mysql::detail::get_size( }, input); } -inline void mysql::detail::serialize( +inline void boost::mysql::detail::serialize( const value& input, SerializationContext& ctx ) noexcept diff --git a/include/boost/mysql/detail/protocol/impl/channel.hpp b/include/boost/mysql/detail/protocol/impl/channel.hpp index 891cd1e2..b7c21433 100644 --- a/include/boost/mysql/detail/protocol/impl/channel.hpp +++ b/include/boost/mysql/detail/protocol/impl/channel.hpp @@ -9,10 +9,9 @@ #include "boost/mysql/detail/protocol/constants.hpp" #include -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { inline std::uint32_t compute_size_to_write( std::size_t buffer_size, @@ -27,9 +26,10 @@ inline std::uint32_t compute_size_to_write( } // detail } // mysql +} // boost template -bool mysql::detail::channel::process_sequence_number( +bool boost::mysql::detail::channel::process_sequence_number( std::uint8_t got ) { @@ -45,7 +45,7 @@ bool mysql::detail::channel::process_sequence_number( } template -mysql::error_code mysql::detail::channel::process_header_read( +boost::mysql::error_code boost::mysql::detail::channel::process_header_read( std::uint32_t& size_to_read ) { @@ -62,7 +62,7 @@ mysql::error_code mysql::detail::channel::process_header_read( } template -void mysql::detail::channel::process_header_write( +void boost::mysql::detail::channel::process_header_write( std::uint32_t size_to_write ) { @@ -75,7 +75,7 @@ void mysql::detail::channel::process_header_write( template template -void mysql::detail::channel::read( +void boost::mysql::detail::channel::read( basic_bytestring& buffer, error_code& errc ) @@ -107,7 +107,7 @@ void mysql::detail::channel::read( } template -void mysql::detail::channel::write( +void boost::mysql::detail::channel::write( boost::asio::const_buffer buffer, error_code& errc ) @@ -138,8 +138,8 @@ void mysql::detail::channel::write( template template -BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void(mysql::error_code)) -mysql::detail::channel::async_read( +BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void(boost::mysql::error_code)) +boost::mysql::detail::channel::async_read( basic_bytestring& buffer, CompletionToken&& token ) @@ -228,8 +228,8 @@ mysql::detail::channel::async_read( template template -BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void(mysql::error_code)) -mysql::detail::channel::async_write( +BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void(boost::mysql::error_code)) +boost::mysql::detail::channel::async_write( boost::asio::const_buffer buffer, CompletionToken&& token ) diff --git a/include/boost/mysql/detail/protocol/impl/messages.ipp b/include/boost/mysql/detail/protocol/impl/messages.ipp index 992a5ba5..ffee07a7 100644 --- a/include/boost/mysql/detail/protocol/impl/messages.ipp +++ b/include/boost/mysql/detail/protocol/impl/messages.ipp @@ -7,10 +7,9 @@ #include #include -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { // Maps from an actual value to a protocol_field_type. Only value's type is used inline protocol_field_type get_protocol_field_type( @@ -48,10 +47,11 @@ inline bool is_unsigned( }, input); } -} -} +} // detail +} // mysql +} // boost -inline mysql::Error mysql::detail::deserialize( +inline boost::mysql::Error boost::mysql::detail::deserialize( ok_packet& output, DeserializationContext& ctx ) noexcept @@ -70,7 +70,7 @@ inline mysql::Error mysql::detail::deserialize( return err; } -inline mysql::Error mysql::detail::deserialize( +inline boost::mysql::Error boost::mysql::detail::deserialize( handshake_packet& output, DeserializationContext& ctx ) noexcept @@ -134,7 +134,7 @@ inline mysql::Error mysql::detail::deserialize( return Error::ok; } -std::size_t mysql::detail::get_size( +std::size_t boost::mysql::detail::get_size( const handshake_response_packet& value, const SerializationContext& ctx ) noexcept @@ -154,7 +154,7 @@ std::size_t mysql::detail::get_size( return res; } -inline void mysql::detail::serialize( +inline void boost::mysql::detail::serialize( const handshake_response_packet& value, SerializationContext& ctx ) noexcept @@ -173,7 +173,7 @@ inline void mysql::detail::serialize( serialize(value.client_plugin_name, ctx); } -inline mysql::Error mysql::detail::deserialize( +inline boost::mysql::Error boost::mysql::detail::deserialize( auth_switch_request_packet& output, DeserializationContext& ctx ) noexcept @@ -189,7 +189,7 @@ inline mysql::Error mysql::detail::deserialize( return err; } -inline mysql::Error mysql::detail::deserialize( +inline boost::mysql::Error boost::mysql::detail::deserialize( column_definition_packet& output, DeserializationContext& ctx ) noexcept @@ -214,7 +214,7 @@ inline mysql::Error mysql::detail::deserialize( ); } -inline mysql::Error mysql::detail::deserialize( +inline boost::mysql::Error boost::mysql::detail::deserialize( com_stmt_prepare_ok_packet& output, DeserializationContext& ctx ) noexcept @@ -231,7 +231,7 @@ inline mysql::Error mysql::detail::deserialize( } template -inline std::size_t mysql::detail::get_size( +inline std::size_t boost::mysql::detail::get_size( const com_stmt_execute_packet& value, const SerializationContext& ctx ) noexcept @@ -253,7 +253,7 @@ inline std::size_t mysql::detail::get_size( } template -inline void mysql::detail::serialize( +inline void boost::mysql::detail::serialize( const com_stmt_execute_packet& input, SerializationContext& ctx ) noexcept @@ -300,7 +300,7 @@ inline void mysql::detail::serialize( } template -void mysql::detail::serialize_message( +void boost::mysql::detail::serialize_message( const Serializable& input, capabilities caps, basic_bytestring& buffer @@ -315,7 +315,7 @@ void mysql::detail::serialize_message( } template -mysql::error_code mysql::detail::deserialize_message( +boost::mysql::error_code boost::mysql::detail::deserialize_message( Deserializable& output, DeserializationContext& ctx ) @@ -327,7 +327,8 @@ mysql::error_code mysql::detail::deserialize_message( } -inline std::pair mysql::detail::deserialize_message_type( +inline std::pair +boost::mysql::detail::deserialize_message_type( DeserializationContext& ctx ) { @@ -345,7 +346,7 @@ inline std::pair mysql::detail::deserialize_mes return res; } -inline mysql::error_code mysql::detail::process_error_packet( +inline boost::mysql::error_code boost::mysql::detail::process_error_packet( DeserializationContext& ctx, error_info& info ) diff --git a/include/boost/mysql/detail/protocol/impl/text_deserialization.ipp b/include/boost/mysql/detail/protocol/impl/text_deserialization.ipp index f689c683..9bcf5cd8 100644 --- a/include/boost/mysql/detail/protocol/impl/text_deserialization.ipp +++ b/include/boost/mysql/detail/protocol/impl/text_deserialization.ipp @@ -6,10 +6,9 @@ #include #include -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { inline Error deserialize_text_value_impl( std::string_view from, @@ -142,10 +141,11 @@ inline bool is_next_field_null( return false; } -} -} +} // detail +} // mysql +} // boost -inline mysql::Error mysql::detail::deserialize_text_value( +inline boost::mysql::Error boost::mysql::detail::deserialize_text_value( std::string_view from, const field_metadata& meta, value& output @@ -197,7 +197,7 @@ inline mysql::Error mysql::detail::deserialize_text_value( } -mysql::error_code mysql::detail::deserialize_text_row( +boost::mysql::error_code boost::mysql::detail::deserialize_text_row( DeserializationContext& ctx, const std::vector& fields, std::vector& output diff --git a/include/boost/mysql/detail/protocol/messages.hpp b/include/boost/mysql/detail/protocol/messages.hpp index 08ad869a..43cbf367 100644 --- a/include/boost/mysql/detail/protocol/messages.hpp +++ b/include/boost/mysql/detail/protocol/messages.hpp @@ -11,10 +11,9 @@ #include #include -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { struct packet_header { @@ -339,6 +338,7 @@ inline error_code process_error_packet(DeserializationContext& ctx, error_info& } // detail } // mysql +} // boost #include "boost/mysql/detail/protocol/impl/messages.ipp" diff --git a/include/boost/mysql/detail/protocol/null_bitmap_traits.hpp b/include/boost/mysql/detail/protocol/null_bitmap_traits.hpp index b1d23f25..7cb811a0 100644 --- a/include/boost/mysql/detail/protocol/null_bitmap_traits.hpp +++ b/include/boost/mysql/detail/protocol/null_bitmap_traits.hpp @@ -4,10 +4,9 @@ #include #include -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { class null_bitmap_traits { @@ -38,8 +37,8 @@ public: constexpr std::size_t stmt_execute_null_bitmap_offset = 0; constexpr std::size_t binary_row_null_bitmap_offset = 2; -} -} - +} // detail +} // mysql +} // boost #endif /* INCLUDE_NULL_BITMAP_HPP_ */ diff --git a/include/boost/mysql/detail/protocol/serialization.hpp b/include/boost/mysql/detail/protocol/serialization.hpp index eb36e8e1..43f23f44 100644 --- a/include/boost/mysql/detail/protocol/serialization.hpp +++ b/include/boost/mysql/detail/protocol/serialization.hpp @@ -13,10 +13,9 @@ #include "boost/mysql/detail/protocol/capabilities.hpp" #include "boost/mysql/error.hpp" -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { class DeserializationContext { @@ -536,8 +535,8 @@ inline std::size_t get_size(dummy_serializable, const SerializationContext&) noe inline void serialize(dummy_serializable, SerializationContext&) noexcept {} inline Error deserialize(dummy_serializable, DeserializationContext&) noexcept { return Error::ok; } -} -} - +} // detail +} // mysql +} // boost #endif diff --git a/include/boost/mysql/detail/protocol/text_deserialization.hpp b/include/boost/mysql/detail/protocol/text_deserialization.hpp index b3c89e79..b6faeb4b 100644 --- a/include/boost/mysql/detail/protocol/text_deserialization.hpp +++ b/include/boost/mysql/detail/protocol/text_deserialization.hpp @@ -7,10 +7,9 @@ #include "boost/mysql/metadata.hpp" #include -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { inline Error deserialize_text_value( std::string_view from, @@ -24,8 +23,9 @@ inline error_code deserialize_text_row( std::vector& output ); -} -} +} // detail +} // mysql +} // boost #include "boost/mysql/detail/protocol/impl/text_deserialization.ipp" diff --git a/include/boost/mysql/error.hpp b/include/boost/mysql/error.hpp index c36a3c7f..b72e2706 100644 --- a/include/boost/mysql/error.hpp +++ b/include/boost/mysql/error.hpp @@ -4,8 +4,8 @@ #include #include -namespace mysql -{ +namespace boost { +namespace mysql { /// MySQL-specific error codes. enum class Error : int @@ -58,7 +58,8 @@ inline bool operator!=(const error_info& lhs, const error_info& rhs) noexcept { inline std::ostream& operator<<(std::ostream& os, const error_info& v) { return os << v.message(); } -} +} // mysql +} // boost #include "boost/mysql/impl/error.hpp" diff --git a/include/boost/mysql/field_type.hpp b/include/boost/mysql/field_type.hpp index 96d7e77f..553648d4 100644 --- a/include/boost/mysql/field_type.hpp +++ b/include/boost/mysql/field_type.hpp @@ -3,8 +3,8 @@ #include -namespace mysql -{ +namespace boost { +namespace mysql { /** * \brief Represents the type of a MySQL field. @@ -43,7 +43,8 @@ enum class field_type _not_computed, }; -} +} // mysql +} // boost diff --git a/include/boost/mysql/impl/connection.hpp b/include/boost/mysql/impl/connection.hpp index b15f662f..1250b3d4 100644 --- a/include/boost/mysql/impl/connection.hpp +++ b/include/boost/mysql/impl/connection.hpp @@ -6,10 +6,9 @@ #include "boost/mysql/detail/network_algorithms/prepare_statement.hpp" #include -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { inline handshake_params to_handshake_params( const connection_params& input @@ -23,11 +22,12 @@ inline handshake_params to_handshake_params( }; } -} -} +} // detail +} // mysql +} // boost template -void mysql::connection::handshake( +void boost::mysql::connection::handshake( const connection_params& params, error_code& errc, error_info& info @@ -45,7 +45,7 @@ void mysql::connection::handshake( } template -void mysql::connection::handshake( +void boost::mysql::connection::handshake( const connection_params& params ) { @@ -57,8 +57,11 @@ void mysql::connection::handshake( template template -BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void(mysql::error_code, mysql::error_info)) -mysql::connection::async_handshake( +BOOST_ASIO_INITFN_RESULT_TYPE( + CompletionToken, + void(boost::mysql::error_code, boost::mysql::error_info) +) +boost::mysql::connection::async_handshake( const connection_params& params, CompletionToken&& token ) @@ -72,7 +75,7 @@ mysql::connection::async_handshake( // Query template -mysql::resultset mysql::connection::query( +boost::mysql::resultset boost::mysql::connection::query( std::string_view query_string, error_code& err, error_info& info @@ -86,7 +89,7 @@ mysql::resultset mysql::connection::query( } template -mysql::resultset mysql::connection::query( +boost::mysql::resultset boost::mysql::connection::query( std::string_view query_string ) { @@ -102,9 +105,9 @@ template template BOOST_ASIO_INITFN_RESULT_TYPE( CompletionToken, - void(mysql::error_code, mysql::error_info, mysql::resultset) + void(boost::mysql::error_code, boost::mysql::error_info, boost::mysql::resultset) ) -mysql::connection::async_query( +boost::mysql::connection::async_query( std::string_view query_string, CompletionToken&& token ) @@ -117,7 +120,7 @@ mysql::connection::async_query( } template -mysql::prepared_statement mysql::connection::prepare_statement( +boost::mysql::prepared_statement boost::mysql::connection::prepare_statement( std::string_view statement, error_code& err, error_info& info @@ -131,7 +134,7 @@ mysql::prepared_statement mysql::connection::prepare_statement( } template -mysql::prepared_statement mysql::connection::prepare_statement( +boost::mysql::prepared_statement boost::mysql::connection::prepare_statement( std::string_view statement ) { @@ -145,7 +148,7 @@ mysql::prepared_statement mysql::connection::prepare_statement( template template -auto mysql::connection::async_prepare_statement( +auto boost::mysql::connection::async_prepare_statement( std::string_view statement, CompletionToken&& token ) diff --git a/include/boost/mysql/impl/error.hpp b/include/boost/mysql/impl/error.hpp index 99857c98..a7b26c91 100644 --- a/include/boost/mysql/impl/error.hpp +++ b/include/boost/mysql/impl/error.hpp @@ -4,10 +4,8 @@ #include #include -namespace boost -{ -namespace system -{ +namespace boost { +namespace system { template <> struct is_error_code_enum @@ -16,13 +14,9 @@ struct is_error_code_enum }; } // system -} // boost - -namespace mysql -{ -namespace detail -{ +namespace mysql { +namespace detail { inline const char* error_to_string(Error error) noexcept { @@ -67,10 +61,9 @@ inline void check_error_code(const error_code& errc, const error_info& info) } } -} -} - - +} // detail +} // mysql +} // boost #endif diff --git a/include/boost/mysql/impl/metadata.ipp b/include/boost/mysql/impl/metadata.ipp index 7898baa8..916c424d 100644 --- a/include/boost/mysql/impl/metadata.ipp +++ b/include/boost/mysql/impl/metadata.ipp @@ -1,10 +1,9 @@ #ifndef MYSQL_ASIO_IMPL_METADATA_HPP #define MYSQL_ASIO_IMPL_METADATA_HPP -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { inline field_type compute_field_type_string( std::uint32_t flags @@ -63,10 +62,11 @@ inline field_type compute_field_type( } } -} -} +} // detail +} // mysql +} // boost -inline mysql::field_type mysql::field_metadata::type() const noexcept +inline boost::mysql::field_type boost::mysql::field_metadata::type() const noexcept { if (field_type_ == field_type::_not_computed) { @@ -76,4 +76,4 @@ inline mysql::field_type mysql::field_metadata::type() const noexcept return field_type_; } -#endif \ No newline at end of file +#endif diff --git a/include/boost/mysql/impl/prepared_statement.hpp b/include/boost/mysql/impl/prepared_statement.hpp index 334f4d29..2ebcb312 100644 --- a/include/boost/mysql/impl/prepared_statement.hpp +++ b/include/boost/mysql/impl/prepared_statement.hpp @@ -8,7 +8,7 @@ template template -void mysql::prepared_statement::check_num_params( +void boost::mysql::prepared_statement::check_num_params( ForwardIterator first, ForwardIterator last, error_code& err, @@ -27,7 +27,7 @@ void mysql::prepared_statement::check_num_params( template template -mysql::resultset mysql::prepared_statement::execute( +boost::mysql::resultset boost::mysql::prepared_statement::execute( ForwardIterator params_first, ForwardIterator params_last, error_code& err, @@ -60,7 +60,7 @@ mysql::resultset mysql::prepared_statement::execute( template template -mysql::resultset mysql::prepared_statement::execute( +boost::mysql::resultset boost::mysql::prepared_statement::execute( ForwardIterator params_first, ForwardIterator params_last ) const @@ -74,7 +74,7 @@ mysql::resultset mysql::prepared_statement::execute( template template -auto mysql::prepared_statement::async_execute( +auto boost::mysql::prepared_statement::async_execute( ForwardIterator params_first, ForwardIterator params_last, CompletionToken&& token @@ -110,7 +110,7 @@ auto mysql::prepared_statement::async_execute( } template -void mysql::prepared_statement::close( +void boost::mysql::prepared_statement::close( error_code& errc, error_info& info ) @@ -122,7 +122,7 @@ void mysql::prepared_statement::close( } template -void mysql::prepared_statement::close() +void boost::mysql::prepared_statement::close() { assert(valid()); error_code errc; @@ -133,7 +133,7 @@ void mysql::prepared_statement::close() template template -auto mysql::prepared_statement::async_close( +auto boost::mysql::prepared_statement::async_close( CompletionToken&& token ) { diff --git a/include/boost/mysql/impl/resultset.hpp b/include/boost/mysql/impl/resultset.hpp index 0c03e829..8872285c 100644 --- a/include/boost/mysql/impl/resultset.hpp +++ b/include/boost/mysql/impl/resultset.hpp @@ -8,7 +8,7 @@ #include template -const mysql::row* mysql::resultset::fetch_one( +const boost::mysql::row* boost::mysql::resultset::fetch_one( error_code& err, error_info& info ) @@ -37,7 +37,7 @@ const mysql::row* mysql::resultset::fetch_one( } template -const mysql::row* mysql::resultset::fetch_one() +const boost::mysql::row* boost::mysql::resultset::fetch_one() { error_code errc; error_info info; @@ -47,7 +47,7 @@ const mysql::row* mysql::resultset::fetch_one() } template -std::vector mysql::resultset::fetch_many( +std::vector boost::mysql::resultset::fetch_many( std::size_t count, error_code& err, error_info& info @@ -93,7 +93,7 @@ std::vector mysql::resultset::fetch_many( } template -std::vector mysql::resultset::fetch_many( +std::vector boost::mysql::resultset::fetch_many( std::size_t count ) { @@ -105,7 +105,7 @@ std::vector mysql::resultset::fetch_many( } template -std::vector mysql::resultset::fetch_all( +std::vector boost::mysql::resultset::fetch_all( error_code& err, error_info& info ) @@ -114,7 +114,7 @@ std::vector mysql::resultset::fetch_all( } template -std::vector mysql::resultset::fetch_all() +std::vector boost::mysql::resultset::fetch_all() { return fetch_many(std::numeric_limits::max()); } @@ -123,9 +123,9 @@ template template BOOST_ASIO_INITFN_RESULT_TYPE( CompletionToken, - void(mysql::error_code, mysql::error_info, const mysql::row*) + void(boost::mysql::error_code, boost::mysql::error_info, const boost::mysql::row*) ) -mysql::resultset::async_fetch_one( +boost::mysql::resultset::async_fetch_one( CompletionToken&& token ) { @@ -195,9 +195,9 @@ template template BOOST_ASIO_INITFN_RESULT_TYPE( CompletionToken, - void(mysql::error_code, mysql::error_info, std::vector) + void(boost::mysql::error_code, boost::mysql::error_info, std::vector) ) -mysql::resultset::async_fetch_many( +boost::mysql::resultset::async_fetch_many( std::size_t count, CompletionToken&& token ) @@ -293,9 +293,9 @@ template template BOOST_ASIO_INITFN_RESULT_TYPE( CompletionToken, - void(mysql::error_code, mysql::error_info, std::vector) + void(boost::mysql::error_code, boost::mysql::error_info, std::vector) ) -mysql::resultset::async_fetch_all( +boost::mysql::resultset::async_fetch_all( CompletionToken&& token ) { diff --git a/include/boost/mysql/impl/value.hpp b/include/boost/mysql/impl/value.hpp index f10745ee..659e3081 100644 --- a/include/boost/mysql/impl/value.hpp +++ b/include/boost/mysql/impl/value.hpp @@ -3,10 +3,9 @@ #include "boost/mysql/detail/aux/container_equals.hpp" -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { // Max/min constexpr date min_date = ::date::day(1)/::date::January/::date::year(100); // some implementations support less than the official @@ -57,10 +56,11 @@ struct print_visitor void operator()(std::nullptr_t) const { os << ""; } }; -} -} +} // detail +} // mysql +} // boost -inline bool mysql::operator==( +inline bool boost::mysql::operator==( const value& lhs, const value& rhs ) @@ -72,7 +72,7 @@ inline bool mysql::operator==( }, rhs); } -inline bool mysql::operator==( +inline bool boost::mysql::operator==( const std::vector& lhs, const std::vector& rhs ) @@ -80,7 +80,7 @@ inline bool mysql::operator==( return detail::container_equals(lhs, rhs); } -inline std::ostream& mysql::operator<<( +inline std::ostream& boost::mysql::operator<<( std::ostream& os, const value& value ) @@ -90,11 +90,12 @@ inline std::ostream& mysql::operator<<( } template -std::array mysql::make_values( +std::array +boost::mysql::make_values( Types&&... args ) { - return std::array{value(std::forward(args))...}; + return std::array{value(std::forward(args))...}; } diff --git a/include/boost/mysql/metadata.hpp b/include/boost/mysql/metadata.hpp index b0c86081..e289d94a 100644 --- a/include/boost/mysql/metadata.hpp +++ b/include/boost/mysql/metadata.hpp @@ -5,8 +5,8 @@ #include "boost/mysql/detail/basic_types.hpp" #include "boost/mysql/field_type.hpp" -namespace mysql -{ +namespace boost { +namespace mysql { /** * \brief Holds metadata about a field in a SQL query. @@ -97,8 +97,7 @@ public: bool is_set_to_now_on_update() const noexcept { return flag_set(detail::column_flags::on_update_now); } }; -namespace detail -{ +namespace detail { class resultset_metadata { @@ -118,6 +117,7 @@ public: } // detail } // mysql +} // boost #include "boost/mysql/impl/metadata.ipp" diff --git a/include/boost/mysql/prepared_statement.hpp b/include/boost/mysql/prepared_statement.hpp index c084cc35..27cf08c3 100644 --- a/include/boost/mysql/prepared_statement.hpp +++ b/include/boost/mysql/prepared_statement.hpp @@ -6,8 +6,8 @@ #include "boost/mysql/detail/protocol/messages.hpp" #include -namespace mysql -{ +namespace boost { +namespace mysql { /// Convenience constant to use within prepared_statement::execute with statements without parameters. constexpr std::array no_statement_params {}; @@ -144,7 +144,8 @@ public: /// A prepared statement associated to a TCP connection to the MySQL server. using tcp_prepared_statement = prepared_statement; -} +} // mysql +} // boost #include "boost/mysql/impl/prepared_statement.hpp" diff --git a/include/boost/mysql/resultset.hpp b/include/boost/mysql/resultset.hpp index 929d228d..b9bdb314 100644 --- a/include/boost/mysql/resultset.hpp +++ b/include/boost/mysql/resultset.hpp @@ -9,8 +9,8 @@ #include #include -namespace mysql -{ +namespace boost { +namespace mysql { /** * \brief Represents tabular data retrieved from the MySQL server. @@ -177,7 +177,8 @@ public: /// Specialization of resultset for TCP sockets. using tcp_resultset = resultset; -} +} // mysql +} // boost #include "boost/mysql/impl/resultset.hpp" diff --git a/include/boost/mysql/row.hpp b/include/boost/mysql/row.hpp index 2e33b0d2..d690b0c1 100644 --- a/include/boost/mysql/row.hpp +++ b/include/boost/mysql/row.hpp @@ -7,8 +7,8 @@ #include "boost/mysql/detail/aux/container_equals.hpp" #include -namespace mysql -{ +namespace boost { +namespace mysql { /** * \brief Represents a row returned from a query. @@ -98,7 +98,8 @@ inline bool operator!=(const std::vector& lhs, const std::vector #include -namespace mysql -{ +namespace boost { +namespace mysql { /// Type representing MySQL DATE data type. using date = ::date::sys_days; @@ -67,7 +67,8 @@ inline std::ostream& operator<<(std::ostream& os, const value& value); template std::array make_values(Types&&... args); -} +} // mysql +} // boost #include "boost/mysql/impl/value.hpp" diff --git a/test/common/serialization_test_common.hpp b/test/common/serialization_test_common.hpp index 238379bf..27a4257c 100644 --- a/test/common/serialization_test_common.hpp +++ b/test/common/serialization_test_common.hpp @@ -11,10 +11,9 @@ #include "boost/mysql/value.hpp" #include "test_common.hpp" -namespace mysql -{ -namespace detail -{ +namespace boost { +namespace mysql { +namespace detail { // Operator << for some basic types template @@ -116,9 +115,9 @@ class TypeErasedValueImpl : public TypeErasedValue T value_; public: TypeErasedValueImpl(const T& v): value_(v) {}; - void serialize(SerializationContext& ctx) const override { ::mysql::detail::serialize(value_, ctx); } - std::size_t get_size(const SerializationContext& ctx) const override { return ::mysql::detail::get_size(value_, ctx); } - Error deserialize(DeserializationContext& ctx) override { return ::mysql::detail::deserialize(value_, ctx); } + void serialize(SerializationContext& ctx) const override { ::boost::mysql::detail::serialize(value_, ctx); } + std::size_t get_size(const SerializationContext& ctx) const override { return ::boost::mysql::detail::get_size(value_, ctx); } + Error deserialize(DeserializationContext& ctx) override { return ::boost::mysql::detail::deserialize(value_, ctx); } std::shared_ptr default_construct() const override { return std::make_shared>(T{}); @@ -310,8 +309,9 @@ TEST_P(DeserializeErrorTest, Deserialize_ErrorCondition_ReturnsErrorCode) } -} -} +} // detail +} // mysql +} // boost #endif /* TEST_SERIALIZATION_TEST_COMMON_HPP_ */ diff --git a/test/common/test_common.hpp b/test/common/test_common.hpp index 67460640..f1f3b020 100644 --- a/test/common/test_common.hpp +++ b/test/common/test_common.hpp @@ -11,10 +11,9 @@ #include #include -namespace mysql -{ -namespace test -{ +namespace boost { +namespace mysql { +namespace test { template std::vector makevalues(Types&&... args) @@ -131,8 +130,9 @@ constexpr auto test_name_generator = [](const auto& param_info) { return res; }; -} -} +} // test +} // mysql +} // boost diff --git a/test/integration/close_statement.cpp b/test/integration/close_statement.cpp index d433d01f..317a8f4b 100644 --- a/test/integration/close_statement.cpp +++ b/test/integration/close_statement.cpp @@ -7,7 +7,7 @@ #include "integration_test_common.hpp" -using namespace mysql::test; +using namespace boost::mysql::test; namespace { @@ -39,7 +39,7 @@ TEST_P(CloseStatementTest, ExistingOrClosedStatement) // Verify close took effect exec_result = net->execute_statement(stmt.value, {}); - exec_result.validate_error(mysql::Error::unknown_stmt_handler, {"unknown prepared statement"}); + exec_result.validate_error(boost::mysql::Error::unknown_stmt_handler, {"unknown prepared statement"}); } MYSQL_NETWORK_TEST_SUITE(CloseStatementTest); diff --git a/test/integration/database_types.cpp b/test/integration/database_types.cpp index 6144cb39..c56d863a 100644 --- a/test/integration/database_types.cpp +++ b/test/integration/database_types.cpp @@ -12,12 +12,14 @@ #include #include -using namespace mysql::test; +using namespace boost::mysql::test; using namespace testing; using namespace date::literals; -using mysql::value; -using mysql::field_metadata; -using mysql::field_type; +using boost::mysql::value; +using boost::mysql::field_metadata; +using boost::mysql::field_type; +using boost::mysql::row; +using boost::mysql::datetime; namespace { @@ -76,9 +78,9 @@ TEST_P(DatabaseTypesTest, Query_MetadataAndValueCorrect) validate_meta(result.fields(), {param.mvalid}); // Validate the returned value - mysql::row expected_row ({param.expected_value}); + row expected_row ({param.expected_value}); ASSERT_EQ(rows.size(), 1); - EXPECT_EQ(static_cast(rows[0]), expected_row); // make gtest pick operator<< + EXPECT_EQ(static_cast(rows[0]), expected_row); // make gtest pick operator<< } TEST_P(DatabaseTypesTest, PreparedStatementExecuteResult_MetadataAndValueCorrect) @@ -102,9 +104,9 @@ TEST_P(DatabaseTypesTest, PreparedStatementExecuteResult_MetadataAndValueCorrect validate_meta(result.fields(), {param.mvalid}); // Validate the returned value - mysql::row expected_row ({param.expected_value}); + row expected_row ({param.expected_value}); ASSERT_EQ(rows.size(), 1); - EXPECT_EQ(static_cast(rows[0]), expected_row); // make gtest pick operator<< + EXPECT_EQ(static_cast(rows[0]), expected_row); // make gtest pick operator<< } TEST_P(DatabaseTypesTest, PreparedStatementExecuteParam_ValueSerializedCorrectly) @@ -133,9 +135,9 @@ TEST_P(DatabaseTypesTest, PreparedStatementExecuteParam_ValueSerializedCorrectly auto rows = result.fetch_all(); // Validate the returned value - mysql::row expected_row ({param.expected_value}); + row expected_row ({param.expected_value}); ASSERT_EQ(rows.size(), 1); - EXPECT_EQ(static_cast(rows[0]), expected_row); // make gtest pick operator<< + EXPECT_EQ(static_cast(rows[0]), expected_row); // make gtest pick operator<< } using flagsvec = std::vector; @@ -305,7 +307,7 @@ std::chrono::microseconds round_micros(std::chrono::microseconds input, int deci return std::chrono::microseconds(round_micros(static_cast(input.count()), decimals)); } -std::pair datetime_from_id(std::bitset<4> id, int decimals) +std::pair datetime_from_id(std::bitset<4> id, int decimals) { // id represents which components (h, m, s, u) should the test case have constexpr struct @@ -320,7 +322,7 @@ std::pair datetime_from_id(std::bitset<4> id, int }; std::string name; - mysql::datetime dt = makedt(2010, 5, 2); // components all tests have + datetime dt = makedt(2010, 5, 2); // components all tests have for (std::size_t i = 0; i < id.size(); ++i) { @@ -340,8 +342,8 @@ std::pair datetime_from_id(std::bitset<4> id, int database_types_testcase create_datetime_testcase( int decimals, std::string id, - mysql::value expected, - mysql::field_type type + value expected, + field_type type ) { static std::unordered_map table_map { @@ -359,11 +361,11 @@ database_types_testcase create_datetime_testcase( type, no_flags, decimals, - flagsvec{ &mysql::field_metadata::is_unsigned } + flagsvec{ &field_metadata::is_unsigned } ); } -std::pair time_from_id(std::bitset<6> id, int decimals) +std::pair time_from_id(std::bitset<6> id, int decimals) { // id represents which components (h, m, s, u) should the test case have constexpr struct @@ -380,7 +382,7 @@ std::pair time_from_id(std::bitset<6> id, int decimals }; std::string name; - mysql::time t {0}; + boost::mysql::time t {0}; for (std::size_t i = 1; i < id.size(); ++i) { @@ -404,7 +406,7 @@ std::pair time_from_id(std::bitset<6> id, int decimals // shared between DATETIME and TIMESTAMP std::vector generate_common_datetime_cases( - mysql::field_type type + field_type type ) { std::vector res; diff --git a/test/integration/execute_statement.cpp b/test/integration/execute_statement.cpp index 77c9a9b5..3e505e77 100644 --- a/test/integration/execute_statement.cpp +++ b/test/integration/execute_statement.cpp @@ -8,13 +8,13 @@ #include "integration_test_common.hpp" #include -using namespace mysql::test; -using mysql::value; -using mysql::error_code; -using mysql::error_info; -using mysql::Error; -using mysql::tcp_resultset; -using mysql::tcp_prepared_statement; +using namespace boost::mysql::test; +using boost::mysql::value; +using boost::mysql::error_code; +using boost::mysql::error_info; +using boost::mysql::Error; +using boost::mysql::tcp_resultset; +using boost::mysql::tcp_prepared_statement; namespace { @@ -101,7 +101,7 @@ struct ExecuteStatementOtherContainersTest : IntegTestAfterHandshake {}; TEST_F(ExecuteStatementOtherContainersTest, NoParams_CanUseNoStatementParamsVariable) { auto stmt = conn.prepare_statement("SELECT * FROM empty_table"); - auto result = stmt.execute(mysql::no_statement_params); + auto result = stmt.execute(boost::mysql::no_statement_params); EXPECT_TRUE(result.valid()); } diff --git a/test/integration/handshake.cpp b/test/integration/handshake.cpp index 4057ed0e..8ec0d4a7 100644 --- a/test/integration/handshake.cpp +++ b/test/integration/handshake.cpp @@ -12,11 +12,12 @@ namespace net = boost::asio; using namespace testing; -using namespace mysql::test; +using namespace boost::mysql::test; -using mysql::detail::make_error_code; -using mysql::error_info; -using mysql::Error; +using boost::mysql::detail::make_error_code; +using boost::mysql::error_info; +using boost::mysql::Error; +using boost::mysql::error_code; namespace { @@ -51,7 +52,7 @@ TEST_P(HandshakeTest, FastAuthBadUser) { connection_params.username = "non_existing_user"; auto result = do_handshake(); - EXPECT_NE(result.err, mysql::error_code()); + EXPECT_NE(result.err, error_code()); // TODO: if default auth plugin is unknown, unknown auth plugin is returned instead of access denied // EXPECT_EQ(errc, make_error_code(mysql::Error::access_denied_error)); } @@ -60,14 +61,14 @@ TEST_P(HandshakeTest, FastAuthBadPassword) { connection_params.password = "bad_password"; auto result = do_handshake(); - result.validate_error(mysql::Error::access_denied_error, {"access denied", "integ_user"}); + result.validate_error(Error::access_denied_error, {"access denied", "integ_user"}); } TEST_P(HandshakeTest, FastAuthBadDatabase) { connection_params.database = "bad_database"; auto result = do_handshake(); - result.validate_error(mysql::Error::dbaccess_denied_error, {"database", "bad_database"}); + result.validate_error(Error::dbaccess_denied_error, {"database", "bad_database"}); } MYSQL_NETWORK_TEST_SUITE(HandshakeTest); diff --git a/test/integration/integration_test_common.hpp b/test/integration/integration_test_common.hpp index 61db8486..c683252b 100644 --- a/test/integration/integration_test_common.hpp +++ b/test/integration/integration_test_common.hpp @@ -12,10 +12,9 @@ #include "metadata_validator.hpp" #include "network_functions.hpp" -namespace mysql -{ -namespace test -{ +namespace boost { +namespace mysql { +namespace test { struct IntegTest : testing::Test { @@ -101,7 +100,8 @@ struct NetworkTest : public BaseType, { }; -} -} +} // test +} // mysql +} // boost #endif /* TEST_INTEGRATION_INTEGRATION_TEST_COMMON_HPP_ */ diff --git a/test/integration/metadata_validator.cpp b/test/integration/metadata_validator.cpp index e8402aac..b54344fd 100644 --- a/test/integration/metadata_validator.cpp +++ b/test/integration/metadata_validator.cpp @@ -8,10 +8,10 @@ #include "metadata_validator.hpp" #include -using namespace mysql::test; +using namespace boost::mysql::test; #define MYSQL_TEST_FLAG_GETTER_NAME_ENTRY(getter) \ - { #getter, &mysql::field_metadata::getter } + { #getter, &boost::mysql::field_metadata::getter } static struct flag_entry { @@ -76,7 +76,7 @@ void meta_validator::validate( } } -void mysql::test::validate_meta( +void boost::mysql::test::validate_meta( const std::vector& actual, const std::vector& expected ) diff --git a/test/integration/metadata_validator.hpp b/test/integration/metadata_validator.hpp index a862860f..42da83f3 100644 --- a/test/integration/metadata_validator.hpp +++ b/test/integration/metadata_validator.hpp @@ -4,10 +4,9 @@ #include "boost/mysql/metadata.hpp" #include -namespace mysql -{ -namespace test -{ +namespace boost { +namespace mysql { +namespace test { class meta_validator { @@ -46,8 +45,9 @@ private: void validate_meta(const std::vector& actual, const std::vector& expected); -} -} +} // test +} // mysql +} // boost diff --git a/test/integration/network_functions.cpp b/test/integration/network_functions.cpp index 83fb6ad5..9b34d0a2 100644 --- a/test/integration/network_functions.cpp +++ b/test/integration/network_functions.cpp @@ -1,14 +1,17 @@ #include "network_functions.hpp" #include -using namespace mysql::test; -using mysql::tcp_prepared_statement; -using mysql::tcp_resultset; -using mysql::tcp_connection; -using mysql::error_info; -using mysql::error_code; -using mysql::detail::make_error_code; -using mysql::Error; +using namespace boost::mysql::test; +using boost::mysql::tcp_prepared_statement; +using boost::mysql::tcp_resultset; +using boost::mysql::tcp_connection; +using boost::mysql::error_info; +using boost::mysql::error_code; +using boost::mysql::detail::make_error_code; +using boost::mysql::Error; +using boost::mysql::value; +using boost::mysql::row; +using boost::mysql::owning_row; namespace { @@ -28,7 +31,7 @@ public: const char* name() const override { return "sync_errc"; } network_result handshake( tcp_connection& conn, - const mysql::connection_params& params + const boost::mysql::connection_params& params ) override { return impl([&](error_code& errc, error_info& info) { @@ -66,7 +69,7 @@ public: } network_result execute_statement( tcp_prepared_statement& stmt, - const std::vector& values + const std::vector& values ) override { return impl([&stmt, &values](error_code& err, error_info& info) { @@ -82,7 +85,7 @@ public: return no_result(); }); } - network_result fetch_one( + network_result fetch_one( tcp_resultset& r ) override { @@ -90,7 +93,7 @@ public: return r.fetch_one(errc, info); }); } - network_result> fetch_many( + network_result> fetch_many( tcp_resultset& r, std::size_t count ) override @@ -99,7 +102,7 @@ public: return r.fetch_many(count, errc, info); }); } - network_result> fetch_all( + network_result> fetch_all( tcp_resultset& r ) override { @@ -130,7 +133,7 @@ public: const char* name() const override { return "sync_exc"; } network_result handshake( tcp_connection& conn, - const mysql::connection_params& params + const boost::mysql::connection_params& params ) override { return impl([&] { @@ -168,7 +171,7 @@ public: } network_result execute_statement( tcp_prepared_statement& stmt, - const std::vector& values + const std::vector& values ) override { return impl([&stmt, &values] { @@ -184,7 +187,7 @@ public: return no_result(); }); } - network_result fetch_one( + network_result fetch_one( tcp_resultset& r ) override { @@ -192,7 +195,7 @@ public: return r.fetch_one(); }); } - network_result> fetch_many( + network_result> fetch_many( tcp_resultset& r, std::size_t count ) override @@ -201,7 +204,7 @@ public: return r.fetch_many(count); }); } - network_result> fetch_all( + network_result> fetch_all( tcp_resultset& r ) override { @@ -234,7 +237,7 @@ public: const char* name() const override { return "async"; } network_result handshake( tcp_connection& conn, - const mysql::connection_params& params + const boost::mysql::connection_params& params ) override { return impl_no_result([&](auto&& token) { @@ -271,7 +274,7 @@ public: } network_result execute_statement( tcp_prepared_statement& stmt, - const std::vector& values + const std::vector& values ) override { return impl([&](auto&& token) { @@ -286,28 +289,28 @@ public: return stmt.async_close(std::forward(token)); }); } - network_result fetch_one( + network_result fetch_one( tcp_resultset& r ) override { - return impl([&](auto&& token) { + return impl([&](auto&& token) { return r.async_fetch_one(std::forward(token)); }); } - network_result> fetch_many( + network_result> fetch_many( tcp_resultset& r, std::size_t count ) override { - return impl>([&](auto&& token) { + return impl>([&](auto&& token) { return r.async_fetch_many(count, std::forward(token)); }); } - network_result> fetch_all( + network_result> fetch_all( tcp_resultset& r ) override { - return impl>([&](auto&& token) { + return impl>([&](auto&& token) { return r.async_fetch_all(std::forward(token)); }); } @@ -321,6 +324,6 @@ async async_obj; } // Visible stuff -mysql::test::network_functions* mysql::test::sync_errc_network_functions = &sync_errc_obj; -mysql::test::network_functions* mysql::test::sync_exc_network_functions = &sync_exc_obj; -mysql::test::network_functions* mysql::test::async_network_functions = &async_obj; +boost::mysql::test::network_functions* boost::mysql::test::sync_errc_network_functions = &sync_errc_obj; +boost::mysql::test::network_functions* boost::mysql::test::sync_exc_network_functions = &sync_exc_obj; +boost::mysql::test::network_functions* boost::mysql::test::async_network_functions = &async_obj; diff --git a/test/integration/network_functions.hpp b/test/integration/network_functions.hpp index 9fbde5ce..1037f798 100644 --- a/test/integration/network_functions.hpp +++ b/test/integration/network_functions.hpp @@ -6,10 +6,9 @@ #include #include -namespace mysql -{ -namespace test -{ +namespace boost { +namespace mysql { +namespace test { struct no_result {}; @@ -80,8 +79,10 @@ inline network_functions* all_network_functions [] = { all_network_functions \ ), [](const auto& param_info) { return param_info.param->name(); }) -} -} + +} // test +} // mysql +} // boost diff --git a/test/integration/prepare_statement.cpp b/test/integration/prepare_statement.cpp index bf111857..fa41ae25 100644 --- a/test/integration/prepare_statement.cpp +++ b/test/integration/prepare_statement.cpp @@ -7,12 +7,12 @@ #include "integration_test_common.hpp" -using namespace mysql::test; -using mysql::error_code; -using mysql::error_info; -using mysql::Error; -using mysql::tcp_prepared_statement; -using mysql::tcp_connection; +using namespace boost::mysql::test; +using boost::mysql::error_code; +using boost::mysql::error_info; +using boost::mysql::Error; +using boost::mysql::tcp_prepared_statement; +using boost::mysql::tcp_connection; namespace { diff --git a/test/integration/prepared_statement_lifecycle.cpp b/test/integration/prepared_statement_lifecycle.cpp index 30588082..b93a5b2a 100644 --- a/test/integration/prepared_statement_lifecycle.cpp +++ b/test/integration/prepared_statement_lifecycle.cpp @@ -7,9 +7,9 @@ #include "integration_test_common.hpp" -using namespace mysql::test; -using mysql::row; -using mysql::value; +using namespace boost::mysql::test; +using boost::mysql::row; +using boost::mysql::value; namespace { diff --git a/test/integration/query.cpp b/test/integration/query.cpp index 79d969e8..bdfd66b5 100644 --- a/test/integration/query.cpp +++ b/test/integration/query.cpp @@ -14,14 +14,11 @@ namespace net = boost::asio; using namespace testing; -using namespace mysql::test; -using mysql::detail::make_error_code; -using mysql::test::meta_validator; -using mysql::test::validate_meta; -using mysql::field_metadata; -using mysql::field_type; -using mysql::error_code; -using mysql::error_info; +using namespace boost::mysql::test; +using boost::mysql::detail::make_error_code; +using boost::mysql::field_metadata; +using boost::mysql::field_type; +using boost::mysql::Error; namespace { @@ -49,7 +46,7 @@ TEST_P(QueryTest, InsertQueryFailed) { const char* sql = "INSERT INTO bad_table (field_varchar, field_date) VALUES ('v0', '2010-10-11')"; auto result = do_query(sql); - result.validate_error(mysql::Error::no_such_table, {"table", "doesn't exist", "bad_table"}); + result.validate_error(Error::no_such_table, {"table", "doesn't exist", "bad_table"}); EXPECT_FALSE(result.value.valid()); } @@ -79,7 +76,7 @@ TEST_P(QueryTest, SelectOk) TEST_P(QueryTest, SelectQueryFailed) { auto result = do_query("SELECT field_varchar, field_bad FROM one_row_table"); - result.validate_error(mysql::Error::bad_field_error, {"unknown column", "field_bad"}); + result.validate_error(Error::bad_field_error, {"unknown column", "field_bad"}); EXPECT_FALSE(result.value.valid()); } diff --git a/test/integration/resultset.cpp b/test/integration/resultset.cpp index d3d115f2..d2894174 100644 --- a/test/integration/resultset.cpp +++ b/test/integration/resultset.cpp @@ -8,15 +8,14 @@ #include "integration_test_common.hpp" #include -using namespace mysql::test; -using mysql::detail::make_error_code; -using mysql::test::meta_validator; -using mysql::test::validate_meta; -using mysql::field_metadata; -using mysql::field_type; -using mysql::error_code; -using mysql::error_info; -using mysql::tcp_resultset; +using namespace boost::mysql::test; +using boost::mysql::detail::make_error_code; +using boost::mysql::field_metadata; +using boost::mysql::field_type; +using boost::mysql::error_code; +using boost::mysql::error_info; +using boost::mysql::tcp_resultset; +using boost::mysql::tcp_connection; namespace net = boost::asio; namespace @@ -27,7 +26,7 @@ class resultset_generator public: virtual ~resultset_generator() {} virtual const char* name() const = 0; - virtual mysql::tcp_resultset generate(mysql::tcp_connection&, std::string_view) = 0; + virtual tcp_resultset generate(tcp_connection&, std::string_view) = 0; }; struct ResultsetTestParam : named_param @@ -250,7 +249,7 @@ class text_resultset_generator : public resultset_generator { public: const char* name() const override { return "text"; } - mysql::tcp_resultset generate(mysql::tcp_connection& conn, std::string_view query) override + tcp_resultset generate(tcp_connection& conn, std::string_view query) override { return conn.query(query); } @@ -260,9 +259,9 @@ class binary_resultset_generator : public resultset_generator { public: const char* name() const override { return "binary"; } - mysql::tcp_resultset generate(mysql::tcp_connection& conn, std::string_view query) override + tcp_resultset generate(tcp_connection& conn, std::string_view query) override { - return conn.prepare_statement(query).execute(mysql::no_statement_params); + return conn.prepare_statement(query).execute(boost::mysql::no_statement_params); } }; diff --git a/test/unit/detail/auth/mysql_native_password.cpp b/test/unit/detail/auth/mysql_native_password.cpp index 04fbf709..eb8943b0 100644 --- a/test/unit/detail/auth/mysql_native_password.cpp +++ b/test/unit/detail/auth/mysql_native_password.cpp @@ -9,7 +9,7 @@ #include #include -using namespace mysql::detail; +using namespace boost::mysql::detail; using namespace testing; namespace diff --git a/test/unit/detail/protocol/binary_deserialization.cpp b/test/unit/detail/protocol/binary_deserialization.cpp index c5816810..f279dfe1 100644 --- a/test/unit/detail/protocol/binary_deserialization.cpp +++ b/test/unit/detail/protocol/binary_deserialization.cpp @@ -9,25 +9,25 @@ #include "boost/mysql/detail/protocol/binary_deserialization.hpp" #include "test_common.hpp" -using namespace mysql::detail; -using namespace mysql::test; +using namespace boost::mysql::detail; +using namespace boost::mysql::test; using namespace testing; using namespace date::literals; -using mysql::value; -using mysql::collation; -using mysql::error_code; -using mysql::Error; +using boost::mysql::value; +using boost::mysql::collation; +using boost::mysql::error_code; +using boost::mysql::Error; namespace { -using mysql::operator<<; +using boost::mysql::operator<<; -std::vector make_meta( +std::vector make_meta( const std::vector& types ) { - std::vector res; + std::vector res; for (const auto type: types) { column_definition_packet coldef; @@ -70,7 +70,7 @@ TEST_P(DeserializeBinaryValueTest, CorrectFormat_SetsOutputValueReturnsTrue) column_definition_packet coldef; coldef.type = GetParam().type; coldef.flags.value = GetParam().flags; - mysql::field_metadata meta (coldef); + boost::mysql::field_metadata meta (coldef); value actual_value; const auto& buffer = GetParam().from; DeserializationContext ctx (buffer.data(), buffer.data() + buffer.size(), capabilities()); diff --git a/test/unit/detail/protocol/capabilities.cpp b/test/unit/detail/protocol/capabilities.cpp index 95b7fcc1..dba8e81e 100644 --- a/test/unit/detail/protocol/capabilities.cpp +++ b/test/unit/detail/protocol/capabilities.cpp @@ -8,7 +8,7 @@ #include "boost/mysql/detail/protocol/capabilities.hpp" #include -using namespace mysql::detail; +using namespace boost::mysql::detail; using namespace testing; TEST(Capabilities, Has_BitSet_ReturnsTrue) diff --git a/test/unit/detail/protocol/channel.cpp b/test/unit/detail/protocol/channel.cpp index 4ca5f48b..427cde77 100644 --- a/test/unit/detail/protocol/channel.cpp +++ b/test/unit/detail/protocol/channel.cpp @@ -13,10 +13,11 @@ #include "boost/mysql/detail/protocol/channel.hpp" using namespace testing; -using namespace mysql::detail; +using namespace boost::mysql::detail; using namespace boost::asio; namespace errc = boost::system::errc; -using mysql::error_code; +using boost::mysql::error_code; +using boost::mysql::Error; namespace { @@ -36,8 +37,8 @@ void concat(std::vector& lhs, const std::vector& rhs) class MockStream { public: - MOCK_METHOD2(read_buffer, std::size_t(boost::asio::mutable_buffer, mysql::error_code&)); - MOCK_METHOD2(write_buffer, std::size_t(boost::asio::const_buffer, mysql::error_code&)); + MOCK_METHOD2(read_buffer, std::size_t(boost::asio::mutable_buffer, error_code&)); + MOCK_METHOD2(write_buffer, std::size_t(boost::asio::const_buffer, error_code&)); void set_default_behavior() { @@ -52,7 +53,7 @@ public: } template - std::size_t read_some(MutableBufferSequence mb, mysql::error_code& ec) + std::size_t read_some(MutableBufferSequence mb, error_code& ec) { if (buffer_size(mb) == 0) { @@ -78,7 +79,7 @@ public: } template - std::size_t write_some(ConstBufferSequence cb, mysql::error_code& ec) + std::size_t write_some(ConstBufferSequence cb, error_code& ec) { if (buffer_size(cb) == 0) { @@ -113,7 +114,7 @@ struct MysqlChannelFixture : public Test using MockChannel = channel>; NiceMock stream; MockChannel chan {stream}; - mysql::error_code errc; + error_code errc; InSequence seq; MysqlChannelFixture() @@ -136,7 +137,7 @@ struct MysqlChannelReadTest : public MysqlChannelFixture static auto buffer_copier(const std::vector& buffer) { - return [buffer](boost::asio::mutable_buffer b, mysql::error_code& ec) { + return [buffer](boost::asio::mutable_buffer b, error_code& ec) { assert(b.size() >= buffer.size()); memcpy(b.data(), buffer.data(), buffer.size()); ec.clear(); @@ -146,7 +147,7 @@ struct MysqlChannelReadTest : public MysqlChannelFixture auto make_read_handler() { - return [this](boost::asio::mutable_buffer b, mysql::error_code& ec) { + return [this](boost::asio::mutable_buffer b, error_code& ec) { std::size_t to_copy = std::min(b.size(), bytes_to_read.size() - index); memcpy(b.data(), bytes_to_read.data() + index, to_copy); index += to_copy; @@ -157,7 +158,7 @@ struct MysqlChannelReadTest : public MysqlChannelFixture static auto read_failer(error_code error) { - return [error](boost::asio::mutable_buffer, mysql::error_code& ec) { + return [error](boost::asio::mutable_buffer, error_code& ec) { ec = error; return size_t(0); }; @@ -239,7 +240,7 @@ TEST_F(MysqlChannelReadTest, SyncRead_SequenceNumberMismatch_ReturnsAppropriateE .WillByDefault(Invoke(make_read_handler())); bytes_to_read = {0xff, 0xff, 0xff, 0x05}; chan.read(buffer, errc); - EXPECT_EQ(errc, make_error_code(mysql::Error::sequence_number_mismatch)); + EXPECT_EQ(errc, make_error_code(Error::sequence_number_mismatch)); } TEST_F(MysqlChannelReadTest, SyncRead_SequenceNumberNotZero_RespectsCurrentSequenceNumber) diff --git a/test/unit/detail/protocol/null_bitmap_traits.cpp b/test/unit/detail/protocol/null_bitmap_traits.cpp index 14f59de1..5984c848 100644 --- a/test/unit/detail/protocol/null_bitmap_traits.cpp +++ b/test/unit/detail/protocol/null_bitmap_traits.cpp @@ -4,10 +4,10 @@ #include "boost/mysql/detail/protocol/null_bitmap_traits.hpp" #include "test_common.hpp" -using mysql::detail::null_bitmap_traits; -using mysql::detail::stmt_execute_null_bitmap_offset; -using mysql::detail::binary_row_null_bitmap_offset; -using namespace mysql::test; +using boost::mysql::detail::null_bitmap_traits; +using boost::mysql::detail::stmt_execute_null_bitmap_offset; +using boost::mysql::detail::binary_row_null_bitmap_offset; +using namespace boost::mysql::test; namespace { diff --git a/test/unit/detail/protocol/serialization.cpp b/test/unit/detail/protocol/serialization.cpp index 004e3499..99d496b0 100644 --- a/test/unit/detail/protocol/serialization.cpp +++ b/test/unit/detail/protocol/serialization.cpp @@ -14,11 +14,11 @@ using namespace testing; using namespace std; -using namespace mysql::detail; -using namespace mysql::test; -using mysql::Error; -using mysql::collation; -using mysql::value; +using namespace boost::mysql::detail; +using namespace boost::mysql::test; +using boost::mysql::Error; +using boost::mysql::collation; +using boost::mysql::value; namespace { diff --git a/test/unit/detail/protocol/text_deserialization.cpp b/test/unit/detail/protocol/text_deserialization.cpp index a5318ef3..51675116 100644 --- a/test/unit/detail/protocol/text_deserialization.cpp +++ b/test/unit/detail/protocol/text_deserialization.cpp @@ -9,19 +9,19 @@ #include "boost/mysql/detail/protocol/text_deserialization.hpp" #include "test_common.hpp" -using namespace mysql::detail; -using namespace mysql::test; +using namespace boost::mysql::detail; +using namespace boost::mysql::test; using namespace testing; using namespace date::literals; -using mysql::value; -using mysql::collation; -using mysql::error_code; -using mysql::Error; +using boost::mysql::value; +using boost::mysql::collation; +using boost::mysql::error_code; +using boost::mysql::Error; namespace { -using mysql::operator<<; +using boost::mysql::operator<<; struct TextValueParam : named_param { @@ -59,7 +59,7 @@ TEST_P(DeserializeTextValueTest, CorrectFormat_SetsOutputValueReturnsTrue) coldef.type = GetParam().type; coldef.decimals.value = static_cast(GetParam().decimals); coldef.flags.value = GetParam().flags; - mysql::field_metadata meta (coldef); + boost::mysql::field_metadata meta (coldef); value actual_value; auto err = deserialize_text_value(GetParam().from, meta, actual_value); EXPECT_EQ(err, Error::ok); @@ -169,11 +169,11 @@ INSTANTIATE_TEST_SUITE_P(DOUBLE, DeserializeTextValueTest, Values( ), test_name_generator); INSTANTIATE_TEST_SUITE_P(DATE, DeserializeTextValueTest, Values( - TextValueParam("regular_date", "2019-02-28", mysql::date(2019_y/2/28), protocol_field_type::date), - TextValueParam("leap_year", "1788-02-29", mysql::date(1788_y/2/29), protocol_field_type::date), - TextValueParam("min", "1000-01-01", mysql::date(1000_y/1/1), protocol_field_type::date), - TextValueParam("max", "9999-12-31", mysql::date(9999_y/12/31), protocol_field_type::date), - TextValueParam("unofficial_min", "0100-01-01", mysql::date(100_y/1/1), protocol_field_type::date) + TextValueParam("regular_date", "2019-02-28", boost::mysql::date(2019_y/2/28), protocol_field_type::date), + TextValueParam("leap_year", "1788-02-29", boost::mysql::date(1788_y/2/29), protocol_field_type::date), + TextValueParam("min", "1000-01-01", boost::mysql::date(1000_y/1/1), protocol_field_type::date), + TextValueParam("max", "9999-12-31", boost::mysql::date(9999_y/12/31), protocol_field_type::date), + TextValueParam("unofficial_min", "0100-01-01", boost::mysql::date(100_y/1/1), protocol_field_type::date) ), test_name_generator); INSTANTIATE_TEST_SUITE_P(DATETIME, DeserializeTextValueTest, Values( @@ -295,7 +295,7 @@ INSTANTIATE_TEST_SUITE_P(YEAR, DeserializeTextValueTest, Values( struct DeserializeTextRowTest : public Test { - std::vector meta { + std::vector meta { column_definition_packet { string_lenenc("def"), string_lenenc("awesome"), diff --git a/test/unit/error.cpp b/test/unit/error.cpp index ae141bcc..704c7c02 100644 --- a/test/unit/error.cpp +++ b/test/unit/error.cpp @@ -9,8 +9,8 @@ #include "boost/mysql/error.hpp" using namespace testing; -using mysql::Error; -using mysql::detail::error_to_string; +using boost::mysql::Error; +using boost::mysql::detail::error_to_string; TEST(Error, ErrorToString_Ok_ReturnsOk) { diff --git a/test/unit/metadata.cpp b/test/unit/metadata.cpp index d65320f5..60a3a82c 100644 --- a/test/unit/metadata.cpp +++ b/test/unit/metadata.cpp @@ -10,7 +10,10 @@ #include "boost/mysql/detail/protocol/serialization.hpp" using namespace testing; -using namespace mysql::detail; +using namespace boost::mysql::detail; +using boost::mysql::collation; +using boost::mysql::field_metadata; +using boost::mysql::field_type; namespace { @@ -24,13 +27,13 @@ TEST(FieldMetadata, IntPrimaryKey) string_lenenc("test_table"), string_lenenc("id"), string_lenenc("id"), - mysql::collation::binary, + collation::binary, int4(11), protocol_field_type::long_, int2(column_flags::pri_key | column_flags::auto_increment | column_flags::not_null), int1(0) }; - mysql::field_metadata meta (msg); + field_metadata meta (msg); EXPECT_EQ(meta.database(), "awesome"); EXPECT_EQ(meta.table(), "test_table"); @@ -38,7 +41,7 @@ TEST(FieldMetadata, IntPrimaryKey) EXPECT_EQ(meta.field_name(), "id"); EXPECT_EQ(meta.original_field_name(), "id"); EXPECT_EQ(meta.column_length(), 11); - EXPECT_EQ(meta.type(), mysql::field_type::int_); + EXPECT_EQ(meta.type(), field_type::int_); EXPECT_EQ(meta.protocol_type(), protocol_field_type::long_); EXPECT_EQ(meta.decimals(), 0); EXPECT_TRUE(meta.is_not_null()); @@ -61,13 +64,13 @@ TEST(FieldMetadata, VarcharWithAlias) string_lenenc("child_table"), string_lenenc("field_alias"), string_lenenc("field_varchar"), - mysql::collation::utf8_general_ci, + collation::utf8_general_ci, int4(765), protocol_field_type::var_string, int2(0), int1(0) }; - mysql::field_metadata meta (msg); + field_metadata meta (msg); EXPECT_EQ(meta.database(), "awesome"); EXPECT_EQ(meta.table(), "child"); @@ -76,7 +79,7 @@ TEST(FieldMetadata, VarcharWithAlias) EXPECT_EQ(meta.original_field_name(), "field_varchar"); EXPECT_EQ(meta.column_length(), 765); EXPECT_EQ(meta.protocol_type(), protocol_field_type::var_string); - EXPECT_EQ(meta.type(), mysql::field_type::varchar); + EXPECT_EQ(meta.type(), field_type::varchar); EXPECT_EQ(meta.decimals(), 0); EXPECT_FALSE(meta.is_not_null()); EXPECT_FALSE(meta.is_primary_key()); @@ -98,13 +101,13 @@ TEST(FieldMetadata, FloatField) string_lenenc("test_table"), string_lenenc("field_float"), string_lenenc("field_float"), - mysql::collation::binary, + collation::binary, int4(12), protocol_field_type::float_, int2(0), int1(31) }; - mysql::field_metadata meta (msg); + field_metadata meta (msg); EXPECT_EQ(meta.database(), "awesome"); EXPECT_EQ(meta.table(), "test_table"); @@ -113,7 +116,7 @@ TEST(FieldMetadata, FloatField) EXPECT_EQ(meta.original_field_name(), "field_float"); EXPECT_EQ(meta.column_length(), 12); EXPECT_EQ(meta.protocol_type(), protocol_field_type::float_); - EXPECT_EQ(meta.type(), mysql::field_type::float_); + EXPECT_EQ(meta.type(), field_type::float_); EXPECT_EQ(meta.decimals(), 31); EXPECT_FALSE(meta.is_not_null()); EXPECT_FALSE(meta.is_primary_key()); diff --git a/test/unit/prepared_statement.cpp b/test/unit/prepared_statement.cpp index f96763d2..ac3b91ad 100644 --- a/test/unit/prepared_statement.cpp +++ b/test/unit/prepared_statement.cpp @@ -9,14 +9,14 @@ #include "boost/mysql/prepared_statement.hpp" #include -using namespace mysql::detail; +using namespace boost::mysql::detail; namespace { using stream_type = boost::asio::ip::tcp::socket; -using channel_type = mysql::detail::channel; -using stmt_type = mysql::prepared_statement; +using channel_type = channel; +using stmt_type = boost::mysql::prepared_statement; struct PreparedStatementTest : public testing::Test { diff --git a/test/unit/row.cpp b/test/unit/row.cpp index df80ff6b..49cc0b99 100644 --- a/test/unit/row.cpp +++ b/test/unit/row.cpp @@ -9,9 +9,9 @@ #include "boost/mysql/row.hpp" #include "test_common.hpp" -using namespace mysql::test; +using namespace boost::mysql::test; using namespace testing; -using mysql::row; +using boost::mysql::row; namespace { diff --git a/test/unit/value.cpp b/test/unit/value.cpp index 6a9b7037..8c30744c 100644 --- a/test/unit/value.cpp +++ b/test/unit/value.cpp @@ -10,45 +10,46 @@ #include "boost/mysql/value.hpp" #include "test_common.hpp" -using namespace mysql::test; +using namespace boost::mysql::test; using namespace testing; using namespace date::literals; using namespace std::chrono; +using boost::mysql::value; namespace { // Required because value is a typedef for a specific std::variant and operator<< // is defined in namespace mysql - ADL does not find it -using mysql::operator<<; +using boost::mysql::operator<<; // tests for operator== and operator!= struct ValueEqualityTest : public Test { - std::vector values = makevalues( + std::vector values = makevalues( std::int32_t(20), std::int64_t(-1), std::uint32_t(0xffffffff), std::uint64_t(0x100000000), 3.14f, 8.89, - mysql::date(1_d/10/2019_y), - mysql::date(1_d/10/2019_y) + std::chrono::hours(10), - mysql::time(std::chrono::seconds(-10)), + boost::mysql::date(1_d/10/2019_y), + boost::mysql::date(1_d/10/2019_y) + std::chrono::hours(10), + boost::mysql::time(std::chrono::seconds(-10)), std::uint32_t(2010), nullptr ); - std::vector values_copy = values; - std::vector other_values = makevalues( + std::vector values_copy = values; + std::vector other_values = makevalues( std::int32_t(10), std::int64_t(-22), std::uint32_t(0xff6723), std::uint64_t(222), -3.0f, 8e24, - mysql::date(1_d/9/2019_y), - mysql::date(1_d/9/2019_y) + std::chrono::hours(10), - mysql::time(std::chrono::seconds(10)), + boost::mysql::date(1_d/9/2019_y), + boost::mysql::date(1_d/9/2019_y) + std::chrono::hours(10), + boost::mysql::time(std::chrono::seconds(10)), std::uint32_t(1900), nullptr ); @@ -89,7 +90,7 @@ TEST_F(ValueEqualityTest, OperatorsEqNe_SameTypeSameValue_ReturnEquals) // Tests for operator<< struct ValueStreamParams { - mysql::value input; + value input; std::string expected; template @@ -118,11 +119,11 @@ INSTANTIATE_TEST_SUITE_P(Default, ValueStreamTest, Values( ValueStreamParams("a_string", "a_string"), ValueStreamParams(2.43f, "2.43"), ValueStreamParams(8.12, "8.12"), - ValueStreamParams(mysql::date(1_d/9/2019_y), "2019-09-01"), - ValueStreamParams(mysql::time(0), "00:00:00:000000"), - ValueStreamParams(mysql::time(hours(24)), "24:00:00:000000"), - ValueStreamParams(mysql::time(hours(210) + minutes(59) + seconds(59) + microseconds(100)), "210:59:59:000100"), - ValueStreamParams(mysql::time(hours(-839) - minutes(20) - seconds(35) - microseconds(999999)), "-839:20:35:999999"), + ValueStreamParams(makedate(2019, 9, 1), "2019-09-01"), + ValueStreamParams(maket(0, 0, 0), "00:00:00:000000"), + ValueStreamParams(maket(24, 0, 0), "24:00:00:000000"), + ValueStreamParams(maket(210, 59, 59, 100), "210:59:59:000100"), + ValueStreamParams(-maket(839, 20, 35, 999999), "-839:20:35:999999"), ValueStreamParams(maket(0, 2, 5), "00:02:05:000000"), ValueStreamParams(-maket(0, 21, 45), "-00:21:45:000000"), ValueStreamParams(maket(0, 0, 1, 234000), "00:00:01:234000"),