MySQL 8.0.40
Source Code Documentation
classic_protocol_message.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2019, 2024, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is designed to work with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have either included with
14 the program or referenced in the documentation.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24*/
25
26#ifndef MYSQL_ROUTER_CLASSIC_PROTOCOL_MESSAGE_H_
27#define MYSQL_ROUTER_CLASSIC_PROTOCOL_MESSAGE_H_
28
29#include <cstddef> // uint8_t
30#include <optional>
31#include <string>
32#include <vector>
33
37
40 public:
41 // flags of message::client::BinlogDump
42 enum class Flags : uint16_t {
43 non_blocking = 1 << 0,
44 };
45};
46} // namespace classic_protocol::message::client::impl
47
48namespace stdx {
49// enable flag-ops for BinlogDump::Flags
50template <>
51struct is_flags<classic_protocol::message::client::impl::BinlogDump::Flags>
52 : std::true_type {};
53} // namespace stdx
54 //
57 public:
58 // flags of message::client::BinlogDumpGtid
59 enum class Flags : uint16_t {
60 non_blocking = 1 << 0,
61 through_position = 1 << 1,
62 through_gtid = 1 << 2,
63 };
64};
65} // namespace classic_protocol::message::client::impl
66
67namespace stdx {
68// enable flag-ops for BinlogDumpGtid::Flags
69template <>
70struct is_flags<classic_protocol::message::client::impl::BinlogDumpGtid::Flags>
71 : std::true_type {};
72} // namespace stdx
73
74namespace classic_protocol {
75
76namespace borrowable {
77/**
78 * AuthMethod of classic protocol.
79 *
80 * classic proto supports negotiating the auth-method via capabilities and
81 * auth-method names.
82 */
83template <bool Borrowed>
85 public:
87 std::conditional_t<Borrowed, std::string_view, std::string>;
88
90 string_type auth_method_name)
91 : capabilities_{capabilities},
92 auth_method_name_{std::move(auth_method_name)} {}
93
94 constexpr string_type name() const {
95 if (auth_method_name_.empty() &&
99 return "mysql_native_password";
100 } else {
101 return "old_password";
102 }
103 }
104
105 return auth_method_name_;
106 }
107
108 private:
111};
112
113namespace message {
114
115namespace server {
116
117template <bool Borrowed>
118class Greeting {
119 public:
121 std::conditional_t<Borrowed, std::string_view, std::string>;
122
126 uint8_t collation,
130 version_{std::move(version)},
137
138 constexpr uint8_t protocol_version() const noexcept {
139 return protocol_version_;
140 }
141 void protocol_version(uint8_t val) { protocol_version_ = val; }
142
143 constexpr string_type version() const { return version_; }
144 void version(string_type val) { version_ = val; }
145
146 constexpr string_type auth_method_name() const { return auth_method_name_; }
148 constexpr string_type auth_method_data() const { return auth_method_data_; }
150
152 return capabilities_;
153 }
154
156 capabilities_ = caps;
157 }
158
159 constexpr uint8_t collation() const noexcept { return collation_; }
160 void collation(uint8_t val) { collation_ = val; }
161
163 return status_flags_;
164 }
166 status_flags_ = val;
167 }
168
169 constexpr uint32_t connection_id() const noexcept { return connection_id_; }
170 void connection_id(uint32_t val) { connection_id_ = val; }
171
172 private:
178 uint8_t collation_;
181};
182
183template <bool Borrowed>
184inline bool operator==(const Greeting<Borrowed> &a,
185 const Greeting<Borrowed> &b) {
186 return (a.protocol_version() == b.protocol_version()) &&
187 (a.version() == b.version()) &&
188 (a.connection_id() == b.connection_id()) &&
189 (a.auth_method_data() == b.auth_method_data()) &&
190 (a.capabilities() == b.capabilities()) &&
191 (a.collation() == b.collation()) &&
192 (a.status_flags() == b.status_flags()) &&
194}
195
196template <bool Borrowed>
198 public:
200 std::conditional_t<Borrowed, std::string_view, std::string>;
201
202 constexpr AuthMethodSwitch() = default;
203
206 : auth_method_{std::move(auth_method)},
208
211
212 private:
215};
216
217template <bool Borrowed>
220 return (a.auth_method_data() == b.auth_method_data()) &&
221 (a.auth_method() == b.auth_method());
222}
223
224/**
225 * Opaque auth-method-data message.
226 *
227 * used for server messages the handshake phase that aren't
228 *
229 * - Ok
230 * - Error
231 * - AuthMethodSwitch
232 *
233 * like caching_sha2_password does:
234 *
235 * - 0x01 0x02 (send public key)
236 * - 0x01 0x03 (send full handshake)
237 * - 0x01 0x04 (fast path done)
238 */
239template <bool Borrowed>
241 public:
243 std::conditional_t<Borrowed, std::string_view, std::string>;
244
247
248 constexpr string_type auth_method_data() const { return auth_method_data_; }
249
250 private:
252};
253
254template <bool Borrowed>
256 const AuthMethodData<Borrowed> &b) {
257 return a.auth_method_data() == b.auth_method_data();
258}
259
260/**
261 * Ok message.
262 *
263 * - affected_rows
264 * - last_insert_id
265 * - status_flags
266 * - warning_count
267 * - optional message
268 * - optional server-side tracked session_changes
269 */
270template <bool Borrowed>
271class Ok {
272 public:
274 std::conditional_t<Borrowed, std::string_view, std::string>;
275
276 constexpr Ok() = default;
277
278 constexpr Ok(uint64_t affected_rows, uint64_t last_insert_id,
280 uint16_t warning_count, string_type message = "",
286 message_{std::move(message)},
288
291 }
292
294 return status_flags_;
295 }
296
297 constexpr void warning_count(uint16_t count) { warning_count_ = count; }
298 constexpr uint16_t warning_count() const noexcept { return warning_count_; }
299
300 constexpr void last_insert_id(uint64_t val) { last_insert_id_ = val; }
301 constexpr uint64_t last_insert_id() const noexcept { return last_insert_id_; }
302
303 constexpr void affected_rows(uint64_t val) { affected_rows_ = val; }
304 constexpr uint64_t affected_rows() const noexcept { return affected_rows_; }
305
306 constexpr void message(const string_type &msg) { message_ = msg; }
307 constexpr string_type message() const { return message_; }
308
309 constexpr void session_changes(const string_type &changes) {
310 session_changes_ = changes;
311 }
312 /**
313 * get session-changes.
314 *
315 * @returns encoded array of session_track::Field
316 */
318
319 private:
321 uint16_t warning_count_{};
322 uint64_t last_insert_id_{};
323 uint64_t affected_rows_{};
324
327};
328
329template <bool Borrowed>
330inline bool operator==(const Ok<Borrowed> &a, const Ok<Borrowed> &b) {
331 return (a.status_flags() == b.status_flags()) &&
332 (a.warning_count() == b.warning_count()) &&
333 (a.last_insert_id() == b.last_insert_id()) &&
334 (a.affected_rows() == b.affected_rows()) &&
335 (a.message() == b.message()) &&
336 (a.session_changes() == b.session_changes());
337}
338
339/**
340 * End of Resultset message.
341 */
342template <bool Borrowed>
343class Eof : public Ok<Borrowed> {
344 public:
346 std::conditional_t<Borrowed, std::string_view, std::string>;
347
349
350 using base__::base__;
351
352 // 3.23-like constructor
353 constexpr Eof() = default;
354
355 // 4.1-like constructor
357 uint16_t warning_count)
359
364 std::move(session_changes)) {}
365};
366
367/**
368 * Error message.
369 */
370template <bool Borrowed>
371class Error {
372 public:
374 std::conditional_t<Borrowed, std::string_view, std::string>;
375
376 constexpr Error() = default;
377 /**
378 * construct an Error message.
379 *
380 * @param error_code error code
381 * @param message error message
382 * @param sql_state SQL state
383 */
384 constexpr Error(uint16_t error_code, string_type message,
385 string_type sql_state = "HY000")
387 message_{std::move(message)},
388 sql_state_{std::move(sql_state)} {}
389
390 constexpr uint16_t error_code() const noexcept { return error_code_; }
391 constexpr void error_code(uint16_t code) { error_code_ = code; }
392 constexpr string_type sql_state() const { return sql_state_; }
393 constexpr void sql_state(const string_type &state) { sql_state_ = state; }
394 constexpr string_type message() const { return message_; }
395 constexpr void message(const string_type &msg) { message_ = msg; }
396
397 private:
398 uint16_t error_code_{0};
401};
402
403template <bool Borrowed>
404inline bool operator==(const Error<Borrowed> &a, const Error<Borrowed> &b) {
405 return (a.error_code() == b.error_code()) &&
406 (a.sql_state() == b.sql_state()) && (a.message() == b.message());
407}
408
409/**
410 * ColumnCount message.
411 */
413 public:
414 /**
415 * construct an ColumnCount message.
416 *
417 * @param count column count
418 */
419 constexpr ColumnCount(uint64_t count) : count_{count} {}
420
421 constexpr uint64_t count() const noexcept { return count_; }
422
423 private:
424 uint64_t count_;
425};
426
427constexpr inline bool operator==(const ColumnCount &a, const ColumnCount &b) {
428 return (a.count() == b.count());
429}
430
431template <bool Borrowed>
433 public:
435 std::conditional_t<Borrowed, std::string_view, std::string>;
436
440 uint16_t collation, uint32_t column_length, uint8_t type,
442 uint8_t decimals)
443 : catalog_{std::move(catalog)},
444 schema_{std::move(schema)},
445 table_{std::move(table)},
446 orig_table_{std::move(orig_table)},
447 name_{std::move(name)},
448 orig_name_{std::move(orig_name)},
451 type_{type},
452 flags_{flags},
454
455 constexpr string_type catalog() const { return catalog_; }
456 constexpr string_type schema() const { return schema_; }
457 constexpr string_type table() const { return table_; }
458 constexpr string_type orig_table() const { return orig_table_; }
459 constexpr string_type name() const { return name_; }
460 constexpr string_type orig_name() const { return orig_name_; }
461 constexpr uint16_t collation() const { return collation_; }
462 constexpr uint32_t column_length() const { return column_length_; }
463 constexpr uint8_t type() const { return type_; }
465 return flags_;
466 }
467 constexpr uint8_t decimals() const { return decimals_; }
468
469 private:
476 uint16_t collation_;
478 uint8_t type_;
480 uint8_t decimals_;
481};
482
483template <bool Borrowed>
484inline bool operator==(const ColumnMeta<Borrowed> &a,
485 const ColumnMeta<Borrowed> &b) {
486 return (a.catalog() == b.catalog()) && (a.schema() == b.schema()) &&
487 (a.table() == b.table()) && (a.orig_table() == b.orig_table()) &&
488 (a.name() == b.name()) && (a.orig_name() == b.orig_name()) &&
489 (a.collation() == b.collation()) &&
490 (a.column_length() == b.column_length()) && (a.type() == b.type()) &&
491 (a.flags() == b.flags()) && (a.decimals() == b.decimals());
492}
493
494/**
495 * Row in a resultset.
496 *
497 * each Row is sent as its own frame::Frame
498 *
499 * each Field in a row may either be NULL or a std::string.
500 */
501template <bool Borrowed>
502class Row {
503 public:
505 std::conditional_t<Borrowed, std::string_view, std::string>;
506
507 using value_type = std::optional<string_type>;
508 using const_iterator = typename std::vector<value_type>::const_iterator;
509
510 Row(std::vector<value_type> fields) : fields_{std::move(fields)} {}
511
512 auto begin() const { return fields_.begin(); }
513 auto end() const { return fields_.end(); }
514
515 private:
516 std::vector<value_type> fields_;
517};
518
519template <bool Borrowed>
520inline bool operator==(const Row<Borrowed> &a, const Row<Borrowed> &b) {
521 auto a_iter = a.begin();
522 const auto a_end = a.end();
523 auto b_iter = b.begin();
524 const auto b_end = b.end();
525
526 for (; a_iter != a_end && b_iter != b_end; ++a_iter, ++b_iter) {
527 if (*a_iter != *b_iter) return false;
528 }
529
530 return true;
531}
532
533template <bool Borrowed>
535 public:
538 : column_metas_{std::move(column_metas)}, rows_{std::move(rows)} {}
539
540 std::vector<ColumnMeta<Borrowed>> column_metas() const {
541 return column_metas_;
542 }
543 std::vector<Row<Borrowed>> rows() const { return rows_; }
544
545 private:
546 std::vector<ColumnMeta<Borrowed>> column_metas_;
547 std::vector<Row<Borrowed>> rows_;
548};
549
550/**
551 * StmtPrepareOk message.
552 *
553 * response to a client::StmtPrepare
554 */
556 public:
557 /**
558 * create a Ok message for a client::StmtPrepare.
559 *
560 * @param stmt_id id of the statement
561 * @param column_count number of columns the prepared stmt will return
562 * @param param_count number of parameters the prepared stmt contained
563 * @param warning_count number of warnings the prepared stmt created
564 * @param with_metadata 0 if no metadata shall be sent for "param_count" and
565 * "column_count".
566 */
567 constexpr StmtPrepareOk(uint32_t stmt_id, uint16_t column_count,
568 uint16_t param_count, uint16_t warning_count,
569 uint8_t with_metadata)
570 : statement_id_{stmt_id},
575
576 constexpr uint32_t statement_id() const noexcept { return statement_id_; }
577 constexpr void statement_id(uint32_t id) noexcept { statement_id_ = id; }
578 constexpr uint16_t warning_count() const noexcept { return warning_count_; }
579 constexpr void warning_count(uint16_t cnt) noexcept { warning_count_ = cnt; }
580
581 constexpr uint16_t column_count() const noexcept { return column_count_; }
582 constexpr void column_count(uint16_t cnt) noexcept { column_count_ = cnt; }
583 constexpr uint16_t param_count() const noexcept { return param_count_; }
584 constexpr void param_count(uint16_t cnt) noexcept { param_count_ = cnt; }
585 constexpr uint8_t with_metadata() const noexcept { return with_metadata_; }
586 constexpr void with_metadata(uint8_t with) noexcept { with_metadata_ = with; }
587
588 friend constexpr bool operator==(const StmtPrepareOk &lhs,
589 const StmtPrepareOk &rhs) {
590 return (lhs.statement_id() == rhs.statement_id()) &&
591 (lhs.column_count() == rhs.column_count()) &&
592 (lhs.param_count() == rhs.param_count()) &&
593 (lhs.warning_count() == rhs.warning_count()) &&
594 (lhs.with_metadata() == rhs.with_metadata());
595 }
596
597 private:
600 uint16_t param_count_;
603};
604
605/**
606 * StmtRow message.
607 *
608 * holds the same information as a Row.
609 *
610 * needs 'types' to be able to encode a Field of the Row.
611 */
612template <bool Borrowed>
613class StmtRow : public Row<Borrowed> {
614 public:
616
618
619 StmtRow(std::vector<field_type::value_type> types,
620 std::vector<value_type> fields)
621 : base_{std::move(fields)}, types_{std::move(types)} {}
622
623 std::vector<field_type::value_type> types() const { return types_; }
624
625 private:
626 std::vector<field_type::value_type> types_;
627};
628
629template <bool Borrowed>
631 public:
633 std::conditional_t<Borrowed, std::string_view, std::string>;
634 /**
635 * construct a SendFileRequest message.
636 *
637 * @param filename filename
638 */
640 : filename_{std::move(filename)} {}
641
642 constexpr string_type filename() const { return filename_; }
643
644 private:
646};
647
648template <bool Borrowed>
649constexpr bool operator==(const SendFileRequest<Borrowed> &a,
650 const SendFileRequest<Borrowed> &b) {
651 return a.filename() == b.filename();
652}
653
654template <bool Borrowed>
656 public:
658 std::conditional_t<Borrowed, std::string_view, std::string>;
659
660 /**
661 * construct a Statistics message.
662 *
663 * @param stats statistics
664 */
665 constexpr Statistics(string_type stats) : stats_{std::move(stats)} {}
666
667 constexpr string_type stats() const { return stats_; }
668
669 private:
671};
672
673template <bool Borrowed>
674constexpr bool operator==(const Statistics<Borrowed> &a,
675 const Statistics<Borrowed> &b) {
676 return a.stats() == b.stats();
677}
678
679} // namespace server
680
681namespace client {
682
683template <bool Borrowed>
684class Greeting {
685 public:
687 std::conditional_t<Borrowed, std::string_view, std::string>;
688
689 /**
690 * construct a client::Greeting message.
691 *
692 * @param capabilities protocol capabilities of the client
693 * @param max_packet_size max size of the frame::Frame client wants to send
694 * @param collation initial collation of connection
695 * @param username username to authenticate as
696 * @param auth_method_data auth-method specific data like hashed password
697 * @param schema initial schema of the newly authenticated session
698 * @param auth_method_name auth-method the data is for
699 * @param attributes session-attributes
700 */
702 uint32_t max_packet_size, uint8_t collation,
709 username_{std::move(username)},
711 schema_{std::move(schema)},
713 attributes_{std::move(attributes)} {}
714
716 return capabilities_;
717 }
718
720 capabilities_ = caps;
721 }
722
723 constexpr uint32_t max_packet_size() const noexcept {
724 return max_packet_size_;
725 }
726 constexpr void max_packet_size(uint32_t sz) noexcept {
727 max_packet_size_ = sz;
728 }
729
730 constexpr uint8_t collation() const noexcept { return collation_; }
731 constexpr void collation(uint8_t coll) noexcept { collation_ = coll; }
732
733 constexpr string_type username() const { return username_; }
734 constexpr void username(const string_type &v) { username_ = v; }
735
736 constexpr string_type auth_method_data() const { return auth_method_data_; }
737 constexpr void auth_method_data(const string_type &v) {
739 }
740
741 constexpr string_type schema() const { return schema_; }
742 constexpr void schema(const string_type &schema) { schema_ = schema; }
743
744 /**
745 * name of the auth-method that was explicitly set.
746 *
747 * use classic_protocol::AuthMethod() to get the effective auth-method
748 * which may be announced though capability flags (like if
749 * capabilities::plugin_auth wasn't set)
750 */
751 constexpr string_type auth_method_name() const { return auth_method_name_; }
752
753 constexpr void auth_method_name(const string_type &name) {
755 }
756
757 // [key, value]* in Codec<wire::VarString> encoding
758 constexpr string_type attributes() const { return attributes_; }
759
760 constexpr void attributes(const string_type &attrs) { attributes_ = attrs; }
761
762 private:
765 uint8_t collation_;
771};
772
773template <bool Borrowed>
774constexpr bool operator==(const Greeting<Borrowed> &a,
775 const Greeting<Borrowed> &b) {
776 return (a.capabilities() == b.capabilities()) &&
777 (a.max_packet_size() == b.max_packet_size()) &&
778 (a.collation() == b.collation()) && (a.username() == b.username()) &&
779 (a.auth_method_data() == b.auth_method_data()) &&
780 (a.schema() == b.schema()) &&
781 (a.auth_method_name() == b.auth_method_name()) &&
782 (a.attributes() == b.attributes());
783}
784
785template <bool Borrowed>
786class Query {
787 public:
789 std::conditional_t<Borrowed, std::string_view, std::string>;
790
791 struct Param {
794 std::optional<string_type> value;
795
796 Param(uint16_t t, string_type n, std::optional<string_type> v)
797 : type_and_flags(t), name(std::move(n)), value(std::move(v)) {}
798 };
799
801
802 /**
803 * construct a Query message with values.
804 *
805 * @param statement statement to query
806 * @param values values for statement
807 */
808 Query(string_type statement, std::vector<Param> values)
809 : statement_{std::move(statement)}, values_(std::move(values)) {}
810
811 constexpr string_type statement() const { return statement_; }
812
813 std::vector<Param> values() const { return values_; }
814
815 private:
817 std::vector<Param> values_;
818};
819
820template <bool Borrowed>
821constexpr bool operator==(const Query<Borrowed> &a, const Query<Borrowed> &b) {
822 return a.statement() == b.statement();
823}
824
825template <bool Borrowed>
827 public:
829 std::conditional_t<Borrowed, std::string_view, std::string>;
830
831 /**
832 * list columns of a table.
833 *
834 * If 'wildcard' is empty the server will execute:
835 *
836 * SHOW COLUMNS FROM table_name
837 *
838 * Otherwise:
839 *
840 * SHOW COLUMNS FROM table_name LIKE wildcard
841 *
842 * @param table_name name of table to list
843 * @param wildcard wildcard
844 */
846 : table_name_{std::move(table_name)}, wildcard_{std::move(wildcard)} {}
847
848 constexpr string_type table_name() const { return table_name_; }
849 constexpr string_type wildcard() const { return wildcard_; }
850
851 private:
854};
855
856template <bool Borrowed>
857constexpr bool operator==(const ListFields<Borrowed> &a,
858 const ListFields<Borrowed> &b) {
859 return a.table_name() == b.table_name() && a.wildcard() == b.wildcard();
860}
861
862template <bool Borrowed>
864 public:
866 std::conditional_t<Borrowed, std::string_view, std::string>;
867
868 /**
869 * construct a InitSchema message.
870 *
871 * @param schema schema to change to
872 */
874
875 constexpr string_type schema() const { return schema_; }
876
877 private:
879};
880
881template <bool Borrowed>
882constexpr bool operator==(const InitSchema<Borrowed> &a,
883 const InitSchema<Borrowed> &b) {
884 return a.schema() == b.schema();
885}
886
887template <bool Borrowed>
889 public:
891 std::conditional_t<Borrowed, std::string_view, std::string>;
892 /**
893 * construct a ChangeUser message.
894 *
895 * @param username username to change to
896 * @param auth_method_data auth-method specific data like hashed password
897 * @param schema initial schema of the newly authenticated session
898 * @param auth_method_name auth-method the data is for
899 * @param collation collation
900 * @param attributes session-attributes
901 */
903 string_type schema, uint16_t collation,
905 : username_{std::move(username)},
907 schema_{std::move(schema)},
910 attributes_{std::move(attributes)} {}
911
912 constexpr uint8_t collation() const noexcept { return collation_; }
913 constexpr string_type username() const { return username_; }
914 constexpr string_type auth_method_data() const { return auth_method_data_; }
915 constexpr string_type schema() const { return schema_; }
916 constexpr string_type auth_method_name() const { return auth_method_name_; }
917
918 // [key, value]* in Codec<wire::VarString> encoding
919 constexpr string_type attributes() const { return attributes_; }
920
921 private:
925 uint16_t collation_;
928};
929
930template <bool Borrowed>
931constexpr bool operator==(const ChangeUser<Borrowed> &a,
932 const ChangeUser<Borrowed> &b) {
933 return (a.collation() == b.collation()) && (a.username() == b.username()) &&
934 (a.auth_method_data() == b.auth_method_data()) &&
935 (a.schema() == b.schema()) &&
936 (a.auth_method_name() == b.auth_method_name()) &&
937 (a.attributes() == b.attributes());
938}
939
940// no content
942
943constexpr bool operator==(const ResetConnection &, const ResetConnection &) {
944 return true;
945}
946
947// no content
948class Statistics {};
949
950constexpr bool operator==(const Statistics &, const Statistics &) {
951 return true;
952}
953
954class Reload {
955 public:
956 /**
957 * construct a Reload message.
958 *
959 * @param cmds what to reload
960 */
962 : cmds_{cmds} {}
963
965 return cmds_;
966 }
967
968 private:
970};
971
972inline bool operator==(const Reload &a, const Reload &b) {
973 return a.cmds() == b.cmds();
974}
975
976class Kill {
977 public:
978 /**
979 * construct a Kill message.
980 *
981 * @param connection_id payload
982 */
984
985 constexpr uint32_t connection_id() const { return connection_id_; }
986
987 private:
989};
990
991constexpr bool operator==(const Kill &a, const Kill &b) {
992 return a.connection_id() == b.connection_id();
993}
994
995template <bool Borrowed>
996class SendFile {
997 public:
999 std::conditional_t<Borrowed, std::string_view, std::string>;
1000
1001 /**
1002 * construct a SendFile message.
1003 *
1004 * @param payload payload
1005 */
1007
1008 constexpr string_type payload() const { return payload_; }
1009
1010 private:
1012};
1013
1014template <bool Borrowed>
1015inline bool operator==(const SendFile<Borrowed> &a,
1016 const SendFile<Borrowed> &b) {
1017 return a.payload() == b.payload();
1018}
1019
1020template <bool Borrowed>
1022 public:
1024 std::conditional_t<Borrowed, std::string_view, std::string>;
1025 /**
1026 * construct a PrepareStmt message.
1027 *
1028 * @param statement statement to prepare
1029 */
1031 : statement_{std::move(statement)} {}
1032
1033 constexpr string_type statement() const { return statement_; }
1034
1035 private:
1037};
1038
1039template <bool Borrowed>
1041 const StmtPrepare<Borrowed> &b) {
1042 return a.statement() == b.statement();
1043}
1044
1045/**
1046 * append data to a parameter of a prepared statement.
1047 */
1048template <bool Borrowed>
1050 public:
1052 std::conditional_t<Borrowed, std::string_view, std::string>;
1053
1054 /**
1055 * construct an append-data-to-parameter message.
1056 *
1057 * @param statement_id statement-id to close
1058 * @param param_id parameter-id to append data to
1059 * @param data data to append to param_id of statement_id
1060 */
1061 constexpr StmtParamAppendData(uint32_t statement_id, uint16_t param_id,
1065 data_{std::move(data)} {}
1066
1067 constexpr uint32_t statement_id() const { return statement_id_; }
1068 constexpr uint16_t param_id() const { return param_id_; }
1069 constexpr string_type data() const { return data_; }
1070
1071 private:
1073 uint16_t param_id_;
1075};
1076
1077template <bool Borrowed>
1080 return a.statement_id() == b.statement_id() && a.param_id() == b.param_id() &&
1081 a.data() == b.data();
1082}
1083
1084/**
1085 * execute a prepared statement.
1086 *
1087 * 'values' raw bytes as encoded by the binary codec
1088 */
1089template <bool Borrowed>
1091 public:
1093 std::conditional_t<Borrowed, std::string_view, std::string>;
1094
1095 using value_type = std::optional<string_type>;
1096
1097 struct ParamDef {
1098 ParamDef() = default;
1099
1100 ParamDef(uint16_t type_and_flags_) : type_and_flags(type_and_flags_) {}
1101
1102 ParamDef(uint16_t type_and_flags_, string_type name_)
1103 : type_and_flags(type_and_flags_), name(std::move(name_)) {}
1104
1105 friend bool operator==(const ParamDef &lhs, const ParamDef &rhs) {
1106 return lhs.type_and_flags == rhs.type_and_flags && lhs.name == rhs.name;
1107 }
1108
1109 uint16_t type_and_flags{};
1111 };
1112
1113 /**
1114 * construct a ExecuteStmt message.
1115 *
1116 * @param statement_id statement id
1117 * @param flags cursor flags
1118 * @param iteration_count iteration_count
1119 * @param new_params_bound new params bound
1120 * @param types field types of the parameters
1121 * @param values binary-encoded values without length-bytes
1122 */
1124 uint32_t iteration_count, bool new_params_bound,
1125 std::vector<ParamDef> types, std::vector<value_type> values)
1127 flags_{flags},
1130 types_{std::move(types)},
1131 values_{std::move(values)} {}
1132
1133 uint32_t statement_id() const noexcept { return statement_id_; }
1135 uint32_t iteration_count() const noexcept { return iteration_count_; }
1136 bool new_params_bound() const noexcept { return new_params_bound_; }
1137 std::vector<ParamDef> types() const { return types_; }
1138 std::vector<value_type> values() const { return values_; }
1139
1140 private:
1145 std::vector<ParamDef> types_;
1146 std::vector<value_type> values_;
1147};
1148
1149template <bool Borrowed>
1151 const StmtExecute<Borrowed> &b) {
1152 return a.statement_id() == b.statement_id() && a.flags() == b.flags() &&
1153 a.iteration_count() == b.iteration_count() &&
1155 a.types() == b.types() && a.values() == b.values();
1156}
1157
1158/**
1159 * close a prepared statement.
1160 */
1162 public:
1163 /**
1164 * construct a StmtClose message.
1165 *
1166 * @param statement_id statement-id to close
1167 */
1169
1170 constexpr uint32_t statement_id() const { return statement_id_; }
1171
1172 private:
1174};
1175
1176constexpr bool operator==(const StmtClose &a, const StmtClose &b) {
1177 return a.statement_id() == b.statement_id();
1178}
1179
1180/**
1181 * reset a prepared statement.
1182 */
1184 public:
1185 /**
1186 * construct a ResetStmt message.
1187 *
1188 * @param statement_id statement-id to close
1189 */
1191
1192 constexpr uint32_t statement_id() const { return statement_id_; }
1193
1194 private:
1196};
1197
1198constexpr bool operator==(const StmtReset &a, const StmtReset &b) {
1199 return a.statement_id() == b.statement_id();
1200}
1201
1202/**
1203 * fetch rows from an executed statement.
1204 */
1206 public:
1207 /**
1208 * construct a ResetStmt message.
1209 *
1210 * @param statement_id statement-id to close
1211 * @param row_count statement-id to close
1212 */
1213 constexpr StmtFetch(uint32_t statement_id, uint32_t row_count)
1215
1216 constexpr uint32_t statement_id() const { return statement_id_; }
1217 constexpr uint32_t row_count() const { return row_count_; }
1218
1219 private:
1221 uint32_t row_count_;
1222};
1223
1224constexpr bool operator==(const StmtFetch &a, const StmtFetch &b) {
1225 return a.statement_id() == b.statement_id() && a.row_count() == b.row_count();
1226}
1227
1228/**
1229 * set options on the current connection.
1230 */
1232 public:
1233 /**
1234 * construct a SetOption message.
1235 *
1236 * @param option options to set
1237 */
1238 constexpr SetOption(uint16_t option) : option_{option} {}
1239
1240 constexpr uint16_t option() const { return option_; }
1241
1242 private:
1243 uint16_t option_;
1244};
1245
1246constexpr bool operator==(const SetOption &a, const SetOption &b) {
1247 return a.option() == b.option();
1248}
1249
1250// no content
1251class Quit {};
1252
1253constexpr bool operator==(const Quit &, const Quit &) { return true; }
1254
1255// no content
1256class Ping {};
1257
1258constexpr bool operator==(const Ping &, const Ping &) { return true; }
1259
1260template <bool Borrowed>
1262 public:
1264 std::conditional_t<Borrowed, std::string_view, std::string>;
1265
1266 /**
1267 * send data for the current auth-method to server.
1268 *
1269 * @param auth_method_data data of the auth-method
1270 */
1273
1274 constexpr string_type auth_method_data() const { return auth_method_data_; }
1275
1276 private:
1278};
1279
1280template <bool Borrowed>
1281constexpr bool operator==(const AuthMethodData<Borrowed> &a,
1282 const AuthMethodData<Borrowed> &b) {
1283 return a.auth_method_data() == b.auth_method_data();
1284}
1285
1286// switch to Clone Protocol.
1287//
1288// response: server::Ok -> clone protocol
1289// response: server::Error
1290//
1291// no content
1292class Clone {};
1293
1294template <bool Borrowed>
1296 public:
1298 std::conditional_t<Borrowed, std::string_view, std::string>;
1299
1300 using Flags =
1302
1304 string_type filename, uint32_t position)
1306 flags_{flags},
1308 filename_{std::move(filename)} {}
1309
1310 [[nodiscard]] constexpr stdx::flags<Flags> flags() const { return flags_; }
1311 [[nodiscard]] constexpr uint32_t server_id() const { return server_id_; }
1312 [[nodiscard]] constexpr string_type filename() const { return filename_; }
1313 [[nodiscard]] constexpr uint64_t position() const { return position_; }
1314
1315 private:
1316 uint32_t position_;
1318 uint32_t server_id_;
1320};
1321
1322template <bool Borrowed>
1324 public:
1326 std::conditional_t<Borrowed, std::string_view, std::string>;
1327
1328 using Flags =
1330
1332 string_type filename, uint64_t position,
1334 : flags_{flags},
1336 filename_{std::move(filename)},
1338 sids_{std::move(sids)} {}
1339
1340 [[nodiscard]] constexpr stdx::flags<Flags> flags() const { return flags_; }
1341 [[nodiscard]] constexpr uint32_t server_id() const { return server_id_; }
1342 [[nodiscard]] constexpr string_type filename() const { return filename_; }
1343 [[nodiscard]] constexpr uint64_t position() const { return position_; }
1344 [[nodiscard]] constexpr string_type sids() const { return sids_; }
1345
1346 private:
1348 uint32_t server_id_;
1350 uint64_t position_;
1352};
1353
1354template <bool Borrowed>
1356 public:
1358 std::conditional_t<Borrowed, std::string_view, std::string>;
1359
1362 uint16_t port, uint32_t replication_rank,
1363 uint32_t master_id)
1365 hostname_{std::move(hostname)},
1366 username_{std::move(username)},
1367 password_{std::move(password)},
1368 port_{port},
1371
1372 [[nodiscard]] constexpr uint32_t server_id() const { return server_id_; }
1373 [[nodiscard]] constexpr string_type hostname() const { return hostname_; }
1374 [[nodiscard]] constexpr string_type username() const { return username_; }
1375 [[nodiscard]] constexpr string_type password() const { return password_; }
1376 [[nodiscard]] constexpr uint16_t port() const { return port_; }
1377 [[nodiscard]] constexpr uint32_t replication_rank() const {
1378 return replication_rank_;
1379 }
1380 [[nodiscard]] constexpr uint32_t master_id() const { return master_id_; }
1381
1382 private:
1383 uint32_t server_id_;
1387 uint16_t port_;
1389 uint32_t master_id_;
1390};
1391
1392} // namespace client
1393} // namespace message
1394} // namespace borrowable
1395
1396namespace message {
1397namespace server {
1398using Ok = borrowable::message::server::Ok<false>;
1399using Error = borrowable::message::server::Error<false>;
1400using Eof = borrowable::message::server::Eof<false>;
1401using Greeting = borrowable::message::server::Greeting<false>;
1403using ColumnMeta = borrowable::message::server::ColumnMeta<false>;
1404using AuthMethodSwitch = borrowable::message::server::AuthMethodSwitch<false>;
1405using AuthMethodData = borrowable::message::server::AuthMethodData<false>;
1406using SendFileRequest = borrowable::message::server::SendFileRequest<false>;
1407using Row = borrowable::message::server::Row<false>;
1408using StmtRow = borrowable::message::server::StmtRow<false>;
1410using Statistics = borrowable::message::server::Statistics<false>;
1411} // namespace server
1412
1413namespace client {
1439} // namespace client
1440} // namespace message
1441
1442namespace borrowed {
1443namespace message {
1444namespace server {
1445using Ok = borrowable::message::server::Ok<true>;
1446using Error = borrowable::message::server::Error<true>;
1447using Eof = borrowable::message::server::Eof<true>;
1448using Greeting = borrowable::message::server::Greeting<true>;
1450using ColumnMeta = borrowable::message::server::ColumnMeta<true>;
1451using AuthMethodSwitch = borrowable::message::server::AuthMethodSwitch<true>;
1452using AuthMethodData = borrowable::message::server::AuthMethodData<true>;
1453using SendFileRequest = borrowable::message::server::SendFileRequest<true>;
1454using Row = borrowable::message::server::Row<true>;
1455using StmtRow = borrowable::message::server::StmtRow<true>;
1457using Statistics = borrowable::message::server::Statistics<true>;
1458} // namespace server
1459
1460namespace client {
1486} // namespace client
1487} // namespace message
1488} // namespace borrowed
1489
1490} // namespace classic_protocol
1491
1492#endif
Class representing an error.
Definition: error.h:48
AuthMethod of classic protocol.
Definition: classic_protocol_message.h:84
constexpr string_type name() const
Definition: classic_protocol_message.h:94
const classic_protocol::capabilities::value_type capabilities_
Definition: classic_protocol_message.h:109
const string_type auth_method_name_
Definition: classic_protocol_message.h:110
std::conditional_t< Borrowed, std::string_view, std::string > string_type
Definition: classic_protocol_message.h:87
AuthMethod(classic_protocol::capabilities::value_type capabilities, string_type auth_method_name)
Definition: classic_protocol_message.h:89
Definition: classic_protocol_message.h:1261
constexpr string_type auth_method_data() const
Definition: classic_protocol_message.h:1274
string_type auth_method_data_
Definition: classic_protocol_message.h:1277
std::conditional_t< Borrowed, std::string_view, std::string > string_type
Definition: classic_protocol_message.h:1264
constexpr AuthMethodData(string_type auth_method_data)
send data for the current auth-method to server.
Definition: classic_protocol_message.h:1271
Definition: classic_protocol_message.h:1323
constexpr uint64_t position() const
Definition: classic_protocol_message.h:1343
constexpr stdx::flags< Flags > flags() const
Definition: classic_protocol_message.h:1340
string_type filename_
Definition: classic_protocol_message.h:1349
uint32_t server_id_
Definition: classic_protocol_message.h:1348
std::conditional_t< Borrowed, std::string_view, std::string > string_type
Definition: classic_protocol_message.h:1326
stdx::flags< Flags > flags_
Definition: classic_protocol_message.h:1347
constexpr string_type sids() const
Definition: classic_protocol_message.h:1344
string_type sids_
Definition: classic_protocol_message.h:1351
constexpr string_type filename() const
Definition: classic_protocol_message.h:1342
typename classic_protocol::message::client::impl::BinlogDumpGtid::Flags Flags
Definition: classic_protocol_message.h:1329
uint64_t position_
Definition: classic_protocol_message.h:1350
constexpr uint32_t server_id() const
Definition: classic_protocol_message.h:1341
constexpr BinlogDumpGtid(stdx::flags< Flags > flags, uint32_t server_id, string_type filename, uint64_t position, string_type sids)
Definition: classic_protocol_message.h:1331
Definition: classic_protocol_message.h:1295
constexpr stdx::flags< Flags > flags() const
Definition: classic_protocol_message.h:1310
string_type filename_
Definition: classic_protocol_message.h:1319
uint32_t server_id_
Definition: classic_protocol_message.h:1318
constexpr uint64_t position() const
Definition: classic_protocol_message.h:1313
stdx::flags< Flags > flags_
Definition: classic_protocol_message.h:1317
uint32_t position_
Definition: classic_protocol_message.h:1316
constexpr BinlogDump(stdx::flags< Flags > flags, uint32_t server_id, string_type filename, uint32_t position)
Definition: classic_protocol_message.h:1303
std::conditional_t< Borrowed, std::string_view, std::string > string_type
Definition: classic_protocol_message.h:1298
constexpr uint32_t server_id() const
Definition: classic_protocol_message.h:1311
constexpr string_type filename() const
Definition: classic_protocol_message.h:1312
typename classic_protocol::message::client::impl::BinlogDump::Flags Flags
Definition: classic_protocol_message.h:1301
Definition: classic_protocol_message.h:888
constexpr ChangeUser(string_type username, string_type auth_method_data, string_type schema, uint16_t collation, string_type auth_method_name, string_type attributes)
construct a ChangeUser message.
Definition: classic_protocol_message.h:902
string_type attributes_
Definition: classic_protocol_message.h:927
std::conditional_t< Borrowed, std::string_view, std::string > string_type
Definition: classic_protocol_message.h:891
string_type username_
Definition: classic_protocol_message.h:922
constexpr string_type attributes() const
Definition: classic_protocol_message.h:919
uint16_t collation_
Definition: classic_protocol_message.h:925
constexpr string_type auth_method_name() const
Definition: classic_protocol_message.h:916
constexpr uint8_t collation() const noexcept
Definition: classic_protocol_message.h:912
string_type auth_method_data_
Definition: classic_protocol_message.h:923
constexpr string_type username() const
Definition: classic_protocol_message.h:913
constexpr string_type auth_method_data() const
Definition: classic_protocol_message.h:914
constexpr string_type schema() const
Definition: classic_protocol_message.h:915
string_type schema_
Definition: classic_protocol_message.h:924
string_type auth_method_name_
Definition: classic_protocol_message.h:926
Definition: classic_protocol_message.h:1292
Definition: classic_protocol_message.h:684
constexpr string_type schema() const
Definition: classic_protocol_message.h:741
constexpr void schema(const string_type &schema)
Definition: classic_protocol_message.h:742
constexpr string_type auth_method_data() const
Definition: classic_protocol_message.h:736
string_type auth_method_name_
Definition: classic_protocol_message.h:769
constexpr void capabilities(classic_protocol::capabilities::value_type caps)
Definition: classic_protocol_message.h:719
uint32_t max_packet_size_
Definition: classic_protocol_message.h:764
constexpr string_type auth_method_name() const
name of the auth-method that was explicitly set.
Definition: classic_protocol_message.h:751
std::conditional_t< Borrowed, std::string_view, std::string > string_type
Definition: classic_protocol_message.h:687
uint8_t collation_
Definition: classic_protocol_message.h:765
constexpr void collation(uint8_t coll) noexcept
Definition: classic_protocol_message.h:731
constexpr uint8_t collation() const noexcept
Definition: classic_protocol_message.h:730
string_type username_
Definition: classic_protocol_message.h:766
constexpr void username(const string_type &v)
Definition: classic_protocol_message.h:734
constexpr Greeting(classic_protocol::capabilities::value_type capabilities, uint32_t max_packet_size, uint8_t collation, string_type username, string_type auth_method_data, string_type schema, string_type auth_method_name, string_type attributes)
construct a client::Greeting message.
Definition: classic_protocol_message.h:701
constexpr classic_protocol::capabilities::value_type capabilities() const
Definition: classic_protocol_message.h:715
constexpr void max_packet_size(uint32_t sz) noexcept
Definition: classic_protocol_message.h:726
constexpr void auth_method_data(const string_type &v)
Definition: classic_protocol_message.h:737
string_type attributes_
Definition: classic_protocol_message.h:770
constexpr uint32_t max_packet_size() const noexcept
Definition: classic_protocol_message.h:723
constexpr void attributes(const string_type &attrs)
Definition: classic_protocol_message.h:760
constexpr string_type attributes() const
Definition: classic_protocol_message.h:758
constexpr string_type username() const
Definition: classic_protocol_message.h:733
classic_protocol::capabilities::value_type capabilities_
Definition: classic_protocol_message.h:763
string_type auth_method_data_
Definition: classic_protocol_message.h:767
constexpr void auth_method_name(const string_type &name)
Definition: classic_protocol_message.h:753
string_type schema_
Definition: classic_protocol_message.h:768
Definition: classic_protocol_message.h:863
string_type schema_
Definition: classic_protocol_message.h:878
constexpr InitSchema(string_type schema)
construct a InitSchema message.
Definition: classic_protocol_message.h:873
constexpr string_type schema() const
Definition: classic_protocol_message.h:875
std::conditional_t< Borrowed, std::string_view, std::string > string_type
Definition: classic_protocol_message.h:866
Definition: classic_protocol_message.h:976
uint32_t connection_id_
Definition: classic_protocol_message.h:988
constexpr uint32_t connection_id() const
Definition: classic_protocol_message.h:985
constexpr Kill(uint32_t connection_id)
construct a Kill message.
Definition: classic_protocol_message.h:983
Definition: classic_protocol_message.h:826
constexpr string_type table_name() const
Definition: classic_protocol_message.h:848
constexpr ListFields(string_type table_name, string_type wildcard)
list columns of a table.
Definition: classic_protocol_message.h:845
string_type table_name_
Definition: classic_protocol_message.h:852
constexpr string_type wildcard() const
Definition: classic_protocol_message.h:849
string_type wildcard_
Definition: classic_protocol_message.h:853
std::conditional_t< Borrowed, std::string_view, std::string > string_type
Definition: classic_protocol_message.h:829
Definition: classic_protocol_message.h:1256
Definition: classic_protocol_message.h:786
std::conditional_t< Borrowed, std::string_view, std::string > string_type
Definition: classic_protocol_message.h:789
constexpr string_type statement() const
Definition: classic_protocol_message.h:811
string_type statement_
Definition: classic_protocol_message.h:816
Query(string_type statement)
Definition: classic_protocol_message.h:800
Query(string_type statement, std::vector< Param > values)
construct a Query message with values.
Definition: classic_protocol_message.h:808
std::vector< Param > values_
Definition: classic_protocol_message.h:817
std::vector< Param > values() const
Definition: classic_protocol_message.h:813
Definition: classic_protocol_message.h:1251
Definition: classic_protocol_message.h:1355
std::conditional_t< Borrowed, std::string_view, std::string > string_type
Definition: classic_protocol_message.h:1358
uint32_t server_id_
Definition: classic_protocol_message.h:1383
string_type password_
Definition: classic_protocol_message.h:1386
constexpr RegisterReplica(uint32_t server_id, string_type hostname, string_type username, string_type password, uint16_t port, uint32_t replication_rank, uint32_t master_id)
Definition: classic_protocol_message.h:1360
constexpr string_type password() const
Definition: classic_protocol_message.h:1375
uint32_t replication_rank_
Definition: classic_protocol_message.h:1388
uint16_t port_
Definition: classic_protocol_message.h:1387
constexpr uint32_t master_id() const
Definition: classic_protocol_message.h:1380
constexpr uint32_t replication_rank() const
Definition: classic_protocol_message.h:1377
constexpr uint32_t server_id() const
Definition: classic_protocol_message.h:1372
constexpr string_type username() const
Definition: classic_protocol_message.h:1374
constexpr string_type hostname() const
Definition: classic_protocol_message.h:1373
string_type username_
Definition: classic_protocol_message.h:1385
string_type hostname_
Definition: classic_protocol_message.h:1384
uint32_t master_id_
Definition: classic_protocol_message.h:1389
constexpr uint16_t port() const
Definition: classic_protocol_message.h:1376
Definition: classic_protocol_message.h:954
classic_protocol::reload_cmds::value_type cmds_
Definition: classic_protocol_message.h:969
constexpr Reload(classic_protocol::reload_cmds::value_type cmds)
construct a Reload message.
Definition: classic_protocol_message.h:961
constexpr classic_protocol::reload_cmds::value_type cmds() const
Definition: classic_protocol_message.h:964
Definition: classic_protocol_message.h:941
Definition: classic_protocol_message.h:996
constexpr string_type payload() const
Definition: classic_protocol_message.h:1008
string_type payload_
Definition: classic_protocol_message.h:1011
std::conditional_t< Borrowed, std::string_view, std::string > string_type
Definition: classic_protocol_message.h:999
constexpr SendFile(string_type payload)
construct a SendFile message.
Definition: classic_protocol_message.h:1006
set options on the current connection.
Definition: classic_protocol_message.h:1231
constexpr SetOption(uint16_t option)
construct a SetOption message.
Definition: classic_protocol_message.h:1238
constexpr uint16_t option() const
Definition: classic_protocol_message.h:1240
uint16_t option_
Definition: classic_protocol_message.h:1243
Definition: classic_protocol_message.h:948
close a prepared statement.
Definition: classic_protocol_message.h:1161
constexpr uint32_t statement_id() const
Definition: classic_protocol_message.h:1170
constexpr StmtClose(uint32_t statement_id)
construct a StmtClose message.
Definition: classic_protocol_message.h:1168
uint32_t statement_id_
Definition: classic_protocol_message.h:1173
execute a prepared statement.
Definition: classic_protocol_message.h:1090
bool new_params_bound() const noexcept
Definition: classic_protocol_message.h:1136
std::vector< value_type > values_
Definition: classic_protocol_message.h:1146
std::optional< string_type > value_type
Definition: classic_protocol_message.h:1095
uint32_t iteration_count() const noexcept
Definition: classic_protocol_message.h:1135
std::vector< value_type > values() const
Definition: classic_protocol_message.h:1138
std::conditional_t< Borrowed, std::string_view, std::string > string_type
Definition: classic_protocol_message.h:1093
uint32_t statement_id_
Definition: classic_protocol_message.h:1141
bool new_params_bound_
Definition: classic_protocol_message.h:1144
std::vector< ParamDef > types_
Definition: classic_protocol_message.h:1145
uint32_t statement_id() const noexcept
Definition: classic_protocol_message.h:1133
uint32_t iteration_count_
Definition: classic_protocol_message.h:1143
StmtExecute(uint32_t statement_id, classic_protocol::cursor::value_type flags, uint32_t iteration_count, bool new_params_bound, std::vector< ParamDef > types, std::vector< value_type > values)
construct a ExecuteStmt message.
Definition: classic_protocol_message.h:1123
classic_protocol::cursor::value_type flags() const noexcept
Definition: classic_protocol_message.h:1134
std::vector< ParamDef > types() const
Definition: classic_protocol_message.h:1137
classic_protocol::cursor::value_type flags_
Definition: classic_protocol_message.h:1142
fetch rows from an executed statement.
Definition: classic_protocol_message.h:1205
constexpr uint32_t row_count() const
Definition: classic_protocol_message.h:1217
uint32_t row_count_
Definition: classic_protocol_message.h:1221
constexpr uint32_t statement_id() const
Definition: classic_protocol_message.h:1216
uint32_t statement_id_
Definition: classic_protocol_message.h:1220
constexpr StmtFetch(uint32_t statement_id, uint32_t row_count)
construct a ResetStmt message.
Definition: classic_protocol_message.h:1213
append data to a parameter of a prepared statement.
Definition: classic_protocol_message.h:1049
constexpr string_type data() const
Definition: classic_protocol_message.h:1069
string_type data_
Definition: classic_protocol_message.h:1074
uint16_t param_id_
Definition: classic_protocol_message.h:1073
constexpr uint32_t statement_id() const
Definition: classic_protocol_message.h:1067
constexpr StmtParamAppendData(uint32_t statement_id, uint16_t param_id, string_type data)
construct an append-data-to-parameter message.
Definition: classic_protocol_message.h:1061
std::conditional_t< Borrowed, std::string_view, std::string > string_type
Definition: classic_protocol_message.h:1052
constexpr uint16_t param_id() const
Definition: classic_protocol_message.h:1068
uint32_t statement_id_
Definition: classic_protocol_message.h:1072
Definition: classic_protocol_message.h:1021
constexpr StmtPrepare(string_type statement)
construct a PrepareStmt message.
Definition: classic_protocol_message.h:1030
string_type statement_
Definition: classic_protocol_message.h:1036
std::conditional_t< Borrowed, std::string_view, std::string > string_type
Definition: classic_protocol_message.h:1024
constexpr string_type statement() const
Definition: classic_protocol_message.h:1033
reset a prepared statement.
Definition: classic_protocol_message.h:1183
uint32_t statement_id_
Definition: classic_protocol_message.h:1195
constexpr uint32_t statement_id() const
Definition: classic_protocol_message.h:1192
constexpr StmtReset(uint32_t statement_id)
construct a ResetStmt message.
Definition: classic_protocol_message.h:1190
Opaque auth-method-data message.
Definition: classic_protocol_message.h:240
string_type auth_method_data_
Definition: classic_protocol_message.h:251
constexpr AuthMethodData(string_type auth_method_data)
Definition: classic_protocol_message.h:245
constexpr string_type auth_method_data() const
Definition: classic_protocol_message.h:248
std::conditional_t< Borrowed, std::string_view, std::string > string_type
Definition: classic_protocol_message.h:243
Definition: classic_protocol_message.h:197
std::conditional_t< Borrowed, std::string_view, std::string > string_type
Definition: classic_protocol_message.h:200
constexpr AuthMethodSwitch(string_type auth_method, string_type auth_method_data)
Definition: classic_protocol_message.h:204
string_type auth_method_data_
Definition: classic_protocol_message.h:214
string_type auth_method_data() const
Definition: classic_protocol_message.h:210
string_type auth_method() const
Definition: classic_protocol_message.h:209
string_type auth_method_
Definition: classic_protocol_message.h:213
ColumnCount message.
Definition: classic_protocol_message.h:412
constexpr uint64_t count() const noexcept
Definition: classic_protocol_message.h:421
uint64_t count_
Definition: classic_protocol_message.h:424
constexpr ColumnCount(uint64_t count)
construct an ColumnCount message.
Definition: classic_protocol_message.h:419
Definition: classic_protocol_message.h:432
constexpr classic_protocol::column_def::value_type flags() const
Definition: classic_protocol_message.h:464
classic_protocol::column_def::value_type flags_
Definition: classic_protocol_message.h:479
constexpr uint32_t column_length() const
Definition: classic_protocol_message.h:462
string_type schema_
Definition: classic_protocol_message.h:471
constexpr ColumnMeta(string_type catalog, string_type schema, string_type table, string_type orig_table, string_type name, string_type orig_name, uint16_t collation, uint32_t column_length, uint8_t type, classic_protocol::column_def::value_type flags, uint8_t decimals)
Definition: classic_protocol_message.h:437
constexpr string_type orig_table() const
Definition: classic_protocol_message.h:458
uint16_t collation_
Definition: classic_protocol_message.h:476
std::conditional_t< Borrowed, std::string_view, std::string > string_type
Definition: classic_protocol_message.h:435
uint8_t type_
Definition: classic_protocol_message.h:478
constexpr string_type name() const
Definition: classic_protocol_message.h:459
string_type catalog_
Definition: classic_protocol_message.h:470
string_type orig_name_
Definition: classic_protocol_message.h:475
constexpr string_type orig_name() const
Definition: classic_protocol_message.h:460
uint32_t column_length_
Definition: classic_protocol_message.h:477
constexpr string_type catalog() const
Definition: classic_protocol_message.h:455
string_type table_
Definition: classic_protocol_message.h:472
uint8_t decimals_
Definition: classic_protocol_message.h:480
constexpr uint8_t decimals() const
Definition: classic_protocol_message.h:467
constexpr string_type schema() const
Definition: classic_protocol_message.h:456
string_type name_
Definition: classic_protocol_message.h:474
constexpr uint16_t collation() const
Definition: classic_protocol_message.h:461
constexpr string_type table() const
Definition: classic_protocol_message.h:457
string_type orig_table_
Definition: classic_protocol_message.h:473
constexpr uint8_t type() const
Definition: classic_protocol_message.h:463
End of Resultset message.
Definition: classic_protocol_message.h:343
constexpr Eof(classic_protocol::status::value_type status_flags, uint16_t warning_count, string_type message, string_type session_changes)
Definition: classic_protocol_message.h:360
constexpr Eof(classic_protocol::status::value_type status_flags, uint16_t warning_count)
Definition: classic_protocol_message.h:356
Error message.
Definition: classic_protocol_message.h:371
constexpr string_type message() const
Definition: classic_protocol_message.h:394
constexpr string_type sql_state() const
Definition: classic_protocol_message.h:392
string_type message_
Definition: classic_protocol_message.h:399
constexpr uint16_t error_code() const noexcept
Definition: classic_protocol_message.h:390
constexpr void message(const string_type &msg)
Definition: classic_protocol_message.h:395
string_type sql_state_
Definition: classic_protocol_message.h:400
constexpr Error(uint16_t error_code, string_type message, string_type sql_state="HY000")
construct an Error message.
Definition: classic_protocol_message.h:384
uint16_t error_code_
Definition: classic_protocol_message.h:398
std::conditional_t< Borrowed, std::string_view, std::string > string_type
Definition: classic_protocol_message.h:374
constexpr void error_code(uint16_t code)
Definition: classic_protocol_message.h:391
constexpr void sql_state(const string_type &state)
Definition: classic_protocol_message.h:393
Definition: classic_protocol_message.h:118
constexpr uint8_t collation() const noexcept
Definition: classic_protocol_message.h:159
constexpr uint32_t connection_id() const noexcept
Definition: classic_protocol_message.h:169
constexpr classic_protocol::status::value_type status_flags() const noexcept
Definition: classic_protocol_message.h:162
uint32_t connection_id_
Definition: classic_protocol_message.h:175
void status_flags(classic_protocol::status::value_type val)
Definition: classic_protocol_message.h:165
string_type auth_method_data_
Definition: classic_protocol_message.h:176
void collation(uint8_t val)
Definition: classic_protocol_message.h:160
void connection_id(uint32_t val)
Definition: classic_protocol_message.h:170
constexpr Greeting(uint8_t protocol_version, string_type version, uint32_t connection_id, string_type auth_method_data, classic_protocol::capabilities::value_type capabilities, uint8_t collation, classic_protocol::status::value_type status_flags, string_type auth_method_name)
Definition: classic_protocol_message.h:123
string_type version_
Definition: classic_protocol_message.h:174
void auth_method_data(string_type val)
Definition: classic_protocol_message.h:149
constexpr string_type auth_method_name() const
Definition: classic_protocol_message.h:146
classic_protocol::capabilities::value_type capabilities() const noexcept
Definition: classic_protocol_message.h:151
std::conditional_t< Borrowed, std::string_view, std::string > string_type
Definition: classic_protocol_message.h:121
uint8_t protocol_version_
Definition: classic_protocol_message.h:173
string_type auth_method_name_
Definition: classic_protocol_message.h:180
uint8_t collation_
Definition: classic_protocol_message.h:178
void version(string_type val)
Definition: classic_protocol_message.h:144
void auth_method_name(string_type val)
Definition: classic_protocol_message.h:147
void protocol_version(uint8_t val)
Definition: classic_protocol_message.h:141
classic_protocol::capabilities::value_type capabilities_
Definition: classic_protocol_message.h:177
constexpr string_type version() const
Definition: classic_protocol_message.h:143
constexpr string_type auth_method_data() const
Definition: classic_protocol_message.h:148
classic_protocol::status::value_type status_flags_
Definition: classic_protocol_message.h:179
void capabilities(classic_protocol::capabilities::value_type caps)
Definition: classic_protocol_message.h:155
constexpr uint8_t protocol_version() const noexcept
Definition: classic_protocol_message.h:138
Ok message.
Definition: classic_protocol_message.h:271
constexpr string_type message() const
Definition: classic_protocol_message.h:307
constexpr uint64_t last_insert_id() const noexcept
Definition: classic_protocol_message.h:301
uint16_t warning_count_
Definition: classic_protocol_message.h:321
constexpr void affected_rows(uint64_t val)
Definition: classic_protocol_message.h:303
constexpr void status_flags(classic_protocol::status::value_type flags)
Definition: classic_protocol_message.h:289
constexpr void last_insert_id(uint64_t val)
Definition: classic_protocol_message.h:300
constexpr void message(const string_type &msg)
Definition: classic_protocol_message.h:306
constexpr void session_changes(const string_type &changes)
Definition: classic_protocol_message.h:309
uint64_t last_insert_id_
Definition: classic_protocol_message.h:322
constexpr classic_protocol::status::value_type status_flags() const noexcept
Definition: classic_protocol_message.h:293
std::conditional_t< Borrowed, std::string_view, std::string > string_type
Definition: classic_protocol_message.h:274
string_type message_
Definition: classic_protocol_message.h:325
classic_protocol::status::value_type status_flags_
Definition: classic_protocol_message.h:320
constexpr uint64_t affected_rows() const noexcept
Definition: classic_protocol_message.h:304
constexpr uint16_t warning_count() const noexcept
Definition: classic_protocol_message.h:298
uint64_t affected_rows_
Definition: classic_protocol_message.h:323
string_type session_changes() const
get session-changes.
Definition: classic_protocol_message.h:317
constexpr void warning_count(uint16_t count)
Definition: classic_protocol_message.h:297
constexpr Ok(uint64_t affected_rows, uint64_t last_insert_id, classic_protocol::status::value_type status_flags, uint16_t warning_count, string_type message="", string_type session_changes="")
Definition: classic_protocol_message.h:278
string_type session_changes_
Definition: classic_protocol_message.h:326
Definition: classic_protocol_message.h:534
std::vector< Row< Borrowed > > rows() const
Definition: classic_protocol_message.h:543
std::vector< ColumnMeta< Borrowed > > column_metas() const
Definition: classic_protocol_message.h:540
std::vector< ColumnMeta< Borrowed > > column_metas_
Definition: classic_protocol_message.h:546
std::vector< Row< Borrowed > > rows_
Definition: classic_protocol_message.h:547
ResultSet(std::vector< ColumnMeta< Borrowed > > column_metas, std::vector< Row< Borrowed > > rows)
Definition: classic_protocol_message.h:536
Row in a resultset.
Definition: classic_protocol_message.h:502
typename std::vector< value_type >::const_iterator const_iterator
Definition: classic_protocol_message.h:508
Row(std::vector< value_type > fields)
Definition: classic_protocol_message.h:510
auto begin() const
Definition: classic_protocol_message.h:512
std::vector< value_type > fields_
Definition: classic_protocol_message.h:516
std::conditional_t< Borrowed, std::string_view, std::string > string_type
Definition: classic_protocol_message.h:505
std::optional< string_type > value_type
Definition: classic_protocol_message.h:507
auto end() const
Definition: classic_protocol_message.h:513
Definition: classic_protocol_message.h:630
std::conditional_t< Borrowed, std::string_view, std::string > string_type
Definition: classic_protocol_message.h:633
constexpr string_type filename() const
Definition: classic_protocol_message.h:642
constexpr SendFileRequest(string_type filename)
construct a SendFileRequest message.
Definition: classic_protocol_message.h:639
string_type filename_
Definition: classic_protocol_message.h:645
Definition: classic_protocol_message.h:655
string_type stats_
Definition: classic_protocol_message.h:670
constexpr Statistics(string_type stats)
construct a Statistics message.
Definition: classic_protocol_message.h:665
constexpr string_type stats() const
Definition: classic_protocol_message.h:667
std::conditional_t< Borrowed, std::string_view, std::string > string_type
Definition: classic_protocol_message.h:658
StmtPrepareOk message.
Definition: classic_protocol_message.h:555
constexpr uint16_t param_count() const noexcept
Definition: classic_protocol_message.h:583
constexpr void column_count(uint16_t cnt) noexcept
Definition: classic_protocol_message.h:582
uint8_t with_metadata_
Definition: classic_protocol_message.h:602
constexpr uint16_t column_count() const noexcept
Definition: classic_protocol_message.h:581
constexpr void warning_count(uint16_t cnt) noexcept
Definition: classic_protocol_message.h:579
constexpr void statement_id(uint32_t id) noexcept
Definition: classic_protocol_message.h:577
constexpr uint8_t with_metadata() const noexcept
Definition: classic_protocol_message.h:585
uint32_t statement_id_
Definition: classic_protocol_message.h:598
uint16_t warning_count_
Definition: classic_protocol_message.h:599
constexpr StmtPrepareOk(uint32_t stmt_id, uint16_t column_count, uint16_t param_count, uint16_t warning_count, uint8_t with_metadata)
create a Ok message for a client::StmtPrepare.
Definition: classic_protocol_message.h:567
constexpr friend bool operator==(const StmtPrepareOk &lhs, const StmtPrepareOk &rhs)
Definition: classic_protocol_message.h:588
uint16_t column_count_
Definition: classic_protocol_message.h:601
constexpr uint16_t warning_count() const noexcept
Definition: classic_protocol_message.h:578
constexpr void with_metadata(uint8_t with) noexcept
Definition: classic_protocol_message.h:586
constexpr uint32_t statement_id() const noexcept
Definition: classic_protocol_message.h:576
constexpr void param_count(uint16_t cnt) noexcept
Definition: classic_protocol_message.h:584
uint16_t param_count_
Definition: classic_protocol_message.h:600
StmtRow message.
Definition: classic_protocol_message.h:613
std::vector< field_type::value_type > types_
Definition: classic_protocol_message.h:626
std::vector< field_type::value_type > types() const
Definition: classic_protocol_message.h:623
StmtRow(std::vector< field_type::value_type > types, std::vector< value_type > fields)
Definition: classic_protocol_message.h:619
Definition: classic_protocol_message.h:56
Flags
Definition: classic_protocol_message.h:59
Definition: classic_protocol_message.h:39
Flags
Definition: classic_protocol_message.h:42
a type-safe flags type.
Definition: flags.h:115
static int flags[50]
Definition: hp_test1.cc:40
static int count
Definition: myisam_ftdump.cc:43
uint16_t value_type
Definition: vt100.h:184
constexpr bool operator==(const Greeting< Borrowed > &a, const Greeting< Borrowed > &b)
Definition: classic_protocol_message.h:774
bool operator==(const Greeting< Borrowed > &a, const Greeting< Borrowed > &b)
Definition: classic_protocol_message.h:184
borrowable::message::client::Reload Reload
Definition: classic_protocol_message.h:1470
borrowable::message::client::Kill Kill
Definition: classic_protocol_message.h:1468
borrowable::message::server::ColumnMeta< true > ColumnMeta
Definition: classic_protocol_message.h:1450
borrowable::message::server::StmtPrepareOk StmtPrepareOk
Definition: classic_protocol_message.h:1456
borrowable::message::server::SendFileRequest< true > SendFileRequest
Definition: classic_protocol_message.h:1453
borrowable::message::server::StmtRow< true > StmtRow
Definition: classic_protocol_message.h:1455
borrowable::message::server::Eof< true > Eof
Definition: classic_protocol_message.h:1447
borrowable::message::server::Statistics< true > Statistics
Definition: classic_protocol_message.h:1457
borrowable::message::server::Row< true > Row
Definition: classic_protocol_message.h:1454
borrowable::message::server::AuthMethodData< true > AuthMethodData
Definition: classic_protocol_message.h:1452
borrowable::message::server::Ok< true > Ok
Definition: classic_protocol_message.h:1445
borrowable::message::server::ColumnCount ColumnCount
Definition: classic_protocol_message.h:1449
borrowable::message::server::Greeting< true > Greeting
Definition: classic_protocol_message.h:1448
borrowable::message::server::AuthMethodSwitch< true > AuthMethodSwitch
Definition: classic_protocol_message.h:1451
constexpr value_type plugin_auth
Definition: classic_protocol_constants.h:57
constexpr value_type secure_connection
Definition: classic_protocol_constants.h:53
std::bitset< 32 > value_type
Definition: classic_protocol_constants.h:73
std::bitset< pos::_bitset_size > value_type
Definition: classic_protocol_constants.h:286
std::bitset< pos::_bitset_size > value_type
Definition: classic_protocol_constants.h:220
Definition: classic_protocol_message.h:38
borrowable::message::server::AuthMethodSwitch< false > AuthMethodSwitch
Definition: classic_protocol_message.h:1404
borrowable::message::server::StmtPrepareOk StmtPrepareOk
Definition: classic_protocol_message.h:1409
borrowable::message::server::Greeting< false > Greeting
Definition: classic_protocol_message.h:1401
borrowable::message::server::Row< false > Row
Definition: classic_protocol_message.h:1407
borrowable::message::server::Eof< false > Eof
Definition: classic_protocol_message.h:1400
borrowable::message::server::ColumnCount ColumnCount
Definition: classic_protocol_message.h:1402
borrowable::message::server::Ok< false > Ok
Definition: classic_protocol_message.h:1398
borrowable::message::server::AuthMethodData< false > AuthMethodData
Definition: classic_protocol_message.h:1405
borrowable::message::server::Statistics< false > Statistics
Definition: classic_protocol_message.h:1410
borrowable::message::server::StmtRow< false > StmtRow
Definition: classic_protocol_message.h:1408
borrowable::message::server::SendFileRequest< false > SendFileRequest
Definition: classic_protocol_message.h:1406
borrowable::message::server::ColumnMeta< false > ColumnMeta
Definition: classic_protocol_message.h:1403
std::bitset< pos::_bitset_size > value_type
Definition: classic_protocol_constants.h:319
std::bitset< 16 > value_type
Definition: classic_protocol_constants.h:168
Definition: classic_protocol_binary.h:39
Definition: gcs_xcom_synode.h:64
Definition: bit.h:34
std::vector< T, ut::allocator< T > > vector
Specialization of vector which uses allocator.
Definition: ut0new.h:2875
case opt name
Definition: sslopt-case.h:33
Definition: classic_protocol_message.h:791
std::optional< string_type > value
Definition: classic_protocol_message.h:794
string_type name
Definition: classic_protocol_message.h:793
uint16_t type_and_flags
Definition: classic_protocol_message.h:792
Param(uint16_t t, string_type n, std::optional< string_type > v)
Definition: classic_protocol_message.h:796
ParamDef(uint16_t type_and_flags_, string_type name_)
Definition: classic_protocol_message.h:1102
uint16_t type_and_flags
Definition: classic_protocol_message.h:1109
string_type name
Definition: classic_protocol_message.h:1110
friend bool operator==(const ParamDef &lhs, const ParamDef &rhs)
Definition: classic_protocol_message.h:1105
ParamDef(uint16_t type_and_flags_)
Definition: classic_protocol_message.h:1100
Definition: server_struct.h:39
Definition: mysqlslap.cc:217
Definition: mysqlslap.cc:238
Definition: flags.h:38
@ a_end
Definition: task_arg.h:38
unsigned long id[MAX_DEAD]
Definition: xcom_base.cc:510
int n
Definition: xcom_base.cc:509