MySQL Connector/C++ 9.3.0
MySQL connector library for C and C++ applications
All Classes Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
common_constants.h
1/*
2 * Copyright (c) 2015, 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, as
6 * 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, as
10 * 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 * Without limiting anything contained in the foregoing, this file,
17 * which is part of Connector/C++, is also subject to the
18 * Universal FOSS Exception, version 1.0, a copy of which can be found at
19 * https://oss.oracle.com/licenses/universal-foss-exception.
20 *
21 * This program is distributed in the hope that it will be useful, but
22 * WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
24 * See the GNU General Public License, version 2.0, for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software Foundation, Inc.,
28 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 */
30
31#ifndef MYSQL_COMMON_CONSTANTS_H
32#define MYSQL_COMMON_CONSTANTS_H
33
34#include "version_info.h"
35
36#define DEFAULT_MYSQL_PORT 3306
37#define DEFAULT_MYSQLX_PORT 33060
38
39// ----------------------------------------------------------------------------
40
41/*
42 Common constants
43 ================
44
45 Warning: Values of these constants are part of the public API. Changing them
46 is a non backward compatible API change.
47
48 Note: Value of 0 is reserved for special uses and thus constant values
49 are always > 0.
50
51 Note: the empty END_LIST macro at the end of list macros helps Doxygen
52 correctly interpret documentation for the list item.
53*/
54
55#define OPT_STR(X,Y,N) X##_str(Y,N)
56#define OPT_BOOL(X,Y,N) X##_bool(Y,N)
57#define OPT_NUM(X,Y,N) X##_num(Y,N)
58#define OPT_ANY(X,Y,N) X##_any(Y,N)
59
60
61#undef END_LIST
62#define END_LIST
63
64
65#define CLIENT_OPTION_LIST(x) \
66 OPT_BOOL(x,POOLING,1) \
67 OPT_NUM(x,POOL_MAX_SIZE,2) \
68 OPT_NUM(x,POOL_QUEUE_TIMEOUT,3) \
70 OPT_NUM(x,POOL_MAX_IDLE_TIME,4) \
72 END_LIST
73
74
75#define SESSION_OPTION_LIST(x) \
76 OPT_STR(x,URI,1) \
77 \
78 OPT_STR(x,HOST,2) \
79 OPT_NUM(x,PORT,3) \
80 \
86 OPT_NUM(x,PRIORITY,4) \
87 OPT_STR(x,USER,5) \
88 OPT_STR(x,PWD,6) \
89 OPT_STR(x,DB,7) \
90 \
94 OPT_ANY(x,SSL_MODE,8) \
95 \
96 OPT_STR(x,SSL_CA,9) \
97 \
101 OPT_ANY(x,AUTH,10) \
102 OPT_STR(x,SOCKET,11) \
103 \
107 OPT_NUM(x,CONNECT_TIMEOUT,12) \
108 \
118 OPT_STR(x,CONNECTION_ATTRIBUTES,13) \
119 \
124 OPT_STR(x,TLS_VERSIONS, 14) \
125 \
132 OPT_STR(x,TLS_CIPHERSUITES, 15) \
133 \
137 OPT_BOOL(x, DNS_SRV, 16) \
138 OPT_ANY(x,COMPRESSION,17) \
139 \
142 OPT_STR(x,COMPRESSION_ALGORITHMS,18) \
143 \
147 OPT_STR(x,SSL_CAPATH,19) \
148 \
149 OPT_STR(x,SSL_CRL,20) \
150 \
154 OPT_STR(x,SSL_CRLPATH,21) \
155 END_LIST
156
157
158/*
159 Names for options supported in the query part of a connection string and
160 how they map to session options above.
161
162 Note: when adding new options to this list, also update doxygen docs
163 for mysqlx::SessionSettings URL ctor (include\mysqlx\devapi\settings.h) and
164 for mysqlx_get_session_from_url() (include\mysqlx\xapi.h).
165*/
166
167#define URI_OPTION_LIST(X) \
168 X("ssl-mode", SSL_MODE) \
169 X("ssl-ca", SSL_CA) \
170 X("ssl-capath", SSL_CAPATH) \
171 X("ssl-crl", SSL_CRL) \
172 X("ssl-crlpath", SSL_CRLPATH) \
173 X("auth", AUTH) \
174 X("connect-timeout", CONNECT_TIMEOUT) \
175 X("connection-attributes",CONNECTION_ATTRIBUTES)\
176 X("tls-version", TLS_VERSIONS) \
177 X("tls-versions", TLS_VERSIONS) \
178 X("tls-ciphersuites", TLS_CIPHERSUITES) \
179 X("compression", COMPRESSION) \
180 X("compression-algorithms", COMPRESSION_ALGORITHMS) \
181 END_LIST
182
183
184#define SSL_MODE_LIST(x) \
185 x(DISABLED,1) \
186 x(REQUIRED,2) \
190 x(VERIFY_CA,3) \
195 x(VERIFY_IDENTITY,4) \
198 END_LIST
199
200
201#define AUTH_METHOD_LIST(x)\
202 x(PLAIN,1) \
205 x(MYSQL41,2) \
209 x(EXTERNAL,3) \
212 x(SHA256_MEMORY,4) \
216 END_LIST
217
218/*
219 Types that can be reported by MySQL server.
220*/
221
222#define RESULT_TYPE_LIST(X) \
223 X(BIT, 1) \
224 X(TINYINT, 2) \
225 X(SMALLINT, 3) \
226 X(MEDIUMINT, 4) \
227 X(INT, 5) \
228 X(BIGINT, 6) \
229 X(FLOAT, 7) \
230 X(DECIMAL, 8) \
231 X(DOUBLE, 9) \
232 X(JSON, 10) \
233 X(STRING, 11) \
234 X(BYTES, 12) \
235 X(TIME, 13) \
236 X(DATE, 14) \
237 X(DATETIME, 15) \
238 X(TIMESTAMP, 16) \
239 X(SET, 17) \
240 X(ENUM, 18) \
241 X(GEOMETRY, 19) \
242 END_LIST
243
244
245/*
246 Check options for an updatable view.
247 @see https://dev.mysql.com/doc/refman/en/view-check-option.html
248*/
249
250#define VIEW_CHECK_OPTION_LIST(x) \
251 x(CASCADED,1) \
252 x(LOCAL,2) \
253 END_LIST
254
255/*
256 Algorithms used to process views.
257 @see https://dev.mysql.com/doc/refman/en/view-algorithms.html
258*/
259
260#define VIEW_ALGORITHM_LIST(x) \
261 x(UNDEFINED,1) \
262 x(MERGE,2) \
263 x(TEMPTABLE,3) \
264 END_LIST
265
266/*
267 View security settings.
268 @see https://dev.mysql.com/doc/refman/en/stored-programs-security.html
269*/
270
271#define VIEW_SECURITY_LIST(x) \
272 x(DEFINER,1) \
273 x(INVOKER,2) \
274 END_LIST
275
276
277#define LOCK_MODE_LIST(X) \
278 X(SHARED,1) \
285 X(EXCLUSIVE,2) \
291 END_LIST
292
293#define LOCK_CONTENTION_LIST(X) \
294 X(DEFAULT,0) \
295 X(NOWAIT,1) \
296 X(SKIP_LOCKED,2) \
298 END_LIST
299
300#define COMPRESSION_MODE_LIST(x) \
301 x(DISABLED,1) \
302 x(PREFERRED,2) \
305 x(REQUIRED,3) \
307 END_LIST
308
309// ----------------------------------------------------------------------------
310
311
312#define COLLECTION_OPTIONS_OPTION(X)\
313 X(REUSE,1) \
314 X(VALIDATION,2) \
316 END_LIST
317
318#define COLLECTION_VALIDATION_OPTION(X)\
319 X(SCHEMA,1) \
322 X(LEVEL,2) \
327 END_LIST
328
329
330 // Schema Validation Level
331
332//Windows defines STRICT as a macro... undefine it
333#ifdef STRICT
334 #undef STRICT
335#endif
336
337#define COLLECTION_VALIDATION_LEVEL(X)\
338 X(OFF,1) \
339 X(STRICT,2) \
341 END_LIST
342
343
344
345#endif