MySQL Connector/C++ 9.4.0
MySQL connector library for C and C++ applications
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 \
159 OPT_NUM(x,READ_TIMEOUT,22) \
160 \
164 OPT_NUM(x,WRITE_TIMEOUT,23) \
165 END_LIST
166
167
168/*
169 Names for options supported in the query part of a connection string and
170 how they map to session options above.
171
172 Note: when adding new options to this list, also update doxygen docs
173 for mysqlx::SessionSettings URL ctor (include\mysqlx\devapi\settings.h) and
174 for mysqlx_get_session_from_url() (include\mysqlx\xapi.h).
175*/
176
177#define URI_OPTION_LIST(X) \
178 X("ssl-mode", SSL_MODE) \
179 X("ssl-ca", SSL_CA) \
180 X("ssl-capath", SSL_CAPATH) \
181 X("ssl-crl", SSL_CRL) \
182 X("ssl-crlpath", SSL_CRLPATH) \
183 X("auth", AUTH) \
184 X("connect-timeout", CONNECT_TIMEOUT) \
185 X("connection-attributes",CONNECTION_ATTRIBUTES)\
186 X("tls-version", TLS_VERSIONS) \
187 X("tls-versions", TLS_VERSIONS) \
188 X("tls-ciphersuites", TLS_CIPHERSUITES) \
189 X("compression", COMPRESSION) \
190 X("compression-algorithms", COMPRESSION_ALGORITHMS) \
191 X("read-timeout", READ_TIMEOUT) \
192 X("write-timeout", WRITE_TIMEOUT) \
193 END_LIST
194
195
196#define SSL_MODE_LIST(x) \
197 x(DISABLED,1) \
198 x(REQUIRED,2) \
202 x(VERIFY_CA,3) \
207 x(VERIFY_IDENTITY,4) \
210 END_LIST
211
212
213#define AUTH_METHOD_LIST(x)\
214 x(PLAIN,1) \
217 x(MYSQL41,2) \
221 x(EXTERNAL,3) \
224 x(SHA256_MEMORY,4) \
228 END_LIST
229
230/*
231 Types that can be reported by MySQL server.
232*/
233
234#define RESULT_TYPE_LIST(X) \
235 X(BIT, 1) \
236 X(TINYINT, 2) \
237 X(SMALLINT, 3) \
238 X(MEDIUMINT, 4) \
239 X(INT, 5) \
240 X(BIGINT, 6) \
241 X(FLOAT, 7) \
242 X(DECIMAL, 8) \
243 X(DOUBLE, 9) \
244 X(JSON, 10) \
245 X(STRING, 11) \
246 X(BYTES, 12) \
247 X(TIME, 13) \
248 X(DATE, 14) \
249 X(DATETIME, 15) \
250 X(TIMESTAMP, 16) \
251 X(SET, 17) \
252 X(ENUM, 18) \
253 X(GEOMETRY, 19) \
254 END_LIST
255
256
257/*
258 Check options for an updatable view.
259 @see https://dev.mysql.com/doc/refman/en/view-check-option.html
260*/
261
262#define VIEW_CHECK_OPTION_LIST(x) \
263 x(CASCADED,1) \
264 x(LOCAL,2) \
265 END_LIST
266
267/*
268 Algorithms used to process views.
269 @see https://dev.mysql.com/doc/refman/en/view-algorithms.html
270*/
271
272#define VIEW_ALGORITHM_LIST(x) \
273 x(UNDEFINED,1) \
274 x(MERGE,2) \
275 x(TEMPTABLE,3) \
276 END_LIST
277
278/*
279 View security settings.
280 @see https://dev.mysql.com/doc/refman/en/stored-programs-security.html
281*/
282
283#define VIEW_SECURITY_LIST(x) \
284 x(DEFINER,1) \
285 x(INVOKER,2) \
286 END_LIST
287
288
289#define LOCK_MODE_LIST(X) \
290 X(SHARED,1) \
297 X(EXCLUSIVE,2) \
303 END_LIST
304
305#define LOCK_CONTENTION_LIST(X) \
306 X(DEFAULT,0) \
307 X(NOWAIT,1) \
308 X(SKIP_LOCKED,2) \
310 END_LIST
311
312#define COMPRESSION_MODE_LIST(x) \
313 x(DISABLED,1) \
314 x(PREFERRED,2) \
317 x(REQUIRED,3) \
319 END_LIST
320
321// ----------------------------------------------------------------------------
322
323
324#define COLLECTION_OPTIONS_OPTION(X)\
325 X(REUSE,1) \
326 X(VALIDATION,2) \
328 END_LIST
329
330#define COLLECTION_VALIDATION_OPTION(X)\
331 X(SCHEMA,1) \
334 X(LEVEL,2) \
339 END_LIST
340
341
342 // Schema Validation Level
343
344//Windows defines STRICT as a macro... undefine it
345#ifdef STRICT
346 #undef STRICT
347#endif
348
349#define COLLECTION_VALIDATION_LEVEL(X)\
350 X(OFF,1) \
351 X(STRICT,2) \
353 END_LIST
354
355
356
357#endif