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