MySQL 9.1.0
Source Code Documentation
classic_protocol_constants.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_CONSTANTS_H_
27#define MYSQL_ROUTER_CLASSIC_PROTOCOL_CONSTANTS_H_
28
29#include <bitset>
30#include <cstdint>
31
32namespace classic_protocol {
33
34namespace capabilities {
35
36namespace pos {
37using value_type = uint8_t;
40constexpr value_type long_flag{2};
42constexpr value_type no_schema{4};
43constexpr value_type compress{5};
44constexpr value_type odbc{6};
48constexpr value_type interactive{10};
49constexpr value_type ssl{11};
50// 12 is unused
52// 14 is unused
57constexpr value_type plugin_auth{19};
66//
67// 29 is an extension flag for >32 bit
68// 30 is client only
69// 31 is client only
70
71} // namespace pos
72
73using value_type = std::bitset<32>;
74
75// old_password instead of older_password
76// version_added: 3.21
78// found rows, instead of affected rows.
79// version_added: 3.21
81// version_added: 3.21
82// get all column flags
84// connect with schema
85// version_added: 3.21
87// don't allow schema.table.column
88// version_added: 3.21
90// use deflate compression
91// version_added: 3.22
93// odbc client
94// version_added: 3.22
95constexpr value_type odbc{1 << pos::odbc};
96// can use LOCAL INFILE
97// version_added: 3.22
99// ignore space before (
100// version_added: 3.22
102// protocol_version 10 + more fields in server::Greeting
103// version_added: 4.1
105// interactive
106// version_added: 3.22
108// switch to SSL
109// version_added: 3.23
110constexpr value_type ssl{1 << pos::ssl};
111// status-field in Ok message
112// version_added: 3.23
114// mysql_native_password
115// version_added: 4.1
117// multi-statement support
118// version_added: 4.1
120// multi-result support
121// version_added: 4.1
123// version_added: 5.5
125// version_added: 5.5
127// version_added: 5.6
129// version_added: 5.6
132// version_added: 5.6
134// version_added: 5.7
136// version_added: 5.7
139// version_added: 8.0
141// version_added: 8.0
144// version_added: 8.0
146} // namespace capabilities
147
148namespace status {
149namespace pos {
150using value_type = uint8_t;
153// 2 is unused (more-results in 4.1.22)
166
167} // namespace pos
168using value_type = std::bitset<16>;
169
170// transaction is open
171// version_added: 3.23
173// autocommit
174// version_added: 3.23
176// multi-statement more results
177// version_added: 4.1
179// no good index used
180// version_added: 4.1
182// no index used
183// version_added: 4.1
185// cursor exists
186// version_added: 5.0
188// last row sent
189// version_added: 5.0
191// schema dropped
192// version_added: 4.1
194// no backslash escapes
195// version_added: 5.0
197// metadata changed
198// version_added: 5.1
200// version_added: 5.5
202// version_added: 5.5
204// version_added: 5.7
206// version_added: 5.7
208} // namespace status
209
210namespace cursor {
211namespace pos {
212using value_type = uint8_t;
217
219} // namespace pos
220using value_type = std::bitset<pos::_bitset_size>;
221
227} // namespace cursor
228
229namespace field_type {
230using value_type = uint8_t;
231constexpr value_type Decimal{0x00};
232constexpr value_type Tiny{0x01};
233constexpr value_type Short{0x02};
234constexpr value_type Long{0x03};
235constexpr value_type Float{0x04};
236constexpr value_type Double{0x05};
237constexpr value_type Null{0x06};
238constexpr value_type Timestamp{0x07};
239constexpr value_type LongLong{0x08};
240constexpr value_type Int24{0x09};
241constexpr value_type Date{0x0a};
242constexpr value_type Time{0x0b};
243constexpr value_type DateTime{0x0c};
244constexpr value_type Year{0x0d};
245// not used in protocol: constexpr value_type NewDate{0x0e};
246constexpr value_type Varchar{0x0f};
247constexpr value_type Bit{0x10};
248constexpr value_type Timestamp2{0x11};
249// not used in protocol: constexpr value_type Datetime2{0x12};
250// not used in protocol: constexpr value_type Time2{0x13};
251// not used in protocol: constexpr value_type TypedArray{0x14};
252constexpr value_type Json{0xf5};
253constexpr value_type NewDecimal{0xf6};
254constexpr value_type Enum{0xf7};
255constexpr value_type Set{0xf8};
256constexpr value_type TinyBlob{0xf9};
257constexpr value_type MediumBlob{0xfa};
258constexpr value_type LongBlob{0xfb};
259constexpr value_type Blob{0xfc};
260constexpr value_type VarString{0xfd};
261constexpr value_type String{0xfe};
262constexpr value_type Geometry{0xff};
263} // namespace field_type
264
265namespace column_def {
266namespace pos {
267using value_type = uint8_t;
268constexpr value_type not_null{0};
272constexpr value_type blob{4};
274constexpr value_type zerofill{6};
275constexpr value_type binary{7};
276constexpr value_type is_enum{8};
278constexpr value_type timestamp{10};
279constexpr value_type set{11};
281constexpr value_type on_update{13};
282constexpr value_type numeric{14};
283
285} // namespace pos
286using value_type = std::bitset<pos::_bitset_size>;
287
292constexpr value_type blob{1 << pos::blob};
299constexpr value_type set{1 << pos::set};
303} // namespace column_def
304
305namespace reload_cmds {
306namespace pos {
307using value_type = uint8_t;
316
318} // namespace pos
319using value_type = std::bitset<pos::_bitset_size>;
320
329
330} // namespace reload_cmds
331
332namespace collation {
333using value_type = uint8_t;
335constexpr value_type Utf8GeneralCi{0x21};
336constexpr value_type Binary{0x3f};
337} // namespace collation
338
339} // namespace classic_protocol
340
341#endif
Class representing a region of memory (e.g., a string or binary buffer).
Definition: common.h:160
Definition: spatial.h:213
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:167
const char * collation
Definition: audit_api_message_emit.cc:184
constexpr value_type ps_multi_results
Definition: classic_protocol_constants.h:56
constexpr value_type text_result_with_session_tracking
Definition: classic_protocol_constants.h:62
constexpr value_type long_password
Definition: classic_protocol_constants.h:38
constexpr value_type no_schema
Definition: classic_protocol_constants.h:42
constexpr value_type compress
Definition: classic_protocol_constants.h:43
constexpr value_type long_flag
Definition: classic_protocol_constants.h:40
constexpr value_type transactions
Definition: classic_protocol_constants.h:51
constexpr value_type expired_passwords
Definition: classic_protocol_constants.h:60
constexpr value_type multi_statements
Definition: classic_protocol_constants.h:54
constexpr value_type plugin_auth
Definition: classic_protocol_constants.h:57
constexpr value_type session_track
Definition: classic_protocol_constants.h:61
constexpr value_type optional_resultset_metadata
Definition: classic_protocol_constants.h:63
uint8_t value_type
Definition: classic_protocol_constants.h:37
constexpr value_type interactive
Definition: classic_protocol_constants.h:48
constexpr value_type query_attributes
Definition: classic_protocol_constants.h:65
constexpr value_type connect_attributes
Definition: classic_protocol_constants.h:58
constexpr value_type found_rows
Definition: classic_protocol_constants.h:39
constexpr value_type client_auth_method_data_varint
Definition: classic_protocol_constants.h:59
constexpr value_type ssl
Definition: classic_protocol_constants.h:49
constexpr value_type local_files
Definition: classic_protocol_constants.h:45
constexpr value_type connect_with_schema
Definition: classic_protocol_constants.h:41
constexpr value_type multi_results
Definition: classic_protocol_constants.h:55
constexpr value_type secure_connection
Definition: classic_protocol_constants.h:53
constexpr value_type ignore_space
Definition: classic_protocol_constants.h:46
constexpr value_type compress_zstd
Definition: classic_protocol_constants.h:64
constexpr value_type protocol_41
Definition: classic_protocol_constants.h:47
constexpr value_type odbc
Definition: classic_protocol_constants.h:44
constexpr value_type client_auth_method_data_varint
Definition: classic_protocol_constants.h:130
constexpr value_type found_rows
Definition: classic_protocol_constants.h:80
constexpr value_type connect_attributes
Definition: classic_protocol_constants.h:128
constexpr value_type interactive
Definition: classic_protocol_constants.h:107
constexpr value_type expired_passwords
Definition: classic_protocol_constants.h:133
constexpr value_type plugin_auth
Definition: classic_protocol_constants.h:126
constexpr value_type long_flag
Definition: classic_protocol_constants.h:83
constexpr value_type no_schema
Definition: classic_protocol_constants.h:89
constexpr value_type local_files
Definition: classic_protocol_constants.h:98
constexpr value_type ssl
Definition: classic_protocol_constants.h:110
constexpr value_type compress
Definition: classic_protocol_constants.h:92
constexpr value_type protocol_41
Definition: classic_protocol_constants.h:104
constexpr value_type compress_zstd
Definition: classic_protocol_constants.h:140
constexpr value_type multi_results
Definition: classic_protocol_constants.h:122
constexpr value_type transactions
Definition: classic_protocol_constants.h:113
constexpr value_type optional_resultset_metadata
Definition: classic_protocol_constants.h:142
constexpr value_type text_result_with_session_tracking
Definition: classic_protocol_constants.h:137
constexpr value_type secure_connection
Definition: classic_protocol_constants.h:116
constexpr value_type ps_multi_results
Definition: classic_protocol_constants.h:124
constexpr value_type odbc
Definition: classic_protocol_constants.h:95
constexpr value_type multi_statements
Definition: classic_protocol_constants.h:119
constexpr value_type ignore_space
Definition: classic_protocol_constants.h:101
constexpr value_type query_attributes
Definition: classic_protocol_constants.h:145
std::bitset< 32 > value_type
Definition: classic_protocol_constants.h:73
constexpr value_type connect_with_schema
Definition: classic_protocol_constants.h:86
constexpr value_type long_password
Definition: classic_protocol_constants.h:77
constexpr value_type session_track
Definition: classic_protocol_constants.h:135
constexpr value_type Utf8GeneralCi
Definition: classic_protocol_constants.h:335
uint8_t value_type
Definition: classic_protocol_constants.h:333
constexpr value_type Latin1SwedishCi
Definition: classic_protocol_constants.h:334
constexpr value_type Binary
Definition: classic_protocol_constants.h:336
constexpr value_type not_null
Definition: classic_protocol_constants.h:268
constexpr value_type blob
Definition: classic_protocol_constants.h:272
constexpr value_type on_update
Definition: classic_protocol_constants.h:281
constexpr value_type zerofill
Definition: classic_protocol_constants.h:274
constexpr value_type timestamp
Definition: classic_protocol_constants.h:278
constexpr value_type auto_increment
Definition: classic_protocol_constants.h:277
constexpr value_type is_unsigned
Definition: classic_protocol_constants.h:273
constexpr value_type is_enum
Definition: classic_protocol_constants.h:276
constexpr value_type primary_key
Definition: classic_protocol_constants.h:269
constexpr value_type _bitset_size
Definition: classic_protocol_constants.h:284
constexpr value_type set
Definition: classic_protocol_constants.h:279
uint8_t value_type
Definition: classic_protocol_constants.h:267
constexpr value_type no_default_value
Definition: classic_protocol_constants.h:280
constexpr value_type unique_key
Definition: classic_protocol_constants.h:270
constexpr value_type numeric
Definition: classic_protocol_constants.h:282
constexpr value_type binary
Definition: classic_protocol_constants.h:275
constexpr value_type multiple_key
Definition: classic_protocol_constants.h:271
constexpr value_type is_unsigned
Definition: classic_protocol_constants.h:293
constexpr value_type numeric
Definition: classic_protocol_constants.h:302
constexpr value_type unique_key
Definition: classic_protocol_constants.h:290
constexpr value_type set
Definition: classic_protocol_constants.h:299
constexpr value_type on_update
Definition: classic_protocol_constants.h:301
std::bitset< pos::_bitset_size > value_type
Definition: classic_protocol_constants.h:286
constexpr value_type binary
Definition: classic_protocol_constants.h:295
constexpr value_type zerofill
Definition: classic_protocol_constants.h:294
constexpr value_type timestamp
Definition: classic_protocol_constants.h:298
constexpr value_type primary_key
Definition: classic_protocol_constants.h:289
constexpr value_type multiple_key
Definition: classic_protocol_constants.h:291
constexpr value_type not_null
Definition: classic_protocol_constants.h:288
constexpr value_type is_enum
Definition: classic_protocol_constants.h:296
constexpr value_type auto_increment
Definition: classic_protocol_constants.h:297
constexpr value_type no_default_value
Definition: classic_protocol_constants.h:300
constexpr value_type blob
Definition: classic_protocol_constants.h:292
constexpr value_type scrollable
Definition: classic_protocol_constants.h:215
constexpr value_type read_only
Definition: classic_protocol_constants.h:213
constexpr value_type param_count_available
Definition: classic_protocol_constants.h:216
constexpr value_type for_update
Definition: classic_protocol_constants.h:214
constexpr value_type _bitset_size
Definition: classic_protocol_constants.h:218
uint8_t value_type
Definition: classic_protocol_constants.h:212
constexpr value_type param_count_available
Definition: classic_protocol_constants.h:226
constexpr value_type read_only
Definition: classic_protocol_constants.h:223
constexpr value_type scrollable
Definition: classic_protocol_constants.h:225
constexpr value_type no_cursor
Definition: classic_protocol_constants.h:222
constexpr value_type for_update
Definition: classic_protocol_constants.h:224
std::bitset< pos::_bitset_size > value_type
Definition: classic_protocol_constants.h:220
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
uint8_t value_type
Definition: classic_protocol_constants.h:230
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 Set
Definition: classic_protocol_constants.h:255
constexpr value_type Timestamp2
Definition: classic_protocol_constants.h:248
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 Date
Definition: classic_protocol_constants.h:241
constexpr value_type Float
Definition: classic_protocol_constants.h:235
constexpr value_type flush_privileges
Definition: classic_protocol_constants.h:308
constexpr value_type flush_threads
Definition: classic_protocol_constants.h:313
constexpr value_type reset_master
Definition: classic_protocol_constants.h:315
constexpr value_type flush_tables
Definition: classic_protocol_constants.h:310
constexpr value_type reset_slave
Definition: classic_protocol_constants.h:314
constexpr value_type flush_status
Definition: classic_protocol_constants.h:312
constexpr value_type _bitset_size
Definition: classic_protocol_constants.h:317
constexpr value_type flush_hosts
Definition: classic_protocol_constants.h:311
uint8_t value_type
Definition: classic_protocol_constants.h:307
constexpr value_type flush_logs
Definition: classic_protocol_constants.h:309
constexpr value_type flush_logs
Definition: classic_protocol_constants.h:322
constexpr value_type flush_threads
Definition: classic_protocol_constants.h:326
std::bitset< pos::_bitset_size > value_type
Definition: classic_protocol_constants.h:319
constexpr value_type flush_status
Definition: classic_protocol_constants.h:325
constexpr value_type reset_master
Definition: classic_protocol_constants.h:328
constexpr value_type flush_privileges
Definition: classic_protocol_constants.h:321
constexpr value_type reset_slave
Definition: classic_protocol_constants.h:327
constexpr value_type flush_hosts
Definition: classic_protocol_constants.h:324
constexpr value_type flush_tables
Definition: classic_protocol_constants.h:323
constexpr value_type in_transaction_readonly
Definition: classic_protocol_constants.h:164
constexpr value_type in_transaction
Definition: classic_protocol_constants.h:151
constexpr value_type autocommit
Definition: classic_protocol_constants.h:152
constexpr value_type query_was_slow
Definition: classic_protocol_constants.h:162
constexpr value_type session_state_changed
Definition: classic_protocol_constants.h:165
constexpr value_type no_good_index_used
Definition: classic_protocol_constants.h:155
constexpr value_type last_row_sent
Definition: classic_protocol_constants.h:158
constexpr value_type metadata_changed
Definition: classic_protocol_constants.h:161
uint8_t value_type
Definition: classic_protocol_constants.h:150
constexpr value_type schema_dropped
Definition: classic_protocol_constants.h:159
constexpr value_type no_index_used
Definition: classic_protocol_constants.h:156
constexpr value_type more_results_exist
Definition: classic_protocol_constants.h:154
constexpr value_type cursor_exists
Definition: classic_protocol_constants.h:157
constexpr value_type ps_out_params
Definition: classic_protocol_constants.h:163
constexpr value_type no_backslash_escapes
Definition: classic_protocol_constants.h:160
constexpr value_type no_backslash_escapes
Definition: classic_protocol_constants.h:196
constexpr value_type more_results_exist
Definition: classic_protocol_constants.h:178
constexpr value_type schema_dropped
Definition: classic_protocol_constants.h:193
constexpr value_type in_transaction
Definition: classic_protocol_constants.h:172
constexpr value_type no_index_used
Definition: classic_protocol_constants.h:184
constexpr value_type autocommit
Definition: classic_protocol_constants.h:175
std::bitset< 16 > value_type
Definition: classic_protocol_constants.h:168
constexpr value_type no_good_index_used
Definition: classic_protocol_constants.h:181
constexpr value_type last_row_sent
Definition: classic_protocol_constants.h:190
constexpr value_type cursor_exists
Definition: classic_protocol_constants.h:187
constexpr value_type query_was_slow
Definition: classic_protocol_constants.h:201
constexpr value_type in_transaction_readonly
Definition: classic_protocol_constants.h:205
constexpr value_type ps_out_params
Definition: classic_protocol_constants.h:203
constexpr value_type metadata_changed
Definition: classic_protocol_constants.h:199
constexpr value_type session_state_changed
Definition: classic_protocol_constants.h:207
Definition: classic_protocol_binary.h:39
required uint32 status
Definition: replication_asynchronous_connection_failover.proto:61