2
0
mirror of https://github.com/boostorg/mysql.git synced 2026-02-14 00:42:53 +00:00

Moved all names into namespace boost::mysql

This commit is contained in:
ruben
2020-03-19 17:19:43 +00:00
parent dafe0fa1d4
commit afdc3bfd19
82 changed files with 621 additions and 615 deletions

View File

@@ -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
Test for too many connections: do we have a buffer overrun there? (error msg shows incomplete)

View File

@@ -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

View File

@@ -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<mysql::owning_row> salaries = result.fetch_all(); // Get all the results
boost::mysql::tcp_resultset result = salary_getter.execute(boost::mysql::make_values("Efficient"));
std::vector<boost::mysql::owning_row> salaries = result.fetch_all(); // Get all the results
assert(salaries.size() == 1);
[[maybe_unused]] auto salary = std::get<double>(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<double>(salaries[0].values().at(0));

View File

@@ -6,6 +6,9 @@
#include <boost/asio/yield.hpp>
#include <iostream>
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<double>(rows[0].values()[0]);

View File

@@ -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<mysql::owning_row> employees = result.fetch_all();
std::vector<boost::mysql::owning_row> employees = result.fetch_all();
for (const auto& employee: employees)
{
print_employee(employee);

View File

@@ -3,8 +3,8 @@
#include <cstdint>
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

View File

@@ -9,8 +9,8 @@
#include "boost/mysql/prepared_statement.hpp"
#include <boost/asio/ip/tcp.hpp>
namespace mysql
{
namespace boost {
namespace mysql {
/**
* \brief Parameters defining how to authenticate to a MySQL server.
@@ -154,7 +154,8 @@ using tcp_connection = connection<boost::asio::ip::tcp::socket>;
/// The default TCP port for the MySQL protocol.
constexpr unsigned short default_port = 3306;
}
} // mysql
} // boost
#include "boost/mysql/impl/connection.hpp"

View File

@@ -5,7 +5,7 @@
#include <cstring>
// SHA1( password ) XOR SHA1( "20-bytes random data from server" <concat> 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
#endif

View File

@@ -5,13 +5,10 @@
#include <string_view>
#include <array>
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
#endif

View File

@@ -4,10 +4,9 @@
#include <algorithm>
#include <vector>
namespace mysql
{
namespace detail
{
namespace boost {
namespace mysql {
namespace detail {
template <typename TLeft, typename TRight>
inline bool container_equals(
@@ -23,9 +22,10 @@ inline bool container_equals(
);
}
}
}
} // detail
} // mysql
} // boost
#endif
#endif

View File

@@ -4,10 +4,9 @@
#include <string>
#include <sstream>
namespace mysql
{
namespace detail
{
namespace boost {
namespace mysql {
namespace detail {
template <typename... Types>
std::string stringize(const Types&... inputs)
@@ -17,8 +16,9 @@ std::string stringize(const Types&... inputs)
return ss.str();
}
}
}
} // detail
} // mysql
} // boost

View File

@@ -3,10 +3,9 @@
#include <type_traits>
namespace mysql
{
namespace detail
{
namespace boost {
namespace mysql {
namespace detail {
template <typename T, typename Head, typename... Tail>
struct is_one_of
@@ -24,9 +23,9 @@ struct is_one_of<T, Head>
template <typename T, typename... Types>
constexpr bool is_one_of_v = is_one_of<T, Types...>::value;
}
}
} // detail
} // mysql
} // boost
#endif /* INCLUDE_BOOST_MYSQL_DETAIL_AUX_TMP_HPP_ */

View File

@@ -7,10 +7,9 @@
#include <vector>
#include <cstring>
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<std::uint8_t, Allocator>;
using bytestring = std::vector<std::uint8_t>;
}
}
} // detail
} // mysql
} // boost
#endif

View File

@@ -3,10 +3,9 @@
#include "boost/mysql/detail/network_algorithms/common.hpp"
namespace mysql
{
namespace detail
{
namespace boost {
namespace mysql {
namespace detail {
template <typename StreamType>
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"

View File

@@ -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<value>&
);
}
}
} // detail
} // mysql
} // boost
#endif /* INCLUDE_BOOST_MYSQL_DETAIL_NETWORK_ALGORITHMS_COMMON_HPP_ */

View File

@@ -5,10 +5,9 @@
#include "boost/mysql/resultset.hpp"
#include <string_view>
namespace mysql
{
namespace detail
{
namespace boost {
namespace mysql {
namespace detail {
template <typename StreamType, typename Serializable>
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"

View File

@@ -5,10 +5,9 @@
#include "boost/mysql/resultset.hpp"
#include <string_view>
namespace mysql
{
namespace detail
{
namespace boost {
namespace mysql {
namespace detail {
template <typename StreamType>
void execute_query(
@@ -27,6 +26,7 @@ async_execute_query(
CompletionToken&& token
);
}
}
}

View File

@@ -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 <typename StreamType, typename ForwardIterator>
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"

View File

@@ -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"

View File

@@ -5,7 +5,7 @@
#include <boost/asio/async_result.hpp>
template <typename StreamType>
void mysql::detail::close_statement(
void boost::mysql::detail::close_statement(
channel<StreamType>& chan,
std::uint32_t statement_id,
error_code& errc,
@@ -24,8 +24,8 @@ void mysql::detail::close_statement(
}
template <typename StreamType, typename CompletionToken>
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<StreamType>& chan,
std::uint32_t statement_id,
CompletionToken&& token

View File

@@ -6,10 +6,9 @@
#include <optional>
#include <boost/asio/yield.hpp>
namespace mysql
{
namespace detail
{
namespace boost {
namespace mysql {
namespace detail {
template <typename StreamType>
class execute_processor
@@ -109,11 +108,12 @@ public:
auto& get_buffer() { return buffer_; }
};
}
}
} // detail
} // mysql
} // boost
template <typename StreamType, typename Serializable>
void mysql::detail::execute_generic(
void boost::mysql::detail::execute_generic(
deserialize_row_fn deserializer,
channel<StreamType>& channel,
const Serializable& request,
@@ -162,9 +162,9 @@ void mysql::detail::execute_generic(
template <typename StreamType, typename Serializable, typename CompletionToken>
BOOST_ASIO_INITFN_RESULT_TYPE(
CompletionToken,
void(mysql::error_code, mysql::error_info, mysql::resultset<StreamType>)
void(boost::mysql::error_code, boost::mysql::error_info, boost::mysql::resultset<StreamType>)
)
mysql::detail::async_execute_generic(
boost::mysql::detail::async_execute_generic(
deserialize_row_fn deserializer,
channel<StreamType>& chan,
const Serializable& request,

View File

@@ -5,7 +5,7 @@
#include "boost/mysql/detail/protocol/text_deserialization.hpp"
template <typename StreamType>
void mysql::detail::execute_query(
void boost::mysql::detail::execute_query(
channel<StreamType>& channel,
std::string_view query,
resultset<StreamType>& output,
@@ -21,9 +21,9 @@ void mysql::detail::execute_query(
template <typename StreamType, typename CompletionToken>
BOOST_ASIO_INITFN_RESULT_TYPE(
CompletionToken,
void(mysql::error_code, mysql::error_info, mysql::resultset<StreamType>)
void(boost::mysql::error_code, boost::mysql::error_info, boost::mysql::resultset<StreamType>)
)
mysql::detail::async_execute_query(
boost::mysql::detail::async_execute_query(
channel<StreamType>& chan,
std::string_view query,
CompletionToken&& token

View File

@@ -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 <typename ForwardIterator>
com_stmt_execute_packet<ForwardIterator> make_stmt_execute_packet(
@@ -26,11 +25,12 @@ com_stmt_execute_packet<ForwardIterator> make_stmt_execute_packet(
};
}
}
}
} // detail
} // mysql
} // boost
template <typename StreamType, typename ForwardIterator>
void mysql::detail::execute_statement(
void boost::mysql::detail::execute_statement(
channel<StreamType>& chan,
std::uint32_t statement_id,
ForwardIterator params_begin,
@@ -47,9 +47,9 @@ void mysql::detail::execute_statement(
template <typename StreamType, typename ForwardIterator, typename CompletionToken>
BOOST_ASIO_INITFN_RESULT_TYPE(
CompletionToken,
void(mysql::error_code, mysql::error_info, mysql::resultset<StreamType>)
void(boost::mysql::error_code, boost::mysql::error_info, boost::mysql::resultset<StreamType>)
)
mysql::detail::async_execute_statement(
boost::mysql::detail::async_execute_statement(
channel<StreamType>& chan,
std::uint32_t statement_id,
ForwardIterator params_begin,

View File

@@ -7,10 +7,9 @@
#include "boost/mysql/detail/network_algorithms/common.hpp"
#include <boost/asio/yield.hpp>
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 <typename StreamType>
void mysql::detail::hanshake(
void boost::mysql::detail::hanshake(
channel<StreamType>& channel,
const handshake_params& params,
error_code& err,
@@ -277,8 +276,8 @@ void mysql::detail::hanshake(
}
template <typename StreamType, typename CompletionToken>
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<StreamType>& chan,
const handshake_params& params,
CompletionToken&& token

View File

@@ -3,10 +3,9 @@
#include <boost/asio/yield.hpp>
namespace mysql
{
namespace detail
{
namespace boost {
namespace mysql {
namespace detail {
template <typename StreamType>
class prepare_statement_processor
@@ -54,13 +53,12 @@ public:
}
};
}
}
} // detail
} // mysql
} // boost
template <typename StreamType>
void mysql::detail::prepare_statement(
void boost::mysql::detail::prepare_statement(
channel<StreamType>& channel,
std::string_view statement,
error_code& err,
@@ -99,9 +97,9 @@ void mysql::detail::prepare_statement(
template <typename StreamType, typename CompletionToken>
BOOST_ASIO_INITFN_RESULT_TYPE(
CompletionToken,
void(mysql::error_code, mysql::error_info, mysql::prepared_statement<StreamType>)
void(boost::mysql::error_code, boost::mysql::error_info, boost::mysql::prepared_statement<StreamType>)
)
mysql::detail::async_prepare_statement(
boost::mysql::detail::async_prepare_statement(
channel<StreamType>& chan,
std::string_view statement,
CompletionToken&& token

View File

@@ -4,10 +4,9 @@
#include "boost/mysql/detail/protocol/text_deserialization.hpp"
#include <boost/asio/yield.hpp>
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 <typename StreamType>
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<StreamType>& channel,
const std::vector<field_metadata>& meta,
@@ -87,9 +86,9 @@ mysql::detail::read_row_result mysql::detail::read_row(
template <typename StreamType, typename CompletionToken>
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<StreamType>& chan,
const std::vector<field_metadata>& meta,

View File

@@ -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 <typename StreamType>
void prepare_statement(
channel<StreamType>& channel,
::boost::mysql::detail::channel<StreamType>& 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"

View File

@@ -6,10 +6,9 @@
#include <string_view>
#include <vector>
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"

View File

@@ -7,10 +7,9 @@
#include "boost/mysql/metadata.hpp"
#include <vector>
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<value>& output
);
}
}
} // detail
} // mysql
} // boost
#include "boost/mysql/detail/protocol/impl/binary_deserialization.ipp"

View File

@@ -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"

View File

@@ -3,10 +3,9 @@
#include <cstdint>
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

View File

@@ -8,10 +8,9 @@
#include <boost/asio/async_result.hpp>
#include <array>
namespace mysql
{
namespace detail
{
namespace boost {
namespace mysql {
namespace detail {
template <typename AsyncStream>
class channel
@@ -61,8 +60,9 @@ public:
template <typename ChannelType>
using channel_stream_type = typename ChannelType::stream_type;
}
}
} // detail
} // mysql
} // boost
#include "boost/mysql/detail/protocol/impl/channel.hpp"

View File

@@ -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

View File

@@ -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<field_metadata>& meta,
std::vector<value>& output

View File

@@ -3,10 +3,9 @@
#include <type_traits>
namespace mysql
{
namespace detail
{
namespace boost {
namespace mysql {
namespace detail {
// Performs a mapping from T to a type that can be serialized
template <typename T>
@@ -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

View File

@@ -9,10 +9,9 @@
#include "boost/mysql/detail/protocol/constants.hpp"
#include <boost/asio/yield.hpp>
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 <typename AsyncStream>
bool mysql::detail::channel<AsyncStream>::process_sequence_number(
bool boost::mysql::detail::channel<AsyncStream>::process_sequence_number(
std::uint8_t got
)
{
@@ -45,7 +45,7 @@ bool mysql::detail::channel<AsyncStream>::process_sequence_number(
}
template <typename AsyncStream>
mysql::error_code mysql::detail::channel<AsyncStream>::process_header_read(
boost::mysql::error_code boost::mysql::detail::channel<AsyncStream>::process_header_read(
std::uint32_t& size_to_read
)
{
@@ -62,7 +62,7 @@ mysql::error_code mysql::detail::channel<AsyncStream>::process_header_read(
}
template <typename AsyncStream>
void mysql::detail::channel<AsyncStream>::process_header_write(
void boost::mysql::detail::channel<AsyncStream>::process_header_write(
std::uint32_t size_to_write
)
{
@@ -75,7 +75,7 @@ void mysql::detail::channel<AsyncStream>::process_header_write(
template <typename AsyncStream>
template <typename Allocator>
void mysql::detail::channel<AsyncStream>::read(
void boost::mysql::detail::channel<AsyncStream>::read(
basic_bytestring<Allocator>& buffer,
error_code& errc
)
@@ -107,7 +107,7 @@ void mysql::detail::channel<AsyncStream>::read(
}
template <typename AsyncStream>
void mysql::detail::channel<AsyncStream>::write(
void boost::mysql::detail::channel<AsyncStream>::write(
boost::asio::const_buffer buffer,
error_code& errc
)
@@ -138,8 +138,8 @@ void mysql::detail::channel<AsyncStream>::write(
template <typename AsyncStream>
template <typename Allocator, typename CompletionToken>
BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void(mysql::error_code))
mysql::detail::channel<AsyncStream>::async_read(
BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void(boost::mysql::error_code))
boost::mysql::detail::channel<AsyncStream>::async_read(
basic_bytestring<Allocator>& buffer,
CompletionToken&& token
)
@@ -228,8 +228,8 @@ mysql::detail::channel<AsyncStream>::async_read(
template <typename AsyncStream>
template <typename CompletionToken>
BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void(mysql::error_code))
mysql::detail::channel<AsyncStream>::async_write(
BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void(boost::mysql::error_code))
boost::mysql::detail::channel<AsyncStream>::async_write(
boost::asio::const_buffer buffer,
CompletionToken&& token
)

View File

@@ -7,10 +7,9 @@
#include <cassert>
#include <iterator>
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 <typename ForwardIterator>
inline std::size_t mysql::detail::get_size(
inline std::size_t boost::mysql::detail::get_size(
const com_stmt_execute_packet<ForwardIterator>& value,
const SerializationContext& ctx
) noexcept
@@ -253,7 +253,7 @@ inline std::size_t mysql::detail::get_size(
}
template <typename ForwardIterator>
inline void mysql::detail::serialize(
inline void boost::mysql::detail::serialize(
const com_stmt_execute_packet<ForwardIterator>& input,
SerializationContext& ctx
) noexcept
@@ -300,7 +300,7 @@ inline void mysql::detail::serialize(
}
template <typename Serializable, typename Allocator>
void mysql::detail::serialize_message(
void boost::mysql::detail::serialize_message(
const Serializable& input,
capabilities caps,
basic_bytestring<Allocator>& buffer
@@ -315,7 +315,7 @@ void mysql::detail::serialize_message(
}
template <typename Deserializable>
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::error_code, std::uint8_t> mysql::detail::deserialize_message_type(
inline std::pair<boost::mysql::error_code, std::uint8_t>
boost::mysql::detail::deserialize_message_type(
DeserializationContext& ctx
)
{
@@ -345,7 +346,7 @@ inline std::pair<mysql::error_code, std::uint8_t> 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
)

View File

@@ -6,10 +6,9 @@
#include <boost/lexical_cast/try_lexical_convert.hpp>
#include <date/date.h>
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<field_metadata>& fields,
std::vector<value>& output

View File

@@ -11,10 +11,9 @@
#include <variant>
#include <tuple>
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"

View File

@@ -4,10 +4,9 @@
#include <cstddef>
#include <cstdint>
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_ */

View File

@@ -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

View File

@@ -7,10 +7,9 @@
#include "boost/mysql/metadata.hpp"
#include <vector>
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<value>& output
);
}
}
} // detail
} // mysql
} // boost
#include "boost/mysql/detail/protocol/impl/text_deserialization.ipp"

View File

@@ -4,8 +4,8 @@
#include <boost/system/error_code.hpp>
#include <string>
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"

View File

@@ -3,8 +3,8 @@
#include <cstdint>
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

View File

@@ -6,10 +6,9 @@
#include "boost/mysql/detail/network_algorithms/prepare_statement.hpp"
#include <boost/asio/buffer.hpp>
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 <typename Stream>
void mysql::connection<Stream>::handshake(
void boost::mysql::connection<Stream>::handshake(
const connection_params& params,
error_code& errc,
error_info& info
@@ -45,7 +45,7 @@ void mysql::connection<Stream>::handshake(
}
template <typename Stream>
void mysql::connection<Stream>::handshake(
void boost::mysql::connection<Stream>::handshake(
const connection_params& params
)
{
@@ -57,8 +57,11 @@ void mysql::connection<Stream>::handshake(
template <typename Stream>
template <typename CompletionToken>
BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void(mysql::error_code, mysql::error_info))
mysql::connection<Stream>::async_handshake(
BOOST_ASIO_INITFN_RESULT_TYPE(
CompletionToken,
void(boost::mysql::error_code, boost::mysql::error_info)
)
boost::mysql::connection<Stream>::async_handshake(
const connection_params& params,
CompletionToken&& token
)
@@ -72,7 +75,7 @@ mysql::connection<Stream>::async_handshake(
// Query
template <typename Stream>
mysql::resultset<Stream> mysql::connection<Stream>::query(
boost::mysql::resultset<Stream> boost::mysql::connection<Stream>::query(
std::string_view query_string,
error_code& err,
error_info& info
@@ -86,7 +89,7 @@ mysql::resultset<Stream> mysql::connection<Stream>::query(
}
template <typename Stream>
mysql::resultset<Stream> mysql::connection<Stream>::query(
boost::mysql::resultset<Stream> boost::mysql::connection<Stream>::query(
std::string_view query_string
)
{
@@ -102,9 +105,9 @@ template <typename Stream>
template <typename CompletionToken>
BOOST_ASIO_INITFN_RESULT_TYPE(
CompletionToken,
void(mysql::error_code, mysql::error_info, mysql::resultset<Stream>)
void(boost::mysql::error_code, boost::mysql::error_info, boost::mysql::resultset<Stream>)
)
mysql::connection<Stream>::async_query(
boost::mysql::connection<Stream>::async_query(
std::string_view query_string,
CompletionToken&& token
)
@@ -117,7 +120,7 @@ mysql::connection<Stream>::async_query(
}
template <typename Stream>
mysql::prepared_statement<Stream> mysql::connection<Stream>::prepare_statement(
boost::mysql::prepared_statement<Stream> boost::mysql::connection<Stream>::prepare_statement(
std::string_view statement,
error_code& err,
error_info& info
@@ -131,7 +134,7 @@ mysql::prepared_statement<Stream> mysql::connection<Stream>::prepare_statement(
}
template <typename Stream>
mysql::prepared_statement<Stream> mysql::connection<Stream>::prepare_statement(
boost::mysql::prepared_statement<Stream> boost::mysql::connection<Stream>::prepare_statement(
std::string_view statement
)
{
@@ -145,7 +148,7 @@ mysql::prepared_statement<Stream> mysql::connection<Stream>::prepare_statement(
template <typename Stream>
template <typename CompletionToken>
auto mysql::connection<Stream>::async_prepare_statement(
auto boost::mysql::connection<Stream>::async_prepare_statement(
std::string_view statement,
CompletionToken&& token
)

View File

@@ -4,10 +4,8 @@
#include <boost/system/error_code.hpp>
#include <boost/system/system_error.hpp>
namespace boost
{
namespace system
{
namespace boost {
namespace system {
template <>
struct is_error_code_enum<mysql::Error>
@@ -16,13 +14,9 @@ struct is_error_code_enum<mysql::Error>
};
} // 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

View File

@@ -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
#endif

View File

@@ -8,7 +8,7 @@
template <typename Stream>
template <typename ForwardIterator>
void mysql::prepared_statement<Stream>::check_num_params(
void boost::mysql::prepared_statement<Stream>::check_num_params(
ForwardIterator first,
ForwardIterator last,
error_code& err,
@@ -27,7 +27,7 @@ void mysql::prepared_statement<Stream>::check_num_params(
template <typename Stream>
template <typename ForwardIterator>
mysql::resultset<Stream> mysql::prepared_statement<Stream>::execute(
boost::mysql::resultset<Stream> boost::mysql::prepared_statement<Stream>::execute(
ForwardIterator params_first,
ForwardIterator params_last,
error_code& err,
@@ -60,7 +60,7 @@ mysql::resultset<Stream> mysql::prepared_statement<Stream>::execute(
template <typename Stream>
template <typename ForwardIterator>
mysql::resultset<Stream> mysql::prepared_statement<Stream>::execute(
boost::mysql::resultset<Stream> boost::mysql::prepared_statement<Stream>::execute(
ForwardIterator params_first,
ForwardIterator params_last
) const
@@ -74,7 +74,7 @@ mysql::resultset<Stream> mysql::prepared_statement<Stream>::execute(
template <typename StreamType>
template <typename ForwardIterator, typename CompletionToken>
auto mysql::prepared_statement<StreamType>::async_execute(
auto boost::mysql::prepared_statement<StreamType>::async_execute(
ForwardIterator params_first,
ForwardIterator params_last,
CompletionToken&& token
@@ -110,7 +110,7 @@ auto mysql::prepared_statement<StreamType>::async_execute(
}
template <typename StreamType>
void mysql::prepared_statement<StreamType>::close(
void boost::mysql::prepared_statement<StreamType>::close(
error_code& errc,
error_info& info
)
@@ -122,7 +122,7 @@ void mysql::prepared_statement<StreamType>::close(
}
template <typename StreamType>
void mysql::prepared_statement<StreamType>::close()
void boost::mysql::prepared_statement<StreamType>::close()
{
assert(valid());
error_code errc;
@@ -133,7 +133,7 @@ void mysql::prepared_statement<StreamType>::close()
template <typename StreamType>
template <typename CompletionToken>
auto mysql::prepared_statement<StreamType>::async_close(
auto boost::mysql::prepared_statement<StreamType>::async_close(
CompletionToken&& token
)
{

View File

@@ -8,7 +8,7 @@
#include <boost/asio/yield.hpp>
template <typename StreamType>
const mysql::row* mysql::resultset<StreamType>::fetch_one(
const boost::mysql::row* boost::mysql::resultset<StreamType>::fetch_one(
error_code& err,
error_info& info
)
@@ -37,7 +37,7 @@ const mysql::row* mysql::resultset<StreamType>::fetch_one(
}
template <typename StreamType>
const mysql::row* mysql::resultset<StreamType>::fetch_one()
const boost::mysql::row* boost::mysql::resultset<StreamType>::fetch_one()
{
error_code errc;
error_info info;
@@ -47,7 +47,7 @@ const mysql::row* mysql::resultset<StreamType>::fetch_one()
}
template <typename StreamType>
std::vector<mysql::owning_row> mysql::resultset<StreamType>::fetch_many(
std::vector<boost::mysql::owning_row> boost::mysql::resultset<StreamType>::fetch_many(
std::size_t count,
error_code& err,
error_info& info
@@ -93,7 +93,7 @@ std::vector<mysql::owning_row> mysql::resultset<StreamType>::fetch_many(
}
template <typename StreamType>
std::vector<mysql::owning_row> mysql::resultset<StreamType>::fetch_many(
std::vector<boost::mysql::owning_row> boost::mysql::resultset<StreamType>::fetch_many(
std::size_t count
)
{
@@ -105,7 +105,7 @@ std::vector<mysql::owning_row> mysql::resultset<StreamType>::fetch_many(
}
template <typename StreamType>
std::vector<mysql::owning_row> mysql::resultset<StreamType>::fetch_all(
std::vector<boost::mysql::owning_row> boost::mysql::resultset<StreamType>::fetch_all(
error_code& err,
error_info& info
)
@@ -114,7 +114,7 @@ std::vector<mysql::owning_row> mysql::resultset<StreamType>::fetch_all(
}
template <typename StreamType>
std::vector<mysql::owning_row> mysql::resultset<StreamType>::fetch_all()
std::vector<boost::mysql::owning_row> boost::mysql::resultset<StreamType>::fetch_all()
{
return fetch_many(std::numeric_limits<std::size_t>::max());
}
@@ -123,9 +123,9 @@ template <typename StreamType>
template <typename CompletionToken>
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<StreamType>::async_fetch_one(
boost::mysql::resultset<StreamType>::async_fetch_one(
CompletionToken&& token
)
{
@@ -195,9 +195,9 @@ template <typename StreamType>
template <typename CompletionToken>
BOOST_ASIO_INITFN_RESULT_TYPE(
CompletionToken,
void(mysql::error_code, mysql::error_info, std::vector<mysql::owning_row>)
void(boost::mysql::error_code, boost::mysql::error_info, std::vector<boost::mysql::owning_row>)
)
mysql::resultset<StreamType>::async_fetch_many(
boost::mysql::resultset<StreamType>::async_fetch_many(
std::size_t count,
CompletionToken&& token
)
@@ -293,9 +293,9 @@ template <typename StreamType>
template <typename CompletionToken>
BOOST_ASIO_INITFN_RESULT_TYPE(
CompletionToken,
void(mysql::error_code, mysql::error_info, std::vector<mysql::owning_row>)
void(boost::mysql::error_code, boost::mysql::error_info, std::vector<boost::mysql::owning_row>)
)
mysql::resultset<StreamType>::async_fetch_all(
boost::mysql::resultset<StreamType>::async_fetch_all(
CompletionToken&& token
)
{

View File

@@ -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 << "<NULL>"; }
};
}
}
} // 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<value>& lhs,
const std::vector<value>& 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 <typename... Types>
std::array<mysql::value, sizeof...(Types)> mysql::make_values(
std::array<boost::mysql::value, sizeof...(Types)>
boost::mysql::make_values(
Types&&... args
)
{
return std::array<mysql::value, sizeof...(Types)>{value(std::forward<Types>(args))...};
return std::array<value, sizeof...(Types)>{value(std::forward<Types>(args))...};
}

View File

@@ -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"

View File

@@ -6,8 +6,8 @@
#include "boost/mysql/detail/protocol/messages.hpp"
#include <optional>
namespace mysql
{
namespace boost {
namespace mysql {
/// Convenience constant to use within prepared_statement::execute with statements without parameters.
constexpr std::array<value, 0> 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<boost::asio::ip::tcp::socket>;
}
} // mysql
} // boost
#include "boost/mysql/impl/prepared_statement.hpp"

View File

@@ -9,8 +9,8 @@
#include <boost/asio/ip/tcp.hpp>
#include <cassert>
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<boost::asio::ip::tcp::socket>;
}
} // mysql
} // boost
#include "boost/mysql/impl/resultset.hpp"

View File

@@ -7,8 +7,8 @@
#include "boost/mysql/detail/aux/container_equals.hpp"
#include <algorithm>
namespace mysql
{
namespace boost {
namespace mysql {
/**
* \brief Represents a row returned from a query.
@@ -98,7 +98,8 @@ inline bool operator!=(const std::vector<RowTypeLeft>& lhs, const std::vector<Ro
return !(lhs == rhs);
}
}
} // mysql
} // boost

View File

@@ -10,8 +10,8 @@
#include <array>
#include <vector>
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 <typename... Types>
std::array<value, sizeof...(Types)> make_values(Types&&... args);
}
} // mysql
} // boost
#include "boost/mysql/impl/value.hpp"

View File

@@ -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 <std::size_t N>
@@ -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<TypeErasedValue> default_construct() const override
{
return std::make_shared<TypeErasedValueImpl<T>>(T{});
@@ -310,8 +309,9 @@ TEST_P(DeserializeErrorTest, Deserialize_ErrorCondition_ReturnsErrorCode)
}
}
}
} // detail
} // mysql
} // boost
#endif /* TEST_SERIALIZATION_TEST_COMMON_HPP_ */

View File

@@ -11,10 +11,9 @@
#include <type_traits>
#include <ostream>
namespace mysql
{
namespace test
{
namespace boost {
namespace mysql {
namespace test {
template <typename... Types>
std::vector<value> makevalues(Types&&... args)
@@ -131,8 +130,9 @@ constexpr auto test_name_generator = [](const auto& param_info) {
return res;
};
}
}
} // test
} // mysql
} // boost

View File

@@ -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);

View File

@@ -12,12 +12,14 @@
#include <unordered_map>
#include <bitset>
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<const mysql::row&>(rows[0]), expected_row); // make gtest pick operator<<
EXPECT_EQ(static_cast<const row&>(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<const mysql::row&>(rows[0]), expected_row); // make gtest pick operator<<
EXPECT_EQ(static_cast<const row&>(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<const mysql::row&>(rows[0]), expected_row); // make gtest pick operator<<
EXPECT_EQ(static_cast<const row&>(rows[0]), expected_row); // make gtest pick operator<<
}
using flagsvec = std::vector<meta_validator::flag_getter>;
@@ -305,7 +307,7 @@ std::chrono::microseconds round_micros(std::chrono::microseconds input, int deci
return std::chrono::microseconds(round_micros(static_cast<int>(input.count()), decimals));
}
std::pair<std::string, mysql::datetime> datetime_from_id(std::bitset<4> id, int decimals)
std::pair<std::string, datetime> 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<std::string, mysql::datetime> 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<std::string, mysql::datetime> 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<field_type, const char*> 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<std::string, mysql::time> time_from_id(std::bitset<6> id, int decimals)
std::pair<std::string, boost::mysql::time> 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<std::string, mysql::time> 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<std::string, mysql::time> time_from_id(std::bitset<6> id, int decimals
// shared between DATETIME and TIMESTAMP
std::vector<database_types_testcase> generate_common_datetime_cases(
mysql::field_type type
field_type type
)
{
std::vector<database_types_testcase> res;

View File

@@ -8,13 +8,13 @@
#include "integration_test_common.hpp"
#include <forward_list>
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());
}

View File

@@ -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);

View File

@@ -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_ */

View File

@@ -8,10 +8,10 @@
#include "metadata_validator.hpp"
#include <gtest/gtest.h>
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<field_metadata>& actual,
const std::vector<meta_validator>& expected
)

View File

@@ -4,10 +4,9 @@
#include "boost/mysql/metadata.hpp"
#include <vector>
namespace mysql
{
namespace test
{
namespace boost {
namespace mysql {
namespace test {
class meta_validator
{
@@ -46,8 +45,9 @@ private:
void validate_meta(const std::vector<field_metadata>& actual, const std::vector<meta_validator>& expected);
}
}
} // test
} // mysql
} // boost

View File

@@ -1,14 +1,17 @@
#include "network_functions.hpp"
#include <future>
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<no_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<tcp_resultset> execute_statement(
tcp_prepared_statement& stmt,
const std::vector<mysql::value>& values
const std::vector<value>& values
) override
{
return impl([&stmt, &values](error_code& err, error_info& info) {
@@ -82,7 +85,7 @@ public:
return no_result();
});
}
network_result<const mysql::row*> fetch_one(
network_result<const row*> fetch_one(
tcp_resultset& r
) override
{
@@ -90,7 +93,7 @@ public:
return r.fetch_one(errc, info);
});
}
network_result<std::vector<mysql::owning_row>> fetch_many(
network_result<std::vector<owning_row>> fetch_many(
tcp_resultset& r,
std::size_t count
) override
@@ -99,7 +102,7 @@ public:
return r.fetch_many(count, errc, info);
});
}
network_result<std::vector<mysql::owning_row>> fetch_all(
network_result<std::vector<owning_row>> fetch_all(
tcp_resultset& r
) override
{
@@ -130,7 +133,7 @@ public:
const char* name() const override { return "sync_exc"; }
network_result<no_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<tcp_resultset> execute_statement(
tcp_prepared_statement& stmt,
const std::vector<mysql::value>& values
const std::vector<value>& values
) override
{
return impl([&stmt, &values] {
@@ -184,7 +187,7 @@ public:
return no_result();
});
}
network_result<const mysql::row*> fetch_one(
network_result<const row*> fetch_one(
tcp_resultset& r
) override
{
@@ -192,7 +195,7 @@ public:
return r.fetch_one();
});
}
network_result<std::vector<mysql::owning_row>> fetch_many(
network_result<std::vector<owning_row>> fetch_many(
tcp_resultset& r,
std::size_t count
) override
@@ -201,7 +204,7 @@ public:
return r.fetch_many(count);
});
}
network_result<std::vector<mysql::owning_row>> fetch_all(
network_result<std::vector<owning_row>> fetch_all(
tcp_resultset& r
) override
{
@@ -234,7 +237,7 @@ public:
const char* name() const override { return "async"; }
network_result<no_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<tcp_resultset> execute_statement(
tcp_prepared_statement& stmt,
const std::vector<mysql::value>& values
const std::vector<value>& values
) override
{
return impl<tcp_resultset>([&](auto&& token) {
@@ -286,28 +289,28 @@ public:
return stmt.async_close(std::forward<decltype(token)>(token));
});
}
network_result<const mysql::row*> fetch_one(
network_result<const row*> fetch_one(
tcp_resultset& r
) override
{
return impl<const mysql::row*>([&](auto&& token) {
return impl<const row*>([&](auto&& token) {
return r.async_fetch_one(std::forward<decltype(token)>(token));
});
}
network_result<std::vector<mysql::owning_row>> fetch_many(
network_result<std::vector<owning_row>> fetch_many(
tcp_resultset& r,
std::size_t count
) override
{
return impl<std::vector<mysql::owning_row>>([&](auto&& token) {
return impl<std::vector<owning_row>>([&](auto&& token) {
return r.async_fetch_many(count, std::forward<decltype(token)>(token));
});
}
network_result<std::vector<mysql::owning_row>> fetch_all(
network_result<std::vector<owning_row>> fetch_all(
tcp_resultset& r
) override
{
return impl<std::vector<mysql::owning_row>>([&](auto&& token) {
return impl<std::vector<owning_row>>([&](auto&& token) {
return r.async_fetch_all(std::forward<decltype(token)>(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;

View File

@@ -6,10 +6,9 @@
#include <gtest/gtest.h>
#include <forward_list>
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

View File

@@ -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
{

View File

@@ -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
{

View File

@@ -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());
}

View File

@@ -8,15 +8,14 @@
#include "integration_test_common.hpp"
#include <boost/asio/use_future.hpp>
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);
}
};

View File

@@ -9,7 +9,7 @@
#include <gtest/gtest.h>
#include <array>
using namespace mysql::detail;
using namespace boost::mysql::detail;
using namespace testing;
namespace

View File

@@ -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<mysql::field_metadata> make_meta(
std::vector<boost::mysql::field_metadata> make_meta(
const std::vector<protocol_field_type>& types
)
{
std::vector<mysql::field_metadata> res;
std::vector<boost::mysql::field_metadata> 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());

View File

@@ -8,7 +8,7 @@
#include "boost/mysql/detail/protocol/capabilities.hpp"
#include <gtest/gtest.h>
using namespace mysql::detail;
using namespace boost::mysql::detail;
using namespace testing;
TEST(Capabilities, Has_BitSet_ReturnsTrue)

View File

@@ -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<uint8_t>& lhs, const std::vector<uint8_t>& 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 <typename MutableBufferSequence>
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 <typename ConstBufferSequence>
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<MockStream>>;
NiceMock<MockStream> 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<uint8_t>& 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)

View File

@@ -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
{

View File

@@ -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
{

View File

@@ -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<std::uint8_t>(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<mysql::field_metadata> meta {
std::vector<boost::mysql::field_metadata> meta {
column_definition_packet {
string_lenenc("def"),
string_lenenc("awesome"),

View File

@@ -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)
{

View File

@@ -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());

View File

@@ -9,14 +9,14 @@
#include "boost/mysql/prepared_statement.hpp"
#include <boost/asio/ip/tcp.hpp>
using namespace mysql::detail;
using namespace boost::mysql::detail;
namespace
{
using stream_type = boost::asio::ip::tcp::socket;
using channel_type = mysql::detail::channel<stream_type>;
using stmt_type = mysql::prepared_statement<stream_type>;
using channel_type = channel<stream_type>;
using stmt_type = boost::mysql::prepared_statement<stream_type>;
struct PreparedStatementTest : public testing::Test
{

View File

@@ -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
{

View File

@@ -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<mysql::value> values = makevalues(
std::vector<value> 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<mysql::value> values_copy = values;
std::vector<mysql::value> other_values = makevalues(
std::vector<value> values_copy = values;
std::vector<value> 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 <typename T>
@@ -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"),