mirror of
https://github.com/boostorg/mysql.git
synced 2026-02-18 02:02:17 +00:00
Changes to make code build with g++ release
This commit is contained in:
@@ -53,7 +53,7 @@ void main_impl(int argc, char** argv)
|
||||
*/
|
||||
assert(result.fields().size() == 2);
|
||||
|
||||
const mysql::field_metadata& company_name = result.fields()[0];
|
||||
[[maybe_unused]] const 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
|
||||
@@ -64,7 +64,7 @@ void main_impl(int argc, char** argv)
|
||||
assert(!company_name.is_auto_increment()); // field is not AUTO_INCREMENT
|
||||
assert(company_name.is_not_null()); // field may not be NULL
|
||||
|
||||
const mysql::field_metadata& employee_id = result.fields()[1];
|
||||
[[maybe_unused]] const 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
|
||||
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
void update_slacker()
|
||||
{
|
||||
const char* sql = "UPDATE employee SET salary = 15000 WHERE last_name = 'Slacker'";
|
||||
connection.async_query(sql, [this](const mysql::error_code& err, mysql::tcp_resultset&& result) {
|
||||
connection.async_query(sql, [this](const mysql::error_code& err, [[maybe_unused]] mysql::tcp_resultset&& result) {
|
||||
die_on_error(err);
|
||||
assert(result.fields().size() == 0);
|
||||
query_intern();
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
resultset.async_fetch_all([](const mysql::error_code& err, const auto& rows) {
|
||||
die_on_error(err);
|
||||
assert(rows.size() == 1);
|
||||
auto salary = std::get<double>(rows[0].values()[0]);
|
||||
[[maybe_unused]] auto salary = std::get<double>(rows[0].values()[0]);
|
||||
assert(salary == 15000);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -99,7 +99,7 @@ void main_impl(int argc, char** argv)
|
||||
result = conn.query("SELECT salary FROM employee WHERE first_name = 'Underpaid'");
|
||||
auto rows = result.fetch_all();
|
||||
assert(rows.size() == 1);
|
||||
auto salary = std::get<double>(rows[0].values()[0]);
|
||||
[[maybe_unused]] auto salary = std::get<double>(rows[0].values()[0]);
|
||||
assert(salary == 10000);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,9 +24,8 @@ inline error_code deserialize_handshake(
|
||||
handshake_packet& output
|
||||
)
|
||||
{
|
||||
std::uint8_t msg_type;
|
||||
DeserializationContext ctx (boost::asio::buffer(buffer), capabilities());
|
||||
auto err = deserialize_message_type(msg_type, ctx);
|
||||
auto [err, msg_type] = deserialize_message_type(ctx);
|
||||
if (err) return err;
|
||||
if (msg_type == handshake_protocol_version_9)
|
||||
{
|
||||
@@ -163,9 +162,8 @@ public:
|
||||
bool& auth_complete
|
||||
)
|
||||
{
|
||||
std::uint8_t msg_type;
|
||||
DeserializationContext ctx (boost::asio::buffer(buffer), negotiated_caps_);
|
||||
auto err = deserialize_message_type(msg_type, ctx);
|
||||
auto [err, msg_type] = deserialize_message_type(ctx);
|
||||
if (err) return err;
|
||||
if (msg_type == ok_packet_header)
|
||||
{
|
||||
@@ -206,8 +204,7 @@ public:
|
||||
)
|
||||
{
|
||||
DeserializationContext ctx (boost::asio::buffer(buffer), negotiated_caps_);
|
||||
std::uint8_t msg_type;
|
||||
auto err = deserialize_message_type(msg_type, ctx);
|
||||
auto [err, msg_type] = deserialize_message_type(ctx);
|
||||
if (err) return err;
|
||||
if (msg_type == error_packet_header)
|
||||
{
|
||||
|
||||
@@ -228,8 +228,7 @@ error_code deserialize_message(
|
||||
DeserializationContext& ctx
|
||||
);
|
||||
|
||||
inline error_code deserialize_message_type(
|
||||
std::uint8_t& output,
|
||||
inline std::pair<error_code, std::uint8_t> deserialize_message_type(
|
||||
DeserializationContext& ctx
|
||||
);
|
||||
|
||||
|
||||
@@ -194,16 +194,22 @@ mysql::error_code mysql::detail::deserialize_message(
|
||||
}
|
||||
|
||||
|
||||
inline mysql::error_code mysql::detail::deserialize_message_type(
|
||||
std::uint8_t& output,
|
||||
inline std::pair<mysql::error_code, std::uint8_t> mysql::detail::deserialize_message_type(
|
||||
DeserializationContext& ctx
|
||||
)
|
||||
{
|
||||
int1 msg_type;
|
||||
std::pair<mysql::error_code, std::uint8_t> res {};
|
||||
auto err = deserialize(msg_type, ctx);
|
||||
if (err != Error::ok) return make_error_code(err);
|
||||
output = msg_type.value;
|
||||
return error_code();
|
||||
if (err == Error::ok)
|
||||
{
|
||||
res.second = msg_type.value;
|
||||
}
|
||||
else
|
||||
{
|
||||
res.first = make_error_code(err);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
inline mysql::error_code mysql::detail::process_error_packet(
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
// a length-encoded int containing the field count
|
||||
DeserializationContext ctx (boost::asio::buffer(buffer_), channel_.current_capabilities());
|
||||
std::uint8_t msg_type;
|
||||
err = deserialize_message_type(msg_type, ctx);
|
||||
std::tie(err, msg_type) = deserialize_message_type(ctx);
|
||||
if (err) return {};
|
||||
if (msg_type == ok_packet_header)
|
||||
{
|
||||
@@ -122,7 +122,7 @@ inline fetch_result process_fetch_message(
|
||||
// Message type: row, error or eof?
|
||||
std::uint8_t msg_type;
|
||||
DeserializationContext ctx (boost::asio::buffer(buffer), current_capabilities);
|
||||
err = deserialize_message_type(msg_type, ctx);
|
||||
std::tie(err, msg_type) = deserialize_message_type(ctx);
|
||||
if (err) return fetch_result::error;
|
||||
if (msg_type == eof_packet_header)
|
||||
{
|
||||
|
||||
@@ -124,8 +124,7 @@ public:
|
||||
}
|
||||
std::shared_ptr<TypeErasedValue> default_construct() const override
|
||||
{
|
||||
T res; // intentionally not value-initializing it
|
||||
return std::make_shared<TypeErasedValueImpl<T>>(res);
|
||||
return std::make_shared<TypeErasedValueImpl<T>>(T{});
|
||||
}
|
||||
bool equals(const TypeErasedValue& rhs) const override
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user