MySQL 8.0.40
Source Code Documentation
classic_protocol_codec_binary.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2023, 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_CODEC_BINARY_H_
27#define MYSQL_ROUTER_CLASSIC_PROTOCOL_CODEC_BINARY_H_
28
29#include <cstddef> // size_t
30#include <cstdint> // uint8_t
31#include <system_error> // error_code
32#include <utility> // move
33
39
40namespace classic_protocol {
41
42namespace impl {
43template <class T>
45
46template <bool Borrowed>
47struct BinaryTypeBase<borrowable::binary::Decimal<Borrowed>> {
48 static constexpr const uint16_t binary_field_type = field_type::Decimal;
49};
50
51template <>
52struct BinaryTypeBase<borrowable::binary::Tiny> {
53 static constexpr const uint16_t binary_field_type = field_type::Tiny;
54 static constexpr const uint8_t byte_size = 1;
55};
56
57template <>
58struct BinaryTypeBase<borrowable::binary::Short> {
59 static constexpr const uint16_t binary_field_type = field_type::Short;
60 static constexpr const uint8_t byte_size = 2;
61};
62
63template <>
64struct BinaryTypeBase<borrowable::binary::Long> {
65 static constexpr const uint16_t binary_field_type = field_type::Long;
66 static constexpr const uint8_t byte_size = 4;
67};
68
69template <>
70struct BinaryTypeBase<borrowable::binary::Float> {
71 static constexpr const uint16_t binary_field_type = field_type::Float;
72 static constexpr const uint8_t byte_size = 4;
73};
74
75template <>
76struct BinaryTypeBase<borrowable::binary::Double> {
77 static constexpr const uint16_t binary_field_type = field_type::Double;
78 static constexpr const uint8_t byte_size = 8;
79};
80
81template <>
82struct BinaryTypeBase<borrowable::binary::Null> {
83 static constexpr const uint16_t binary_field_type = field_type::Null;
84};
85
86template <>
87struct BinaryTypeBase<borrowable::binary::Timestamp> {
88 static constexpr const uint16_t binary_field_type = field_type::Timestamp;
89};
90
91template <>
92struct BinaryTypeBase<borrowable::binary::LongLong> {
93 static constexpr const uint16_t binary_field_type = field_type::LongLong;
94 static constexpr const uint8_t byte_size = 8;
95};
96
97template <>
98struct BinaryTypeBase<borrowable::binary::Int24> {
99 static constexpr const uint16_t binary_field_type = field_type::Int24;
100 static constexpr const uint8_t byte_size = 4;
101};
102
103template <>
104struct BinaryTypeBase<borrowable::binary::Date> {
105 static constexpr const uint16_t binary_field_type = field_type::Date;
106};
107
108template <>
109struct BinaryTypeBase<borrowable::binary::Time> {
110 static constexpr const uint16_t binary_field_type = field_type::Time;
111};
112
113template <>
114struct BinaryTypeBase<borrowable::binary::DateTime> {
115 static constexpr const uint16_t binary_field_type = field_type::DateTime;
116};
117
118template <>
119struct BinaryTypeBase<borrowable::binary::Year> {
120 static constexpr const uint16_t binary_field_type = field_type::Year;
121 static constexpr const uint8_t byte_size = 2;
122};
123
124template <bool Borrowed>
125struct BinaryTypeBase<borrowable::binary::Varchar<Borrowed>> {
126 static constexpr const uint16_t binary_field_type = field_type::Varchar;
127};
128
129template <bool Borrowed>
130struct BinaryTypeBase<borrowable::binary::Bit<Borrowed>> {
131 static constexpr const uint16_t binary_field_type = field_type::Bit;
132};
133
134template <bool Borrowed>
135struct BinaryTypeBase<borrowable::binary::Json<Borrowed>> {
136 static constexpr const uint16_t binary_field_type = field_type::Json;
137};
138
139template <bool Borrowed>
140struct BinaryTypeBase<borrowable::binary::NewDecimal<Borrowed>> {
141 static constexpr const uint16_t binary_field_type = field_type::NewDecimal;
142};
143
144template <bool Borrowed>
145struct BinaryTypeBase<borrowable::binary::Enum<Borrowed>> {
146 static constexpr const uint16_t binary_field_type = field_type::Enum;
147};
148
149template <bool Borrowed>
150struct BinaryTypeBase<borrowable::binary::Set<Borrowed>> {
151 static constexpr const uint16_t binary_field_type = field_type::Set;
152};
153
154template <bool Borrowed>
155struct BinaryTypeBase<borrowable::binary::TinyBlob<Borrowed>> {
156 static constexpr const uint16_t binary_field_type = field_type::TinyBlob;
157};
158
159template <bool Borrowed>
160struct BinaryTypeBase<borrowable::binary::MediumBlob<Borrowed>> {
161 static constexpr const uint16_t binary_field_type = field_type::MediumBlob;
162};
163
164template <bool Borrowed>
165struct BinaryTypeBase<borrowable::binary::LongBlob<Borrowed>> {
166 static constexpr const uint16_t binary_field_type = field_type::LongBlob;
167};
168
169template <bool Borrowed>
170struct BinaryTypeBase<borrowable::binary::Blob<Borrowed>> {
171 static constexpr const uint16_t binary_field_type = field_type::Blob;
172};
173
174template <bool Borrowed>
175struct BinaryTypeBase<borrowable::binary::String<Borrowed>> {
176 static constexpr const uint16_t binary_field_type = field_type::String;
177};
178
179template <bool Borrowed>
180struct BinaryTypeBase<borrowable::binary::VarString<Borrowed>> {
181 static constexpr const uint16_t binary_field_type = field_type::VarString;
182};
183
184template <bool Borrowed>
185struct BinaryTypeBase<borrowable::binary::Geometry<Borrowed>> {
186 static constexpr const uint16_t binary_field_type = field_type::Geometry;
187};
188
189// codec base
190
191template <class T>
192class FixedIntCodec : public impl::EncodeBase<FixedIntCodec<T>> {
193 static constexpr const int byte_size = BinaryTypeBase<T>::byte_size;
194
195 template <class Accumulator>
196 constexpr auto accumulate_fields(Accumulator &&accu) const {
197 accu.step(wire::FixedInt<byte_size>(val_.value()));
198
199 return accu.result();
200 }
201
202 public:
203 using value_type = T;
205
206 friend base_;
207
209 : base_(caps), val_{std::move(val)} {}
210
211 static constexpr uint16_t type() {
213 }
214
218
219 auto value_res = accu.template step<wire::FixedInt<byte_size>>();
220 if (!accu.result()) return stdx::make_unexpected(accu.result().error());
221
222 return std::make_pair(accu.result().value(),
223 value_type(value_res->value()));
224 }
225
226 private:
228};
229
230template <class T>
231class FloatCodec : public impl::EncodeBase<FloatCodec<T>> {
232 static constexpr const int byte_size = BinaryTypeBase<T>::byte_size;
233
234 template <class Accumulator>
235 constexpr auto accumulate_fields(Accumulator &&accu) const {
236 // reinterpret_cast<> isn't allowed in constexpr.
237 //
238 // Use a union as a workaround.
239 union overlapped_storage {
240 constexpr overlapped_storage(typename value_type::value_type val)
241 : val_(val) {}
242
244
245 char addr_[sizeof(val_)];
246 } overlapped(val_.value());
247
248 static_assert(sizeof(overlapped.val_) == byte_size);
249
250 return accu
252 std::string_view((&overlapped.addr_[0]), sizeof(overlapped.val_))})
253 .result();
254 }
255
256 public:
257 using value_type = T;
259
260 friend base_;
261
263 : base_(caps), val_{std::move(val)} {}
264
265 static constexpr uint16_t type() {
267 }
268
272
273 auto value_res = accu.template step<borrowed::wire::String>(byte_size);
274 if (!accu.result()) return stdx::make_unexpected(accu.result().error());
275
276 typename T::value_type val;
277
278 memcpy(&val, value_res->value().data(), byte_size);
279
280 return std::make_pair(accu.result().value(), value_type(val));
281 }
282
283 private:
285};
286
287template <bool Borrowed, class T>
288class StringCodec : public impl::EncodeBase<StringCodec<Borrowed, T>> {
289 template <class Accumulator>
290 constexpr auto accumulate_fields(Accumulator &&accu) const {
291 accu.step(borrowable::wire::String<Borrowed>(val_.value()));
292
293 return accu.result();
294 }
295
296 public:
297 using value_type = T;
299
300 friend base_;
301
303 : base_(caps), val_{std::move(val)} {}
304
305 static constexpr uint16_t type() {
307 }
308
312
313 auto value_res = accu.template step<borrowable::wire::String<Borrowed>>();
314 if (!accu.result()) return stdx::make_unexpected(accu.result().error());
315
316 return std::make_pair(accu.result().value(),
317 value_type(value_res->value()));
318 }
319
320 private:
322};
323
324template <class T>
325class DatetimeCodec : public impl::EncodeBase<DatetimeCodec<T>> {
326 template <class Accumulator>
327 constexpr auto accumulate_fields(Accumulator &&accu) const {
328 const bool has_ms = val_.microsecond();
329 const bool has_time =
330 val_.hour() || val_.minute() || val_.second() || has_ms;
331 const bool has_date = val_.year() || val_.month() || val_.day() || has_time;
332
333 if (has_date) {
334 accu.step(wire::FixedInt<2>(val_.year()))
335 .step(wire::FixedInt<1>(val_.month()))
336 .step(wire::FixedInt<1>(val_.day()));
337 if (has_time) {
338 accu.step(wire::FixedInt<1>(val_.hour()))
339 .step(wire::FixedInt<1>(val_.minute()))
340 .step(wire::FixedInt<1>(val_.second()));
341 if (has_ms) {
342 accu.step(wire::FixedInt<4>(val_.microsecond()));
343 }
344 }
345 }
346 return accu.result();
347 }
348
349 public:
350 using value_type = T;
352
353 friend base_;
354
356 : base_(caps), val_{std::move(val)} {}
357
358 static constexpr uint16_t type() {
360 }
361
365
366 auto year_res = accu.template try_step<wire::FixedInt<2>>();
367 if (!year_res) {
368 return std::make_pair(accu.result().value(), value_type());
369 }
370
371 auto month_res = accu.template step<wire::FixedInt<1>>();
372 auto day_res = accu.template step<wire::FixedInt<1>>();
373 if (!accu.result()) return stdx::make_unexpected(accu.result().error());
374
375 auto hour_res = accu.template try_step<wire::FixedInt<1>>();
376 if (!hour_res) {
377 return std::make_pair(
378 accu.result().value(),
379 value_type(year_res->value(), month_res->value(), day_res->value()));
380 }
381
382 auto minute_res = accu.template step<wire::FixedInt<1>>();
383 auto second_res = accu.template step<wire::FixedInt<1>>();
384 if (!accu.result()) return stdx::make_unexpected(accu.result().error());
385
386 auto microsecond_res = accu.template try_step<wire::FixedInt<4>>();
387 if (!microsecond_res) {
388 return std::make_pair(
389 accu.result().value(),
390 value_type(year_res->value(), month_res->value(), day_res->value(),
391 hour_res->value(), minute_res->value(),
392 second_res->value()));
393 }
394
395 if (!accu.result()) return stdx::make_unexpected(accu.result().error());
396
397 return std::make_pair(
398 accu.result().value(),
399 value_type(year_res->value(), month_res->value(), day_res->value(),
400 hour_res->value(), minute_res->value(), second_res->value(),
401 microsecond_res->value()));
402 }
403
404 private:
406};
407
408template <class T>
409class TimeCodec : public impl::EncodeBase<TimeCodec<T>> {
410 template <class Accumulator>
411 constexpr auto accumulate_fields(Accumulator &&accu) const {
412 if (val_.days() || val_.hour() || val_.minute() || val_.second() ||
413 val_.microsecond()) {
414 accu.step(wire::FixedInt<1>(val_.is_negative()))
415 .step(wire::FixedInt<4>(val_.days()))
416 .step(wire::FixedInt<1>(val_.hour()))
417 .step(wire::FixedInt<1>(val_.minute()))
418 .step(wire::FixedInt<1>(val_.second()));
419 if (val_.microsecond()) {
420 accu.step(wire::FixedInt<4>(val_.microsecond()));
421 }
422 }
423 return accu.result();
424 }
425
426 public:
427 using value_type = T;
429
430 friend base_;
431
433 : base_(caps), val_{std::move(val)} {}
434
435 static constexpr uint16_t type() {
437 }
438
442
443 auto is_negative_res = accu.template try_step<wire::FixedInt<1>>();
444 if (!is_negative_res) {
445 return std::make_pair(accu.result().value(), value_type());
446 }
447 auto days_res = accu.template step<wire::FixedInt<4>>();
448 auto hour_res = accu.template step<wire::FixedInt<1>>();
449 auto minute_res = accu.template step<wire::FixedInt<1>>();
450 auto second_res = accu.template step<wire::FixedInt<1>>();
451 auto microsecond_res = accu.template try_step<wire::FixedInt<4>>();
452
453 if (!microsecond_res) {
454 if (!accu.result()) return stdx::make_unexpected(accu.result().error());
455
456 return std::make_pair(
457 accu.result().value(),
458 value_type(is_negative_res->value(), days_res->value(),
459 hour_res->value(), minute_res->value(),
460 second_res->value()));
461 }
462
463 if (!accu.result()) return stdx::make_unexpected(accu.result().error());
464
465 return std::make_pair(
466 accu.result().value(),
467 value_type(is_negative_res->value(), days_res->value(),
468 hour_res->value(), minute_res->value(), second_res->value(),
469 microsecond_res->value()));
470 }
471
472 private:
474};
475
476} // namespace impl
477
478template <>
479class Codec<borrowable::binary::Null>
480 : public impl::EncodeBase<Codec<borrowable::binary::Null>> {
481 template <class Accumulator>
482 constexpr auto accumulate_fields(Accumulator &&accu) const {
483 return accu.result();
484 }
485
486 public:
489
490 friend base_;
491
492 constexpr Codec(value_type /* val */, capabilities::value_type caps)
493 : base_(caps) {}
494
495 static constexpr uint16_t type() {
497 }
498
500 const net::const_buffer & /* buffer */,
501 capabilities::value_type /* caps */) {
502 return std::make_pair(0, value_type());
503 }
504};
505
506template <>
507class Codec<borrowable::binary::LongLong>
508 : public impl::FixedIntCodec<borrowable::binary::LongLong> {
509 public:
510 using FixedIntCodec::FixedIntCodec;
511};
512
513template <>
514class Codec<borrowable::binary::Long>
515 : public impl::FixedIntCodec<borrowable::binary::Long> {
516 public:
517 using FixedIntCodec::FixedIntCodec;
518};
519
520template <>
521class Codec<borrowable::binary::Int24>
522 : public impl::FixedIntCodec<borrowable::binary::Int24> {
523 public:
524 using FixedIntCodec::FixedIntCodec;
525};
526
527template <>
528class Codec<borrowable::binary::Short>
529 : public impl::FixedIntCodec<borrowable::binary::Short> {
530 public:
531 using FixedIntCodec::FixedIntCodec;
532};
533
534template <>
535class Codec<borrowable::binary::Tiny>
536 : public impl::FixedIntCodec<borrowable::binary::Tiny> {
537 public:
538 using FixedIntCodec::FixedIntCodec;
539};
540
541template <>
542class Codec<borrowable::binary::Year>
543 : public impl::FixedIntCodec<borrowable::binary::Year> {
544 public:
545 using FixedIntCodec::FixedIntCodec;
546};
547
548template <>
549class Codec<borrowable::binary::Double>
550 : public impl::FloatCodec<borrowable::binary::Double> {
551 public:
552 using FloatCodec::FloatCodec;
553};
554
555template <>
556class Codec<borrowable::binary::Float>
557 : public impl::FloatCodec<borrowable::binary::Float> {
558 public:
559 using FloatCodec::FloatCodec;
560};
561
562template <bool Borrowed>
563class Codec<borrowable::binary::String<Borrowed>>
564 : public impl::StringCodec<Borrowed, borrowable::binary::String<Borrowed>> {
565 public:
566 using impl::StringCodec<Borrowed,
568};
569
570template <bool Borrowed>
571class Codec<borrowable::binary::VarString<Borrowed>>
572 : public impl::StringCodec<Borrowed,
573 borrowable::binary::VarString<Borrowed>> {
574 public:
575 using impl::StringCodec<Borrowed,
577};
578
579template <bool Borrowed>
580class Codec<borrowable::binary::Varchar<Borrowed>>
581 : public impl::StringCodec<Borrowed,
582 borrowable::binary::Varchar<Borrowed>> {
583 public:
584 using impl::StringCodec<Borrowed,
586};
587
588template <bool Borrowed>
589class Codec<borrowable::binary::Json<Borrowed>>
590 : public impl::StringCodec<Borrowed, borrowable::binary::Json<Borrowed>> {
591 public:
592 using impl::StringCodec<Borrowed,
594};
595
596template <bool Borrowed>
597class Codec<borrowable::binary::Blob<Borrowed>>
598 : public impl::StringCodec<Borrowed, borrowable::binary::Blob<Borrowed>> {
599 public:
600 using impl::StringCodec<Borrowed,
602};
603
604template <bool Borrowed>
605class Codec<borrowable::binary::TinyBlob<Borrowed>>
606 : public impl::StringCodec<Borrowed,
607 borrowable::binary::TinyBlob<Borrowed>> {
608 public:
609 using impl::StringCodec<Borrowed,
611};
612
613template <bool Borrowed>
614class Codec<borrowable::binary::MediumBlob<Borrowed>>
615 : public impl::StringCodec<Borrowed,
616 borrowable::binary::MediumBlob<Borrowed>> {
617 public:
618 using impl::StringCodec<
619 Borrowed, borrowable::binary::MediumBlob<Borrowed>>::StringCodec;
620};
621
622template <bool Borrowed>
623class Codec<borrowable::binary::LongBlob<Borrowed>>
624 : public impl::StringCodec<Borrowed,
625 borrowable::binary::LongBlob<Borrowed>> {
626 public:
627 using impl::StringCodec<Borrowed,
629};
630
631template <bool Borrowed>
632class Codec<borrowable::binary::Enum<Borrowed>>
633 : public impl::StringCodec<Borrowed, borrowable::binary::Enum<Borrowed>> {
634 public:
635 using impl::StringCodec<Borrowed,
637};
638
639template <bool Borrowed>
640class Codec<borrowable::binary::Set<Borrowed>>
641 : public impl::StringCodec<Borrowed, borrowable::binary::Set<Borrowed>> {
642 public:
643 using impl::StringCodec<Borrowed,
645};
646
647template <bool Borrowed>
648class Codec<borrowable::binary::Decimal<Borrowed>>
649 : public impl::StringCodec<Borrowed,
650 borrowable::binary::Decimal<Borrowed>> {
651 public:
652 using impl::StringCodec<Borrowed,
654};
655
656template <bool Borrowed>
657class Codec<borrowable::binary::NewDecimal<Borrowed>>
658 : public impl::StringCodec<Borrowed,
659 borrowable::binary::NewDecimal<Borrowed>> {
660 public:
661 using impl::StringCodec<
662 Borrowed, borrowable::binary::NewDecimal<Borrowed>>::StringCodec;
663};
664
665template <bool Borrowed>
666class Codec<borrowable::binary::Bit<Borrowed>>
667 : public impl::StringCodec<Borrowed, borrowable::binary::Bit<Borrowed>> {
668 public:
669 using impl::StringCodec<Borrowed,
671};
672
673template <bool Borrowed>
674class Codec<borrowable::binary::Geometry<Borrowed>>
675 : public impl::StringCodec<Borrowed,
676 borrowable::binary::Geometry<Borrowed>> {
677 public:
678 using impl::StringCodec<Borrowed,
680};
681
682template <>
683class Codec<borrowable::binary::Date>
684 : public impl::DatetimeCodec<borrowable::binary::Date> {
685 public:
686 using DatetimeCodec::DatetimeCodec;
687};
688
689template <>
690class Codec<borrowable::binary::DateTime>
691 : public impl::DatetimeCodec<borrowable::binary::DateTime> {
692 public:
693 using DatetimeCodec::DatetimeCodec;
694};
695
696template <>
697class Codec<borrowable::binary::Timestamp>
698 : public impl::DatetimeCodec<borrowable::binary::Timestamp> {
699 public:
700 using DatetimeCodec::DatetimeCodec;
701};
702
703template <>
704class Codec<borrowable::binary::Time>
705 : public impl::TimeCodec<borrowable::binary::Time> {
706 public:
707 using TimeCodec::TimeCodec;
708};
709
710} // namespace classic_protocol
711
712#endif
constexpr Codec(value_type, capabilities::value_type caps)
Definition: classic_protocol_codec_binary.h:492
static constexpr uint16_t type()
Definition: classic_protocol_codec_binary.h:495
friend base_
Definition: classic_protocol_codec_binary.h:490
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_binary.h:482
static stdx::expected< std::pair< size_t, value_type >, std::error_code > decode(const net::const_buffer &, capabilities::value_type)
Definition: classic_protocol_codec_binary.h:499
Codec for a type.
Definition: classic_protocol_codec_base.h:72
Definition: classic_protocol_binary.h:293
Definition: classic_protocol_binary.h:245
Definition: classic_protocol_binary.h:123
Definition: classic_protocol_binary.h:133
Definition: classic_protocol_binary.h:281
Definition: classic_protocol_binary.h:210
Definition: classic_protocol_binary.h:269
Definition: classic_protocol_binary.h:215
Definition: classic_protocol_binary.h:299
Definition: classic_protocol_binary.h:190
Definition: classic_protocol_binary.h:239
Definition: classic_protocol_binary.h:263
Definition: classic_protocol_binary.h:180
Definition: classic_protocol_binary.h:185
Definition: classic_protocol_binary.h:257
Definition: classic_protocol_binary.h:287
Definition: classic_protocol_binary.h:304
Definition: classic_protocol_binary.h:275
Definition: classic_protocol_binary.h:195
Definition: classic_protocol_binary.h:221
Definition: classic_protocol_binary.h:138
Definition: classic_protocol_binary.h:128
Definition: classic_protocol_binary.h:251
Definition: classic_protocol_binary.h:205
Definition: classic_protocol_binary.h:227
Definition: classic_protocol_binary.h:233
Definition: classic_protocol_binary.h:200
Definition: classic_protocol_wire.h:103
Definition: classic_protocol_wire.h:38
Definition: classic_protocol_codec_binary.h:325
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_binary.h:327
static constexpr uint16_t type()
Definition: classic_protocol_codec_binary.h:358
constexpr DatetimeCodec(value_type val, capabilities::value_type caps)
Definition: classic_protocol_codec_binary.h:355
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_binary.h:362
friend base_
Definition: classic_protocol_codec_binary.h:353
value_type val_
Definition: classic_protocol_codec_binary.h:405
T value_type
Definition: classic_protocol_codec_binary.h:350
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:375
constexpr capabilities::value_type caps() const noexcept
Definition: classic_protocol_codec_base.h:390
Definition: classic_protocol_codec_binary.h:192
static constexpr const int byte_size
Definition: classic_protocol_codec_binary.h:193
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_binary.h:196
friend base_
Definition: classic_protocol_codec_binary.h:206
constexpr FixedIntCodec(value_type val, capabilities::value_type caps)
Definition: classic_protocol_codec_binary.h:208
const value_type val_
Definition: classic_protocol_codec_binary.h:227
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_binary.h:215
static constexpr uint16_t type()
Definition: classic_protocol_codec_binary.h:211
T value_type
Definition: classic_protocol_codec_binary.h:203
Definition: classic_protocol_codec_binary.h:231
T value_type
Definition: classic_protocol_codec_binary.h:257
const value_type val_
Definition: classic_protocol_codec_binary.h:284
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_binary.h:235
constexpr FloatCodec(value_type val, capabilities::value_type caps)
Definition: classic_protocol_codec_binary.h:262
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_binary.h:269
static constexpr uint16_t type()
Definition: classic_protocol_codec_binary.h:265
static constexpr const int byte_size
Definition: classic_protocol_codec_binary.h:232
friend base_
Definition: classic_protocol_codec_binary.h:260
Definition: classic_protocol_codec_binary.h:288
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_binary.h:309
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_binary.h:290
const value_type val_
Definition: classic_protocol_codec_binary.h:321
friend base_
Definition: classic_protocol_codec_binary.h:300
constexpr StringCodec(value_type val, capabilities::value_type caps)
Definition: classic_protocol_codec_binary.h:302
T value_type
Definition: classic_protocol_codec_binary.h:297
static constexpr uint16_t type()
Definition: classic_protocol_codec_binary.h:305
Definition: classic_protocol_codec_binary.h:409
static constexpr uint16_t type()
Definition: classic_protocol_codec_binary.h:435
constexpr auto accumulate_fields(Accumulator &&accu) const
Definition: classic_protocol_codec_binary.h:411
const value_type val_
Definition: classic_protocol_codec_binary.h:473
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_binary.h:439
T value_type
Definition: classic_protocol_codec_binary.h:427
constexpr TimeCodec(value_type val, capabilities::value_type caps)
Definition: classic_protocol_codec_binary.h:432
friend base_
Definition: classic_protocol_codec_binary.h:430
Definition: buffer.h:135
constexpr const value_type & value() const &
Definition: expected.h:688
constexpr const error_type & error() const &
Definition: expected.h:737
Definition: expected.h:944
uint16_t value_type
Definition: vt100.h:184
borrowable::binary::Null Null
Definition: classic_protocol_binary.h:337
std::bitset< 32 > value_type
Definition: classic_protocol_constants.h:73
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 Null
Definition: classic_protocol_constants.h:237
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
Definition: classic_protocol_binary.h:39
Definition: authentication.cc:36
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:420
Definition: gcs_xcom_synode.h:64
constexpr auto make_unexpected(E &&e) -> unexpected< std::decay_t< E > >
Definition: expected.h:125
struct result result
Definition: result.h:34
Definition: classic_protocol_codec_binary.h:44