26#ifndef MYSQL_ROUTER_CLASSIC_PROTOCOL_CODEC_MESSAGE_H_
27#define MYSQL_ROUTER_CLASSIC_PROTOCOL_CODEC_MESSAGE_H_
32#include <system_error>
81template <
bool Borrowed>
84 Codec<borrowable::message::server::Greeting<Borrowed>>> {
85 template <
class Accumulator>
87 namespace bw = borrowable::wire;
89 if (v_.protocol_version() == 0x09) {
90 return accu.step(bw::FixedInt<1>(v_.protocol_version()))
91 .step(bw::NulTermString<Borrowed>(v_.version()))
92 .step(bw::FixedInt<4>(v_.connection_id()))
93 .step(bw::NulTermString<Borrowed>(v_.auth_method_data().substr(0, 8)))
96 uint8_t auth_method_data_size{0};
98 auth_method_data_size = v_.auth_method_data().size();
101 accu.step(bw::FixedInt<1>(v_.protocol_version()))
102 .step(bw::NulTermString<Borrowed>(v_.version()))
103 .step(bw::FixedInt<4>(v_.connection_id()))
104 .step(bw::NulTermString<Borrowed>(v_.auth_method_data().substr(0, 8)))
105 .step(bw::FixedInt<2>(v_.capabilities().to_ulong() & 0xffff));
107 if ((v_.capabilities().to_ullong() >= (1 << 16)) ||
108 v_.status_flags().any() || (v_.collation() != 0)) {
109 accu.step(bw::FixedInt<1>(v_.collation()))
110 .step(bw::FixedInt<2>(v_.status_flags().to_ulong()))
112 bw::FixedInt<2>((v_.capabilities().to_ulong() >> 16) & 0xffff))
113 .step(bw::FixedInt<1>(auth_method_data_size))
114 .step(bw::String<Borrowed>(std::string(10,
'\0')));
115 if (v_.capabilities()
117 accu.step(bw::String<Borrowed>(v_.auth_method_data().substr(8)));
118 if (v_.capabilities()
120 accu.step(bw::NulTermString<Borrowed>(v_.auth_method_name()));
124 return accu.result();
129 using value_type = borrowable::message::server::Greeting<Borrowed>;
141 namespace bw = borrowable::wire;
144 auto protocol_version_res = accu.template step<bw::FixedInt<1>>();
147 if (protocol_version_res->value() != 0x09 &&
148 protocol_version_res->value() != 0x0a) {
152 auto version_res = accu.template step<bw::NulTermString<Borrowed>>();
153 auto connection_id_res = accu.template step<bw::FixedInt<4>>();
154 auto auth_method_data_res =
155 accu.template step<bw::NulTermString<Borrowed>>();
157 if (protocol_version_res->value() == 0x09) {
158 return std::make_pair(
160 value_type(protocol_version_res->value(), version_res->value(),
161 connection_id_res->value(), auth_method_data_res->value(),
166 auto cap_lower_res = accu.template step<bw::FixedInt<2>>();
171 return std::make_pair(
173 value_type(protocol_version_res->value(), version_res->value(),
174 connection_id_res->value(),
175 auth_method_data_res->value(), cap_lower_res->value(),
180 auto collation_res = accu.template step<bw::FixedInt<1>>();
181 auto status_flags_res = accu.template step<bw::FixedInt<2>>();
182 auto cap_hi_res = accu.template step<bw::FixedInt<2>>();
188 cap_lower_res->value() | (cap_hi_res->value() << 16));
190 size_t auth_method_data_len{13};
192 auto auth_method_data_len_res = accu.template step<bw::FixedInt<1>>();
196 if (auth_method_data_len_res->value() < 8) {
199 auth_method_data_len = auth_method_data_len_res->value() - 8;
201 accu.template step<void>(1);
204 accu.template step<void>(10);
207 auth_method_data_2_res;
213 auth_method_data_2_res =
214 accu.template step<bw::String<Borrowed>>(auth_method_data_len);
218 auth_method_res = accu.template step<bw::NulTermString<Borrowed>>();
224 return std::make_pair(
227 protocol_version_res->value(), version_res->value(),
228 connection_id_res->value(),
229 auth_method_data_res->value() + auth_method_data_2_res->
value(),
230 capabilities, collation_res->value(), status_flags_res->value(),
231 auth_method_res->
value()));
242template <
bool Borrowed>
245 Codec<borrowable::message::server::AuthMethodSwitch<Borrowed>>> {
246 template <
class Accumulator>
248 namespace bw = borrowable::wire;
250 accu.step(bw::FixedInt<1>(cmd_byte()));
253 accu.step(bw::NulTermString<Borrowed>(v_.auth_method()))
254 .step(bw::String<Borrowed>(v_.auth_method_data()));
257 return accu.result();
261 using value_type = borrowable::message::server::AuthMethodSwitch<Borrowed>;
269 static constexpr uint8_t
cmd_byte() noexcept {
return 0xfe; }
282 namespace bw = borrowable::wire;
285 auto cmd_byte_res = accu.template step<bw::FixedInt<1>>();
288 if (cmd_byte_res->value() != cmd_byte()) {
296 auto auth_method_res = accu.template step<bw::NulTermString<Borrowed>>();
297 auto auth_method_data_res = accu.template step<bw::String<Borrowed>>();
301 return std::make_pair(
303 value_type(auth_method_res->value(), auth_method_data_res->value()));
313template <
bool Borrowed>
316 Codec<borrowable::message::server::AuthMethodData<Borrowed>>> {
317 template <
class Accumulator>
319 namespace bw = borrowable::wire;
321 return accu.step(bw::FixedInt<1>(cmd_byte()))
322 .step(bw::String<Borrowed>(v_.auth_method_data()))
327 using value_type = borrowable::message::server::AuthMethodData<Borrowed>;
335 static constexpr uint8_t
cmd_byte() noexcept {
return 0x01; }
348 namespace bw = borrowable::wire;
350 auto cmd_byte_res = accu.template step<bw::FixedInt<1>>();
353 if (cmd_byte_res->value() != cmd_byte()) {
356 auto auth_method_data_res = accu.template step<bw::String<Borrowed>>();
371template <
bool Borrowed>
374 Codec<borrowable::message::server::Ok<Borrowed>>> {
375 template <
class Accumulator>
377 namespace bw = borrowable::wire;
379 accu.step(bw::FixedInt<1>(cmd_byte()))
385 accu.step(bw::FixedInt<2>(v_.status_flags().to_ulong()));
387 accu.step(bw::FixedInt<2>(v_.warning_count()));
392 accu.step(bw::VarString<Borrowed>(v_.message()));
394 accu.step(bw::VarString<Borrowed>(v_.session_changes()));
397 accu.step(bw::String<Borrowed>(v_.message()));
400 return accu.result();
404 using value_type = borrowable::message::server::Ok<Borrowed>;
412 static constexpr uint8_t
cmd_byte() noexcept {
return 0x00; }
441 namespace bw = borrowable::wire;
443 auto cmd_byte_res = accu.template step<bw::FixedInt<1>>();
446 if (cmd_byte_res->value() != cmd_byte()) {
450 auto affected_rows_res = accu.template step<bw::VarInt>();
451 auto last_insert_id_res = accu.template step<bw::VarInt>();
457 status_flags_res = accu.template step<bw::FixedInt<2>>();
459 warning_count_res = accu.template step<bw::FixedInt<2>>();
468 const auto var_message_res =
469 accu.template try_step<bw::VarString<Borrowed>>();
470 if (var_message_res) {
472 message_res = var_message_res.
value();
475 if (status_flags_res->
value() &
477 session_changes_res = accu.template step<bw::VarString<Borrowed>>();
480 message_res = accu.template step<bw::String<Borrowed>>();
485 return std::make_pair(
487 value_type(affected_rows_res->value(), last_insert_id_res->value(),
488 status_flags_res->
value(), warning_count_res->
value(),
489 message_res->
value(), session_changes_res->
value()));
514template <
bool Borrowed>
517 Codec<borrowable::message::server::Eof<Borrowed>>> {
518 template <
class Accumulator>
520 namespace bw = borrowable::wire;
522 accu.step(bw::FixedInt<1>(cmd_byte()));
524 auto shared_caps = this->caps();
526 if (shared_caps.test(
533 accu.step(bw::FixedInt<2>(v_.status_flags().to_ulong()));
535 accu.step(bw::FixedInt<2>(v_.warning_count()));
540 if (!v_.message().empty() ||
544 accu.step(bw::VarString<Borrowed>(v_.message()));
546 accu.step(bw::VarString<Borrowed>(v_.session_changes()));
550 accu.step(bw::String<Borrowed>(v_.message()));
553 accu.step(bw::FixedInt<2>(v_.warning_count()))
554 .step(bw::FixedInt<2>(v_.status_flags().to_ulong()));
557 return accu.result();
561 using value_type = borrowable::message::server::Eof<Borrowed>;
569 static constexpr uint8_t
cmd_byte() noexcept {
return 0xfe; }
603 namespace bw = borrowable::wire;
605 const auto cmd_byte_res = accu.template step<bw::FixedInt<1>>();
608 if (cmd_byte_res->value() != cmd_byte()) {
613 const auto affected_rows_res = accu.template step<bw::VarInt>();
614 const auto last_insert_id_res = accu.template step<bw::VarInt>();
620 status_flags_res = accu.template step<bw::FixedInt<2>>();
622 warning_count_res = accu.template step<bw::FixedInt<2>>();
628 session_state_info_res;
632 const auto var_message_res =
633 accu.template try_step<bw::VarString<Borrowed>>();
634 if (var_message_res) {
636 message_res = var_message_res.
value();
639 if (status_flags_res->
value() &
641 session_state_info_res =
642 accu.template step<bw::VarString<Borrowed>>();
645 message_res = accu.template step<bw::String<Borrowed>>();
650 return std::make_pair(
652 value_type(affected_rows_res->value(), last_insert_id_res->value(),
653 status_flags_res->
value(), warning_count_res->
value(),
654 message_res->
value(), session_state_info_res->
value()));
656 const auto warning_count_res = accu.template step<bw::FixedInt<2>>();
657 const auto status_flags_res = accu.template step<bw::FixedInt<2>>();
659 return std::make_pair(
661 value_type(status_flags_res->value(), warning_count_res->value()));
695template <
bool Borrowed>
698 Codec<borrowable::message::server::Error<Borrowed>>> {
699 template <
class Accumulator>
701 namespace bw = borrowable::wire;
703 accu.step(bw::FixedInt<1>(cmd_byte()))
704 .step(bw::FixedInt<2>(v_.error_code()));
706 accu.step(bw::FixedInt<1>(
'#'))
707 .step(bw::String<Borrowed>(v_.sql_state()));
710 return accu.step(bw::String<Borrowed>(v_.message())).result();
714 using value_type = borrowable::message::server::Error<Borrowed>;
722 static constexpr uint8_t
cmd_byte() {
return 0xff; }
732 return std::numeric_limits<size_t>::max();
739 namespace bw = borrowable::wire;
741 auto cmd_byte_res = accu.template step<bw::FixedInt<1>>();
744 if (cmd_byte_res->value() != cmd_byte()) {
749 auto error_code_res = accu.template step<bw::FixedInt<2>>();
752 auto sql_state_hash_res = accu.template step<bw::FixedInt<1>>();
753 if (!sql_state_hash_res) {
756 sql_state_res = accu.template step<bw::String<Borrowed>>(5);
758 auto message_res = accu.template step<bw::String<Borrowed>>();
762 return std::make_pair(
764 value_type(error_code_res->value(), message_res->value(),
765 sql_state_res->value()));
777 :
public impl::EncodeBase<Codec<borrowable::message::server::ColumnCount>> {
778 template <
class Accumulator>
780 namespace bw = borrowable::wire;
782 return accu.step(
bw::VarInt(v_.count())).result();
795 return std::numeric_limits<size_t>::max();
802 namespace bw = borrowable::wire;
804 auto count_res = accu.template step<bw::VarInt>();
821template <
bool Borrowed>
824 Codec<borrowable::message::server::ColumnMeta<Borrowed>>> {
825 template <
class Accumulator>
827 namespace bw = borrowable::wire;
830 accu.step(bw::VarString<Borrowed>(v_.table()))
831 .step(bw::VarString<Borrowed>(v_.name()))
833 .step(bw::FixedInt<3>(v_.column_length()))
835 .step(bw::FixedInt<1>(v_.type()));
839 .step(bw::FixedInt<2>(v_.flags().to_ulong()))
840 .step(bw::FixedInt<1>(v_.decimals()));
843 .step(bw::FixedInt<1>(v_.flags().to_ulong()))
844 .step(bw::FixedInt<1>(v_.decimals()));
847 return accu.result();
849 return accu.step(bw::VarString<Borrowed>(v_.catalog()))
850 .step(bw::VarString<Borrowed>(v_.schema()))
851 .step(bw::VarString<Borrowed>(v_.table()))
852 .step(bw::VarString<Borrowed>(v_.orig_table()))
853 .step(bw::VarString<Borrowed>(v_.name()))
854 .step(bw::VarString<Borrowed>(v_.orig_name()))
856 .step(bw::FixedInt<2>(v_.collation()))
857 .step(bw::FixedInt<4>(v_.column_length()))
858 .step(bw::FixedInt<1>(v_.type()))
859 .step(bw::FixedInt<2>(v_.flags().to_ulong()))
860 .step(bw::FixedInt<1>(v_.decimals()))
861 .step(bw::FixedInt<2>(0))
867 using value_type = borrowable::message::server::ColumnMeta<Borrowed>;
876 return std::numeric_limits<size_t>::max();
883 namespace bw = borrowable::wire;
891 const auto table_res = accu.template step<bw::VarString<Borrowed>>();
892 const auto name_res = accu.template step<bw::VarString<Borrowed>>();
894 const auto column_length_len_res = accu.template step<bw::VarInt>();
897 if (column_length_len_res->value() != 3) {
901 const auto column_length_res = accu.template step<bw::FixedInt<3>>();
902 const auto type_len_res = accu.template step<bw::VarInt>();
905 if (type_len_res->value() != 1) {
909 const auto type_res = accu.template step<bw::FixedInt<1>>();
910 const auto flags_and_decimals_len_res = accu.template step<bw::VarInt>();
913 if (flags_and_decimals_len_res->value() != flags_size + 1) {
919 if (flags_size == 2) {
920 flags_and_decimals_res = accu.template step<bw::FixedInt<3>>();
922 const auto small_flags_and_decimals_res =
923 accu.template step<bw::FixedInt<2>>();
924 if (small_flags_and_decimals_res) {
925 flags_and_decimals_res =
926 bw::FixedInt<3>(small_flags_and_decimals_res->value());
932 const uint16_t
flags =
933 flags_and_decimals_res->
value() & ((1 << (flags_size * 8)) - 1);
934 const uint8_t decimals =
935 flags_and_decimals_res->
value() >> (flags_size * 8);
937 return std::make_pair(
939 value_type({}, {}, table_res->value(), {}, name_res->value(), {}, {},
940 column_length_res->value(), type_res->value(),
flags,
943 const auto catalog_res = accu.template step<bw::VarString<Borrowed>>();
944 const auto schema_res = accu.template step<bw::VarString<Borrowed>>();
945 const auto table_res = accu.template step<bw::VarString<Borrowed>>();
946 const auto orig_table_res = accu.template step<bw::VarString<Borrowed>>();
947 const auto name_res = accu.template step<bw::VarString<Borrowed>>();
948 const auto orig_name_res = accu.template step<bw::VarString<Borrowed>>();
952 const auto other_len_res = accu.template step<bw::VarInt>();
954 if (other_len_res->value() != 12) {
958 const auto collation_res = accu.template step<bw::FixedInt<2>>();
959 const auto column_length_res = accu.template step<bw::FixedInt<4>>();
960 const auto type_res = accu.template step<bw::FixedInt<1>>();
961 const auto flags_res = accu.template step<bw::FixedInt<2>>();
962 const auto decimals_res = accu.template step<bw::FixedInt<1>>();
964 accu.template step<void>(2);
968 return std::make_pair(
970 value_type(catalog_res->value(), schema_res->value(),
971 table_res->value(), orig_table_res->value(),
972 name_res->value(), orig_name_res->value(),
973 collation_res->value(), column_length_res->value(),
974 type_res->value(), flags_res->value(),
975 decimals_res->value()));
992template <
bool Borrowed>
995 Codec<borrowable::message::server::SendFileRequest<Borrowed>>> {
996 template <
class Accumulator>
998 namespace bw = borrowable::wire;
1000 return accu.step(bw::FixedInt<1>(cmd_byte()))
1001 .step(bw::String<Borrowed>(v_.filename()))
1006 using value_type = borrowable::message::server::SendFileRequest<Borrowed>;
1014 static constexpr uint8_t
cmd_byte() noexcept {
return 0xfb; }
1027 namespace bw = borrowable::wire;
1029 auto cmd_byte_res = accu.template step<bw::FixedInt<1>>();
1032 if (cmd_byte_res->value() != cmd_byte()) {
1036 auto filename_res = accu.template step<bw::String<Borrowed>>();
1068 Codec<borrowable::message::server::StmtPrepareOk>> {
1069 template <
class Accumulator>
1071 namespace bw = borrowable::wire;
1073 accu.step(bw::FixedInt<1>(cmd_byte()))
1074 .step(bw::FixedInt<4>(v_.statement_id()))
1075 .step(bw::FixedInt<2>(v_.column_count()))
1076 .step(bw::FixedInt<2>(v_.param_count()))
1077 .step(bw::FixedInt<1>(0))
1078 .step(bw::FixedInt<2>(v_.warning_count()));
1081 accu.step(bw::FixedInt<1>(v_.with_metadata()));
1084 return accu.result();
1096 constexpr static uint8_t
cmd_byte() noexcept {
return 0x00; }
1109 namespace bw = borrowable::wire;
1111 auto cmd_byte_res = accu.template step<bw::FixedInt<1>>();
1113 auto stmt_id_res = accu.template step<bw::FixedInt<4>>();
1114 auto column_count_res = accu.template step<bw::FixedInt<2>>();
1115 auto param_count_res = accu.template step<bw::FixedInt<2>>();
1116 auto filler_res = accu.template step<bw::FixedInt<1>>();
1118 auto warning_count_res = accu.template step<bw::FixedInt<2>>();
1121 int8_t with_metadata{1};
1123 auto with_metadata_res = accu.template step<bw::FixedInt<1>>();
1125 if (with_metadata_res) {
1126 with_metadata = with_metadata_res->value();
1132 return std::make_pair(
1134 value_type(stmt_id_res->value(), column_count_res->value(),
1135 param_count_res->value(), warning_count_res->value(),
1146template <
bool Borrowed>
1149 Codec<borrowable::message::server::Row<Borrowed>>> {
1150 template <
class Accumulator>
1152 namespace bw = borrowable::wire;
1154 for (
const auto &field : v_) {
1156 accu.step(bw::VarString<Borrowed>(*field));
1162 return accu.result();
1175 return std::numeric_limits<size_t>::max();
1182 namespace bw = borrowable::wire;
1184 std::vector<typename value_type::value_type> fields;
1190 auto null_res = accu.template try_step<bw::Null>();
1192 fields.emplace_back(std::nullopt);
1194 auto field_res = accu.template step<bw::VarString<Borrowed>>();
1197 fields.emplace_back(field_res->value());
1224template <
bool Borrowed>
1227 Codec<borrowable::message::server::StmtRow<Borrowed>>> {
1228 template <
class Accumulator>
1230 namespace bw = borrowable::wire;
1232 accu.step(bw::FixedInt<1>(0));
1236 uint8_t null_bit_byte{};
1238 for (
auto const &field : v_) {
1239 if (!field) null_bit_byte |= (1 << bit_pos);
1241 if (++bit_pos > 7) {
1242 accu.step(bw::FixedInt<1>(null_bit_byte));
1249 if (bit_pos != 0) accu.step(bw::FixedInt<1>(null_bit_byte));
1252 if (!field)
continue;
1254 switch (v_.types()[
n]) {
1274 accu.step(bw::FixedInt<1>(field->size()));
1290 return accu.result();
1294 using value_type = borrowable::message::server::StmtRow<Borrowed>;
1303 return std::numeric_limits<size_t>::max();
1308 std::vector<field_type::value_type> types) {
1309 namespace bw = borrowable::wire;
1313 const auto row_byte_res = accu.template step<bw::FixedInt<1>>();
1317 if (row_byte_res->value() != 0x00) {
1321 const auto nullbits_res =
1322 accu.template step<bw::String<Borrowed>>(
bytes_per_bits(types.size()));
1325 const auto nullbits = nullbits_res->value();
1327 std::vector<typename value_type::value_type> values;
1329 for (
size_t n{}, bit_pos{2}, byte_pos{};
n < types.size(); ++
n, ++bit_pos) {
1335 if (!(nullbits[byte_pos] & (1 << bit_pos))) {
1352 auto string_field_size_res = accu.template step<bw::VarInt>();
1355 field_size_res = string_field_size_res->
value();
1361 auto time_field_size_res = accu.template step<bw::FixedInt<1>>();
1364 field_size_res = time_field_size_res->
value();
1384 if (!field_size_res) {
1389 const auto value_res =
1390 accu.template step<bw::String<Borrowed>>(field_size_res.
value());
1393 values.push_back(value_res->value());
1395 values.emplace_back(std::nullopt);
1411template <
bool Borrowed>
1414 Codec<borrowable::message::server::Statistics<Borrowed>>> {
1415 template <
class Accumulator>
1417 namespace bw = borrowable::wire;
1419 return accu.step(bw::String<Borrowed>(v_.stats())).result();
1423 using value_type = borrowable::message::server::Statistics<Borrowed>;
1435 namespace bw = borrowable::wire;
1437 auto stats_res = accu.template step<bw::String<Borrowed>>();
1452template <
class Base,
class ValueType>
1455 template <
class Accumulator>
1457 namespace bw = borrowable::wire;
1459 return accu.step(bw::FixedInt<1>(Base::cmd_byte())).result();
1469 static constexpr size_t max_size() noexcept {
return 1; }
1475 namespace bw = borrowable::wire;
1477 auto cmd_byte_res = accu.template step<bw::FixedInt<1>>();
1480 if (cmd_byte_res->value() != Base::cmd_byte()) {
1484 return std::make_pair(accu.
result().
value(), ValueType());
1529 borrowable::message::client::Quit> {
1554 Codec<borrowable::message::client::ResetConnection>,
1555 borrowable::message::client::ResetConnection> {
1580 borrowable::message::client::Ping> {
1605 borrowable::message::client::Statistics> {
1630 borrowable::message::client::Debug> {
1652template <
bool Borrowed>
1655 Codec<borrowable::message::client::InitSchema<Borrowed>>> {
1656 template <
class Accumulator>
1658 namespace bw = borrowable::wire;
1660 return accu.step(bw::FixedInt<1>(cmd_byte()))
1661 .step(bw::String<Borrowed>(v_.schema()))
1689 namespace bw = borrowable::wire;
1691 auto cmd_byte_res = accu.template step<bw::FixedInt<1>>();
1694 if (cmd_byte_res->value() != cmd_byte()) {
1698 auto schema_res = accu.template step<bw::String<Borrowed>>();
1712template <
bool Borrowed>
1715 Codec<borrowable::message::client::Query<Borrowed>>> {
1716 template <
class Accumulator>
1718 namespace bw = borrowable::wire;
1720 accu.step(bw::FixedInt<1>(cmd_byte()));
1722 auto caps = this->caps();
1725 uint64_t param_count = v_.values().size();
1729 if (param_count > 0) {
1736 uint8_t null_bit_byte{};
1739 for (
auto const ¶m : v_.values()) {
1740 if (!param.value) null_bit_byte |= 1 << bit_pos;
1742 if (++bit_pos > 7) {
1743 accu.step(bw::FixedInt<1>(null_bit_byte));
1750 if (bit_pos != 0) accu.step(bw::FixedInt<1>(null_bit_byte));
1752 accu.step(bw::FixedInt<1>(1));
1754 for (
const auto ¶m : v_.values()) {
1755 accu.step(bw::FixedInt<2>(param.type_and_flags))
1756 .step(bw::VarString<Borrowed>(param.name));
1759 for (
const auto ¶m : v_.values()) {
1760 if (!param.value)
continue;
1762 auto type = param.type_and_flags & 0xff;
1778 accu.template step<bw::VarInt>(param.value->size());
1784 assert(param.value->size() <= 255);
1786 accu.template step<bw::FixedInt<1>>(param.value->size());
1791 assert(param.value->size() == 8);
1797 assert(param.value->size() == 4);
1802 assert(param.value->size() == 2);
1806 assert(param.value->size() == 1);
1810 assert(
true ||
"unknown field-type");
1813 accu.template step<bw::String<Borrowed>>(*param.value);
1818 accu.step(bw::String<Borrowed>(v_.statement()));
1819 return accu.result();
1822 template <
class Accu>
1824 Accu &accu, uint8_t
type) {
1825 namespace bw = borrowable::wire;
1842 auto string_field_size_res = accu.template step<bw::VarInt>();
1843 if (!accu.result()) {
1847 return string_field_size_res->value();
1853 auto time_field_size_res = accu.template step<bw::FixedInt<1>>();
1854 if (!accu.result()) {
1858 return time_field_size_res->value();
1901 namespace bw = borrowable::wire;
1903 auto cmd_byte_res = accu.template step<bw::FixedInt<1>>();
1906 if (cmd_byte_res->value() != cmd_byte()) {
1910 std::vector<typename value_type::Param> params;
1913 auto param_count_res = accu.template step<bw::VarInt>();
1917 auto param_set_count_res = accu.template step<bw::VarInt>();
1918 if (!param_set_count_res)
1921 if (param_set_count_res->value() != 1) {
1925 const auto param_count = param_count_res->value();
1926 if (param_count > 0) {
1928 const auto nullbits_res = accu.template step<bw::String<Borrowed>>(
1932 const auto nullbits = nullbits_res->value();
1935 auto new_params_bound_res = accu.template step<bw::FixedInt<1>>();
1938 auto new_params_bound = new_params_bound_res->value();
1939 if (new_params_bound != 1) {
1949 if (new_params_bound == 1) {
1950 for (
long n{};
n < param_count; ++
n) {
1951 auto param_type_res = accu.template step<bw::FixedInt<2>>();
1955 auto param_name_res = accu.template step<bw::VarString<Borrowed>>();
1960 params.emplace_back(param_type_res->value(),
1961 param_name_res->value(),
1962 std::optional<std::string>());
1966 for (
long n{}, nullbit_pos{}, nullbyte_pos{};
n < param_count;
1967 ++
n, ++nullbit_pos) {
1968 if (nullbit_pos > 7) {
1973 if (!(nullbits[nullbyte_pos] & (1 << nullbit_pos))) {
1974 auto ¶m = params[
n];
1976 auto field_size_res =
1977 decode_field_size(accu, param.type_and_flags & 0xff);
1978 if (!field_size_res) {
1982 auto param_value_res = accu.template step<bw::String<Borrowed>>(
1983 field_size_res.value());
1988 param.value = param_value_res->value();
1994 auto statement_res = accu.template step<bw::String<Borrowed>>();
1998 return std::make_pair(
2000 value_type(statement_res->value(), std::move(params)));
2016template <
bool Borrowed>
2019 Codec<borrowable::message::client::SendFile<Borrowed>>> {
2020 template <
class Accumulator>
2022 namespace bw = borrowable::wire;
2024 return accu.step(bw::String<Borrowed>(v_.payload())).result();
2047 namespace bw = borrowable::wire;
2049 auto payload_res = accu.template step<bw::String<Borrowed>>();
2063template <
bool Borrowed>
2066 Codec<borrowable::message::client::ListFields<Borrowed>>> {
2067 template <
class Accumulator>
2069 namespace bw = borrowable::wire;
2071 return accu.step(bw::FixedInt<1>(cmd_byte()))
2072 .step(bw::NulTermString<Borrowed>(v_.table_name()))
2073 .step(bw::String<Borrowed>(v_.wildcard()))
2101 namespace bw = borrowable::wire;
2103 auto cmd_byte_res = accu.template step<bw::FixedInt<1>>();
2106 if (cmd_byte_res->value() != cmd_byte()) {
2110 auto table_name_res = accu.template step<bw::NulTermString<Borrowed>>();
2111 auto wildcard_res = accu.template step<bw::String<Borrowed>>();
2114 return std::make_pair(
2116 value_type(table_name_res->value(), wildcard_res->value()));
2129 template <
class Accumulator>
2131 namespace bw = borrowable::wire;
2133 return accu.step(bw::FixedInt<1>(cmd_byte()))
2134 .step(bw::FixedInt<1>(v_.cmds().to_ulong()))
2162 namespace bw = borrowable::wire;
2164 auto cmd_byte_res = accu.template step<bw::FixedInt<1>>();
2167 if (cmd_byte_res->value() != cmd_byte()) {
2171 auto cmds_res = accu.template step<bw::FixedInt<1>>();
2192 template <
class Accumulator>
2194 namespace bw = borrowable::wire;
2196 return accu.step(bw::FixedInt<1>(cmd_byte()))
2197 .step(bw::FixedInt<4>(v_.connection_id()))
2225 namespace bw = borrowable::wire;
2227 auto cmd_byte_res = accu.template step<bw::FixedInt<1>>();
2230 if (cmd_byte_res->value() != cmd_byte()) {
2234 auto connection_id_res = accu.template step<bw::FixedInt<4>>();
2248template <
bool Borrowed>
2251 Codec<borrowable::message::client::StmtPrepare<Borrowed>>> {
2252 template <
class Accumulator>
2254 namespace bw = borrowable::wire;
2256 return accu.step(bw::FixedInt<1>(cmd_byte()))
2257 .step(bw::String<Borrowed>(v_.statement()))
2285 namespace bw = borrowable::wire;
2287 auto cmd_byte_res = accu.template step<bw::FixedInt<1>>();
2290 if (cmd_byte_res->value() != cmd_byte()) {
2294 auto statement_res = accu.template step<bw::String<Borrowed>>();
2308template <
bool Borrowed>
2311 Codec<borrowable::message::client::StmtExecute<Borrowed>>> {
2312 template <
class Accumulator>
2314 namespace bw = borrowable::wire;
2316 auto caps = this->caps();
2318 accu.step(bw::FixedInt<1>(cmd_byte()))
2319 .step(bw::FixedInt<4>(v_.statement_id()))
2320 .step(bw::FixedInt<1>(v_.flags().to_ullong()))
2321 .step(bw::FixedInt<4>(v_.iteration_count()));
2324 auto num_params = v_.values().size();
2326 const bool supports_query_attributes =
2329 if (supports_query_attributes &&
2334 if (num_params == 0)
return accu.result();
2340 uint8_t null_bit_byte{};
2343 for (
auto const ¶m : v_.values()) {
2344 if (!param.has_value()) null_bit_byte |= 1 << bit_pos;
2346 if (++bit_pos > 7) {
2347 accu.step(bw::FixedInt<1>(null_bit_byte));
2354 if (bit_pos != 0) accu.step(bw::FixedInt<1>(null_bit_byte));
2356 accu.step(bw::FixedInt<1>(v_.new_params_bound()));
2358 if (v_.new_params_bound()) {
2359 for (
const auto ¶m_def : v_.types()) {
2360 accu.step(bw::FixedInt<2>(param_def.type_and_flags));
2362 if (supports_query_attributes) {
2370 if (!v.has_value())
continue;
2373 switch (v_.types()[
n].type_and_flags & 0xff) {
2393 accu.step(bw::FixedInt<1>(v->size()));
2406 assert(
false ||
"Unknown Type");
2411 return accu.result();
2477 template <
class Func>
2480 Func &&metadata_lookup) {
2483 namespace bw = borrowable::wire;
2485 auto cmd_byte_res = accu.template step<bw::FixedInt<1>>();
2488 if (cmd_byte_res->value() != cmd_byte()) {
2492 auto statement_id_res = accu.template step<bw::FixedInt<4>>();
2493 auto flags_res = accu.template step<bw::FixedInt<1>>();
2494 auto iteration_count_res = accu.template step<bw::FixedInt<4>>();
2500 const bool supports_query_attributes =
2504 metadata_res = metadata_lookup(statement_id_res->value());
2505 if (!metadata_res) {
2510 size_t param_count = metadata_res->size();
2512 if (supports_query_attributes &&
2514 auto param_count_res = accu.template step<bw::VarInt>();
2519 if (
static_cast<uint64_t
>(param_count_res->value()) < param_count) {
2524 param_count = param_count_res->value();
2527 if (param_count == 0) {
2528 return std::make_pair(
2530 value_type(statement_id_res->value(), flags_res->value(),
2531 iteration_count_res->value(),
false, {}, {}));
2535 accu.template step<bw::String<Borrowed>>(
bytes_per_bits(param_count));
2538 auto new_params_bound_res = accu.template step<bw::FixedInt<1>>();
2541 std::vector<typename value_type::ParamDef> types;
2543 auto new_params_bound = new_params_bound_res->value();
2544 if (new_params_bound == 0) {
2546 types = *metadata_res;
2547 }
else if (new_params_bound == 1) {
2554 types.reserve(param_count);
2556 for (
size_t n{};
n < param_count; ++
n) {
2557 auto type_res = accu.template step<bw::FixedInt<2>>();
2560 if (supports_query_attributes) {
2561 auto name_res = accu.template step<bw::VarString<Borrowed>>();
2565 types.emplace_back(type_res->value(), name_res->value());
2567 types.emplace_back(type_res->value(),
"");
2574 if (param_count != types.size()) {
2579 std::vector<std::optional<typename value_type::string_type>> values;
2580 values.reserve(param_count);
2582 const auto nullbits = nullbits_res->value();
2583 for (
size_t n{}, bit_pos{}, byte_pos{};
n < param_count; ++
n, ++bit_pos) {
2591 const auto param_already_sent =
2592 n < metadata_res->size() ? (*metadata_res)[
n].param_already_sent
2595 if (param_already_sent) {
2596 values.emplace_back(
"");
2597 }
else if (!(nullbits[byte_pos] & (1 << bit_pos))) {
2600 switch (types[
n].type_and_flags & 0xff) {
2614 auto string_field_size_res = accu.template step<bw::VarInt>();
2619 field_size_res = string_field_size_res->
value();
2625 auto time_field_size_res = accu.template step<bw::FixedInt<1>>();
2630 field_size_res = time_field_size_res->
value();
2650 if (!field_size_res) {
2656 accu.template step<bw::String<Borrowed>>(field_size_res.
value());
2661 values.push_back(value_res->value());
2664 values.emplace_back(std::nullopt);
2670 return std::make_pair(
2672 value_type(statement_id_res->value(), flags_res->value(),
2673 iteration_count_res->value(), new_params_bound_res->value(),
2684template <
bool Borrowed>
2687 Codec<borrowable::message::client::StmtParamAppendData<Borrowed>>> {
2688 template <
class Accumulator>
2690 namespace bw = borrowable::wire;
2692 return accu.step(bw::FixedInt<1>(cmd_byte()))
2693 .step(bw::FixedInt<4>(v_.statement_id()))
2694 .step(bw::FixedInt<2>(v_.param_id()))
2695 .step(bw::String<Borrowed>(v_.data()))
2723 namespace bw = borrowable::wire;
2725 auto cmd_byte_res = accu.template step<bw::FixedInt<1>>();
2728 if (cmd_byte_res->value() != cmd_byte()) {
2732 auto statement_id_res = accu.template step<bw::FixedInt<4>>();
2733 auto param_id_res = accu.template step<bw::FixedInt<2>>();
2734 auto data_res = accu.template step<bw::String<Borrowed>>();
2739 param_id_res->value(), data_res->value()));
2752 template <
class Accumulator>
2754 namespace bw = borrowable::wire;
2756 return accu.step(bw::FixedInt<1>(cmd_byte()))
2757 .step(bw::FixedInt<4>(v_.statement_id()))
2785 namespace bw = borrowable::wire;
2787 auto cmd_byte_res = accu.template step<bw::FixedInt<1>>();
2790 if (cmd_byte_res->value() != cmd_byte()) {
2794 auto statement_id_res = accu.template step<bw::FixedInt<4>>();
2811 template <
class Accumulator>
2813 namespace bw = borrowable::wire;
2815 return accu.step(bw::FixedInt<1>(cmd_byte()))
2816 .step(bw::FixedInt<4>(v_.statement_id()))
2844 namespace bw = borrowable::wire;
2846 auto cmd_byte_res = accu.template step<bw::FixedInt<1>>();
2849 if (cmd_byte_res->value() != cmd_byte()) {
2853 auto statement_id_res = accu.template step<bw::FixedInt<4>>();
2870 template <
class Accumulator>
2872 namespace bw = borrowable::wire;
2874 return accu.step(bw::FixedInt<1>(cmd_byte()))
2875 .step(bw::FixedInt<2>(v_.option()))
2903 namespace bw = borrowable::wire;
2905 auto cmd_byte_res = accu.template step<bw::FixedInt<1>>();
2908 if (cmd_byte_res->value() != cmd_byte()) {
2912 auto option_res = accu.template step<bw::FixedInt<2>>();
2929 template <
class Accumulator>
2931 namespace bw = borrowable::wire;
2933 return accu.step(bw::FixedInt<1>(cmd_byte()))
2934 .step(bw::FixedInt<4>(v_.statement_id()))
2935 .step(bw::FixedInt<4>(v_.row_count()))
2963 namespace bw = borrowable::wire;
2965 auto cmd_byte_res = accu.template step<bw::FixedInt<1>>();
2968 if (cmd_byte_res->value() != cmd_byte()) {
2972 auto statement_id_res = accu.template step<bw::FixedInt<4>>();
2973 auto row_count_res = accu.template step<bw::FixedInt<4>>();
2976 return std::make_pair(
2978 value_type(statement_id_res->value(), row_count_res->value()));
3024template <
bool Borrowed>
3027 Codec<borrowable::message::client::Greeting<Borrowed>>> {
3028 template <
class Accumulator>
3030 namespace bw = borrowable::wire;
3032 const auto shared_caps = v_.capabilities() & this->caps();
3035 accu.step(bw::FixedInt<4>(v_.capabilities().to_ulong()))
3036 .step(bw::FixedInt<4>(v_.max_packet_size()))
3037 .step(bw::FixedInt<1>(v_.collation()))
3038 .step(bw::String<Borrowed>(std::string(23,
'\0')));
3040 v_.username().empty())) {
3043 accu.step(bw::NulTermString<Borrowed>(v_.username()));
3047 accu.step(bw::VarString<Borrowed>(v_.auth_method_data()));
3050 accu.step(bw::FixedInt<1>(v_.auth_method_data().size()))
3051 .step(bw::String<Borrowed>(v_.auth_method_data()));
3053 accu.step(bw::NulTermString<Borrowed>(v_.auth_method_data()));
3058 accu.step(bw::NulTermString<Borrowed>(v_.schema()));
3070 !v_.auth_method_name().empty()) {
3071 accu.step(bw::NulTermString<Borrowed>(v_.auth_method_name()));
3075 accu.step(bw::NulTermString<Borrowed>(v_.auth_method_name()));
3078 accu.step(bw::VarString<Borrowed>(v_.attributes()));
3082 accu.step(bw::FixedInt<2>(v_.capabilities().to_ulong()))
3083 .step(bw::FixedInt<3>(v_.max_packet_size()))
3084 .step(bw::NulTermString<Borrowed>(v_.username()));
3087 accu.step(bw::NulTermString<Borrowed>(v_.auth_method_data()))
3088 .step(bw::String<Borrowed>(v_.schema()));
3090 accu.step(bw::String<Borrowed>(v_.auth_method_data()));
3094 return accu.result();
3119 namespace bw = borrowable::wire;
3121 auto capabilities_lo_res = accu.template step<bw::FixedInt<2>>();
3122 if (!capabilities_lo_res)
3126 capabilities_lo_res->value());
3130 auto shared_capabilities = caps & client_capabilities;
3135 auto capabilities_hi_res = accu.template step<bw::FixedInt<2>>();
3136 if (!capabilities_hi_res)
3140 capabilities_hi_res->value() << 16);
3142 shared_capabilities = caps & client_capabilities;
3144 auto max_packet_size_res = accu.template step<bw::FixedInt<4>>();
3145 auto collation_res = accu.template step<bw::FixedInt<1>>();
3147 accu.template step<bw::String<Borrowed>>(23);
3149 auto last_accu_res = accu.
result();
3151 auto username_res = accu.template step<bw::NulTermString<Borrowed>>();
3155 if (last_accu_res &&
3157 return std::make_pair(
3158 last_accu_res.value(),
3159 value_type(client_capabilities, max_packet_size_res->value(),
3160 collation_res->value(), {}, {}, {}, {}, {}));
3172 auth_method_data_res;
3175 auto res = accu.template step<bw::VarString<Borrowed>>();
3178 auth_method_data_res = bw::String<Borrowed>(res->value());
3179 }
else if (shared_capabilities
3181 auto auth_method_data_len_res = accu.template step<bw::FixedInt<1>>();
3182 if (!auth_method_data_len_res)
3184 auto auth_method_data_len = auth_method_data_len_res->value();
3187 accu.template step<bw::String<Borrowed>>(auth_method_data_len);
3190 auth_method_data_res = bw::String<Borrowed>(res->value());
3192 auto res = accu.template step<bw::NulTermString<Borrowed>>();
3195 auth_method_data_res = bw::String<Borrowed>(res->value());
3199 if (shared_capabilities
3201 schema_res = accu.template step<bw::NulTermString<Borrowed>>();
3207 if (shared_capabilities
3212 auth_method_res = bw::NulTermString<Borrowed>{};
3214 auth_method_res = accu.template step<bw::NulTermString<Borrowed>>();
3220 if (shared_capabilities
3222 attributes_res = accu.template step<bw::VarString<Borrowed>>();
3227 return std::make_pair(
3229 value_type(client_capabilities, max_packet_size_res->value(),
3230 collation_res->value(), username_res->value(),
3231 auth_method_data_res->
value(), schema_res->
value(),
3232 auth_method_res->
value(), attributes_res->
value()));
3235 auto max_packet_size_res = accu.template step<bw::FixedInt<3>>();
3237 auto username_res = accu.template step<bw::NulTermString<Borrowed>>();
3240 auth_method_data_res;
3243 if (shared_capabilities
3245 auto res = accu.template step<bw::NulTermString<Borrowed>>();
3249 auth_method_data_res = bw::String<Borrowed>(res->value());
3251 schema_res = accu.template step<bw::String<Borrowed>>();
3253 auth_method_data_res = accu.template step<bw::String<Borrowed>>();
3276 return std::make_pair(
3278 value_type(client_capabilities, max_packet_size_res->value(), 0x00,
3279 username_res->value(), auth_method_data_res->value(),
3280 schema_res->
value(), {}, {}));
3297template <
bool Borrowed>
3300 Codec<borrowable::message::client::AuthMethodData<Borrowed>>> {
3301 template <
class Accumulator>
3303 namespace bw = borrowable::wire;
3305 return accu.step(bw::String<Borrowed>(v_.auth_method_data())).result();
3328 namespace bw = borrowable::wire;
3330 auto auth_method_data_res = accu.template step<bw::String<Borrowed>>();
3351template <
bool Borrowed>
3354 Codec<borrowable::message::client::ChangeUser<Borrowed>>> {
3355 template <
class Accumulator>
3357 namespace bw = borrowable::wire;
3359 accu.step(bw::FixedInt<1>(cmd_byte()))
3360 .step(bw::NulTermString<Borrowed>(v_.username()));
3363 accu.step(bw::FixedInt<1>(v_.auth_method_data().size()))
3364 .step(bw::String<Borrowed>(v_.auth_method_data()));
3366 accu.step(bw::NulTermString<Borrowed>(v_.auth_method_data()));
3368 accu.step(bw::NulTermString<Borrowed>(v_.schema()));
3374 if (v_.collation() != 0x00 ||
3377 accu.step(bw::FixedInt<2>(v_.collation()));
3379 accu.step(bw::NulTermString<Borrowed>(v_.auth_method_name()));
3384 accu.step(bw::VarString<Borrowed>(v_.attributes()));
3388 return accu.result();
3416 namespace bw = borrowable::wire;
3418 auto cmd_byte_res = accu.template step<bw::FixedInt<1>>();
3421 if (cmd_byte_res->value() != cmd_byte()) {
3424 auto username_res = accu.template step<bw::NulTermString<Borrowed>>();
3432 auto auth_method_data_len_res = accu.template step<bw::FixedInt<1>>();
3433 if (!auth_method_data_len_res)
3435 auto auth_method_data_len = auth_method_data_len_res->value();
3437 auto res = accu.template step<bw::String<Borrowed>>(auth_method_data_len);
3440 auth_method_data_res = bw::String<Borrowed>(res->value());
3442 auto res = accu.template step<bw::NulTermString<Borrowed>>();
3445 auth_method_data_res = bw::String<Borrowed>(res->value());
3448 auto schema_res = accu.template step<bw::NulTermString<Borrowed>>();
3454 return std::make_pair(
3456 value_type(username_res->value(), auth_method_data_res->value(),
3457 schema_res->value(), 0x00, {}, {}));
3461 auto collation_res = accu.template step<bw::FixedInt<2>>();
3464 auth_method_name_res;
3466 auth_method_name_res = accu.template step<bw::NulTermString<Borrowed>>();
3471 attributes_res = accu.template step<bw::VarString<Borrowed>>();
3476 return std::make_pair(
3478 value_type(username_res->value(), auth_method_data_res->value(),
3479 schema_res->value(), collation_res->value(),
3480 auth_method_name_res->value(), attributes_res->
value()));
3495 borrowable::message::client::Clone> {
3517template <
bool Borrowed>
3520 Codec<borrowable::message::client::BinlogDump<Borrowed>>> {
3525 template <
class Accumulator>
3527 namespace bw = borrowable::wire;
3529 return accu.step(bw::FixedInt<1>(cmd_byte()))
3530 .step(bw::FixedInt<4>(v_.position()))
3531 .step(bw::FixedInt<2>(v_.flags().underlying_value()))
3532 .step(bw::FixedInt<4>(v_.server_id()))
3533 .step(bw::String<Borrowed>(v_.filename()))
3560 namespace bw = borrowable::wire;
3562 auto cmd_byte_res = accu.template step<bw::FixedInt<1>>();
3565 if (cmd_byte_res->value() != cmd_byte()) {
3568 auto position_res = accu.template step<bw::FixedInt<4>>();
3569 auto flags_res = accu.template step<bw::FixedInt<2>>();
3570 auto server_id_res = accu.template step<bw::FixedInt<4>>();
3572 auto filename_res = accu.template step<bw::String<Borrowed>>();
3577 flags.underlying_value(flags_res->value());
3579 return std::make_pair(
3582 position_res->value()));
3592template <
bool Borrowed>
3595 Codec<borrowable::message::client::RegisterReplica<Borrowed>>> {
3600 template <
class Accumulator>
3602 namespace bw = borrowable::wire;
3604 return accu.step(bw::FixedInt<1>(cmd_byte()))
3605 .step(bw::FixedInt<4>(v_.server_id()))
3606 .step(bw::FixedInt<1>(v_.hostname().size()))
3607 .step(bw::String<Borrowed>(v_.hostname()))
3608 .step(bw::FixedInt<1>(v_.username().size()))
3609 .step(bw::String<Borrowed>(v_.username()))
3610 .step(bw::FixedInt<1>(v_.password().size()))
3611 .step(bw::String<Borrowed>(v_.password()))
3612 .step(bw::FixedInt<2>(v_.port()))
3613 .step(bw::FixedInt<4>(v_.replication_rank()))
3614 .step(bw::FixedInt<4>(v_.master_id()))
3641 namespace bw = borrowable::wire;
3643 auto cmd_byte_res = accu.template step<bw::FixedInt<1>>();
3646 if (cmd_byte_res->value() != cmd_byte()) {
3649 auto server_id_res = accu.template step<bw::FixedInt<4>>();
3650 auto hostname_len_res = accu.template step<bw::FixedInt<1>>();
3654 accu.template step<bw::String<Borrowed>>(hostname_len_res->value());
3656 auto username_len_res = accu.template step<bw::FixedInt<1>>();
3660 accu.template step<bw::String<Borrowed>>(username_len_res->value());
3662 auto password_len_res = accu.template step<bw::FixedInt<1>>();
3666 accu.template step<bw::String<Borrowed>>(password_len_res->value());
3668 auto port_res = accu.template step<bw::FixedInt<2>>();
3669 auto replication_rank_res = accu.template step<bw::FixedInt<4>>();
3670 auto master_id_res = accu.template step<bw::FixedInt<4>>();
3674 return std::make_pair(
3676 value_type(server_id_res->value(), hostname_res->value(),
3677 username_res->value(), password_res->value(),
3678 port_res->value(), replication_rank_res->value(),
3679 master_id_res->value()));
3689template <
bool Borrowed>
3692 Codec<borrowable::message::client::BinlogDumpGtid<Borrowed>>> {
3697 template <
class Accumulator>
3699 namespace bw = borrowable::wire;
3701 accu.step(bw::FixedInt<1>(cmd_byte()))
3702 .step(bw::FixedInt<2>(v_.flags().underlying_value()))
3703 .step(bw::FixedInt<4>(v_.server_id()))
3704 .step(bw::FixedInt<4>(v_.filename().size()))
3705 .step(bw::String<Borrowed>(v_.filename()))
3706 .step(bw::FixedInt<8>(v_.position()));
3708 if (v_.flags() & value_type::Flags::through_gtid) {
3709 accu.step(bw::FixedInt<4>(v_.sids().size()))
3710 .step(bw::String<Borrowed>(v_.sids()));
3713 return accu.result();
3722 :
base_(caps), v_{
std::move(val)} {}
3739 namespace bw = borrowable::wire;
3741 auto cmd_byte_res = accu.template step<bw::FixedInt<1>>();
3744 if (cmd_byte_res->value() != cmd_byte()) {
3747 auto flags_res = accu.template step<bw::FixedInt<2>>();
3748 auto server_id_res = accu.template step<bw::FixedInt<4>>();
3749 auto filename_len_res = accu.template step<bw::FixedInt<4>>();
3753 accu.template step<bw::String<Borrowed>>(filename_len_res->value());
3754 auto position_res = accu.template step<bw::FixedInt<8>>();
3757 flags.underlying_value(flags_res->value());
3759 if (!(
flags & value_type::Flags::through_gtid)) {
3762 return std::make_pair(
3765 position_res->value(), {}));
3768 auto sids_len_res = accu.template step<bw::FixedInt<4>>();
3772 accu.template step<bw::String<Borrowed>>(sids_len_res->value());
3776 return std::make_pair(
3779 position_res->value(), sids_res->value()));
CRTP base for client-side commands that are encoded as a single byte.
Definition: classic_protocol_codec_message.h:1454
constexpr CodecSimpleCommand(capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:1467
friend __base
Definition: classic_protocol_codec_message.h:1465
static constexpr size_t max_size() noexcept
Definition: classic_protocol_codec_message.h:1469
static stdx::expected< std::pair< size_t, ValueType >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:1471
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:1456
const value_type v_
Definition: classic_protocol_codec_message.h:3339
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:3324
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:3320
friend __base
Definition: classic_protocol_codec_message.h:3312
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:3302
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:3314
constexpr static uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:3724
const value_type v_
Definition: classic_protocol_codec_message.h:3783
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:3735
constexpr Codec(value_type val, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:3721
friend base_
Definition: classic_protocol_codec_message.h:3719
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:3731
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:3698
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:3542
friend __base
Definition: classic_protocol_codec_message.h:3540
const value_type v_
Definition: classic_protocol_codec_message.h:3586
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:3556
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:3526
constexpr static uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:3545
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:3552
const value_type v_
Definition: classic_protocol_codec_message.h:3484
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:3407
constexpr static uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:3400
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:3412
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:3397
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:3356
friend __base
Definition: classic_protocol_codec_message.h:3395
constexpr static uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:3502
constexpr Codec(value_type, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:3500
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:3509
constexpr static uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:1637
constexpr Codec(value_type, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:1635
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:1644
friend __base
Definition: classic_protocol_codec_message.h:3101
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:3115
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:3103
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:3029
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:3109
const value_type v_
Definition: classic_protocol_codec_message.h:3285
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:1685
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:1657
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:1681
const value_type v_
Definition: classic_protocol_codec_message.h:1706
friend __base
Definition: classic_protocol_codec_message.h:1669
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:1671
constexpr static uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:1674
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:2217
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:2193
value_type v_
Definition: classic_protocol_codec_message.h:2242
friend __base
Definition: classic_protocol_codec_message.h:2205
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:2221
constexpr static uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:2210
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:2207
const value_type v_
Definition: classic_protocol_codec_message.h:2120
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:2083
constexpr static uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:2086
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:2093
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:2068
friend __base
Definition: classic_protocol_codec_message.h:2081
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:2097
constexpr Codec(value_type, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:1585
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:1594
constexpr static uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:1587
const value_type v_
Definition: classic_protocol_codec_message.h:2004
friend __base
Definition: classic_protocol_codec_message.h:1881
auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:1717
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:1897
constexpr static uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:1886
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:1893
static stdx::expected< size_t, std::error_code > decode_field_size(Accu &accu, uint8_t type)
Definition: classic_protocol_codec_message.h:1823
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:1883
constexpr static uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:1536
constexpr Codec(value_type, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:1534
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:1543
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:3601
const value_type v_
Definition: classic_protocol_codec_message.h:3683
constexpr static uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:3626
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:3623
friend __base
Definition: classic_protocol_codec_message.h:3621
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:3637
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:3633
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:2154
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:2130
constexpr static uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:2147
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:2144
friend __base
Definition: classic_protocol_codec_message.h:2142
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:2158
const value_type v_
Definition: classic_protocol_codec_message.h:2178
constexpr Codec(value_type, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:1560
constexpr static uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:1562
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:1569
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:2043
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:2021
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:2039
friend __base
Definition: classic_protocol_codec_message.h:2031
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:2033
const value_type v_
Definition: classic_protocol_codec_message.h:2057
const value_type v_
Definition: classic_protocol_codec_message.h:2920
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:2899
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:2885
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:2895
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:2871
constexpr static uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:2888
friend __base
Definition: classic_protocol_codec_message.h:2883
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:1619
constexpr Codec(value_type, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:1610
constexpr static uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:1612
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:2777
friend __base
Definition: classic_protocol_codec_message.h:2765
const value_type v_
Definition: classic_protocol_codec_message.h:2802
constexpr static uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:2770
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:2753
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:2781
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:2767
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:2430
friend __base
Definition: classic_protocol_codec_message.h:2418
const value_type v_
Definition: classic_protocol_codec_message.h:2678
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps, Func &&metadata_lookup)
decode a buffer into a message::client::StmtExecute.
Definition: classic_protocol_codec_message.h:2478
auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:2313
constexpr static uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:2423
constexpr Codec(value_type val, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:2420
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:2959
constexpr static uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:2948
const value_type v_
Definition: classic_protocol_codec_message.h:2982
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:2930
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:2945
friend __base
Definition: classic_protocol_codec_message.h:2943
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:2955
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:2705
constexpr static uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:2708
friend __base
Definition: classic_protocol_codec_message.h:2703
const value_type v_
Definition: classic_protocol_codec_message.h:2743
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:2715
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:2719
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:2689
constexpr static uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:2270
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:2281
const value_type v_
Definition: classic_protocol_codec_message.h:2302
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:2267
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:2277
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:2253
friend __base
Definition: classic_protocol_codec_message.h:2265
constexpr static uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:2829
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:2840
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:2812
friend __base
Definition: classic_protocol_codec_message.h:2824
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:2836
const value_type v_
Definition: classic_protocol_codec_message.h:2861
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:2826
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:332
const value_type v_
Definition: classic_protocol_codec_message.h:365
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:318
borrowable::message::server::AuthMethodData< Borrowed > value_type
Definition: classic_protocol_codec_message.h:327
static constexpr uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:335
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:340
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:344
friend __base
Definition: classic_protocol_codec_message.h:330
friend __base
Definition: classic_protocol_codec_message.h:264
borrowable::message::server::AuthMethodSwitch< Borrowed > value_type
Definition: classic_protocol_codec_message.h:261
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:266
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:247
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:278
static constexpr uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:269
const value_type v_
Definition: classic_protocol_codec_message.h:307
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:274
borrowable::message::server::ColumnCount value_type
Definition: classic_protocol_codec_message.h:786
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:791
friend __base
Definition: classic_protocol_codec_message.h:789
const value_type v_
Definition: classic_protocol_codec_message.h:812
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:779
static constexpr size_t max_size() noexcept
Definition: classic_protocol_codec_message.h:794
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:798
borrowable::message::server::Eof< Borrowed > value_type
Definition: classic_protocol_codec_message.h:561
const value_type v_
Definition: classic_protocol_codec_message.h:668
friend __base
Definition: classic_protocol_codec_message.h:564
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:574
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:566
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:519
static constexpr uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:569
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
decode a server::Eof message from a buffer-sequence.
Definition: classic_protocol_codec_message.h:599
friend __base
Definition: classic_protocol_codec_message.h:717
static constexpr uint8_t cmd_byte()
Definition: classic_protocol_codec_message.h:722
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:719
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:727
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:735
borrowable::message::server::Error< Borrowed > value_type
Definition: classic_protocol_codec_message.h:714
const value_type v_
Definition: classic_protocol_codec_message.h:769
static constexpr size_t max_size() noexcept
Definition: classic_protocol_codec_message.h:731
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:700
const value_type v_
Definition: classic_protocol_codec_message.h:236
friend __base
Definition: classic_protocol_codec_message.h:132
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:134
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:137
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:86
borrowable::message::server::Greeting< Borrowed > value_type
Definition: classic_protocol_codec_message.h:129
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:417
const value_type v_
Definition: classic_protocol_codec_message.h:493
borrowable::message::server::Ok< Borrowed > value_type
Definition: classic_protocol_codec_message.h:404
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:376
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:409
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
decode a server::Ok message from a buffer-sequence.
Definition: classic_protocol_codec_message.h:437
friend __base
Definition: classic_protocol_codec_message.h:407
static constexpr uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:412
static size_t max_size() noexcept
Definition: classic_protocol_codec_message.h:1174
Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:1171
const value_type v_
Definition: classic_protocol_codec_message.h:1207
auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:1151
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:1178
borrowable::message::server::Row< Borrowed > value_type
Definition: classic_protocol_codec_message.h:1166
friend __base
Definition: classic_protocol_codec_message.h:1169
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:1019
const value_type v_
Definition: classic_protocol_codec_message.h:1044
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:1011
friend __base
Definition: classic_protocol_codec_message.h:1009
borrowable::message::server::SendFileRequest< Borrowed > value_type
Definition: classic_protocol_codec_message.h:1006
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:1023
static constexpr uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:1014
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:997
const value_type v_
Definition: classic_protocol_codec_message.h:1446
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:1428
borrowable::message::server::Statistics< Borrowed > value_type
Definition: classic_protocol_codec_message.h:1423
friend __base
Definition: classic_protocol_codec_message.h:1426
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:1431
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:1416
constexpr static uint8_t cmd_byte() noexcept
Definition: classic_protocol_codec_message.h:1096
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:1105
friend __base
Definition: classic_protocol_codec_message.h:1091
constexpr Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:1093
static constexpr capabilities::value_type depends_on_capabilities() noexcept
capabilities the codec depends on.
Definition: classic_protocol_codec_message.h:1101
borrowable::message::server::StmtPrepareOk value_type
Definition: classic_protocol_codec_message.h:1088
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:1070
const value_type v_
Definition: classic_protocol_codec_message.h:1140
const value_type v_
Definition: classic_protocol_codec_message.h:1405
Codec(value_type v, capabilities::value_type caps)
Definition: classic_protocol_codec_message.h:1299
borrowable::message::server::StmtRow< Borrowed > value_type
Definition: classic_protocol_codec_message.h:1294
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &buffer, capabilities::value_type caps, std::vector< field_type::value_type > types)
Definition: classic_protocol_codec_message.h:1306
static size_t max_size() noexcept
Definition: classic_protocol_codec_message.h:1302
auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_message.h:1229
friend __base
Definition: classic_protocol_codec_message.h:1297
Codec for a type.
Definition: classic_protocol_codec_base.h:72
Definition: classic_protocol_message.h:1273
Definition: classic_protocol_message.h:1335
Definition: classic_protocol_message.h:1307
Definition: classic_protocol_message.h:888
Definition: classic_protocol_message.h:1304
Definition: classic_protocol_message.h:1268
Definition: classic_protocol_message.h:684
Definition: classic_protocol_message.h:863
Definition: classic_protocol_message.h:976
Definition: classic_protocol_message.h:826
Definition: classic_protocol_message.h:1263
Definition: classic_protocol_message.h:786
Definition: classic_protocol_message.h:1258
Definition: classic_protocol_message.h:1367
Definition: classic_protocol_message.h:954
Definition: classic_protocol_message.h:941
Definition: classic_protocol_message.h:996
set options on the current connection.
Definition: classic_protocol_message.h:1238
Definition: classic_protocol_message.h:948
close a prepared statement.
Definition: classic_protocol_message.h:1168
execute a prepared statement.
Definition: classic_protocol_message.h:1090
fetch rows from an executed statement.
Definition: classic_protocol_message.h:1212
append data to a parameter of a prepared statement.
Definition: classic_protocol_message.h:1049
Definition: classic_protocol_message.h:1021
reset a prepared statement.
Definition: classic_protocol_message.h:1190
Definition: classic_protocol_wire.h:38
Definition: classic_protocol_wire.h:65
Generator of decoded Types of a buffer.
Definition: classic_protocol_codec_base.h:153
result_type result() const
get result of the step().
Definition: classic_protocol_codec_base.h:219
CRTP base for the Codec's encode part.
Definition: classic_protocol_codec_base.h:374
constexpr capabilities::value_type caps() const noexcept
Definition: classic_protocol_codec_base.h:389
size_t size() const noexcept
Definition: buffer.h:120
Definition: expected.h:284
constexpr const error_type & error() const &
Definition: expected.h:751
constexpr value_type & value() &
Definition: expected.h:636
a type-safe flags type.
Definition: flags.h:115
Definition: expected.h:112
constexpr DWORD buf_size
Definition: create_def.cc:229
static int flags[50]
Definition: hp_test1.cc:40
borrowable::binary::Null Null
Definition: classic_protocol_binary.h:337
borrowable::wire::VarInt VarInt
Definition: classic_protocol_wire.h:148
Definition: classic_protocol_constants.h:36
constexpr value_type text_result_with_session_tracking
Definition: classic_protocol_constants.h:62
constexpr value_type long_flag
Definition: classic_protocol_constants.h:40
constexpr value_type transactions
Definition: classic_protocol_constants.h:51
constexpr value_type plugin_auth
Definition: classic_protocol_constants.h:57
constexpr value_type session_track
Definition: classic_protocol_constants.h:61
constexpr value_type optional_resultset_metadata
Definition: classic_protocol_constants.h:63
constexpr value_type query_attributes
Definition: classic_protocol_constants.h:65
constexpr value_type connect_attributes
Definition: classic_protocol_constants.h:58
constexpr value_type client_auth_method_data_varint
Definition: classic_protocol_constants.h:59
constexpr value_type ssl
Definition: classic_protocol_constants.h:49
constexpr value_type connect_with_schema
Definition: classic_protocol_constants.h:41
constexpr value_type secure_connection
Definition: classic_protocol_constants.h:53
constexpr value_type protocol_41
Definition: classic_protocol_constants.h:47
constexpr value_type client_auth_method_data_varint
Definition: classic_protocol_constants.h:130
constexpr value_type connect_attributes
Definition: classic_protocol_constants.h:128
constexpr value_type plugin_auth
Definition: classic_protocol_constants.h:126
constexpr value_type ssl
Definition: classic_protocol_constants.h:110
constexpr value_type protocol_41
Definition: classic_protocol_constants.h:104
constexpr value_type transactions
Definition: classic_protocol_constants.h:113
constexpr value_type optional_resultset_metadata
Definition: classic_protocol_constants.h:142
constexpr value_type text_result_with_session_tracking
Definition: classic_protocol_constants.h:137
constexpr value_type secure_connection
Definition: classic_protocol_constants.h:116
constexpr value_type query_attributes
Definition: classic_protocol_constants.h:145
std::bitset< 32 > value_type
Definition: classic_protocol_constants.h:73
constexpr value_type connect_with_schema
Definition: classic_protocol_constants.h:86
constexpr value_type session_track
Definition: classic_protocol_constants.h:135
constexpr value_type param_count_available
Definition: classic_protocol_constants.h:216
constexpr value_type Short
Definition: classic_protocol_constants.h:233
constexpr value_type DateTime
Definition: classic_protocol_constants.h:243
constexpr value_type LongLong
Definition: classic_protocol_constants.h:239
constexpr value_type Varchar
Definition: classic_protocol_constants.h:246
constexpr value_type NewDecimal
Definition: classic_protocol_constants.h:253
constexpr value_type Time
Definition: classic_protocol_constants.h:242
constexpr value_type Decimal
Definition: classic_protocol_constants.h:231
constexpr value_type VarString
Definition: classic_protocol_constants.h:260
constexpr value_type MediumBlob
Definition: classic_protocol_constants.h:257
constexpr value_type String
Definition: classic_protocol_constants.h:261
constexpr value_type Set
Definition: classic_protocol_constants.h:255
constexpr value_type Geometry
Definition: classic_protocol_constants.h:262
constexpr value_type Bit
Definition: classic_protocol_constants.h:247
constexpr value_type Tiny
Definition: classic_protocol_constants.h:232
constexpr value_type TinyBlob
Definition: classic_protocol_constants.h:256
constexpr value_type Json
Definition: classic_protocol_constants.h:252
constexpr value_type Int24
Definition: classic_protocol_constants.h:240
constexpr value_type Enum
Definition: classic_protocol_constants.h:254
constexpr value_type Long
Definition: classic_protocol_constants.h:234
constexpr value_type Double
Definition: classic_protocol_constants.h:236
constexpr value_type Year
Definition: classic_protocol_constants.h:244
constexpr value_type Timestamp
Definition: classic_protocol_constants.h:238
constexpr value_type LongBlob
Definition: classic_protocol_constants.h:258
constexpr value_type Blob
Definition: classic_protocol_constants.h:259
constexpr value_type Date
Definition: classic_protocol_constants.h:241
constexpr value_type Float
Definition: classic_protocol_constants.h:235
borrowable::message::client::StmtFetch StmtFetch
Definition: classic_protocol_message.h:1446
borrowable::message::client::StmtReset StmtReset
Definition: classic_protocol_message.h:1441
borrowable::message::client::Reload Reload
Definition: classic_protocol_message.h:1436
borrowable::message::client::SetOption SetOption
Definition: classic_protocol_message.h:1445
borrowable::message::client::Kill Kill
Definition: classic_protocol_message.h:1434
borrowable::message::client::StmtClose StmtClose
Definition: classic_protocol_message.h:1442
borrowable::message::server::AuthMethodSwitch< false > AuthMethodSwitch
Definition: classic_protocol_message.h:1416
borrowable::message::server::Error< false > Error
Definition: classic_protocol_message.h:1411
borrowable::message::server::StmtPrepareOk StmtPrepareOk
Definition: classic_protocol_message.h:1421
borrowable::message::server::Greeting< false > Greeting
Definition: classic_protocol_message.h:1413
borrowable::message::server::Row< false > Row
Definition: classic_protocol_message.h:1419
borrowable::message::server::Eof< false > Eof
Definition: classic_protocol_message.h:1412
borrowable::message::server::ColumnCount ColumnCount
Definition: classic_protocol_message.h:1414
borrowable::message::server::Ok< false > Ok
Definition: classic_protocol_message.h:1410
borrowable::message::server::AuthMethodData< false > AuthMethodData
Definition: classic_protocol_message.h:1417
borrowable::message::server::Statistics< false > Statistics
Definition: classic_protocol_message.h:1422
borrowable::message::server::StmtRow< false > StmtRow
Definition: classic_protocol_message.h:1420
borrowable::message::server::SendFileRequest< false > SendFileRequest
Definition: classic_protocol_message.h:1418
borrowable::message::server::ColumnMeta< false > ColumnMeta
Definition: classic_protocol_message.h:1415
constexpr value_type session_state_changed
Definition: classic_protocol_constants.h:165
constexpr value_type session_state_changed
Definition: classic_protocol_constants.h:207
Definition: classic_protocol_binary.h:39
std::error_code make_error_code(codec_errc e) noexcept
Definition: classic_protocol_codec_error.h:86
CommandByte
Definition: classic_protocol_codec_message.h:1488
constexpr size_t bytes_per_bits(size_t bits)
Definition: classic_protocol_codec_base.h:55
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:418
size_t buffer_size(const ConstBufferSequence &buffers) noexcept
Definition: buffer.h:313
Definition: gcs_xcom_synode.h:64
constexpr auto enumerate(T &&iterable)
Definition: ranges.h:142
unexpected(E) -> unexpected< E >
required string type
Definition: replication_group_member_actions.proto:34
int n
Definition: xcom_base.cc:509