aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/libmysql_r/include
diff options
context:
space:
mode:
authorhcpp <hcpp@ydb.tech>2023-11-08 12:09:41 +0300
committerhcpp <hcpp@ydb.tech>2023-11-08 12:56:14 +0300
commita361f5b98b98b44ea510d274f6769164640dd5e1 (patch)
treec47c80962c6e2e7b06798238752fd3da0191a3f6 /contrib/libs/libmysql_r/include
parent9478806fde1f4d40bd5a45e7cbe77237dab613e9 (diff)
downloadydb-a361f5b98b98b44ea510d274f6769164640dd5e1.tar.gz
metrics have been added
Diffstat (limited to 'contrib/libs/libmysql_r/include')
-rw-r--r--contrib/libs/libmysql_r/include/base64.h68
-rw-r--r--contrib/libs/libmysql_r/include/crypt_genhash_impl.h53
-rw-r--r--contrib/libs/libmysql_r/include/decimal.h150
-rw-r--r--contrib/libs/libmysql_r/include/errmsg.h137
-rw-r--r--contrib/libs/libmysql_r/include/field_types.h96
-rw-r--r--contrib/libs/libmysql_r/include/ft_global.h131
-rw-r--r--contrib/libs/libmysql_r/include/keycache.h166
-rw-r--r--contrib/libs/libmysql_r/include/lex_string.h54
-rw-r--r--contrib/libs/libmysql_r/include/lf.h230
-rw-r--r--contrib/libs/libmysql_r/include/little_endian.h134
-rw-r--r--contrib/libs/libmysql_r/include/m_ctype.h748
-rw-r--r--contrib/libs/libmysql_r/include/m_string.h371
-rw-r--r--contrib/libs/libmysql_r/include/map_helpers.h335
-rw-r--r--contrib/libs/libmysql_r/include/memory_debugging.h87
-rw-r--r--contrib/libs/libmysql_r/include/mf_wcomp.h95
-rw-r--r--contrib/libs/libmysql_r/include/mutex_lock.h62
-rw-r--r--contrib/libs/libmysql_r/include/my_aes.h140
-rw-r--r--contrib/libs/libmysql_r/include/my_alloc.h413
-rw-r--r--contrib/libs/libmysql_r/include/my_atomic.h63
-rw-r--r--contrib/libs/libmysql_r/include/my_base.h1143
-rw-r--r--contrib/libs/libmysql_r/include/my_basename.h60
-rw-r--r--contrib/libs/libmysql_r/include/my_bit.h152
-rw-r--r--contrib/libs/libmysql_r/include/my_bitmap.h140
-rw-r--r--contrib/libs/libmysql_r/include/my_byteorder.h260
-rw-r--r--contrib/libs/libmysql_r/include/my_command.h102
-rw-r--r--contrib/libs/libmysql_r/include/my_compare.h120
-rw-r--r--contrib/libs/libmysql_r/include/my_compiler.h150
-rw-r--r--contrib/libs/libmysql_r/include/my_config-linux.h366
-rw-r--r--contrib/libs/libmysql_r/include/my_config-musl.h5
-rw-r--r--contrib/libs/libmysql_r/include/my_config-osx.h365
-rw-r--r--contrib/libs/libmysql_r/include/my_config-win.h365
-rw-r--r--contrib/libs/libmysql_r/include/my_config.h17
-rw-r--r--contrib/libs/libmysql_r/include/my_dbug.h320
-rw-r--r--contrib/libs/libmysql_r/include/my_default.h72
-rw-r--r--contrib/libs/libmysql_r/include/my_dir.h96
-rw-r--r--contrib/libs/libmysql_r/include/my_double2ulonglong.h52
-rw-r--r--contrib/libs/libmysql_r/include/my_getopt.h177
-rw-r--r--contrib/libs/libmysql_r/include/my_getpwnam.h75
-rw-r--r--contrib/libs/libmysql_r/include/my_hostname.h56
-rw-r--r--contrib/libs/libmysql_r/include/my_inttypes.h144
-rw-r--r--contrib/libs/libmysql_r/include/my_io.h201
-rw-r--r--contrib/libs/libmysql_r/include/my_list.h70
-rw-r--r--contrib/libs/libmysql_r/include/my_loglevel.h39
-rw-r--r--contrib/libs/libmysql_r/include/my_macros.h89
-rw-r--r--contrib/libs/libmysql_r/include/my_md5.h51
-rw-r--r--contrib/libs/libmysql_r/include/my_murmur3.h37
-rw-r--r--contrib/libs/libmysql_r/include/my_pointer_arithmetic.h51
-rw-r--r--contrib/libs/libmysql_r/include/my_psi_config.h259
-rw-r--r--contrib/libs/libmysql_r/include/my_rdtsc.h132
-rw-r--r--contrib/libs/libmysql_r/include/my_rnd.h39
-rw-r--r--contrib/libs/libmysql_r/include/my_sharedlib.h73
-rw-r--r--contrib/libs/libmysql_r/include/my_shm_defaults.h39
-rw-r--r--contrib/libs/libmysql_r/include/my_sqlcommand.h209
-rw-r--r--contrib/libs/libmysql_r/include/my_stacktrace.h126
-rw-r--r--contrib/libs/libmysql_r/include/my_sys.h1048
-rw-r--r--contrib/libs/libmysql_r/include/my_systime.h200
-rw-r--r--contrib/libs/libmysql_r/include/my_thread.h174
-rw-r--r--contrib/libs/libmysql_r/include/my_thread_local.h68
-rw-r--r--contrib/libs/libmysql_r/include/my_time.h583
-rw-r--r--contrib/libs/libmysql_r/include/my_timer.h75
-rw-r--r--contrib/libs/libmysql_r/include/my_tree.h110
-rw-r--r--contrib/libs/libmysql_r/include/my_uctype.h1022
-rw-r--r--contrib/libs/libmysql_r/include/my_user.h39
-rw-r--r--contrib/libs/libmysql_r/include/my_xml.h98
-rw-r--r--contrib/libs/libmysql_r/include/myisampack.h306
-rw-r--r--contrib/libs/libmysql_r/include/mysql.h791
-rw-r--r--contrib/libs/libmysql_r/include/mysql/client_authentication.h43
-rw-r--r--contrib/libs/libmysql_r/include/mysql/client_plugin.h213
-rw-r--r--contrib/libs/libmysql_r/include/mysql/com_data.h121
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/component_implementation.h329
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/my_service.h113
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/service.h130
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/service_implementation.h90
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/dynamic_loader.h300
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/log_builtins.h1448
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/log_shared.h234
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/my_io_bits.h62
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/my_thread_bits.h58
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/mysql_cond_bits.h62
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/mysql_mutex_bits.h62
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/mysql_rwlock_bits.h84
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/mysql_socket_bits.h63
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/page_track_service.h184
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/psi_cond_bits.h197
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/psi_error_bits.h51
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/psi_file_bits.h318
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/psi_idle_bits.h86
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/psi_mdl_bits.h106
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/psi_memory_bits.h127
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/psi_mutex_bits.h196
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/psi_rwlock_bits.h295
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/psi_socket_bits.h268
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/psi_stage_bits.h120
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/psi_statement_bits.h508
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/psi_system_bits.h42
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/psi_table_bits.h228
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/psi_thread_bits.h468
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/psi_transaction_bits.h176
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/registry.h296
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/system_variable_source_type.h45
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/thr_cond_bits.h48
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/thr_mutex_bits.h68
-rw-r--r--contrib/libs/libmysql_r/include/mysql/components/services/thr_rwlock_bits.h115
-rw-r--r--contrib/libs/libmysql_r/include/mysql/mysql_lex_string.h44
-rw-r--r--contrib/libs/libmysql_r/include/mysql/plugin.h901
-rw-r--r--contrib/libs/libmysql_r/include/mysql/plugin_auth_common.h182
-rw-r--r--contrib/libs/libmysql_r/include/mysql/plugin_trace.h322
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/mysql_cond.h274
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/mysql_file.h1325
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/mysql_memory.h66
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/mysql_mutex.h343
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/mysql_rwlock.h525
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/mysql_socket.h1172
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/mysql_stage.h198
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/mysql_statement.h253
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/mysql_table.h146
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/mysql_thread.h161
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/psi_base.h134
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/psi_cond.h86
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/psi_data_lock.h428
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/psi_error.h87
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/psi_file.h114
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/psi_idle.h90
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/psi_mdl.h91
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/psi_memory.h115
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/psi_mutex.h83
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/psi_rwlock.h96
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/psi_socket.h94
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/psi_stage.h80
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/psi_statement.h155
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/psi_system.h87
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/psi_table.h110
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/psi_thread.h167
-rw-r--r--contrib/libs/libmysql_r/include/mysql/psi/psi_transaction.h107
-rw-r--r--contrib/libs/libmysql_r/include/mysql/service_command.h448
-rw-r--r--contrib/libs/libmysql_r/include/mysql/service_locking.h132
-rw-r--r--contrib/libs/libmysql_r/include/mysql/service_my_plugin_log.h72
-rw-r--r--contrib/libs/libmysql_r/include/mysql/service_mysql_alloc.h130
-rw-r--r--contrib/libs/libmysql_r/include/mysql/service_mysql_keyring.h109
-rw-r--r--contrib/libs/libmysql_r/include/mysql/service_mysql_password_policy.h78
-rw-r--r--contrib/libs/libmysql_r/include/mysql/service_mysql_string.h133
-rw-r--r--contrib/libs/libmysql_r/include/mysql/service_parser.h287
-rw-r--r--contrib/libs/libmysql_r/include/mysql/service_plugin_registry.h129
-rw-r--r--contrib/libs/libmysql_r/include/mysql/service_rpl_transaction_ctx.h79
-rw-r--r--contrib/libs/libmysql_r/include/mysql/service_rpl_transaction_write_set.h78
-rw-r--r--contrib/libs/libmysql_r/include/mysql/service_rules_table.h185
-rw-r--r--contrib/libs/libmysql_r/include/mysql/service_security_context.h166
-rw-r--r--contrib/libs/libmysql_r/include/mysql/service_srv_session.h177
-rw-r--r--contrib/libs/libmysql_r/include/mysql/service_srv_session_info.h180
-rw-r--r--contrib/libs/libmysql_r/include/mysql/service_thd_alloc.h127
-rw-r--r--contrib/libs/libmysql_r/include/mysql/service_thd_wait.h108
-rw-r--r--contrib/libs/libmysql_r/include/mysql/service_thread_scheduler.h87
-rw-r--r--contrib/libs/libmysql_r/include/mysql/services.h48
-rw-r--r--contrib/libs/libmysql_r/include/mysql/status_var.h95
-rw-r--r--contrib/libs/libmysql_r/include/mysql/udf_registration_types.h90
-rw-r--r--contrib/libs/libmysql_r/include/mysql_async.h199
-rw-r--r--contrib/libs/libmysql_r/include/mysql_com.h1089
-rw-r--r--contrib/libs/libmysql_r/include/mysql_time.h71
-rw-r--r--contrib/libs/libmysql_r/include/mysql_version.h32
-rw-r--r--contrib/libs/libmysql_r/include/mysqld_error.h5051
-rw-r--r--contrib/libs/libmysql_r/include/mysys_err.h156
-rw-r--r--contrib/libs/libmysql_r/include/pfs_file_provider.h93
-rw-r--r--contrib/libs/libmysql_r/include/pfs_socket_provider.h80
-rw-r--r--contrib/libs/libmysql_r/include/pfs_stage_provider.h57
-rw-r--r--contrib/libs/libmysql_r/include/pfs_statement_provider.h125
-rw-r--r--contrib/libs/libmysql_r/include/prealloced_array.h571
-rw-r--r--contrib/libs/libmysql_r/include/print_version.h76
-rw-r--r--contrib/libs/libmysql_r/include/sha1.h52
-rw-r--r--contrib/libs/libmysql_r/include/sha2.h58
-rw-r--r--contrib/libs/libmysql_r/include/sql_chars.h97
-rw-r--r--contrib/libs/libmysql_r/include/sql_common.h251
-rw-r--r--contrib/libs/libmysql_r/include/sql_string.h640
-rw-r--r--contrib/libs/libmysql_r/include/template_utils.h147
-rw-r--r--contrib/libs/libmysql_r/include/thr_cond.h166
-rw-r--r--contrib/libs/libmysql_r/include/thr_lock.h178
-rw-r--r--contrib/libs/libmysql_r/include/thr_mutex.h241
-rw-r--r--contrib/libs/libmysql_r/include/thr_rwlock.h148
-rw-r--r--contrib/libs/libmysql_r/include/typelib.h67
-rw-r--r--contrib/libs/libmysql_r/include/violite.h460
-rw-r--r--contrib/libs/libmysql_r/include/wolfssl_fix_namespace_pollution.h64
-rw-r--r--contrib/libs/libmysql_r/include/wolfssl_fix_namespace_pollution_pre.h55
181 files changed, 42251 insertions, 0 deletions
diff --git a/contrib/libs/libmysql_r/include/base64.h b/contrib/libs/libmysql_r/include/base64.h
new file mode 100644
index 0000000000..a9890d7fa2
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/base64.h
@@ -0,0 +1,68 @@
+/* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef __BASE64_H_INCLUDED__
+#define __BASE64_H_INCLUDED__
+
+/**
+ @file include/base64.h
+*/
+
+#include <stddef.h>
+
+#include "my_inttypes.h"
+
+/*
+ Calculate how much memory needed for dst of base64_encode()
+*/
+uint64 base64_needed_encoded_length(uint64 length_of_data);
+
+/*
+ Maximum length base64_encode_needed_length() can accept with no overflow.
+*/
+uint64 base64_encode_max_arg_length(void);
+
+/*
+ Calculate how much memory needed for dst of base64_decode()
+*/
+uint64 base64_needed_decoded_length(uint64 length_of_encoded_data);
+
+/*
+ Maximum length base64_decode_needed_length() can accept with no overflow.
+*/
+uint64 base64_decode_max_arg_length();
+
+/*
+ Encode data as a base64 string
+*/
+int base64_encode(const void *src, size_t src_len, char *dst);
+
+/*
+ Decode a base64 string into data
+*/
+int64 base64_decode(const char *src, size_t src_len, void *dst,
+ const char **end_ptr, int flags);
+
+/* Allow multuple chunks 'AAA= AA== AA==', binlog uses this */
+#define MY_BASE64_DECODE_ALLOW_MULTIPLE_CHUNKS 1
+
+#endif /* !__BASE64_H_INCLUDED__ */
diff --git a/contrib/libs/libmysql_r/include/crypt_genhash_impl.h b/contrib/libs/libmysql_r/include/crypt_genhash_impl.h
new file mode 100644
index 0000000000..e740327e0a
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/crypt_genhash_impl.h
@@ -0,0 +1,53 @@
+/* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/crypt_genhash_impl.h
+*/
+
+#ifndef CRYPT_HASHGEN_IMPL_H
+#define CRYPT_HASHGEN_IMPL_H
+#define ROUNDS_DEFAULT 5000
+#define ROUNDS_MIN 1000
+#define ROUNDS_MAX ROUNDS_DEFAULT
+#define MIXCHARS 32
+#define CRYPT_SALT_LENGTH 20
+#define CRYPT_MAGIC_LENGTH 3
+#define CRYPT_PARAM_LENGTH 13
+#define SHA256_HASH_LENGTH 43
+#define CRYPT_MAX_PASSWORD_SIZE \
+ (CRYPT_SALT_LENGTH + SHA256_HASH_LENGTH + CRYPT_MAGIC_LENGTH + \
+ CRYPT_PARAM_LENGTH)
+#define MAX_PLAINTEXT_LENGTH 256
+
+#include <stddef.h>
+
+#include "my_macros.h"
+
+int extract_user_salt(const char **salt_begin, const char **salt_end);
+char *my_crypt_genhash(char *ctbuffer, size_t ctbufflen, const char *plaintext,
+ size_t plaintext_len, const char *switchsalt,
+ const char **params, unsigned int *num_rounds = NULL);
+void generate_user_salt(char *buffer, int buffer_len);
+void xor_string(char *to, int to_len, char *pattern, int pattern_len);
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/decimal.h b/contrib/libs/libmysql_r/include/decimal.h
new file mode 100644
index 0000000000..fa6186a45d
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/decimal.h
@@ -0,0 +1,150 @@
+/* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef DECIMAL_INCLUDED
+#define DECIMAL_INCLUDED
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdlib.h>
+#endif
+
+#include "my_inttypes.h"
+#include "my_macros.h"
+
+typedef enum {
+ TRUNCATE = 0,
+ HALF_EVEN,
+ HALF_UP,
+ CEILING,
+ FLOOR
+} decimal_round_mode;
+typedef int32 decimal_digit_t;
+
+/**
+ intg is the number of *decimal* digits (NOT number of decimal_digit_t's !)
+ before the point
+ frac is the number of decimal digits after the point
+ len is the length of buf (length of allocated space) in decimal_digit_t's,
+ not in bytes
+ sign false means positive, true means negative
+ buf is an array of decimal_digit_t's
+ */
+struct decimal_t {
+ int intg, frac, len;
+ bool sign;
+ decimal_digit_t *buf;
+};
+
+#ifndef MYSQL_ABI_CHECK
+void widen_fraction(int new_frac, decimal_t *d);
+int string2decimal(const char *from, decimal_t *to, const char **end);
+int decimal2string(const decimal_t *from, char *to, int *to_len,
+ int fixed_precision, int fixed_decimals, char filler);
+int decimal2ulonglong(decimal_t *from, ulonglong *to);
+int ulonglong2decimal(ulonglong from, decimal_t *to);
+int decimal2longlong(decimal_t *from, longlong *to);
+int longlong2decimal(longlong from, decimal_t *to);
+int decimal2double(const decimal_t *from, double *to);
+int double2decimal(double from, decimal_t *to);
+int decimal_actual_fraction(const decimal_t *from);
+int decimal2bin(decimal_t *from, uchar *to, int precision, int scale);
+int bin2decimal(const uchar *from, decimal_t *to, int precision, int scale,
+ bool keep_prec = false);
+
+/**
+ Convert decimal to lldiv_t.
+ The integer part is stored in to->quot.
+ The fractional part is multiplied to 10^9 and stored to to->rem.
+ @param from Decimal value
+ @param [out] to lldiv_t value
+ @retval 0 on success
+ @retval !0 in error
+*/
+int decimal2lldiv_t(const decimal_t *from, lldiv_t *to);
+
+/**
+ Convert doube to lldiv_t.
+ The integer part is stored in to->quot.
+ The fractional part is multiplied to 10^9 and stored to to->rem.
+ @param nr Decimal value
+ @param [out] lld lldiv_t value
+ @retval 0 on success
+ @retval !0 in error
+*/
+
+int double2lldiv_t(double nr, lldiv_t *lld);
+int decimal_size(int precision, int scale);
+int decimal_bin_size(int precision, int scale);
+int decimal_result_size(decimal_t *from1, decimal_t *from2, char op, int param);
+
+int decimal_intg(const decimal_t *from);
+int decimal_add(const decimal_t *from1, const decimal_t *from2, decimal_t *to);
+int decimal_sub(const decimal_t *from1, const decimal_t *from2, decimal_t *to);
+int decimal_cmp(const decimal_t *from1, const decimal_t *from2);
+int decimal_mul(const decimal_t *from1, const decimal_t *from2, decimal_t *to);
+int decimal_div(const decimal_t *from1, const decimal_t *from2, decimal_t *to,
+ int scale_incr);
+int decimal_mod(const decimal_t *from1, const decimal_t *from2, decimal_t *to);
+int decimal_round(const decimal_t *from, decimal_t *to, int new_scale,
+ decimal_round_mode mode);
+int decimal_is_zero(const decimal_t *from);
+void max_decimal(int precision, int frac, decimal_t *to);
+int decimal_shift(decimal_t *dec, int shift);
+
+/* set a decimal_t to zero */
+static inline void decimal_make_zero(decimal_t *dec) {
+ dec->buf[0] = 0;
+ dec->intg = 1;
+ dec->frac = 0;
+ dec->sign = 0;
+}
+
+/**
+ Returns the length of the buffer to hold string representation
+ of the decimal (including decimal dot, possible sign and \0)
+*/
+static inline int decimal_string_size(const decimal_t *dec) {
+ return (dec->intg ? dec->intg : 1) + dec->frac + (dec->frac > 0) + 2;
+}
+
+/*
+ conventions:
+
+ decimal_smth() == 0 -- everything's ok
+ decimal_smth() <= 1 -- result is usable, but precision loss is
+ possible decimal_smth() <= 2 -- result can be unusable, most significant
+ digits could've been lost decimal_smth() > 2 -- no result was generated
+*/
+
+#define E_DEC_OK 0
+#define E_DEC_TRUNCATED 1
+#define E_DEC_OVERFLOW 2
+#define E_DEC_DIV_ZERO 4
+#define E_DEC_BAD_NUM 8
+#define E_DEC_OOM 16
+
+#define E_DEC_ERROR 31
+#define E_DEC_FATAL_ERROR 30
+
+#endif // MYSQL_ABI_CHECK
+
+#endif // DECIMAL_INCLUDED
diff --git a/contrib/libs/libmysql_r/include/errmsg.h b/contrib/libs/libmysql_r/include/errmsg.h
new file mode 100644
index 0000000000..419f03bd70
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/errmsg.h
@@ -0,0 +1,137 @@
+#ifndef ERRMSG_INCLUDED
+#define ERRMSG_INCLUDED
+
+/* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ Without limiting anything contained in the foregoing, this file,
+ which is part of C Driver for MySQL (Connector/C), is also subject to the
+ Universal FOSS Exception, version 1.0, a copy of which can be found at
+ http://oss.oracle.com/licenses/universal-foss-exception.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/errmsg.h
+
+ Error messages for MySQL clients.
+ These are constant and use the CR_ prefix.
+ <mysqlclient_ername.h> will contain auto-generated mappings
+ containing the symbolic name and the number from this file,
+ and the english error messages in libmysql/errmsg.c.
+
+ Dynamic error messages for the daemon are in share/language/errmsg.sys.
+ The server equivalent to <errmsg.h> is <mysqld_error.h>.
+ The server equivalent to <mysqlclient_ername.h> is <mysqld_ername.h>.
+
+ Note that the auth subsystem also uses codes with a CR_ prefix.
+*/
+
+void init_client_errs(void);
+void finish_client_errs(void);
+extern const char *client_errors[]; /* Error messages */
+
+#define CR_MIN_ERROR 2000 /* For easier client code */
+#define CR_MAX_ERROR 2999
+#define CLIENT_ERRMAP 2 /* Errormap used by my_error() */
+
+/* Do not add error numbers before CR_ERROR_FIRST. */
+/* If necessary to add lower numbers, change CR_ERROR_FIRST accordingly. */
+#define CR_ERROR_FIRST 2000 /*Copy first error nr.*/
+#define CR_UNKNOWN_ERROR 2000
+#define CR_SOCKET_CREATE_ERROR 2001
+#define CR_CONNECTION_ERROR 2002
+#define CR_CONN_HOST_ERROR 2003
+#define CR_IPSOCK_ERROR 2004
+#define CR_UNKNOWN_HOST 2005
+#define CR_SERVER_GONE_ERROR 2006
+#define CR_VERSION_ERROR 2007
+#define CR_OUT_OF_MEMORY 2008
+#define CR_WRONG_HOST_INFO 2009
+#define CR_LOCALHOST_CONNECTION 2010
+#define CR_TCP_CONNECTION 2011
+#define CR_SERVER_HANDSHAKE_ERR 2012
+#define CR_SERVER_LOST 2013
+#define CR_COMMANDS_OUT_OF_SYNC 2014
+#define CR_NAMEDPIPE_CONNECTION 2015
+#define CR_NAMEDPIPEWAIT_ERROR 2016
+#define CR_NAMEDPIPEOPEN_ERROR 2017
+#define CR_NAMEDPIPESETSTATE_ERROR 2018
+#define CR_CANT_READ_CHARSET 2019
+#define CR_NET_PACKET_TOO_LARGE 2020
+#define CR_EMBEDDED_CONNECTION 2021
+#define CR_PROBE_SLAVE_STATUS 2022
+#define CR_PROBE_SLAVE_HOSTS 2023
+#define CR_PROBE_SLAVE_CONNECT 2024
+#define CR_PROBE_MASTER_CONNECT 2025
+#define CR_SSL_CONNECTION_ERROR 2026
+#define CR_MALFORMED_PACKET 2027
+#define CR_WRONG_LICENSE 2028
+
+/* new 4.1 error codes */
+#define CR_NULL_POINTER 2029
+#define CR_NO_PREPARE_STMT 2030
+#define CR_PARAMS_NOT_BOUND 2031
+#define CR_DATA_TRUNCATED 2032
+#define CR_NO_PARAMETERS_EXISTS 2033
+#define CR_INVALID_PARAMETER_NO 2034
+#define CR_INVALID_BUFFER_USE 2035
+#define CR_UNSUPPORTED_PARAM_TYPE 2036
+
+#define CR_SHARED_MEMORY_CONNECTION 2037
+#define CR_SHARED_MEMORY_CONNECT_REQUEST_ERROR 2038
+#define CR_SHARED_MEMORY_CONNECT_ANSWER_ERROR 2039
+#define CR_SHARED_MEMORY_CONNECT_FILE_MAP_ERROR 2040
+#define CR_SHARED_MEMORY_CONNECT_MAP_ERROR 2041
+#define CR_SHARED_MEMORY_FILE_MAP_ERROR 2042
+#define CR_SHARED_MEMORY_MAP_ERROR 2043
+#define CR_SHARED_MEMORY_EVENT_ERROR 2044
+#define CR_SHARED_MEMORY_CONNECT_ABANDONED_ERROR 2045
+#define CR_SHARED_MEMORY_CONNECT_SET_ERROR 2046
+#define CR_CONN_UNKNOW_PROTOCOL 2047
+#define CR_INVALID_CONN_HANDLE 2048
+#define CR_UNUSED_1 2049
+#define CR_FETCH_CANCELED 2050
+#define CR_NO_DATA 2051
+#define CR_NO_STMT_METADATA 2052
+#define CR_NO_RESULT_SET 2053
+#define CR_NOT_IMPLEMENTED 2054
+#define CR_SERVER_LOST_EXTENDED 2055
+#define CR_STMT_CLOSED 2056
+#define CR_NEW_STMT_METADATA 2057
+#define CR_ALREADY_CONNECTED 2058
+#define CR_AUTH_PLUGIN_CANNOT_LOAD 2059
+#define CR_DUPLICATE_CONNECTION_ATTR 2060
+#define CR_AUTH_PLUGIN_ERR 2061
+#define CR_INSECURE_API_ERR 2062
+#define CR_FILE_NAME_TOO_LONG 2063
+#define CR_SSL_FIPS_MODE_ERR 2064
+#define CR_COMPRESSION_NOT_SUPPORTED 2065
+#define CR_ERROR_LAST /*Copy last error nr:*/ 2065
+/* Add error numbers before CR_ERROR_LAST and change it accordingly. */
+
+/* Visual Studio requires '__inline' for C code */
+static inline const char *ER_CLIENT(int client_errno) {
+ if (client_errno >= CR_ERROR_FIRST && client_errno <= CR_ERROR_LAST)
+ return client_errors[client_errno - CR_ERROR_FIRST];
+ return client_errors[CR_UNKNOWN_ERROR];
+}
+
+#endif /* ERRMSG_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/field_types.h b/contrib/libs/libmysql_r/include/field_types.h
new file mode 100644
index 0000000000..9485138779
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/field_types.h
@@ -0,0 +1,96 @@
+/* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ Without limiting anything contained in the foregoing, this file,
+ which is part of C Driver for MySQL (Connector/C), is also subject to the
+ Universal FOSS Exception, version 1.0, a copy of which can be found at
+ http://oss.oracle.com/licenses/universal-foss-exception.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file field_types.h
+
+ @brief This file contains the field type.
+
+
+ @note This file can be imported both from C and C++ code, so the
+ definitions have to be constructed to support this.
+*/
+
+#ifndef FIELD_TYPES_INCLUDED
+#define FIELD_TYPES_INCLUDED
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * Constants exported from this package.
+ */
+
+/**
+ Column types for MySQL
+*/
+enum enum_field_types
+#if defined(__cplusplus) && __cplusplus > 201103L
+ // N2764: Forward enum declarations, added in C++11
+ : int
+#endif /* __cplusplus */
+{ MYSQL_TYPE_DECIMAL,
+ MYSQL_TYPE_TINY,
+ MYSQL_TYPE_SHORT,
+ MYSQL_TYPE_LONG,
+ MYSQL_TYPE_FLOAT,
+ MYSQL_TYPE_DOUBLE,
+ MYSQL_TYPE_NULL,
+ MYSQL_TYPE_TIMESTAMP,
+ MYSQL_TYPE_LONGLONG,
+ MYSQL_TYPE_INT24,
+ MYSQL_TYPE_DATE,
+ MYSQL_TYPE_TIME,
+ MYSQL_TYPE_DATETIME,
+ MYSQL_TYPE_YEAR,
+ MYSQL_TYPE_NEWDATE, /**< Internal to MySQL. Not used in protocol */
+ MYSQL_TYPE_VARCHAR,
+ MYSQL_TYPE_BIT,
+ MYSQL_TYPE_TIMESTAMP2,
+ MYSQL_TYPE_DATETIME2, /**< Internal to MySQL. Not used in protocol */
+ MYSQL_TYPE_TIME2, /**< Internal to MySQL. Not used in protocol */
+ MYSQL_TYPE_TYPED_ARRAY = 244, /** Used for replication only */
+ MYSQL_TYPE_JSON = 245,
+ MYSQL_TYPE_NEWDECIMAL = 246,
+ MYSQL_TYPE_ENUM = 247,
+ MYSQL_TYPE_SET = 248,
+ MYSQL_TYPE_TINY_BLOB = 249,
+ MYSQL_TYPE_MEDIUM_BLOB = 250,
+ MYSQL_TYPE_LONG_BLOB = 251,
+ MYSQL_TYPE_BLOB = 252,
+ MYSQL_TYPE_VAR_STRING = 253,
+ MYSQL_TYPE_STRING = 254,
+ MYSQL_TYPE_GEOMETRY = 255 };
+
+#ifdef __cplusplus
+} // extern "C"
+#else
+typedef enum enum_field_types enum_field_types;
+#endif /* __cplusplus */
+
+#endif /* FIELD_TYPES_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/ft_global.h b/contrib/libs/libmysql_r/include/ft_global.h
new file mode 100644
index 0000000000..e50df0aa5e
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/ft_global.h
@@ -0,0 +1,131 @@
+#ifndef FT_GLOBAL_INCLUDED
+#define FT_GLOBAL_INCLUDED
+
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/* Written by Sergei A. Golubchik, who has a shared copyright to this code */
+
+/**
+ @file include/ft_global.h
+ Some definitions for full-text indices.
+*/
+
+/* #include "myisam.h" */
+
+#include <sys/types.h>
+
+#include "m_ctype.h"
+#include "my_base.h"
+#include "my_inttypes.h"
+
+#define HA_FT_MAXBYTELEN 336
+#define HA_FT_MAXCHARLEN (HA_FT_MAXBYTELEN / 4)
+
+#define DEFAULT_FTB_SYNTAX "+ -><()~*:\"\"&|"
+
+struct FT_INFO;
+struct _ft_vft {
+ int (*read_next)(FT_INFO *, char *);
+ float (*find_relevance)(FT_INFO *, uchar *, uint);
+ void (*close_search)(FT_INFO *);
+ float (*get_relevance)(FT_INFO *);
+ void (*reinit_search)(FT_INFO *);
+};
+
+struct FT_INFO_EXT;
+struct _ft_vft_ext {
+ uint (*get_version)(); // Extended API version
+ ulonglong (*get_flags)();
+ ulonglong (*get_docid)(FT_INFO_EXT *);
+ ulonglong (*count_matches)(FT_INFO_EXT *);
+};
+
+/* Flags for extended FT API */
+#define FTS_ORDERED_RESULT (1LL << 1)
+#define FTS_DOCID_IN_RESULT (1LL << 2)
+
+#define FTS_DOC_ID_COL_NAME "FTS_DOC_ID"
+
+#define FTS_NGRAM_PARSER_NAME "ngram"
+
+struct FT_INFO {
+ struct _ft_vft *please; /* INTERCAL style :-) */
+};
+
+#ifndef FT_CORE
+struct FT_INFO_EXT {
+ struct _ft_vft *please; /* INTERCAL style :-) */
+ struct _ft_vft_ext *could_you;
+};
+#endif
+
+extern const char *ft_stopword_file;
+extern const char *ft_precompiled_stopwords[];
+
+extern ulong ft_min_word_len;
+extern ulong ft_max_word_len;
+extern ulong ft_query_expansion_limit;
+extern const char *ft_boolean_syntax;
+extern struct st_mysql_ftparser ft_default_parser;
+
+int ft_init_stopwords(void);
+void ft_free_stopwords(void);
+
+/**
+ Operation types, used in FT_HINTS.
+*/
+
+enum ft_operation {
+ FT_OP_UNDEFINED, /** Operation undefined, use of hints is impossible */
+ FT_OP_NO, /** No operation, single MATCH function */
+ FT_OP_GT, /** 'Greater than' operation */
+ FT_OP_GE /** 'Greater than or equal to' operation */
+};
+
+#define FT_NL 0 /** Normal mode */
+#define FT_BOOL 1 /** Boolean mode */
+#define FT_SORTED 2 /** perform internal sorting by rank */
+#define FT_EXPAND 4 /** query expansion */
+#define FT_NO_RANKING 8 /** skip rank calculation */
+
+/**
+ Info about FULLTEXT index hints,
+ passed to the storage engine.
+*/
+
+struct ft_hints {
+ /** FULLTEXT flags, see FT_NL, etc */
+ uint flags;
+ /** Operation type */
+ enum ft_operation op_type;
+ /** Operation value */
+ double op_value;
+ /** LIMIT value, HA_POS_ERROR if not set */
+ ha_rows limit;
+};
+
+FT_INFO *ft_init_search(uint, void *, uint, uchar *, uint, const CHARSET_INFO *,
+ uchar *);
+bool ft_boolean_check_syntax_string(const uchar *);
+
+#endif /* FT_GLOBAL_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/keycache.h b/contrib/libs/libmysql_r/include/keycache.h
new file mode 100644
index 0000000000..54fbfeed1b
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/keycache.h
@@ -0,0 +1,166 @@
+/* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/keycache.h
+ Key cache variable structures.
+*/
+
+#ifndef _keycache_h
+#define _keycache_h
+
+#include <stddef.h>
+#include <sys/types.h>
+
+#include "my_inttypes.h"
+#include "my_io.h"
+#include "my_macros.h"
+#include "my_sys.h" /* flush_type */
+#include "mysql/psi/mysql_cond.h"
+#include "mysql/psi/mysql_mutex.h"
+
+/* declare structures that is used by KEY_CACHE */
+
+struct BLOCK_LINK;
+struct HASH_LINK;
+
+/* Thread specific variables */
+struct st_keycache_thread_var {
+ mysql_cond_t suspend;
+ struct st_keycache_thread_var *next, **prev;
+ void *opt_info;
+};
+
+/* info about requests in a waiting queue */
+struct KEYCACHE_WQUEUE {
+ st_keycache_thread_var *last_thread; /* circular list of waiting threads */
+};
+
+/* Typical key cash */
+#define KEY_CACHE_SIZE (uint)(8 * 1024 * 1024)
+/* Default size of a key cache block */
+#define KEY_CACHE_BLOCK_SIZE (uint)1024
+
+#define CHANGED_BLOCKS_HASH 128 /* must be power of 2 */
+
+/*
+ The key cache structure
+ It also contains read-only statistics parameters.
+*/
+
+struct KEY_CACHE {
+ bool key_cache_inited;
+ bool in_resize; /* true during resize operation */
+ bool resize_in_flush; /* true during flush of resize operation */
+ bool can_be_used; /* usage of cache for read/write is allowed */
+ size_t key_cache_mem_size; /* specified size of the cache memory */
+ uint key_cache_block_size; /* size of the page buffer of a cache block */
+ ulonglong min_warm_blocks; /* min number of warm blocks; */
+ ulonglong age_threshold; /* age threshold for hot blocks */
+ ulonglong keycache_time; /* total number of block link operations */
+ uint hash_entries; /* max number of entries in the hash table */
+ int hash_links; /* max number of hash links */
+ int hash_links_used; /* number of hash links currently used */
+ int disk_blocks; /* max number of blocks in the cache */
+ ulong blocks_used; /* maximum number of concurrently used blocks */
+ ulong blocks_unused; /* number of currently unused blocks */
+ ulong blocks_changed; /* number of currently dirty blocks */
+ ulong warm_blocks; /* number of blocks in warm sub-chain */
+ ulong cnt_for_resize_op; /* counter to block resize operation */
+ long blocks_available; /* number of blocks available in the LRU chain */
+ HASH_LINK **hash_root; /* arr. of entries into hash table buckets */
+ HASH_LINK *hash_link_root; /* memory for hash table links */
+ HASH_LINK *free_hash_list; /* list of free hash links */
+ BLOCK_LINK *free_block_list; /* list of free blocks */
+ BLOCK_LINK *block_root; /* memory for block links */
+ uchar *block_mem; /* memory for block buffers */
+ BLOCK_LINK *used_last; /* ptr to the last block of the LRU chain */
+ BLOCK_LINK *used_ins; /* ptr to the insertion block in LRU chain */
+ mysql_mutex_t cache_lock; /* to lock access to the cache structure */
+ KEYCACHE_WQUEUE resize_queue; /* threads waiting during resize operation */
+ /*
+ Waiting for a zero resize count. Using a queue for symmetry though
+ only one thread can wait here.
+ */
+ KEYCACHE_WQUEUE waiting_for_resize_cnt;
+ KEYCACHE_WQUEUE waiting_for_hash_link; /* waiting for a free hash link */
+ KEYCACHE_WQUEUE waiting_for_block; /* requests waiting for a free block */
+ BLOCK_LINK *changed_blocks[CHANGED_BLOCKS_HASH]; /* hash for dirty file bl.*/
+ BLOCK_LINK *file_blocks[CHANGED_BLOCKS_HASH]; /* hash for other file bl.*/
+
+ /*
+ The following variables are and variables used to hold parameters for
+ initializing the key cache.
+ */
+
+ ulonglong param_buff_size; /* size the memory allocated for the cache */
+ ulonglong param_block_size; /* size of the blocks in the key cache */
+ ulonglong param_division_limit; /* min. percentage of warm blocks */
+ ulonglong param_age_threshold; /* determines when hot block is downgraded */
+
+ /* Statistics variables. These are reset in reset_key_cache_counters(). */
+ ulong global_blocks_changed; /* number of currently dirty blocks */
+ ulonglong global_cache_w_requests; /* number of write requests (write hits) */
+ ulonglong global_cache_write; /* number of writes from cache to files */
+ ulonglong global_cache_r_requests; /* number of read requests (read hits) */
+ ulonglong global_cache_read; /* number of reads from files to cache */
+
+ int blocks; /* max number of blocks in the cache */
+ bool in_init; /* Set to 1 in MySQL during init/resize */
+};
+
+/* The default key cache */
+extern KEY_CACHE dflt_key_cache_var, *dflt_key_cache;
+
+extern int init_key_cache(KEY_CACHE *keycache, ulonglong key_cache_block_size,
+ size_t use_mem, ulonglong division_limit,
+ ulonglong age_threshold);
+extern int resize_key_cache(KEY_CACHE *keycache,
+ st_keycache_thread_var *thread_var,
+ ulonglong key_cache_block_size, size_t use_mem,
+ ulonglong division_limit, ulonglong age_threshold);
+extern uchar *key_cache_read(KEY_CACHE *keycache,
+ st_keycache_thread_var *thread_var, File file,
+ my_off_t filepos, int level, uchar *buff,
+ uint length, uint block_length, int return_buffer);
+extern int key_cache_insert(KEY_CACHE *keycache,
+ st_keycache_thread_var *thread_var, File file,
+ my_off_t filepos, int level, uchar *buff,
+ uint length);
+extern int key_cache_write(KEY_CACHE *keycache,
+ st_keycache_thread_var *thread_var, File file,
+ my_off_t filepos, int level, uchar *buff,
+ uint length, uint block_length, int force_write);
+extern int flush_key_blocks(KEY_CACHE *keycache,
+ st_keycache_thread_var *thread_var, int file,
+ enum flush_type type);
+extern void end_key_cache(KEY_CACHE *keycache, bool cleanup);
+
+/* Functions to handle multiple key caches */
+extern bool multi_keycache_init(void);
+extern void multi_keycache_free(void);
+extern KEY_CACHE *multi_key_cache_search(uchar *key, uint length);
+extern bool multi_key_cache_set(const uchar *key, uint length,
+ KEY_CACHE *key_cache);
+extern void multi_key_cache_change(KEY_CACHE *old_data, KEY_CACHE *new_data);
+extern int reset_key_cache_counters(const char *name, KEY_CACHE *key_cache);
+#endif /* _keycache_h */
diff --git a/contrib/libs/libmysql_r/include/lex_string.h b/contrib/libs/libmysql_r/include/lex_string.h
new file mode 100644
index 0000000000..27c3bc579b
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/lex_string.h
@@ -0,0 +1,54 @@
+/*
+ Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef LEX_STRING_INCLUDED
+#define LEX_STRING_INCLUDED
+
+#include "mysql/mysql_lex_string.h"
+
+#ifdef __cplusplus
+#include <string>
+#endif
+
+/*
+ LEX_STRING -- a pair of a C-string and its length.
+ (it's part of the plugin API as a MYSQL_LEX_STRING)
+ Ditto LEX_CSTRING/MYSQL_LEX_CSTRING.
+*/
+
+typedef struct MYSQL_LEX_STRING LEX_STRING;
+typedef struct MYSQL_LEX_CSTRING LEX_CSTRING;
+
+#ifdef __cplusplus
+
+static inline std::string to_string(const LEX_STRING &str) {
+ return std::string(str.str, str.length);
+}
+
+static inline std::string to_string(const LEX_CSTRING &str) {
+ return std::string(str.str, str.length);
+}
+
+#endif // defined(__cplusplus)
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/lf.h b/contrib/libs/libmysql_r/include/lf.h
new file mode 100644
index 0000000000..53898f428d
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/lf.h
@@ -0,0 +1,230 @@
+/* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef _lf_h
+#define _lf_h
+
+/**
+ @file include/lf.h
+*/
+
+#include "my_config.h"
+
+#include <stddef.h>
+#include <sys/types.h>
+
+#include <atomic>
+
+#include "my_inttypes.h"
+#include "my_macros.h"
+#include "mysql/psi/mysql_statement.h"
+#include "mysql/service_mysql_alloc.h"
+#include "sql_string.h"
+
+/*
+ wait-free dynamic array, see lf_dynarray.c
+
+ 4 levels of 256 elements each mean 4311810304 elements in an array - it
+ should be enough for a while
+*/
+#define LF_DYNARRAY_LEVEL_LENGTH 256
+#define LF_DYNARRAY_LEVELS 4
+
+typedef struct {
+ std::atomic<void *> level[LF_DYNARRAY_LEVELS];
+ uint size_of_element;
+} LF_DYNARRAY;
+
+typedef int (*lf_dynarray_func)(void *, void *);
+
+void lf_dynarray_init(LF_DYNARRAY *array, uint element_size);
+void lf_dynarray_destroy(LF_DYNARRAY *array);
+void *lf_dynarray_value(LF_DYNARRAY *array, uint idx);
+void *lf_dynarray_lvalue(LF_DYNARRAY *array, uint idx);
+int lf_dynarray_iterate(LF_DYNARRAY *array, lf_dynarray_func func, void *arg);
+
+/*
+ pin manager for memory allocator, lf_alloc-pin.c
+*/
+
+#define LF_PINBOX_PINS 4
+#define LF_PURGATORY_SIZE 10
+
+typedef void lf_pinbox_free_func(void *, void *, void *);
+
+typedef struct {
+ LF_DYNARRAY pinarray;
+ lf_pinbox_free_func *free_func;
+ void *free_func_arg;
+ uint free_ptr_offset;
+ std::atomic<uint32> pinstack_top_ver; /* this is a versioned pointer */
+ std::atomic<uint32> pins_in_array; /* number of elements in array */
+} LF_PINBOX;
+
+struct LF_PINS {
+ std::atomic<void *> pin[LF_PINBOX_PINS];
+ LF_PINBOX *pinbox;
+ void *purgatory;
+ uint32 purgatory_count;
+ std::atomic<uint32> link;
+ /* we want sizeof(LF_PINS) to be 64 to avoid false sharing */
+#if SIZEOF_INT * 2 + SIZEOF_CHARP * (LF_PINBOX_PINS + 2) != 64
+ char pad[64 - sizeof(uint32) * 2 - sizeof(void *) * (LF_PINBOX_PINS + 2)];
+#endif
+};
+
+/*
+ compile-time assert, to require "no less than N" pins
+ it's enough if it'll fail on at least one compiler, so
+ we'll enable it on GCC only, which supports zero-length arrays.
+*/
+#if defined(__GNUC__) && defined(MY_LF_EXTRA_DEBUG)
+#define LF_REQUIRE_PINS(N) \
+ static const char require_pins[LF_PINBOX_PINS - N] MY_ATTRIBUTE((unused)); \
+ static const int LF_NUM_PINS_IN_THIS_FILE = N;
+#else
+#define LF_REQUIRE_PINS(N)
+#endif
+
+static inline void lf_pin(LF_PINS *pins, int pin, void *addr) {
+#if defined(__GNUC__) && defined(MY_LF_EXTRA_DEBUG)
+ assert(pin < LF_NUM_PINS_IN_THIS_FILE);
+#endif
+ pins->pin[pin].store(addr);
+}
+
+static inline void lf_unpin(LF_PINS *pins, int pin) {
+#if defined(__GNUC__) && defined(MY_LF_EXTRA_DEBUG)
+ assert(pin < LF_NUM_PINS_IN_THIS_FILE);
+#endif
+ pins->pin[pin].store(nullptr);
+}
+
+void lf_pinbox_init(LF_PINBOX *pinbox, uint free_ptr_offset,
+ lf_pinbox_free_func *free_func, void *free_func_arg);
+void lf_pinbox_destroy(LF_PINBOX *pinbox);
+LF_PINS *lf_pinbox_get_pins(LF_PINBOX *pinbox);
+void lf_pinbox_put_pins(LF_PINS *pins);
+void lf_pinbox_free(LF_PINS *pins, void *addr);
+
+/*
+ memory allocator, lf_alloc-pin.c
+*/
+typedef void lf_allocator_func(uchar *);
+
+struct LF_ALLOCATOR {
+ LF_PINBOX pinbox;
+ std::atomic<uchar *> top;
+ uint element_size;
+ std::atomic<uint32> mallocs;
+ lf_allocator_func *constructor; /* called, when an object is malloc()'ed */
+ lf_allocator_func *destructor; /* called, when an object is free()'d */
+};
+
+#define lf_alloc_init(A, B, C) lf_alloc_init2(A, B, C, NULL, NULL)
+void lf_alloc_init2(LF_ALLOCATOR *allocator, uint size, uint free_ptr_offset,
+ lf_allocator_func *ctor, lf_allocator_func *dtor);
+void lf_alloc_destroy(LF_ALLOCATOR *allocator);
+uint lf_alloc_pool_count(LF_ALLOCATOR *allocator);
+
+static inline void lf_alloc_direct_free(LF_ALLOCATOR *allocator, void *addr) {
+ if (allocator->destructor) {
+ allocator->destructor((uchar *)addr);
+ }
+ my_free(addr);
+}
+
+void *lf_alloc_new(LF_PINS *pins);
+
+struct LF_HASH;
+
+typedef uint lf_hash_func(const LF_HASH *, const uchar *, size_t);
+typedef void lf_hash_init_func(uchar *dst, const uchar *src);
+
+#define LF_HASH_UNIQUE 1
+#define MY_LF_ERRPTR ((void *)(intptr)1)
+
+/* lf_hash overhead per element (that is, sizeof(LF_SLIST) */
+extern MYSQL_PLUGIN_IMPORT const int LF_HASH_OVERHEAD;
+
+/**
+ Callback for extracting key and key length from user data in a LF_HASH.
+ @param arg Pointer to user data.
+ @param[out] length Store key length here.
+ @return Pointer to key to be hashed.
+
+ @note Was my_hash_get_key, with lots of C-style casting when calling
+ my_hash_init. Renamed to force build error (since signature changed)
+ in case someone keeps following that coding style.
+ */
+typedef const uchar *(*hash_get_key_function)(const uchar *arg, size_t *length);
+
+struct LF_HASH {
+ LF_DYNARRAY array; /* hash itself */
+ LF_ALLOCATOR alloc; /* allocator for elements */
+ hash_get_key_function get_key; /* see HASH */
+ CHARSET_INFO *charset; /* see HASH */
+ lf_hash_func *hash_function; /* see HASH */
+ uint key_offset, key_length; /* see HASH */
+ uint element_size; /* size of memcpy'ed area on insert */
+ uint flags; /* LF_HASH_UNIQUE, etc */
+ std::atomic<int32> size; /* size of array */
+ std::atomic<int32> count; /* number of elements in the hash */
+ /**
+ "Initialize" hook - called to finish initialization of object provided by
+ LF_ALLOCATOR (which is pointed by "dst" parameter) and set element key
+ from object passed as parameter to lf_hash_insert (pointed by "src"
+ parameter). Allows to use LF_HASH with objects which are not "trivially
+ copyable".
+ NULL value means that element initialization is carried out by copying
+ first element_size bytes from object which provided as parameter to
+ lf_hash_insert.
+ */
+ lf_hash_init_func *initialize;
+};
+
+#define lf_hash_init(A, B, C, D, E, F, G) \
+ lf_hash_init2(A, B, C, D, E, F, G, NULL, NULL, NULL, NULL)
+void lf_hash_init2(LF_HASH *hash, uint element_size, uint flags,
+ uint key_offset, uint key_length,
+ hash_get_key_function get_key, CHARSET_INFO *charset,
+ lf_hash_func *hash_function, lf_allocator_func *ctor,
+ lf_allocator_func *dtor, lf_hash_init_func *init);
+void lf_hash_destroy(LF_HASH *hash);
+int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data);
+void *lf_hash_search(LF_HASH *hash, LF_PINS *pins, const void *key,
+ uint keylen);
+int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen);
+
+static inline LF_PINS *lf_hash_get_pins(LF_HASH *hash) {
+ return lf_pinbox_get_pins(&hash->alloc.pinbox);
+}
+
+static inline void lf_hash_put_pins(LF_PINS *pins) { lf_pinbox_put_pins(pins); }
+
+static inline void lf_hash_search_unpin(LF_PINS *pins) { lf_unpin(pins, 2); }
+
+typedef int lf_hash_match_func(const uchar *el);
+void *lf_hash_random_match(LF_HASH *hash, LF_PINS *pins,
+ lf_hash_match_func *match, uint rand_val);
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/little_endian.h b/contrib/libs/libmysql_r/include/little_endian.h
new file mode 100644
index 0000000000..c67a6ee03e
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/little_endian.h
@@ -0,0 +1,134 @@
+#ifndef LITTLE_ENDIAN_INCLUDED
+#define LITTLE_ENDIAN_INCLUDED
+/* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/little_endian.h
+ Data in little-endian format.
+*/
+
+// IWYU pragma: private, include "my_byteorder.h"
+
+#ifndef MY_BYTEORDER_INCLUDED
+#error This file should never be #included directly; use my_byteorder.h.
+#endif
+
+#include <string.h>
+
+#include "my_inttypes.h"
+
+/*
+ Since the pointers may be misaligned, we cannot do a straight read out of
+ them. (It usually works-by-accident on x86 and on modern ARM, but not always
+ when the compiler chooses unusual instruction for the read, e.g. LDM on ARM
+ or most SIMD instructions on x86.) memcpy is safe and gets optimized to a
+ single operation, since the size is small and constant.
+*/
+
+static inline int16 sint2korr(const uchar *A) {
+ int16 ret;
+ memcpy(&ret, A, sizeof(ret));
+ return ret;
+}
+
+static inline int32 sint4korr(const uchar *A) {
+ int32 ret;
+ memcpy(&ret, A, sizeof(ret));
+ return ret;
+}
+
+static inline uint16 uint2korr(const uchar *A) {
+ uint16 ret;
+ memcpy(&ret, A, sizeof(ret));
+ return ret;
+}
+
+static inline uint32 uint4korr(const uchar *A) {
+ uint32 ret;
+ memcpy(&ret, A, sizeof(ret));
+ return ret;
+}
+
+static inline ulonglong uint8korr(const uchar *A) {
+ ulonglong ret;
+ memcpy(&ret, A, sizeof(ret));
+ return ret;
+}
+
+static inline longlong sint8korr(const uchar *A) {
+ longlong ret;
+ memcpy(&ret, A, sizeof(ret));
+ return ret;
+}
+
+static inline void int2store(uchar *T, uint16 A) { memcpy(T, &A, sizeof(A)); }
+
+static inline void int4store(uchar *T, uint32 A) { memcpy(T, &A, sizeof(A)); }
+
+static inline void int7store(uchar *T, ulonglong A) { memcpy(T, &A, 7); }
+
+static inline void int8store(uchar *T, ulonglong A) {
+ memcpy(T, &A, sizeof(A));
+}
+
+static inline void float4get(float *V, const uchar *M) {
+ memcpy(V, (M), sizeof(float));
+}
+
+static inline void float4store(uchar *V, float M) {
+ memcpy(V, (&M), sizeof(float));
+}
+
+static inline void float8get(double *V, const uchar *M) {
+ memcpy(V, M, sizeof(double));
+}
+
+static inline void float8store(uchar *V, double M) {
+ memcpy(V, &M, sizeof(double));
+}
+
+static inline void floatget(float *V, const uchar *M) { float4get(V, M); }
+static inline void floatstore(uchar *V, float M) { float4store(V, M); }
+
+static inline void doublestore(uchar *T, double V) {
+ memcpy(T, &V, sizeof(double));
+}
+static inline void doubleget(double *V, const uchar *M) {
+ memcpy(V, M, sizeof(double));
+}
+
+static inline void ushortget(uint16 *V, const uchar *pM) { *V = uint2korr(pM); }
+static inline void shortget(int16 *V, const uchar *pM) { *V = sint2korr(pM); }
+static inline void longget(int32 *V, const uchar *pM) { *V = sint4korr(pM); }
+static inline void ulongget(uint32 *V, const uchar *pM) { *V = uint4korr(pM); }
+static inline void shortstore(uchar *T, int16 V) { int2store(T, V); }
+static inline void longstore(uchar *T, int32 V) { int4store(T, V); }
+
+static inline void longlongget(longlong *V, const uchar *M) {
+ memcpy(V, (M), sizeof(ulonglong));
+}
+static inline void longlongstore(uchar *T, longlong V) {
+ memcpy((T), &V, sizeof(ulonglong));
+}
+
+#endif /* LITTLE_ENDIAN_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/m_ctype.h b/contrib/libs/libmysql_r/include/m_ctype.h
new file mode 100644
index 0000000000..ffd8860dd5
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/m_ctype.h
@@ -0,0 +1,748 @@
+/* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/m_ctype.h
+ A better implementation of the UNIX ctype(3) library.
+*/
+
+#ifndef _m_ctype_h
+#define _m_ctype_h
+
+#ifndef __cplusplus
+#include <stdbool.h>
+#endif
+#include <stddef.h>
+#include <sys/types.h>
+
+#include "my_compiler.h"
+#include "my_inttypes.h"
+#include "my_loglevel.h"
+#include "my_macros.h"
+#include "my_sharedlib.h"
+#include "template_utils.h"
+
+#define MY_CS_NAME_SIZE 32
+#define MY_CS_CTYPE_TABLE_SIZE 257
+#define MY_CS_TO_LOWER_TABLE_SIZE 256
+#define MY_CS_TO_UPPER_TABLE_SIZE 256
+#define MY_CS_SORT_ORDER_TABLE_SIZE 256
+#define MY_CS_TO_UNI_TABLE_SIZE 256
+
+#define CHARSET_DIR "charsets/"
+
+/**
+ Our own version of wchar_t, ie., a type that holds a single Unicode code point
+ ("wide character"). ulong is always big enough to hold any character
+ in the BMP.
+*/
+typedef ulong my_wc_t;
+
+#define MY_CS_REPLACEMENT_CHARACTER 0xFFFD
+
+static inline void MY_PUT_MB2(unsigned char *s, uint16 code) {
+ s[0] = code >> 8;
+ s[1] = code & 0xFF;
+}
+
+typedef struct MY_UNICASE_CHARACTER {
+ uint32 toupper;
+ uint32 tolower;
+ uint32 sort;
+} MY_UNICASE_CHARACTER;
+
+typedef struct MY_UNICASE_INFO {
+ my_wc_t maxchar;
+ const MY_UNICASE_CHARACTER **page;
+} MY_UNICASE_INFO;
+
+extern MY_UNICASE_INFO my_unicase_default;
+extern MY_UNICASE_INFO my_unicase_turkish;
+extern MY_UNICASE_INFO my_unicase_mysql500;
+extern MY_UNICASE_INFO my_unicase_unicode520;
+
+struct MY_UCA_INFO;
+
+typedef struct MY_UNI_CTYPE {
+ uchar pctype;
+ uchar *ctype;
+} MY_UNI_CTYPE;
+
+extern MY_UNI_CTYPE my_uni_ctype[256];
+
+/* wm_wc and wc_mb return codes */
+#define MY_CS_ILSEQ 0 /* Wrong by sequence: wb_wc */
+#define MY_CS_ILUNI 0 /* Cannot encode Unicode to charset: wc_mb */
+#define MY_CS_TOOSMALL -101 /* Need at least one byte: wc_mb and mb_wc */
+#define MY_CS_TOOSMALL2 -102 /* Need at least two bytes: wc_mb and mb_wc */
+#define MY_CS_TOOSMALL3 -103 /* Need at least three bytes: wc_mb and mb_wc */
+/* These following three are currently not really used */
+#define MY_CS_TOOSMALL4 -104 /* Need at least 4 bytes: wc_mb and mb_wc */
+#define MY_CS_TOOSMALL5 -105 /* Need at least 5 bytes: wc_mb and mb_wc */
+#define MY_CS_TOOSMALL6 -106 /* Need at least 6 bytes: wc_mb and mb_wc */
+/* A helper macros for "need at least n bytes" */
+#define MY_CS_TOOSMALLN(n) (-100 - (n))
+
+#define MY_SEQ_INTTAIL 1
+#define MY_SEQ_SPACES 2
+
+/* My charsets_list flags */
+#define MY_CS_COMPILED 1 /* compiled-in sets */
+#define MY_CS_CONFIG 2 /* sets that have a *.conf file */
+#define MY_CS_INDEX 4 /* sets listed in the Index file */
+#define MY_CS_LOADED 8 /* sets that are currently loaded */
+#define MY_CS_BINSORT 16 /* if binary sort order */
+#define MY_CS_PRIMARY 32 /* if primary collation */
+#define MY_CS_STRNXFRM \
+ 64 /* \
+ if _not_ set, sort_order will \
+ give same result as strnxfrm -- \
+ all new collations should have this \
+ flag set, do not check it in new code \
+ */
+#define MY_CS_UNICODE 128 /* is a charset is BMP Unicode */
+#define MY_CS_READY 256 /* if a charset is initialized */
+#define MY_CS_AVAILABLE 512 /* If either compiled-in or loaded*/
+#define MY_CS_CSSORT 1024 /* if case sensitive sort order */
+#define MY_CS_HIDDEN 2048 /* don't display in SHOW */
+#define MY_CS_PUREASCII 4096 /* if a charset is pure ascii */
+#define MY_CS_NONASCII 8192 /* if not ASCII-compatible */
+#define MY_CS_UNICODE_SUPPLEMENT 16384 /* Non-BMP Unicode characters */
+#define MY_CS_LOWER_SORT 32768 /* If use lower case as weight */
+#define MY_CHARSET_UNDEFINED 0
+
+/* Character repertoire flags */
+#define MY_REPERTOIRE_ASCII 1 /* Pure ASCII U+0000..U+007F */
+#define MY_REPERTOIRE_EXTENDED 2 /* Extended characters: U+0080..U+FFFF */
+#define MY_REPERTOIRE_UNICODE30 3 /* ASCII | EXTENDED: U+0000..U+FFFF */
+
+/* Flags for strxfrm */
+#define MY_STRXFRM_PAD_TO_MAXLEN 0x00000080 /* if pad tail(for filesort) */
+
+typedef struct MY_UNI_IDX {
+ uint16 from;
+ uint16 to;
+ const uchar *tab;
+} MY_UNI_IDX;
+
+typedef struct {
+ uint beg;
+ uint end;
+ uint mb_len;
+} my_match_t;
+
+struct CHARSET_INFO;
+#ifndef __cplusplus
+typedef struct CHARSET_INFO CHARSET_INFO;
+#endif
+extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *system_charset_info;
+
+typedef struct MY_CHARSET_LOADER {
+ uint errcode;
+ char errarg[192];
+ void *(*once_alloc)(size_t);
+ void *(*mem_malloc)(size_t);
+ void *(*mem_realloc)(void *, size_t);
+ void (*mem_free)(void *);
+ void (*reporter)(enum loglevel, uint errcode, ...);
+ int (*add_collation)(CHARSET_INFO *cs);
+} MY_CHARSET_LOADER;
+
+extern int (*my_string_stack_guard)(int);
+
+enum Pad_attribute { PAD_SPACE, NO_PAD };
+
+/* See strings/CHARSET_INFO.txt for information about this structure */
+typedef struct MY_COLLATION_HANDLER {
+ bool (*init)(CHARSET_INFO *, MY_CHARSET_LOADER *);
+ void (*uninit)(CHARSET_INFO *);
+ /* Collation routines */
+ int (*strnncoll)(const CHARSET_INFO *, const uchar *, size_t, const uchar *,
+ size_t, bool);
+ /**
+ Compare the two strings under the pad rules given by the collation.
+
+ Thus, for NO PAD collations, this is identical to strnncoll with is_prefix
+ set to false. For PAD SPACE collations, the two strings are conceptually
+ extended infinitely at the end using space characters (0x20) and then
+ compared under the collation's normal comparison rules, so that e.g 'a' is
+ equal to 'a '.
+ */
+ int (*strnncollsp)(const CHARSET_INFO *, const uchar *, size_t, const uchar *,
+ size_t);
+ /**
+ Transform the string into a form such that memcmp() between transformed
+ strings yields the correct collation order.
+
+ @param [out] dst Buffer for the transformed string.
+ @param [out] dstlen Number of bytes available in dstlen.
+ Must be even.
+ @param num_codepoints Treat the string as if it were of type
+ CHAR(num_codepoints). In particular, this means that if the
+ collation is a pad collation (pad_attribute is PAD_SPACE) and
+ string has fewer than "num_codepoints" codepoints, the string
+ will be transformed as if it ended in (num_codepoints-n) extra spaces.
+ If the string has more than "num_codepoints" codepoints,
+ behavior is undefined; may truncate, may crash, or do something
+ else entirely. Note that MY_STRXFRM_PAD_TO_MAXLEN overrides this;
+ if it is given for a PAD SPACE collation, this value is taken to be
+ effectively infinity.
+ @param src The source string, in the required character set
+ for the collation.
+ @param srclen Number of bytes in src.
+ @param flags ORed bitmask of MY_STRXFRM_* flags.
+
+ @return Number of bytes written to dst.
+ */
+ size_t (*strnxfrm)(const CHARSET_INFO *, uchar *dst, size_t dstlen,
+ uint num_codepoints, const uchar *src, size_t srclen,
+ uint flags);
+
+ /**
+ Return the maximum number of output bytes needed for strnxfrm()
+ to output all weights for any string of the given input length.
+ You can use this to e.g. size buffers for sort keys.
+
+ @param num_bytes Number of bytes in the input string. Note that for
+ multibyte character sets, this _must_ be a pessimistic estimate,
+ ie., one that's cs->mbmaxlen * max_num_codepoints. So for e.g.
+ the utf8mb4 string "foo", you will need to give in 12, not 3.
+ */
+ size_t (*strnxfrmlen)(const CHARSET_INFO *, size_t num_bytes);
+ bool (*like_range)(const CHARSET_INFO *, const char *s, size_t s_length,
+ char w_prefix, char w_one, char w_many, size_t res_length,
+ char *min_str, char *max_str, size_t *min_len,
+ size_t *max_len);
+ int (*wildcmp)(const CHARSET_INFO *, const char *str, const char *str_end,
+ const char *wildstr, const char *wildend, int escape,
+ int w_one, int w_many);
+
+ int (*strcasecmp)(const CHARSET_INFO *, const char *, const char *);
+
+ uint (*strstr)(const CHARSET_INFO *, const char *b, size_t b_length,
+ const char *s, size_t s_length, my_match_t *match,
+ uint nmatch);
+
+ /**
+ Compute a sort hash for the given key. This hash must preserve equality
+ under the given collation, so that a=b => H(a)=H(b). Note that this hash
+ is used for hash-based partitioning (PARTITION KEY), so you cannot change
+ it except when writing a new collation; it needs to be unchanged across
+ releases, so that the on-disk format does not change. (It is also used
+ for testing equality in the MEMORY storage engine.)
+
+ nr1 and nr2 are both in/out parameters. nr1 is the actual hash value;
+ nr2 holds extra state between invocations.
+ */
+ void (*hash_sort)(const CHARSET_INFO *cs, const uchar *key, size_t len,
+ uint64 *nr1, uint64 *nr2);
+ bool (*propagate)(const CHARSET_INFO *cs, const uchar *str, size_t len);
+} MY_COLLATION_HANDLER;
+
+extern MY_COLLATION_HANDLER my_collation_mb_bin_handler;
+extern MY_COLLATION_HANDLER my_collation_8bit_bin_handler;
+extern MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler;
+extern MY_COLLATION_HANDLER my_collation_ucs2_uca_handler;
+
+/* Some typedef to make it easy for C++ to make function pointers */
+typedef int (*my_charset_conv_mb_wc)(const CHARSET_INFO *, my_wc_t *,
+ const uchar *, const uchar *);
+typedef int (*my_charset_conv_wc_mb)(const CHARSET_INFO *, my_wc_t, uchar *,
+ uchar *);
+typedef size_t (*my_charset_conv_case)(const CHARSET_INFO *, char *, size_t,
+ char *, size_t);
+
+/* See strings/CHARSET_INFO.txt about information on this structure */
+typedef struct MY_CHARSET_HANDLER {
+ bool (*init)(CHARSET_INFO *, MY_CHARSET_LOADER *loader);
+ /* Multibyte routines */
+ uint (*ismbchar)(const CHARSET_INFO *, const char *, const char *);
+ uint (*mbcharlen)(const CHARSET_INFO *, uint c);
+ size_t (*numchars)(const CHARSET_INFO *, const char *b, const char *e);
+
+ /**
+ Return at which byte codepoint number "pos" begins, relative to
+ the start of the string. If the string is shorter than or is
+ exactly "pos" codepoints long, returns a value equal or greater to
+ (e-b).
+ */
+ size_t (*charpos)(const CHARSET_INFO *, const char *b, const char *e,
+ size_t pos);
+ size_t (*well_formed_len)(const CHARSET_INFO *, const char *b, const char *e,
+ size_t nchars, int *error);
+ /**
+ Given a pointer and a length in bytes, returns a new length in bytes where
+ all trailing space characters are stripped. This holds even for NO PAD
+ collations.
+
+ Exception: The "binary" collation, which is used behind-the-scenes to
+ implement the BINARY type (by mapping it to CHAR(n) COLLATE "binary"),
+ returns just the length back with no stripping. It's done that way so that
+ Field_string (implementing CHAR(n)) returns the full padded width on read
+ (as opposed to a normal CHAR, where we usually strip the spaces on read),
+ but it's suboptimal, since lengthsp() is also used in a number of other
+ places, e.g. stripping trailing spaces from enum values given in by the
+ user. If you call this function, be aware of this special exception and
+ consider the implications.
+ */
+ size_t (*lengthsp)(const CHARSET_INFO *, const char *ptr, size_t length);
+ size_t (*numcells)(const CHARSET_INFO *, const char *b, const char *e);
+
+ /* Unicode conversion */
+ my_charset_conv_mb_wc mb_wc;
+ my_charset_conv_wc_mb wc_mb;
+
+ /* CTYPE scanner */
+ int (*ctype)(const CHARSET_INFO *cs, int *ctype, const uchar *s,
+ const uchar *e);
+
+ /* Functions for case and sort conversion */
+ size_t (*caseup_str)(const CHARSET_INFO *, char *);
+ size_t (*casedn_str)(const CHARSET_INFO *, char *);
+
+ my_charset_conv_case caseup;
+ my_charset_conv_case casedn;
+
+ /* Charset dependant snprintf() */
+ size_t (*snprintf)(const CHARSET_INFO *, char *to, size_t n, const char *fmt,
+ ...) MY_ATTRIBUTE((format(printf, 4, 5)));
+ size_t (*long10_to_str)(const CHARSET_INFO *, char *to, size_t n, int radix,
+ long int val);
+ size_t (*longlong10_to_str)(const CHARSET_INFO *, char *to, size_t n,
+ int radix, longlong val);
+
+ void (*fill)(const CHARSET_INFO *, char *to, size_t len, int fill);
+
+ /* String-to-number conversion routines */
+ long (*strntol)(const CHARSET_INFO *, const char *s, size_t l, int base,
+ const char **e, int *err);
+ ulong (*strntoul)(const CHARSET_INFO *, const char *s, size_t l, int base,
+ const char **e, int *err);
+ longlong (*strntoll)(const CHARSET_INFO *, const char *s, size_t l, int base,
+ const char **e, int *err);
+ ulonglong (*strntoull)(const CHARSET_INFO *, const char *s, size_t l,
+ int base, const char **e, int *err);
+ double (*strntod)(const CHARSET_INFO *, const char *s, size_t l,
+ const char **e, int *err);
+ longlong (*strtoll10)(const CHARSET_INFO *cs, const char *nptr,
+ const char **endptr, int *error);
+ ulonglong (*strntoull10rnd)(const CHARSET_INFO *cs, const char *str,
+ size_t length, int unsigned_fl,
+ const char **endptr, int *error);
+ size_t (*scan)(const CHARSET_INFO *, const char *b, const char *e, int sq);
+} MY_CHARSET_HANDLER;
+
+extern MY_CHARSET_HANDLER my_charset_8bit_handler;
+extern MY_CHARSET_HANDLER my_charset_ascii_handler;
+extern MY_CHARSET_HANDLER my_charset_ucs2_handler;
+
+/* See strings/CHARSET_INFO.txt about information on this structure */
+struct CHARSET_INFO {
+ uint number;
+ uint primary_number;
+ uint binary_number;
+ uint state;
+ const char *csname;
+ const char *name;
+ const char *comment;
+ const char *tailoring;
+ struct Coll_param *coll_param;
+ const uchar *ctype;
+ const uchar *to_lower;
+ const uchar *to_upper;
+ const uchar *sort_order;
+ struct MY_UCA_INFO *uca; /* This can be changed in apply_one_rule() */
+ const uint16 *tab_to_uni;
+ const MY_UNI_IDX *tab_from_uni;
+ const MY_UNICASE_INFO *caseinfo;
+ const struct lex_state_maps_st *state_maps; /* parser internal data */
+ const uchar *ident_map; /* parser internal data */
+ uint strxfrm_multiply;
+ uchar caseup_multiply;
+ uchar casedn_multiply;
+ uint mbminlen;
+ uint mbmaxlen;
+ uint mbmaxlenlen;
+ my_wc_t min_sort_char;
+ my_wc_t max_sort_char; /* For LIKE optimization */
+ uchar pad_char;
+ bool escape_with_backslash_is_dangerous;
+ uchar levels_for_compare;
+
+ MY_CHARSET_HANDLER *cset;
+ MY_COLLATION_HANDLER *coll;
+
+ /**
+ If this collation is PAD_SPACE, it collates as if all inputs were
+ padded with a given number of spaces at the end (see the "num_codepoints"
+ flag to strnxfrm). NO_PAD simply compares unextended strings.
+
+ Note that this is fundamentally about the behavior of coll->strnxfrm.
+ */
+ enum Pad_attribute pad_attribute;
+};
+#define ILLEGAL_CHARSET_INFO_NUMBER (~0U)
+
+/*
+ NOTE: You cannot use a CHARSET_INFO without it having been initialized first.
+ In particular, they are not initialized when a unit test starts; do not use
+ these globals indiscriminately from there, and do not add more. Instead,
+ load them through a MY_CHARSET_LOADER, using my_collation_get_by_name().
+*/
+
+extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_bin;
+C_MODE_START
+extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_latin1;
+C_MODE_END
+extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_filename;
+extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_utf8mb4_0900_ai_ci;
+extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_utf8mb4_0900_bin;
+
+extern CHARSET_INFO my_charset_latin1_bin;
+extern CHARSET_INFO my_charset_utf32_unicode_ci;
+extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_utf8_general_ci;
+extern CHARSET_INFO my_charset_utf8_tolower_ci;
+extern CHARSET_INFO my_charset_utf8_unicode_ci;
+extern CHARSET_INFO my_charset_utf8_bin;
+extern CHARSET_INFO my_charset_utf8mb4_bin;
+extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_utf8mb4_general_ci;
+
+#define MY_UTF8MB3 "utf8"
+#define MY_UTF8MB4 "utf8mb4"
+
+/* declarations for simple charsets */
+extern size_t my_strnxfrm_simple(const CHARSET_INFO *, uchar *dst,
+ size_t dstlen, uint nweights, const uchar *src,
+ size_t srclen, uint flags);
+size_t my_strnxfrmlen_simple(const CHARSET_INFO *, size_t);
+extern int my_strnncoll_simple(const CHARSET_INFO *, const uchar *, size_t,
+ const uchar *, size_t, bool);
+
+extern int my_strnncollsp_simple(const CHARSET_INFO *, const uchar *, size_t,
+ const uchar *, size_t);
+
+extern void my_hash_sort_simple(const CHARSET_INFO *cs, const uchar *key,
+ size_t len, uint64 *nr1, uint64 *nr2);
+
+extern size_t my_lengthsp_8bit(const CHARSET_INFO *cs, const char *ptr,
+ size_t length);
+
+extern uint my_instr_simple(const CHARSET_INFO *, const char *b,
+ size_t b_length, const char *s, size_t s_length,
+ my_match_t *match, uint nmatch);
+
+/* Functions for 8bit */
+extern size_t my_caseup_str_8bit(const CHARSET_INFO *, char *);
+extern size_t my_casedn_str_8bit(const CHARSET_INFO *, char *);
+extern size_t my_caseup_8bit(const CHARSET_INFO *, char *src, size_t srclen,
+ char *dst, size_t dstlen);
+extern size_t my_casedn_8bit(const CHARSET_INFO *, char *src, size_t srclen,
+ char *dst, size_t dstlen);
+
+extern int my_strcasecmp_8bit(const CHARSET_INFO *cs, const char *,
+ const char *);
+
+int my_mb_wc_8bit(const CHARSET_INFO *cs, my_wc_t *wc, const uchar *s,
+ const uchar *e);
+int my_wc_mb_8bit(const CHARSET_INFO *cs, my_wc_t wc, uchar *s, uchar *e);
+
+int my_mb_ctype_8bit(const CHARSET_INFO *, int *, const uchar *, const uchar *);
+int my_mb_ctype_mb(const CHARSET_INFO *, int *, const uchar *, const uchar *);
+
+size_t my_scan_8bit(const CHARSET_INFO *cs, const char *b, const char *e,
+ int sq);
+
+size_t my_snprintf_8bit(const CHARSET_INFO *, char *to, size_t n,
+ const char *fmt, ...)
+ MY_ATTRIBUTE((format(printf, 4, 5)));
+
+long my_strntol_8bit(const CHARSET_INFO *, const char *s, size_t l, int base,
+ const char **e, int *err);
+ulong my_strntoul_8bit(const CHARSET_INFO *, const char *s, size_t l, int base,
+ const char **e, int *err);
+longlong my_strntoll_8bit(const CHARSET_INFO *, const char *s, size_t l,
+ int base, const char **e, int *err);
+ulonglong my_strntoull_8bit(const CHARSET_INFO *, const char *s, size_t l,
+ int base, const char **e, int *err);
+double my_strntod_8bit(const CHARSET_INFO *, const char *s, size_t l,
+ const char **e, int *err);
+size_t my_long10_to_str_8bit(const CHARSET_INFO *, char *to, size_t l,
+ int radix, long int val);
+size_t my_longlong10_to_str_8bit(const CHARSET_INFO *, char *to, size_t l,
+ int radix, longlong val);
+
+longlong my_strtoll10_8bit(const CHARSET_INFO *cs, const char *nptr,
+ const char **endptr, int *error);
+longlong my_strtoll10_ucs2(const CHARSET_INFO *cs, const char *nptr,
+ char **endptr, int *error);
+
+ulonglong my_strntoull10rnd_8bit(const CHARSET_INFO *cs, const char *str,
+ size_t length, int unsigned_fl,
+ const char **endptr, int *error);
+ulonglong my_strntoull10rnd_ucs2(const CHARSET_INFO *cs, const char *str,
+ size_t length, int unsigned_fl, char **endptr,
+ int *error);
+
+void my_fill_8bit(const CHARSET_INFO *cs, char *to, size_t l, int fill);
+
+/* For 8-bit character set */
+bool my_like_range_simple(const CHARSET_INFO *cs, const char *ptr,
+ size_t ptr_length, char escape, char w_one,
+ char w_many, size_t res_length, char *min_str,
+ char *max_str, size_t *min_length,
+ size_t *max_length);
+
+/* For ASCII-based multi-byte character sets with mbminlen=1 */
+bool my_like_range_mb(const CHARSET_INFO *cs, const char *ptr,
+ size_t ptr_length, char escape, char w_one, char w_many,
+ size_t res_length, char *min_str, char *max_str,
+ size_t *min_length, size_t *max_length);
+
+/* For other character sets, with arbitrary mbminlen and mbmaxlen numbers */
+bool my_like_range_generic(const CHARSET_INFO *cs, const char *ptr,
+ size_t ptr_length, char escape, char w_one,
+ char w_many, size_t res_length, char *min_str,
+ char *max_str, size_t *min_length,
+ size_t *max_length);
+
+int my_wildcmp_8bit(const CHARSET_INFO *, const char *str, const char *str_end,
+ const char *wildstr, const char *wildend, int escape,
+ int w_one, int w_many);
+
+int my_wildcmp_bin(const CHARSET_INFO *, const char *str, const char *str_end,
+ const char *wildstr, const char *wildend, int escape,
+ int w_one, int w_many);
+
+size_t my_numchars_8bit(const CHARSET_INFO *, const char *b, const char *e);
+size_t my_numcells_8bit(const CHARSET_INFO *, const char *b, const char *e);
+size_t my_charpos_8bit(const CHARSET_INFO *, const char *b, const char *e,
+ size_t pos);
+size_t my_well_formed_len_8bit(const CHARSET_INFO *, const char *b,
+ const char *e, size_t pos, int *error);
+uint my_mbcharlen_8bit(const CHARSET_INFO *, uint c);
+
+/* Functions for multibyte charsets */
+extern size_t my_caseup_str_mb(const CHARSET_INFO *, char *);
+extern size_t my_casedn_str_mb(const CHARSET_INFO *, char *);
+extern size_t my_caseup_mb(const CHARSET_INFO *, char *src, size_t srclen,
+ char *dst, size_t dstlen);
+extern size_t my_casedn_mb(const CHARSET_INFO *, char *src, size_t srclen,
+ char *dst, size_t dstlen);
+extern size_t my_caseup_mb_varlen(const CHARSET_INFO *, char *src,
+ size_t srclen, char *dst, size_t dstlen);
+extern size_t my_casedn_mb_varlen(const CHARSET_INFO *, char *src,
+ size_t srclen, char *dst, size_t dstlen);
+extern size_t my_caseup_ujis(const CHARSET_INFO *, char *src, size_t srclen,
+ char *dst, size_t dstlen);
+extern size_t my_casedn_ujis(const CHARSET_INFO *, char *src, size_t srclen,
+ char *dst, size_t dstlen);
+extern int my_strcasecmp_mb(const CHARSET_INFO *cs, const char *, const char *);
+
+int my_wildcmp_mb(const CHARSET_INFO *, const char *str, const char *str_end,
+ const char *wildstr, const char *wildend, int escape,
+ int w_one, int w_many);
+size_t my_numchars_mb(const CHARSET_INFO *, const char *b, const char *e);
+size_t my_numcells_mb(const CHARSET_INFO *, const char *b, const char *e);
+size_t my_charpos_mb(const CHARSET_INFO *, const char *b, const char *e,
+ size_t pos);
+size_t my_well_formed_len_mb(const CHARSET_INFO *, const char *b, const char *e,
+ size_t pos, int *error);
+uint my_instr_mb(const CHARSET_INFO *, const char *b, size_t b_length,
+ const char *s, size_t s_length, my_match_t *match,
+ uint nmatch);
+
+int my_strnncoll_mb_bin(const CHARSET_INFO *cs, const uchar *s, size_t slen,
+ const uchar *t, size_t tlen, bool t_is_prefix);
+
+int my_strnncollsp_mb_bin(const CHARSET_INFO *cs, const uchar *a,
+ size_t a_length, const uchar *b, size_t b_length);
+
+int my_wildcmp_mb_bin(const CHARSET_INFO *cs, const char *str,
+ const char *str_end, const char *wildstr,
+ const char *wildend, int escape, int w_one, int w_many);
+
+int my_strcasecmp_mb_bin(const CHARSET_INFO *cs MY_ATTRIBUTE((unused)),
+ const char *s, const char *t);
+
+void my_hash_sort_mb_bin(const CHARSET_INFO *cs MY_ATTRIBUTE((unused)),
+ const uchar *key, size_t len, uint64 *nr1,
+ uint64 *nr2);
+
+size_t my_strnxfrm_mb(const CHARSET_INFO *, uchar *dst, size_t dstlen,
+ uint nweights, const uchar *src, size_t srclen,
+ uint flags);
+
+size_t my_strnxfrm_unicode(const CHARSET_INFO *, uchar *dst, size_t dstlen,
+ uint nweights, const uchar *src, size_t srclen,
+ uint flags);
+
+size_t my_strnxfrm_unicode_full_bin(const CHARSET_INFO *, uchar *dst,
+ size_t dstlen, uint nweights,
+ const uchar *src, size_t srclen,
+ uint flags);
+size_t my_strnxfrmlen_unicode_full_bin(const CHARSET_INFO *, size_t);
+
+int my_wildcmp_unicode(const CHARSET_INFO *cs, const char *str,
+ const char *str_end, const char *wildstr,
+ const char *wildend, int escape, int w_one, int w_many,
+ const MY_UNICASE_INFO *weights);
+
+extern bool my_parse_charset_xml(MY_CHARSET_LOADER *loader, const char *buf,
+ size_t buflen);
+extern size_t my_strcspn(const CHARSET_INFO *cs, const char *str,
+ const char *end, const char *reject,
+ size_t reject_length);
+
+bool my_propagate_simple(const CHARSET_INFO *cs, const uchar *str, size_t len);
+bool my_propagate_complex(const CHARSET_INFO *cs, const uchar *str, size_t len);
+
+uint my_string_repertoire(const CHARSET_INFO *cs, const char *str, size_t len);
+bool my_charset_is_ascii_based(const CHARSET_INFO *cs);
+bool my_charset_is_8bit_pure_ascii(const CHARSET_INFO *cs);
+uint my_charset_repertoire(const CHARSET_INFO *cs);
+
+uint my_strxfrm_flag_normalize(uint flags);
+size_t my_strxfrm_pad(const CHARSET_INFO *cs, uchar *str, uchar *frmend,
+ uchar *strend, uint nweights, uint flags);
+
+bool my_charset_is_ascii_compatible(const CHARSET_INFO *cs);
+
+size_t my_convert(char *to, size_t to_length, const CHARSET_INFO *to_cs,
+ const char *from, size_t from_length,
+ const CHARSET_INFO *from_cs, uint *errors);
+
+uint my_mbcharlen_ptr(const CHARSET_INFO *cs, const char *s, const char *e);
+
+bool my_is_prefixidx_cand(const CHARSET_INFO *cs, const char *wildstr,
+ const char *wildend, int escape, int w_many,
+ size_t *prefix_len);
+
+#define _MY_U 01 /* Upper case */
+#define _MY_L 02 /* Lower case */
+#define _MY_NMR 04 /* Numeral (digit) */
+#define _MY_SPC 010 /* Spacing character */
+#define _MY_PNT 020 /* Punctuation */
+#define _MY_CTR 040 /* Control character */
+#define _MY_B 0100 /* Blank */
+#define _MY_X 0200 /* heXadecimal digit */
+
+/* The following macros makes sense only for one-byte character sets.
+They will not fail for multibyte character sets, but will not produce
+the expected results. They may have som limited usability like
+e.g. for utf8mb3/utf8mb4, meaningful results will be produced for
+values < 0x7F. */
+#define my_isascii(c) (!((c) & ~0177))
+#define my_toupper(s, c) (char)((s)->to_upper[(uchar)(c)])
+#define my_tolower(s, c) (char)((s)->to_lower[(uchar)(c)])
+#define my_isalpha(s, c) (((s)->ctype + 1)[(uchar)(c)] & (_MY_U | _MY_L))
+#define my_isupper(s, c) (((s)->ctype + 1)[(uchar)(c)] & _MY_U)
+#define my_islower(s, c) (((s)->ctype + 1)[(uchar)(c)] & _MY_L)
+#define my_isdigit(s, c) (((s)->ctype + 1)[(uchar)(c)] & _MY_NMR)
+#define my_isxdigit(s, c) (((s)->ctype + 1)[(uchar)(c)] & _MY_X)
+#define my_isalnum(s, c) \
+ (((s)->ctype + 1)[(uchar)(c)] & (_MY_U | _MY_L | _MY_NMR))
+#define my_isspace(s, c) (((s)->ctype + 1)[(uchar)(c)] & _MY_SPC)
+#define my_ispunct(s, c) (((s)->ctype + 1)[(uchar)(c)] & _MY_PNT)
+#define my_isprint(s, c) \
+ (((s)->ctype + 1)[(uchar)(c)] & (_MY_PNT | _MY_U | _MY_L | _MY_NMR | _MY_B))
+#define my_isgraph(s, c) \
+ (((s)->ctype + 1)[(uchar)(c)] & (_MY_PNT | _MY_U | _MY_L | _MY_NMR))
+#define my_iscntrl(s, c) (((s)->ctype + 1)[(uchar)(c)] & _MY_CTR)
+
+/* Some macros that should be cleaned up a little */
+#define my_isvar(s, c) (my_isalnum(s, c) || (c) == '_')
+#define my_isvar_start(s, c) (my_isalpha(s, c) || (c) == '_')
+
+#define my_binary_compare(s) ((s)->state & MY_CS_BINSORT)
+#define use_strnxfrm(s) ((s)->state & MY_CS_STRNXFRM)
+#define my_strnxfrm(cs, d, dl, s, sl) \
+ ((cs)->coll->strnxfrm((cs), (d), (dl), (dl), (s), (sl), 0))
+#define my_strnncoll(s, a, b, c, d) \
+ ((s)->coll->strnncoll((s), (a), (b), (c), (d), 0))
+#define my_like_range(s, a, b, c, d, e, f, g, h, i, j) \
+ ((s)->coll->like_range((s), (a), (b), (c), (d), (e), (f), (g), (h), (i), (j)))
+#define my_wildcmp(cs, s, se, w, we, e, o, m) \
+ ((cs)->coll->wildcmp((cs), (s), (se), (w), (we), (e), (o), (m)))
+#define my_strcasecmp(s, a, b) ((s)->coll->strcasecmp((s), (a), (b)))
+#define my_charpos(cs, b, e, num) \
+ (cs)->cset->charpos((cs), (const char *)(b), (const char *)(e), (num))
+
+#define use_mb(s) ((s)->cset->ismbchar != NULL)
+static inline uint my_ismbchar(const CHARSET_INFO *cs, const char *str,
+ const char *strend) {
+ return cs->cset->ismbchar(cs, str, strend);
+}
+
+static inline uint my_ismbchar(const CHARSET_INFO *cs, const uchar *str,
+ const uchar *strend) {
+ return cs->cset->ismbchar(cs, pointer_cast<const char *>(str),
+ pointer_cast<const char *>(strend));
+}
+
+#define my_mbcharlen(s, a) ((s)->cset->mbcharlen((s), (a)))
+/**
+ Get the length of gb18030 code by the given two leading bytes
+
+ @param[in] s charset_info
+ @param[in] a first byte of gb18030 code
+ @param[in] b second byte of gb18030 code
+ @return the length of gb18030 code starting with given two bytes,
+ the length would be 2 or 4 for valid gb18030 code,
+ or 0 for invalid gb18030 code
+*/
+#define my_mbcharlen_2(s, a, b) \
+ ((s)->cset->mbcharlen((s), ((((a)&0xFF) << 8) + ((b)&0xFF))))
+/**
+ Get the maximum length of leading bytes needed to determine the length of a
+ multi-byte gb18030 code
+
+ @param[in] s charset_info
+ @return number of leading bytes we need, would be 2 for gb18030
+ and 1 for all other charsets
+*/
+#define my_mbmaxlenlen(s) ((s)->mbmaxlenlen)
+/**
+ Judge if the given byte is a possible leading byte for a charset.
+ For gb18030 whose mbmaxlenlen is 2, we can't determine the length of
+ a multi-byte character by looking at the first byte only
+
+ @param[in] s charset_info
+ @param[in] i possible leading byte
+ @return true if it is, otherwise false
+*/
+#define my_ismb1st(s, i) \
+ (my_mbcharlen((s), (i)) > 1 || \
+ (my_mbmaxlenlen((s)) == 2 && my_mbcharlen((s), (i)) == 0))
+
+#define my_caseup_str(s, a) ((s)->cset->caseup_str((s), (a)))
+#define my_casedn_str(s, a) ((s)->cset->casedn_str((s), (a)))
+#define my_strntol(s, a, b, c, d, e) \
+ ((s)->cset->strntol((s), (a), (b), (c), (d), (e)))
+#define my_strntoul(s, a, b, c, d, e) \
+ ((s)->cset->strntoul((s), (a), (b), (c), (d), (e)))
+#define my_strntoll(s, a, b, c, d, e) \
+ ((s)->cset->strntoll((s), (a), (b), (c), (d), (e)))
+#define my_strntoull(s, a, b, c, d, e) \
+ ((s)->cset->strntoull((s), (a), (b), (c), (d), (e)))
+#define my_strntod(s, a, b, c, d) ((s)->cset->strntod((s), (a), (b), (c), (d)))
+
+#endif /* _m_ctype_h */
diff --git a/contrib/libs/libmysql_r/include/m_string.h b/contrib/libs/libmysql_r/include/m_string.h
new file mode 100644
index 0000000000..557c583125
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/m_string.h
@@ -0,0 +1,371 @@
+/*
+ Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef _m_string_h
+#define _m_string_h
+
+/**
+ @file include/m_string.h
+*/
+
+#include <float.h>
+#include <limits.h>
+#include <stdbool.h> // IWYU pragma: keep
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "lex_string.h"
+#include "my_config.h"
+#include "my_inttypes.h"
+#include "my_macros.h"
+
+/**
+ Definition of the null string (a null pointer of type char *),
+ used in some of our string handling code. New code should use
+ nullptr instead.
+*/
+#define NullS (char *)0
+
+/*
+ my_str_malloc(), my_str_realloc() and my_str_free() are assigned to
+ implementations in strings/alloc.cc, but can be overridden in
+ the calling program.
+ */
+extern void *(*my_str_malloc)(size_t);
+extern void *(*my_str_realloc)(void *, size_t);
+extern void (*my_str_free)(void *);
+
+/* Declared in int2str() */
+extern char _dig_vec_upper[];
+extern char _dig_vec_lower[];
+
+/* Prototypes for string functions */
+
+extern char *strmake(char *dst, const char *src, size_t length);
+extern char *strcont(char *src, const char *set);
+extern char *strxmov(char *dst, const char *src, ...);
+extern char *strxnmov(char *dst, size_t len, const char *src, ...);
+
+/*
+ bchange(dst, old_length, src, new_length, tot_length)
+ replaces old_length characters at dst to new_length characters from
+ src in a buffer with tot_length bytes.
+*/
+static inline void bchange(uchar *dst, size_t old_length, const uchar *src,
+ size_t new_length, size_t tot_length) {
+ memmove(dst + new_length, dst + old_length, tot_length - old_length);
+ memcpy(dst, src, new_length);
+}
+
+/*
+ strend(s) returns a character pointer to the NUL which ends s. That
+ is, strend(s)-s == strlen(s). This is useful for adding things at
+ the end of strings. It is redundant, because strchr(s,'\0') could
+ be used instead, but this is clearer and faster.
+*/
+static inline const char *strend(const char *s) {
+ while (*s++)
+ ;
+ return s - 1;
+}
+
+static inline char *strend(char *s) {
+ while (*s++)
+ ;
+ return s - 1;
+}
+
+/*
+ strcend(s, c) returns a pointer to the first place in s where c
+ occurs, or a pointer to the end-null of s if c does not occur in s.
+*/
+static inline const char *strcend(const char *s, char c) {
+ for (;;) {
+ if (*s == c) return s;
+ if (!*s++) return s - 1;
+ }
+}
+
+/*
+ strfill(dest, len, fill) makes a string of fill-characters. The result
+ string is of length == len. The des+len character is allways set to NULL.
+ strfill() returns pointer to dest+len;
+*/
+static inline char *strfill(char *s, size_t len, char fill) {
+ while (len--) *s++ = fill;
+ *(s) = '\0';
+ return (s);
+}
+
+/*
+ my_stpmov(dst, src) moves all the characters of src (including the
+ closing NUL) to dst, and returns a pointer to the new closing NUL in
+ dst. The similar UNIX routine strcpy returns the old value of dst,
+ which I have never found useful. my_stpmov(my_stpmov(dst,a),b) moves a//b
+ into dst, which seems useful.
+*/
+static inline char *my_stpmov(char *dst, const char *src) {
+ while ((*dst++ = *src++))
+ ;
+ return dst - 1;
+}
+
+/*
+ my_stpnmov(dst,src,length) moves length characters, or until end, of src to
+ dst and appends a closing NUL to dst if src is shorter than length.
+ The result is a pointer to the first NUL in dst, or is dst+n if dst was
+ truncated.
+*/
+static inline char *my_stpnmov(char *dst, const char *src, size_t n) {
+ while (n-- != 0) {
+ if (!(*dst++ = *src++)) return (char *)dst - 1;
+ }
+ return dst;
+}
+
+/**
+ Copy a string from src to dst until (and including) terminating null byte.
+
+ @param dst Destination
+ @param src Source
+
+ @note src and dst cannot overlap.
+ Use my_stpmov() if src and dst overlaps.
+
+ @note Unsafe, consider using my_stpnpy() instead.
+
+ @return pointer to terminating null byte.
+*/
+static inline char *my_stpcpy(char *dst, const char *src) {
+#if defined(HAVE_BUILTIN_STPCPY)
+ return __builtin_stpcpy(dst, src);
+#elif defined(HAVE_STPCPY)
+ return stpcpy(dst, src);
+#else
+ /* Fallback to implementation supporting overlap. */
+ return my_stpmov(dst, src);
+#endif
+}
+
+/**
+ Copy fixed-size string from src to dst.
+
+ @param dst Destination
+ @param src Source
+ @param n Maximum number of characters to copy.
+
+ @note src and dst cannot overlap
+ Use my_stpnmov() if src and dst overlaps.
+
+ @return pointer to terminating null byte.
+*/
+static inline char *my_stpncpy(char *dst, const char *src, size_t n) {
+#if defined(HAVE_STPNCPY)
+ return stpncpy(dst, src, n);
+#else
+ /* Fallback to implementation supporting overlap. */
+ return my_stpnmov(dst, src, n);
+#endif
+}
+
+static inline longlong my_strtoll(const char *nptr, char **endptr, int base) {
+#if defined _WIN32
+ return _strtoi64(nptr, endptr, base);
+#else
+ return strtoll(nptr, endptr, base);
+#endif
+}
+
+static inline ulonglong my_strtoull(const char *nptr, char **endptr, int base) {
+#if defined _WIN32
+ return _strtoui64(nptr, endptr, base);
+#else
+ return strtoull(nptr, endptr, base);
+#endif
+}
+
+static inline char *my_strtok_r(char *str, const char *delim, char **saveptr) {
+#if defined _WIN32
+ return strtok_s(str, delim, saveptr);
+#else
+ return strtok_r(str, delim, saveptr);
+#endif
+}
+
+/* native_ rather than my_ since my_strcasecmp already exists */
+static inline int native_strcasecmp(const char *s1, const char *s2) {
+#if defined _WIN32
+ return _stricmp(s1, s2);
+#else
+ return strcasecmp(s1, s2);
+#endif
+}
+
+/* native_ rather than my_ for consistency with native_strcasecmp */
+static inline int native_strncasecmp(const char *s1, const char *s2, size_t n) {
+#if defined _WIN32
+ return _strnicmp(s1, s2, n);
+#else
+ return strncasecmp(s1, s2, n);
+#endif
+}
+
+/*
+ is_prefix(s, t) returns 1 if s starts with t.
+ A empty t is always a prefix.
+*/
+static inline int is_prefix(const char *s, const char *t) {
+ while (*t)
+ if (*s++ != *t++) return 0;
+ return 1; /* WRONG */
+}
+
+/* Conversion routines */
+typedef enum { MY_GCVT_ARG_FLOAT, MY_GCVT_ARG_DOUBLE } my_gcvt_arg_type;
+
+double my_strtod(const char *str, const char **end, int *error);
+double my_atof(const char *nptr);
+size_t my_fcvt(double x, int precision, char *to, bool *error);
+size_t my_fcvt_compact(double x, char *to, bool *error);
+size_t my_gcvt(double x, my_gcvt_arg_type type, int width, char *to,
+ bool *error);
+
+#define NOT_FIXED_DEC 31
+
+/*
+ The longest string my_fcvt can return is 311 + "precision" bytes.
+ Here we assume that we never cal my_fcvt() with precision >= NOT_FIXED_DEC
+ (+ 1 byte for the terminating '\0').
+*/
+#define FLOATING_POINT_BUFFER (311 + NOT_FIXED_DEC)
+
+/*
+ We want to use the 'e' format in some cases even if we have enough space
+ for the 'f' one just to mimic sprintf("%.15g") behavior for large integers,
+ and to improve it for numbers < 10^(-4).
+ That is, for |x| < 1 we require |x| >= 10^(-15), and for |x| > 1 we require
+ it to be integer and be <= 10^DBL_DIG for the 'f' format to be used.
+ We don't lose precision, but make cases like "1e200" or "0.00001" look nicer.
+*/
+#define MAX_DECPT_FOR_F_FORMAT DBL_DIG
+
+/*
+ The maximum possible field width for my_gcvt() conversion.
+ (DBL_DIG + 2) significant digits + sign + "." + ("e-NNN" or
+ MAX_DECPT_FOR_F_FORMAT zeros for cases when |x|<1 and the 'f' format is used).
+*/
+#define MY_GCVT_MAX_FIELD_WIDTH \
+ (DBL_DIG + 4 + MY_MAX(5, MAX_DECPT_FOR_F_FORMAT))
+
+extern char *int2str(long val, char *dst, int radix, int upcase);
+C_MODE_START
+extern char *int10_to_str(long val, char *dst, int radix);
+C_MODE_END
+extern const char *str2int(const char *src, int radix, long lower, long upper,
+ long *val);
+longlong my_strtoll10(const char *nptr, const char **endptr, int *error);
+#if SIZEOF_LONG == SIZEOF_LONG_LONG
+#define ll2str(A, B, C, D) int2str((A), (B), (C), (D))
+#define longlong10_to_str(A, B, C) int10_to_str((A), (B), (C))
+#undef strtoll
+#define strtoll(A, B, C) strtol((A), (B), (C))
+#define strtoull(A, B, C) strtoul((A), (B), (C))
+#else
+extern char *ll2str(longlong val, char *dst, int radix, int upcase);
+extern char *longlong10_to_str(longlong val, char *dst, int radix);
+#endif
+#define longlong2str(A, B, C) ll2str((A), (B), (C), 1)
+
+/*
+ This function saves a longlong value in a buffer and returns the pointer to
+ the buffer.
+*/
+static inline char *llstr(longlong value, char *buff) {
+ longlong10_to_str(value, buff, -10);
+ return buff;
+}
+
+static inline char *ullstr(longlong value, char *buff) {
+ longlong10_to_str(value, buff, 10);
+ return buff;
+}
+
+#define STRING_WITH_LEN(X) (X), ((sizeof(X) - 1))
+#define C_STRING_WITH_LEN(X) ((char *)(X)), ((sizeof(X) - 1))
+
+/**
+ Skip trailing space (ASCII spaces only).
+
+ @return New end of the string.
+*/
+static inline const uchar *skip_trailing_space(const uchar *ptr, size_t len) {
+ const uchar *end = ptr + len;
+ while (end - ptr >= 8) {
+ uint64_t chunk;
+ memcpy(&chunk, end - 8, sizeof(chunk));
+ if (chunk != 0x2020202020202020ULL) break;
+ end -= 8;
+ }
+ while (end > ptr && end[-1] == 0x20) end--;
+ return (end);
+}
+
+/*
+ Format a double (representing number of bytes) into a human-readable string.
+
+ @param buf Buffer used for printing
+ @param buf_len Length of buffer
+ @param dbl_val Value to be formatted
+
+ @note
+ Sample output format: 42 1K 234M 2G
+ If we exceed ULLONG_MAX YiB we give up, and convert to "+INF".
+
+ @todo Consider writing KiB GiB etc, since we use 1024 rather than 1000
+ */
+static inline void human_readable_num_bytes(char *buf, int buf_len,
+ double dbl_val) {
+ const char size[] = {'\0', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'};
+ unsigned int i;
+ for (i = 0; dbl_val > 1024 && i < sizeof(size) - 1; i++) dbl_val /= 1024;
+ const char mult = size[i];
+ // 18446744073709551615 Yottabytes should be enough for most ...
+ if (dbl_val > ULLONG_MAX)
+ snprintf(buf, buf_len, "+INF");
+ else
+ snprintf(buf, buf_len, "%llu%c", (unsigned long long)dbl_val, mult);
+}
+
+static inline void lex_string_set(LEX_STRING *lex_str, char *c_str) {
+ lex_str->str = c_str;
+ lex_str->length = strlen(c_str);
+}
+
+static inline void lex_cstring_set(LEX_CSTRING *lex_str, const char *c_str) {
+ lex_str->str = c_str;
+ lex_str->length = strlen(c_str);
+}
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/map_helpers.h b/contrib/libs/libmysql_r/include/map_helpers.h
new file mode 100644
index 0000000000..0f771578d1
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/map_helpers.h
@@ -0,0 +1,335 @@
+/* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MAP_HELPERS_INCLUDED
+#define MAP_HELPERS_INCLUDED
+
+#include <map>
+#include <memory>
+#include <string>
+#include <type_traits>
+#include <unordered_map>
+#include <unordered_set>
+#include <utility>
+
+#include "m_ctype.h"
+#include "my_inttypes.h"
+#include "sql/malloc_allocator.h"
+#include "sql/memroot_allocator.h"
+#include "template_utils.h"
+
+/**
+ Some useful helpers for associative arrays with MySQL-specific semantics.
+*/
+
+/**
+ For unordered_map<Key, T*> or unordered_map<Key, unique_ptr<T>>, does
+ find() and returns nullptr if the element was not found.
+
+ It is not possible to distinguish between "not found" and "found, but
+ contained nullptr" in this case. Thus, you should normally prefer checking
+ against container.end() yourself.
+*/
+template <class Container, class Key>
+static inline auto find_or_nullptr(const Container &container, const Key &key)
+ -> typename std::enable_if<
+ std::is_pointer<typename Container::value_type::second_type>::value,
+ typename Container::value_type::second_type>::type {
+ const auto it = container.find(key);
+ if (it == container.end())
+ return nullptr;
+ else
+ return it->second;
+}
+
+template <class Container, class Key>
+static inline auto find_or_nullptr(const Container &container, const Key &key)
+ -> typename std::enable_if<
+ std::is_pointer<
+ typename Container::value_type::second_type::pointer>::value,
+ typename Container::value_type::second_type::pointer>::type {
+ const auto it = container.find(key);
+ if (it == container.end())
+ return nullptr;
+ else
+ return it->second.get();
+}
+
+/**
+ For unordered_multimap<Key, Value>, erase the first specific element that
+ matches _both_ the given key and value.
+*/
+template <class Container>
+typename Container::iterator erase_specific_element(
+ Container *container, const typename Container::key_type &key,
+ const typename Container::value_type::second_type &value) {
+ auto it_range = container->equal_range(key);
+ for (auto it = it_range.first; it != it_range.second; ++it) {
+ if (it->second == value) return container->erase(it);
+ }
+ return container->end();
+}
+
+/**
+ Same as regular erase_specific_element(), but for the case where the
+ container holds unique_ptr elements.
+*/
+template <class Container>
+static inline auto erase_specific_element(
+ Container *container, const typename Container::key_type &key,
+ typename Container::value_type::second_type::pointer value) ->
+ typename std::enable_if<
+ std::is_pointer<
+ typename Container::value_type::second_type::pointer>::value,
+ typename Container::iterator>::type {
+ auto it_range = container->equal_range(key);
+ for (auto it = it_range.first; it != it_range.second; ++it) {
+ if (it->second.get() == value) return container->erase(it);
+ }
+ return container->end();
+}
+
+/**
+ std::unique_ptr, but with a custom delete function.
+ Normally, it is more efficient to have a deleter class instead,
+ but this allows you to have a unique_ptr to a forward-declared class,
+ so it keeps include dependencies down somewhat.
+*/
+template <class T>
+using unique_ptr_with_deleter = std::unique_ptr<T, void (*)(T *)>;
+
+struct My_free_deleter {
+ void operator()(void *ptr) const { my_free(ptr); }
+};
+
+/** std::unique_ptr, but with my_free as deleter. */
+template <class T>
+using unique_ptr_my_free = std::unique_ptr<T, My_free_deleter>;
+
+struct Free_deleter {
+ void operator()(void *ptr) const { free(ptr); }
+};
+
+/** std::unique_ptr, but with free as deleter. */
+template <class T>
+using unique_ptr_free = std::unique_ptr<T, Free_deleter>;
+
+/** A Hasher that hashes std::strings according to a MySQL collation. */
+class Collation_hasher {
+ public:
+ explicit Collation_hasher(const CHARSET_INFO *cs_arg)
+ : cs(cs_arg), hash_sort(cs->coll->hash_sort) {}
+
+ size_t operator()(const std::string &s) const {
+ uint64 nr1 = 1, nr2 = 4;
+ hash_sort(cs, pointer_cast<const uchar *>(s.data()), s.size(), &nr1, &nr2);
+ return nr1;
+ }
+
+ private:
+ const CHARSET_INFO *cs;
+ decltype(cs->coll->hash_sort) hash_sort;
+};
+
+/** A KeyEqual that compares std::strings according to a MySQL collation. */
+class Collation_key_equal {
+ public:
+ explicit Collation_key_equal(const CHARSET_INFO *cs_arg)
+ : cs(cs_arg), strnncollsp(cs->coll->strnncollsp) {}
+
+ size_t operator()(const std::string &a, const std::string &b) const {
+ return strnncollsp(cs, pointer_cast<const uchar *>(a.data()), a.size(),
+ pointer_cast<const uchar *>(b.data()), b.size()) == 0;
+ }
+
+ private:
+ const CHARSET_INFO *cs;
+ decltype(cs->coll->strnncollsp) strnncollsp;
+};
+
+/**
+ std::unordered_map, but with my_malloc, so that you can track the memory
+ used using PSI memory keys.
+*/
+template <class Key, class Value, class Hash = std::hash<Key>,
+ class KeyEqual = std::equal_to<Key>>
+class malloc_unordered_map
+ : public std::unordered_map<Key, Value, Hash, KeyEqual,
+ Malloc_allocator<std::pair<const Key, Value>>> {
+ public:
+ /*
+ In theory, we should be allowed to send in the allocator only, but GCC 4.8
+ is missing several unordered_map constructors, so let's give in everything.
+ */
+ malloc_unordered_map(PSI_memory_key psi_key)
+ : std::unordered_map<Key, Value, Hash, KeyEqual,
+ Malloc_allocator<std::pair<const Key, Value>>>(
+ /*bucket_count=*/10, Hash(), KeyEqual(),
+ Malloc_allocator<>(psi_key)) {}
+};
+
+/**
+ std::unordered_set, but with my_malloc, so that you can track the memory
+ used using PSI memory keys.
+*/
+template <class Key, class Hash = std::hash<Key>,
+ class KeyEqual = std::equal_to<Key>>
+class malloc_unordered_set
+ : public std::unordered_set<Key, Hash, KeyEqual, Malloc_allocator<Key>> {
+ public:
+ /*
+ In theory, we should be allowed to send in the allocator only, but GCC 4.8
+ is missing several unordered_set constructors, so let's give in everything.
+ */
+ malloc_unordered_set(PSI_memory_key psi_key)
+ : std::unordered_set<Key, Hash, KeyEqual, Malloc_allocator<Key>>(
+ /*bucket_count=*/10, Hash(), KeyEqual(),
+ Malloc_allocator<>(psi_key)) {}
+};
+
+/**
+ std::unordered_multimap, but with my_malloc, so that you can track the memory
+ used using PSI memory keys.
+*/
+template <class Key, class Value, class Hash = std::hash<Key>,
+ class KeyEqual = std::equal_to<Key>>
+class malloc_unordered_multimap
+ : public std::unordered_multimap<
+ Key, Value, Hash, KeyEqual,
+ Malloc_allocator<std::pair<const Key, Value>>> {
+ public:
+ /*
+ In theory, we should be allowed to send in the allocator only, but GCC 4.8
+ is missing several unordered_multimap constructors, so let's give in
+ everything.
+ */
+ malloc_unordered_multimap(PSI_memory_key psi_key)
+ : std::unordered_multimap<Key, Value, Hash, KeyEqual,
+ Malloc_allocator<std::pair<const Key, Value>>>(
+ /*bucket_count=*/10, Hash(), KeyEqual(),
+ Malloc_allocator<>(psi_key)) {}
+};
+
+/**
+ std::unordered_map, but with my_malloc and collation-aware comparison.
+*/
+template <class Key, class Value>
+class collation_unordered_map
+ : public std::unordered_map<Key, Value, Collation_hasher,
+ Collation_key_equal,
+ Malloc_allocator<std::pair<const Key, Value>>> {
+ public:
+ collation_unordered_map(const CHARSET_INFO *cs, PSI_memory_key psi_key)
+ : std::unordered_map<Key, Value, Collation_hasher, Collation_key_equal,
+ Malloc_allocator<std::pair<const Key, Value>>>(
+ /*bucket_count=*/10, Collation_hasher(cs), Collation_key_equal(cs),
+ Malloc_allocator<>(psi_key)) {}
+};
+
+/**
+ std::unordered_multimap, but with my_malloc and collation-aware comparison.
+*/
+template <class Key, class Value>
+class collation_unordered_multimap
+ : public std::unordered_multimap<
+ Key, Value, Collation_hasher, Collation_key_equal,
+ Malloc_allocator<std::pair<const Key, Value>>> {
+ public:
+ collation_unordered_multimap(CHARSET_INFO *cs, PSI_memory_key psi_key)
+ : std::unordered_multimap<Key, Value, Collation_hasher,
+ Collation_key_equal,
+ Malloc_allocator<std::pair<const Key, Value>>>(
+ /*bucket_count=*/10, Collation_hasher(cs), Collation_key_equal(cs),
+ Malloc_allocator<>(psi_key)) {}
+};
+
+/**
+ std::unordered_set, but with my_malloc and collation-aware comparison.
+*/
+template <class Key>
+class collation_unordered_set
+ : public std::unordered_set<Key, Collation_hasher, Collation_key_equal,
+ Malloc_allocator<Key>> {
+ public:
+ collation_unordered_set(CHARSET_INFO *cs, PSI_memory_key psi_key)
+ : std::unordered_set<Key, Collation_hasher, Collation_key_equal,
+ Malloc_allocator<Key>>(
+ /*bucket_count=*/10, Collation_hasher(cs), Collation_key_equal(cs),
+ Malloc_allocator<>(psi_key)) {}
+ collation_unordered_set(std::initializer_list<Key> il, CHARSET_INFO *cs,
+ PSI_memory_key psi_key)
+ : std::unordered_set<Key, Collation_hasher, Collation_key_equal,
+ Malloc_allocator<Key>>(
+ il, /*bucket_count=*/10, Collation_hasher(cs),
+ Collation_key_equal(cs), Malloc_allocator<>(psi_key)) {}
+};
+
+/** std::unordered_set, but allocated on a MEM_ROOT. */
+template <class Key, class Hash = std::hash<Key>,
+ class KeyEqual = std::equal_to<Key>>
+class memroot_unordered_set
+ : public std::unordered_set<Key, Hash, KeyEqual, Memroot_allocator<Key>> {
+ public:
+ /*
+ In theory, we should be allowed to send in the allocator only, but GCC 4.8
+ is missing several unordered_set constructors, so let's give in everything.
+ */
+ memroot_unordered_set(MEM_ROOT *mem_root)
+ : std::unordered_set<Key, Hash, KeyEqual, Memroot_allocator<Key>>(
+ /*bucket_count=*/10, Hash(), KeyEqual(),
+ Memroot_allocator<Key>(mem_root)) {}
+};
+
+/**
+ std::unordered_map, but allocated on a MEM_ROOT.
+*/
+template <class Key, class Value, class Hash = std::hash<Key>,
+ class KeyEqual = std::equal_to<Key>>
+class memroot_unordered_map
+ : public std::unordered_map<
+ Key, Value, Hash, KeyEqual,
+ Memroot_allocator<std::pair<const Key, Value>>> {
+ public:
+ memroot_unordered_map(MEM_ROOT *mem_root)
+ : std::unordered_map<Key, Value, Hash, KeyEqual,
+ Memroot_allocator<std::pair<const Key, Value>>>(
+ /*bucket_count=*/10, Hash(), KeyEqual(),
+ Memroot_allocator<std::pair<const Key, Value>>(mem_root)) {}
+};
+
+/**
+ std::unordered_map, but collation aware and allocated on a MEM_ROOT.
+*/
+template <class Key, class Value>
+class memroot_collation_unordered_map
+ : public std::unordered_map<
+ Key, Value, Collation_hasher, Collation_key_equal,
+ Memroot_allocator<std::pair<const Key, Value>>> {
+ public:
+ memroot_collation_unordered_map(const CHARSET_INFO *cs, MEM_ROOT *mem_root)
+ : std::unordered_map<Key, Value, Collation_hasher, Collation_key_equal,
+ Memroot_allocator<std::pair<const Key, Value>>>(
+ /*bucket_count=*/10, Collation_hasher(cs), Collation_key_equal(cs),
+ Memroot_allocator<std::pair<const Key, Value>>(mem_root)) {}
+};
+
+#endif // MAP_HELPERS_INCLUDED
diff --git a/contrib/libs/libmysql_r/include/memory_debugging.h b/contrib/libs/libmysql_r/include/memory_debugging.h
new file mode 100644
index 0000000000..7bae6dd79b
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/memory_debugging.h
@@ -0,0 +1,87 @@
+/* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MEMORY_DEBUGGING_INCLUDED
+#define MEMORY_DEBUGGING_INCLUDED
+
+/**
+ @file memory_debugging.h
+
+ Various macros useful for communicating with memory debuggers,
+ such as Valgrind.
+*/
+
+#ifdef HAVE_VALGRIND
+#include <valgrind/valgrind.h>
+
+#define MEM_MALLOCLIKE_BLOCK(p1, p2, p3, p4) \
+ VALGRIND_MALLOCLIKE_BLOCK(p1, p2, p3, p4)
+#define MEM_FREELIKE_BLOCK(p1, p2) VALGRIND_FREELIKE_BLOCK(p1, p2)
+#include <valgrind/memcheck.h>
+
+#define MEM_UNDEFINED(a, len) VALGRIND_MAKE_MEM_UNDEFINED(a, len)
+#define MEM_DEFINED_IF_ADDRESSABLE(a, len) \
+ VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE(a, len)
+#define MEM_NOACCESS(a, len) VALGRIND_MAKE_MEM_NOACCESS(a, len)
+#define MEM_CHECK_ADDRESSABLE(a, len) VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a, len)
+
+#else /* HAVE_VALGRIND */
+
+#define MEM_MALLOCLIKE_BLOCK(p1, p2, p3, p4) \
+ do { \
+ } while (0)
+#define MEM_FREELIKE_BLOCK(p1, p2) \
+ do { \
+ } while (0)
+#define MEM_UNDEFINED(a, len) ((void)0)
+#define MEM_DEFINED_IF_ADDRESSABLE(a, len) ((void)0)
+#define MEM_NOACCESS(a, len) ((void)0)
+#define MEM_CHECK_ADDRESSABLE(a, len) ((void)0)
+
+#endif
+
+#if !defined(DBUG_OFF) || defined(HAVE_VALGRIND)
+
+/**
+ Put bad content in memory to be sure it will segfault if dereferenced.
+ With Valgrind, verify that memory is addressable, and mark it undefined.
+ We cache value of B because if B is expression which depends on A, memset()
+ trashes value of B.
+*/
+#define TRASH(A, B) \
+ do { \
+ void *p = (A); \
+ const size_t l = (B); \
+ MEM_CHECK_ADDRESSABLE(A, l); \
+ memset(p, 0x8F, l); \
+ MEM_UNDEFINED(A, l); \
+ } while (0)
+
+#else
+
+#define TRASH(A, B) \
+ do { \
+ } while (0)
+
+#endif
+
+#endif // MEMORY_DEBUGGING_INCLUDED
diff --git a/contrib/libs/libmysql_r/include/mf_wcomp.h b/contrib/libs/libmysql_r/include/mf_wcomp.h
new file mode 100644
index 0000000000..846df15a53
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mf_wcomp.h
@@ -0,0 +1,95 @@
+/* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MF_WCOMP_INCLUDED
+#define MF_WCOMP_INCLUDED
+
+/**
+ Character constant for the escape character in a wildcard pattern
+ (SQL style).
+*/
+const char wild_prefix = '\\';
+
+/**
+ Character constant for wildcard representing any one character
+ (SQL style).
+*/
+const char wild_one = '_';
+
+/**
+ Character constant for wildcard representing zero or more
+ characters (SQL style).
+*/
+const char wild_many = '%';
+
+/**
+ Performs wildcard matching, aka globbing, on the input string with
+ the given wildcard pattern, and the specified wildcard characters.
+
+ Note that when str_is_pattern is true, an escaped wildcard in the
+ pattern will only match an escaped wildcard in the string, e.g the
+ string "my_1" will *not* be matched by the pattern "my\\_1".
+
+ @deprecated This function is not charset-aware, and should not be
+ used in new code.
+
+ @param str input which should be matched against pattern
+ @param strlen length of str in bytes
+ @param wildstr pattern with wildcards
+ @param wildlen length of wildstr in bytes
+
+ @param str_is_pattern if true the input string is considered to be a
+ pattern, meaning that escape sequences in the input are processed as
+ if they appeared in the pattern
+ @param w_one wildcard character matching any single character
+ @param w_many wildcard character matching 0 or more characters
+ @param w_prefix escape character for the pattern
+
+ @return 0 if match, 1 otherwise
+*/
+int wild_compare_full(const char *str, int strlen, const char *wildstr,
+ int wildlen, bool str_is_pattern, char w_prefix,
+ char w_one, char w_many);
+
+/**
+ Performs wildcard matching, aka globbing, on the input string with
+ the given wildcard pattern, using the standard SQL wildcard ('_',
+ '%' and '\\') notation.
+
+ @deprecated This function is not charset-aware, and should not be
+ used in new code.
+
+ @param str input which should be matched against pattern
+ @param strlen length of str in bytes
+ @param wildstr pattern with wildcards
+ @param wildlen length of wildstr in bytes
+
+ @param str_is_pattern if true the input string is considered to be a
+ pattern, meaning that escape sequences in the input are processed as
+ if they appeared in the pattern.
+
+ @return 0 if match, 1 otherwise
+ */
+int wild_compare(const char *str, int strlen, const char *wildstr, int wildlen,
+ bool str_is_pattern);
+
+#endif /* !MF_WCOMP_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/mutex_lock.h b/contrib/libs/libmysql_r/include/mutex_lock.h
new file mode 100644
index 0000000000..26eb83379d
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mutex_lock.h
@@ -0,0 +1,62 @@
+/* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MUTEX_LOCK_INCLUDED
+#define MUTEX_LOCK_INCLUDED
+
+/**
+ @file include/mutex_lock.h
+*/
+
+#include <mysql/psi/mysql_mutex.h>
+
+/**
+ A simple wrapper around a mutex:
+ Grabs the mutex in the CTOR, releases it in the DTOR.
+ The mutex may be NULL, in which case this is a no-op.
+*/
+class Mutex_lock {
+ public:
+ explicit Mutex_lock(mysql_mutex_t *mutex, const char *src_file, int src_line)
+ : m_mutex(mutex), m_src_file(src_file), m_src_line(src_line) {
+ if (m_mutex) {
+ mysql_mutex_lock_with_src(m_mutex, m_src_file, m_src_line);
+ }
+ }
+ ~Mutex_lock() {
+ if (m_mutex) {
+ mysql_mutex_unlock_with_src(m_mutex, m_src_file, m_src_line);
+ }
+ }
+
+ private:
+ mysql_mutex_t *m_mutex;
+ const char *m_src_file;
+ int m_src_line;
+
+ Mutex_lock(const Mutex_lock &); /* Not copyable. */
+ void operator=(const Mutex_lock &); /* Not assignable. */
+};
+
+#define MUTEX_LOCK(NAME, X) Mutex_lock NAME(X, __FILE__, __LINE__)
+
+#endif // MUTEX_LOCK_INCLUDED
diff --git a/contrib/libs/libmysql_r/include/my_aes.h b/contrib/libs/libmysql_r/include/my_aes.h
new file mode 100644
index 0000000000..3daa531a22
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_aes.h
@@ -0,0 +1,140 @@
+#ifndef MY_AES_INCLUDED
+#define MY_AES_INCLUDED
+
+/* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/my_aes.h
+ Wrapper to give simple interface for MySQL to AES standard encryption.
+*/
+
+#include "my_inttypes.h"
+#include "my_macros.h"
+
+/** AES IV size is 16 bytes for all supported ciphers except ECB */
+#define MY_AES_IV_SIZE 16
+
+/** AES block size is fixed to be 128 bits for CBC and ECB */
+#define MY_AES_BLOCK_SIZE 16
+
+/** Supported AES cipher/block mode combos */
+enum my_aes_opmode {
+ my_aes_128_ecb,
+ my_aes_192_ecb,
+ my_aes_256_ecb,
+ my_aes_128_cbc,
+ my_aes_192_cbc,
+ my_aes_256_cbc
+#ifndef HAVE_WOLFSSL
+ ,
+ my_aes_128_cfb1,
+ my_aes_192_cfb1,
+ my_aes_256_cfb1,
+ my_aes_128_cfb8,
+ my_aes_192_cfb8,
+ my_aes_256_cfb8,
+ my_aes_128_cfb128,
+ my_aes_192_cfb128,
+ my_aes_256_cfb128,
+ my_aes_128_ofb,
+ my_aes_192_ofb,
+ my_aes_256_ofb
+#endif
+};
+
+#define MY_AES_BEGIN my_aes_128_ecb
+#ifdef HAVE_WOLFSSL
+#define MY_AES_END my_aes_256_cbc
+#else
+#define MY_AES_END my_aes_256_ofb
+#endif
+
+/* If bad data discovered during decoding */
+#define MY_AES_BAD_DATA -1
+
+/** String representations of the supported AES modes. Keep in sync with
+ * my_aes_opmode */
+extern const char *my_aes_opmode_names[];
+
+/**
+ Encrypt a buffer using AES
+
+ @param [in] source Pointer to data for encryption
+ @param [in] source_length Size of encryption data
+ @param [out] dest Buffer to place encrypted data (must be large
+ enough)
+ @param [in] key Key to be used for encryption
+ @param [in] key_length Length of the key. Will handle keys of any length
+ @param [in] mode encryption mode
+ @param [in] iv 16 bytes initialization vector if needed.
+ Otherwise NULL
+ @param [in] padding if padding needed.
+ @return size of encrypted data, or negative in case of error
+*/
+
+int my_aes_encrypt(const unsigned char *source, uint32 source_length,
+ unsigned char *dest, const unsigned char *key,
+ uint32 key_length, enum my_aes_opmode mode,
+ const unsigned char *iv, bool padding = true);
+
+/**
+ Decrypt an AES encrypted buffer
+
+ @param source Pointer to data for decryption
+ @param source_length size of encrypted data
+ @param dest buffer to place decrypted data (must be large enough)
+ @param key Key to be used for decryption
+ @param key_length Length of the key. Will handle keys of any length
+ @param mode encryption mode
+ @param iv 16 bytes initialization vector if needed. Otherwise NULL
+ @param padding if padding needed.
+ @return size of original data.
+*/
+
+int my_aes_decrypt(const unsigned char *source, uint32 source_length,
+ unsigned char *dest, const unsigned char *key,
+ uint32 key_length, enum my_aes_opmode mode,
+ const unsigned char *iv, bool padding = true);
+
+/**
+ Calculate the size of a buffer large enough for encrypted data.
+
+ @param source_length length of data to be encrypted
+ @param opmode encryption mode
+ @return size of buffer required to store encrypted data
+*/
+
+int my_aes_get_size(uint32 source_length, enum my_aes_opmode opmode);
+
+/**
+ Return true if the AES cipher and block mode requires an IV.
+
+ @param opmode encryption mode
+
+ @retval true IV needed
+ @retval false IV not needed
+*/
+
+bool my_aes_needs_iv(my_aes_opmode opmode);
+
+#endif /* MY_AES_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/my_alloc.h b/contrib/libs/libmysql_r/include/my_alloc.h
new file mode 100644
index 0000000000..441b31e3e8
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_alloc.h
@@ -0,0 +1,413 @@
+/* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ * @file include/my_alloc.h
+ *
+ * This file follows Google coding style, except for the name MEM_ROOT (which is
+ * kept for historical reasons).
+ */
+
+#ifndef INCLUDE_MY_ALLOC_H_
+#define INCLUDE_MY_ALLOC_H_
+
+#include <string.h>
+
+#include <memory>
+#include <new>
+#include <type_traits>
+#include <utility>
+
+#include "my_compiler.h"
+#include "my_dbug.h"
+#include "my_inttypes.h"
+#include "my_pointer_arithmetic.h"
+#include "mysql/psi/psi_memory.h"
+
+/**
+ * The MEM_ROOT is a simple arena, where allocations are carved out of
+ * larger blocks. Using an arena over plain malloc gives you two main
+ * advantages:
+ *
+ * * Allocation is very cheap (only a few CPU cycles on the fast path).
+ * * You do not need to keep track of which memory you have allocated,
+ * as it will all be freed when the arena is destroyed.
+ *
+ * Thus, if you need to do many small allocations that all are to have
+ * roughly the same lifetime, the MEM_ROOT is probably a good choice.
+ * The flip side is that _no_ memory is freed until the arena is destroyed,
+ * and no destructors are run (although you can run them manually yourself).
+ *
+ *
+ * This specific implementation works by allocating exponentially larger blocks
+ * each time it needs more memory (generally increasing them by 50%), which
+ * guarantees O(1) total calls to malloc and free. Only one free block is
+ * ever used; as soon as there's an allocation that comes in that doesn't fit,
+ * that block is stored away and never allocated from again. (There's an
+ * exception for allocations larger than the block size; see #AllocSlow
+ * for details.)
+ *
+ * The MEM_ROOT is thread-compatible but not thread-safe. This means you cannot
+ * use the same instance from multiple threads at the same time without external
+ * synchronization, but you can use different MEM_ROOTs concurrently in
+ * different threads.
+ *
+ * For C compatibility reasons, MEM_ROOT is a struct, even though it is
+ * logically a class and follows the style guide for classes.
+ */
+struct MEM_ROOT {
+ private:
+ struct Block {
+ Block *prev{nullptr}; /** Previous block; used for freeing. */
+ };
+
+ public:
+ MEM_ROOT() : MEM_ROOT(0, 512) {} // 0 = PSI_NOT_INSTRUMENTED.
+
+ MEM_ROOT(PSI_memory_key key, size_t block_size)
+ : m_block_size(block_size),
+ m_orig_block_size(block_size),
+ m_psi_key(key) {}
+
+ // MEM_ROOT is movable but not copyable.
+ MEM_ROOT(const MEM_ROOT &) = delete;
+ MEM_ROOT(MEM_ROOT &&other)
+ noexcept
+ : m_current_block(other.m_current_block),
+ m_current_free_start(other.m_current_free_start),
+ m_current_free_end(other.m_current_free_end),
+ m_block_size(other.m_block_size),
+ m_orig_block_size(other.m_orig_block_size),
+ m_max_capacity(other.m_max_capacity),
+ m_allocated_size(other.m_allocated_size),
+ m_error_for_capacity_exceeded(other.m_error_for_capacity_exceeded),
+ m_error_handler(other.m_error_handler),
+ m_psi_key(other.m_psi_key) {
+ other.m_current_block = nullptr;
+ other.m_allocated_size = 0;
+ other.m_block_size = m_orig_block_size;
+ other.m_current_free_start = &s_dummy_target;
+ other.m_current_free_end = &s_dummy_target;
+ }
+
+ MEM_ROOT &operator=(const MEM_ROOT &) = delete;
+ MEM_ROOT &operator=(MEM_ROOT &&other) noexcept {
+ Clear();
+ ::new (this) MEM_ROOT(std::move(other));
+ return *this;
+ }
+
+ ~MEM_ROOT() { Clear(); }
+
+ /**
+ * Allocate memory. Will return nullptr if there's not enough memory,
+ * or if the maximum capacity is reached.
+ *
+ * Note that a zero-length allocation can return _any_ pointer, including
+ * nullptr or a pointer that has been given out before. The current
+ * implementation takes some pains to make sure we never return nullptr
+ * (although it might return a bogus pointer), since there is code that
+ * assumes nullptr always means “out of memory”, but you should not rely on
+ * it, as it may change in the future.
+ *
+ * The returned pointer will always be 8-aligned.
+ */
+ void *Alloc(size_t length) MY_ATTRIBUTE((malloc)) {
+ length = ALIGN_SIZE(length);
+
+ // Skip the straight path if simulating OOM; it should always fail.
+ DBUG_EXECUTE_IF("simulate_out_of_memory", return AllocSlow(length););
+
+ // Fast path, used in the majority of cases. It would be faster here
+ // (saving one register due to CSE) to instead test
+ //
+ // m_current_free_start + length <= m_current_free_end
+ //
+ // but it would invoke undefined behavior, and in particular be prone
+ // to wraparound on 32-bit platforms.
+ if (static_cast<size_t>(m_current_free_end - m_current_free_start) >=
+ length) {
+ void *ret = m_current_free_start;
+ m_current_free_start += length;
+ return ret;
+ }
+
+ return AllocSlow(length);
+ }
+
+ /**
+ Allocate “num” objects of type T, and default-construct them.
+ If the constructor throws an exception, behavior is undefined.
+
+ We don't use new[], as it can put extra data in front of the array.
+ */
+ template <class T>
+ T *ArrayAlloc(size_t num) {
+ static_assert(alignof(T) <= 8, "MEM_ROOT only returns 8-aligned memory.");
+ if (num * sizeof(T) < num) {
+ // Overflow.
+ return nullptr;
+ }
+ T *ret = static_cast<T *>(Alloc(num * sizeof(T)));
+
+ // Default-construct all elements. For primitive types like int,
+ // the entire loop will be optimized away.
+ for (size_t i = 0; i < num; ++i) {
+ new (&ret[i]) T;
+ }
+
+ return ret;
+ }
+
+ /**
+ * Claim all the allocated memory for the current thread in the performance
+ * schema. Use when transferring responsibility for a MEM_ROOT from one thread
+ * to another.
+ */
+ void Claim();
+
+ /**
+ * Deallocate all the RAM used. The MEM_ROOT itself continues to be valid,
+ * so you can make new calls to Alloc() afterwards.
+
+ * @note
+ * One can call this function either with a MEM_ROOT initialized with the
+ * constructor, or with one that's memset() to all zeros.
+ * It's also safe to call this multiple times with the same mem_root.
+ */
+ void Clear();
+
+ /**
+ * Similar to Clear(), but anticipates that the block will be reused for
+ * further allocations. This means that even though all the data is gone,
+ * one memory block (typically the largest allocated) will be kept and
+ * made immediately available for calls to Alloc() without having to go to the
+ * OS for new memory. This can yield performance gains if you use the same
+ * MEM_ROOT many times. Also, the block size is not reset.
+ */
+ void ClearForReuse();
+
+ /**
+ Whether the constructor has run or not.
+
+ This exists solely to support legacy code that memset()s the MEM_ROOT to
+ all zeros, which wants to distinguish between that state and a properly
+ initialized MEM_ROOT. If you do not run the constructor _nor_ do memset(),
+ you are invoking undefined behavior.
+ */
+ bool inited() const { return m_block_size != 0; }
+
+ /**
+ * Set maximum capacity for this MEM_ROOT. Whenever the MEM_ROOT has
+ * allocated more than this (not including overhead), and the free block
+ * is empty, future allocations will fail.
+ *
+ * @param max_capacity Maximum capacity this mem_root can hold
+ */
+ void set_max_capacity(size_t max_capacity) { m_max_capacity = max_capacity; }
+
+ /**
+ * Return maximum capacity for this MEM_ROOT.
+ */
+ size_t get_max_capacity() const { return m_max_capacity; }
+
+ /**
+ * Enable/disable error reporting for exceeding the maximum capacity.
+ * If error reporting is enabled, an error is flagged to indicate that the
+ * capacity is exceeded. However, allocation will still happen for the
+ * requested memory.
+ *
+ * @param report_error whether the error should be reported
+ */
+ void set_error_for_capacity_exceeded(bool report_error) {
+ m_error_for_capacity_exceeded = report_error;
+ }
+
+ /**
+ * Return whether error is to be reported when
+ * maximum capacity exceeds for MEM_ROOT.
+ */
+ bool get_error_for_capacity_exceeded() const {
+ return m_error_for_capacity_exceeded;
+ }
+
+ /**
+ * Set the error handler on memory allocation failure (or nullptr for none).
+ * The error handler is called called whenever my_malloc() failed to allocate
+ * more memory from the OS (which causes my_alloc() to return nullptr).
+ */
+ void set_error_handler(void (*error_handler)(void)) {
+ m_error_handler = error_handler;
+ }
+
+ /**
+ * Amount of memory we have allocated from the operating system, not including
+ * overhead.
+ */
+ size_t allocated_size() const { return m_allocated_size; }
+
+ /**
+ * Set the desired size of the next block to be allocated. Note that future
+ * allocations
+ * will grow in size over this, although a Clear() will reset the size again.
+ */
+ void set_block_size(size_t block_size) {
+ m_block_size = m_orig_block_size = block_size;
+ }
+
+ private:
+ /**
+ * Something to point on that exists solely to never return nullptr
+ * from Alloc(0).
+ */
+ static char s_dummy_target;
+
+ /**
+ Allocate a new block of the given length (plus overhead for the block
+ header).
+ */
+ Block *AllocBlock(size_t length);
+
+ /** Allocate memory that doesn't fit into the current free block. */
+ void *AllocSlow(size_t length);
+
+ /** Free all blocks in a linked list, starting at the given block. */
+ static void FreeBlocks(Block *start);
+
+ /** The current block we are giving out memory from. nullptr if none. */
+ Block *m_current_block = nullptr;
+
+ /** Start (inclusive) of the current free block. */
+ char *m_current_free_start = &s_dummy_target;
+
+ /** End (exclusive) of the current free block. */
+ char *m_current_free_end = &s_dummy_target;
+
+ /** Size of the _next_ block we intend to allocate. */
+ size_t m_block_size;
+
+ /** The original block size the user asked for on construction. */
+ size_t m_orig_block_size;
+
+ /**
+ Maximum amount of memory this MEM_ROOT can hold. A value of 0
+ implies there is no limit.
+ */
+ size_t m_max_capacity = 0;
+
+ /**
+ * Total allocated size for this MEM_ROOT. Does not include overhead
+ * for block headers or malloc overhead, since especially the latter
+ * is impossible to quantify portably.
+ */
+ size_t m_allocated_size = 0;
+
+ /** If enabled, exceeding the capacity will lead to a my_error() call. */
+ bool m_error_for_capacity_exceeded = false;
+
+ void (*m_error_handler)(void) = nullptr;
+
+ PSI_memory_key m_psi_key = 0;
+};
+
+// Legacy C thunks. Do not use in new code.
+static inline void init_alloc_root(PSI_memory_key key, MEM_ROOT *root,
+ size_t block_size, size_t) {
+ ::new (root) MEM_ROOT(key, block_size);
+}
+
+void free_root(MEM_ROOT *root, myf flags);
+
+/**
+ * Allocate an object of the given type. Use like this:
+ *
+ * Foo *foo = new (mem_root) Foo();
+ *
+ * Note that unlike regular operator new, this will not throw exceptions.
+ * However, it can return nullptr if the capacity of the MEM_ROOT has been
+ * reached. This is allowed since it is not a replacement for global operator
+ * new, and thus isn't used automatically by e.g. standard library containers.
+ *
+ * TODO: This syntax is confusing in that it could look like allocating
+ * a MEM_ROOT using regular placement new. We should make a less ambiguous
+ * syntax, e.g. new (On(mem_root)) Foo().
+ */
+inline void *operator new(
+ size_t size, MEM_ROOT *mem_root,
+ const std::nothrow_t &arg MY_ATTRIBUTE((unused)) = std::nothrow) noexcept {
+ return mem_root->Alloc(size);
+}
+
+inline void *operator new[](
+ size_t size, MEM_ROOT *mem_root,
+ const std::nothrow_t &arg MY_ATTRIBUTE((unused)) = std::nothrow) noexcept {
+ return mem_root->Alloc(size);
+}
+
+inline void operator delete(void *, MEM_ROOT *,
+ const std::nothrow_t &)noexcept {
+ /* never called */
+}
+
+inline void operator delete[](void *, MEM_ROOT *,
+ const std::nothrow_t &) noexcept {
+ /* never called */
+}
+
+template <class T>
+inline void destroy(T *ptr) {
+ if (ptr != nullptr) ptr->~T();
+}
+
+template <class T>
+inline void destroy_array(T *ptr, size_t count) {
+ static_assert(!std::is_pointer<T>::value,
+ "You're trying to destroy an array of pointers, "
+ "not an array of objects. This is probably not "
+ "what you intended.");
+ if (ptr != nullptr) {
+ for (size_t i = 0; i < count; ++i) destroy(&ptr[i]);
+ }
+}
+
+/*
+ * For std::unique_ptr with objects allocated on a MEM_ROOT, you shouldn't use
+ * Default_deleter; use this deleter instead.
+ */
+template <class T>
+class Destroy_only {
+ public:
+ void operator()(T *ptr) const { destroy(ptr); }
+};
+
+/** std::unique_ptr, but only destroying. */
+template <class T>
+using unique_ptr_destroy_only = std::unique_ptr<T, Destroy_only<T>>;
+
+template <typename T, typename... Args>
+unique_ptr_destroy_only<T> make_unique_destroy_only(MEM_ROOT *mem_root,
+ Args &&... args) {
+ return unique_ptr_destroy_only<T>(new (mem_root)
+ T(std::forward<Args>(args)...));
+}
+
+#endif // INCLUDE_MY_ALLOC_H_
diff --git a/contrib/libs/libmysql_r/include/my_atomic.h b/contrib/libs/libmysql_r/include/my_atomic.h
new file mode 100644
index 0000000000..ce8927816f
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_atomic.h
@@ -0,0 +1,63 @@
+#ifndef MY_ATOMIC_INCLUDED
+#define MY_ATOMIC_INCLUDED
+
+/* Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/my_atomic.h
+*/
+
+#if defined(_MSC_VER)
+
+#include <windows.h>
+
+/*
+ my_yield_processor (equivalent of x86 PAUSE instruction) should be used
+ to improve performance on hyperthreaded CPUs. Intel recommends to use it in
+ spin loops also on non-HT machines to reduce power consumption (see e.g
+ http://softwarecommunity.intel.com/articles/eng/2004.htm)
+
+ Running benchmarks for spinlocks implemented with InterlockedCompareExchange
+ and YieldProcessor shows that much better performance is achieved by calling
+ YieldProcessor in a loop - that is, yielding longer. On Intel boxes setting
+ loop count in the range 200-300 brought best results.
+ */
+#define YIELD_LOOPS 200
+
+static inline int my_yield_processor() {
+ int i;
+ for (i = 0; i < YIELD_LOOPS; i++) {
+ YieldProcessor();
+ }
+ return 1;
+}
+
+#define LF_BACKOFF my_yield_processor()
+
+#else // !defined(_MSC_VER)
+
+#define LF_BACKOFF (1)
+
+#endif
+
+#endif /* MY_ATOMIC_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/my_base.h b/contrib/libs/libmysql_r/include/my_base.h
new file mode 100644
index 0000000000..d22a2e448b
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_base.h
@@ -0,0 +1,1143 @@
+/* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/my_base.h
+ This file includes constants used by all storage engines.
+*/
+
+#ifndef _my_base_h
+#define _my_base_h
+
+#include <limits.h>
+#include <sys/types.h>
+
+#include "my_config.h"
+#include "my_double2ulonglong.h"
+#include "my_inttypes.h"
+#include "my_macros.h"
+
+/* The following is bits in the flag parameter to ha_open() */
+
+#define HA_OPEN_ABORT_IF_LOCKED 0 /* default */
+#define HA_OPEN_WAIT_IF_LOCKED 1
+#define HA_OPEN_IGNORE_IF_LOCKED 2
+#define HA_OPEN_TMP_TABLE 4 /* Table is a temp table */
+#define HA_OPEN_DELAY_KEY_WRITE 8 /* Don't update index */
+#define HA_OPEN_ABORT_IF_CRASHED 16
+#define HA_OPEN_FOR_REPAIR 32 /* open even if crashed */
+#define HA_OPEN_FROM_SQL_LAYER 64
+#define HA_OPEN_COPY 256 /* Open copy (for repair) */
+/**
+ Internal temp table, used for temporary results; one or more instance of it
+ may be be created.
+*/
+#define HA_OPEN_INTERNAL_TABLE 512
+
+/* The following is parameter to ha_rkey() how to use key */
+
+/*
+ We define a complete-field prefix of a key value as a prefix where
+ the last included field in the prefix contains the full field, not
+ just some bytes from the start of the field. A partial-field prefix
+ is allowed to contain only a few first bytes from the last included
+ field.
+
+ Below HA_READ_KEY_EXACT, ..., HA_READ_BEFORE_KEY can take a
+ complete-field prefix of a key value as the search
+ key. HA_READ_PREFIX and HA_READ_PREFIX_LAST could also take a
+ partial-field prefix, but currently (4.0.10) they are only used with
+ complete-field prefixes. MySQL uses a padding trick to implement
+ LIKE 'abc%' queries.
+
+ NOTE that in InnoDB HA_READ_PREFIX_LAST will NOT work with a
+ partial-field prefix because InnoDB currently strips spaces from the
+ end of varchar fields!
+*/
+
+enum ha_rkey_function {
+ HA_READ_KEY_EXACT, /* Find first record else error */
+ HA_READ_KEY_OR_NEXT, /* Record or next record */
+ HA_READ_KEY_OR_PREV, /* Record or previous */
+ HA_READ_AFTER_KEY, /* Find next rec. after key-record */
+ HA_READ_BEFORE_KEY, /* Find next rec. before key-record */
+ HA_READ_PREFIX, /* Key which as same prefix */
+ HA_READ_PREFIX_LAST, /* Last key with the same prefix */
+ HA_READ_PREFIX_LAST_OR_PREV, /* Last or prev key with the same prefix */
+ HA_READ_MBR_CONTAIN, /* Minimum Bounding Rectangle contains */
+ HA_READ_MBR_INTERSECT, /* Minimum Bounding Rectangle intersect */
+ HA_READ_MBR_WITHIN, /* Minimum Bounding Rectangle within */
+ HA_READ_MBR_DISJOINT, /* Minimum Bounding Rectangle disjoint */
+ HA_READ_MBR_EQUAL, /* Minimum Bounding Rectangle equal */
+ HA_READ_INVALID = -1 /* Invalid enumeration value, always last. */
+};
+
+/* Key algorithm types */
+
+enum ha_key_alg {
+ /**
+ Used for cases when key algorithm which is supported by SE can't be
+ described by one of other classes from this enum (@sa Federated,
+ PerfSchema SE, @sa dd::Index::IA_SE_SPECIFIC).
+
+ @note Assigned as default value for key algorithm by parser, replaced by
+ SEs default algorithm for keys in mysql_prepare_create_table().
+ */
+ HA_KEY_ALG_SE_SPECIFIC = 0,
+ HA_KEY_ALG_BTREE = 1, /* B-tree. */
+ HA_KEY_ALG_RTREE = 2, /* R-tree, for spatial searches */
+ HA_KEY_ALG_HASH = 3, /* HASH keys (HEAP, NDB). */
+ HA_KEY_ALG_FULLTEXT = 4 /* FULLTEXT. */
+};
+
+/* Storage media types */
+
+enum ha_storage_media {
+ HA_SM_DEFAULT = 0, /* Not specified (engine default) */
+ HA_SM_DISK = 1, /* DISK storage */
+ HA_SM_MEMORY = 2 /* MAIN MEMORY storage */
+};
+
+/* The following is parameter to ha_extra() */
+
+/*
+ We divide the HA_EXTRA entries into the following categories:
+
+ 1) Operations used by most handlers:
+ HA_EXTRA_KEYREAD
+ HA_EXTRA_NO_KEYREAD
+ HA_EXTRA_FLUSH
+ HA_EXTRA_PREPARE_FOR_RENAME
+ HA_EXTRA_FORCE_REOPEN
+
+ 2) Operations used by some non-MyISAM handlers
+ HA_EXTRA_KEYREAD_PRESERVE_FIELDS
+ HA_EXTRA_IGNORE_DUP_KEY
+ HA_EXTRA_NO_IGNORE_DUP_KEY
+
+ 3) Operations used only by MyISAM
+ HA_EXTRA_NORMAL
+ HA_EXTRA_QUICK
+ HA_EXTRA_PREPARE_FOR_UPDATE
+ HA_EXTRA_PREPARE_FOR_DROP
+ HA_EXTRA_READCHECK
+ HA_EXTRA_NO_READCHECK
+
+ 4) Operations only used by temporary tables for query processing
+ HA_EXTRA_RESET_STATE
+ HA_EXTRA_NO_ROWS
+
+ 5) Operations only used by MyISAM internally
+ HA_EXTRA_NO_USER_CHANGE
+ HA_EXTRA_WAIT_LOCK
+ HA_EXTRA_WAIT_NOLOCK
+ HA_EXTRA_NO_KEYS
+ HA_EXTRA_KEYREAD_CHANGE_POS
+ HA_EXTRA_REMEMBER_POS
+ HA_EXTRA_RESTORE_POS
+ HA_EXTRA_PRELOAD_BUFFER_SIZE
+ HA_EXTRA_CHANGE_KEY_TO_DUP
+ HA_EXTRA_CHANGE_KEY_TO_UNIQUE
+
+ 6) Operations only used by federated tables for query processing
+ HA_EXTRA_INSERT_WITH_UPDATE
+
+ 7) Operations only used by NDB
+ HA_EXTRA_DELETE_CANNOT_BATCH
+ HA_EXTRA_UPDATE_CANNOT_BATCH
+
+ 8) Operations only used by MERGE
+ HA_EXTRA_ADD_CHILDREN_LIST
+ HA_EXTRA_ATTACH_CHILDREN
+ HA_EXTRA_IS_ATTACHED_CHILDREN
+ HA_EXTRA_DETACH_CHILDREN
+
+ 9) Operations only used by InnoDB
+ HA_EXTRA_EXPORT
+
+ 10) Operations only used by partitioning
+ HA_EXTRA_SECONDARY_SORT_ROWID
+
+ The individual entries are described in more detail below.
+*/
+
+enum ha_extra_function {
+ /*
+ Optimize for space (def).
+ Only used in MyISAM to reset quick mode, not implemented by any other
+ handler. Quick mode is also reset in MyISAM by handler::reset().
+
+ It is called after completing a successful DELETE query if the QUICK
+ option is set.
+ */
+ HA_EXTRA_NORMAL = 0,
+ /*
+ Optimize for speed.
+ When the user does DELETE QUICK FROM table where-clause; this extra
+ option is called before the delete query is performed and
+ HA_EXTRA_NORMAL is called after the delete query is completed.
+ Temporary tables used internally in MySQL always set this option
+
+ The meaning of quick mode is that when deleting in a B-tree no merging
+ of leafs is performed. This is a common method and many large DBMS's
+ actually only support this quick mode since it is very difficult to
+ merge leaves in a tree used by many threads concurrently.
+ */
+ HA_EXTRA_QUICK = 1,
+ HA_EXTRA_NOT_USED = 2,
+ /*
+ Only one call to HA_EXTRA_NO_READCHECK from ha_open where it says that
+ this is not needed in SQL. The reason for this call is that MyISAM sets
+ the READ_CHECK_USED in the open call so the call is needed for MyISAM
+ to reset this feature.
+ The idea with this parameter was to inform of doing/not doing a read
+ check before applying an update. Since SQL always performs a read before
+ applying the update No Read Check is needed in MyISAM as well.
+
+ This is a cut from Docs/myisam.txt
+ Sometimes you might want to force an update without checking whether
+ another user has changed the record since you last read it. This is
+ somewhat dangerous, so it should ideally not be used. That can be
+ accomplished by wrapping the mi_update() call in two calls to mi_extra(),
+ using the flags HA_EXTRA_NO_READCHECK and HA_EXTRA_READCHECK.
+ */
+ HA_EXTRA_NO_READCHECK = 5,
+ HA_EXTRA_READCHECK = 6,
+ /*
+ These parameters are used to provide an optimisation hint to the handler.
+ If HA_EXTRA_KEYREAD is set it is enough to read the index fields, for
+ many handlers this means that the index-only scans can be used and it
+ is not necessary to use the real records to satisfy this part of the
+ query. Index-only scans is a very important optimisation for disk-based
+ indexes. For main-memory indexes most indexes contain a reference to the
+ record and thus KEYREAD only says that it is enough to read key fields.
+ HA_EXTRA_NO_KEYREAD disables this for the handler, also, handler::reset()
+ will disable this option.
+ The handler will set HA_KEYREAD_ONLY in its table flags to indicate this
+ feature is supported.
+ */
+ HA_EXTRA_KEYREAD = 7,
+ HA_EXTRA_NO_KEYREAD = 8,
+ /*
+ No user is allowed to write. Only used by MyISAM, never called.
+ Simulates lock_type as locked.
+ */
+ HA_EXTRA_NO_USER_CHANGE = 9,
+ /*
+ Only used by MyISAM, called from MyISAM handler but never from server
+ code on top of the handler.
+ Sets lock_wait on/off:
+ Wait until file is avalable (def).
+ If file is locked, return quickly.
+ */
+ HA_EXTRA_WAIT_LOCK = 12,
+ HA_EXTRA_NO_WAIT_LOCK = 13,
+ /*
+ Remove all update of keys. Only used by MyISAM, only used internally in
+ MyISAM handler, never called from server level.
+ */
+ HA_EXTRA_NO_KEYS = 16,
+ HA_EXTRA_KEYREAD_CHANGE_POS = 17, /* Keyread, but change pos */
+ /* xxxxchk -r must be used */
+ HA_EXTRA_REMEMBER_POS = 18, /* Remember pos for next/prev */
+ HA_EXTRA_RESTORE_POS = 19,
+ /*
+ Only used by MyISAM and Archive, called when altering table,
+ closing tables to enforce a reopen of the table files.
+ */
+ HA_EXTRA_FORCE_REOPEN = 21,
+ /*
+ Indication to flush tables to disk, is supposed to be used to
+ ensure disk based tables are flushed at end of query execution.
+ Currently is never used.
+ */
+ HA_EXTRA_FLUSH,
+ /*
+ Don't insert rows indication to HEAP and MyISAM, only used by temporary
+ tables used in query processing.
+ */
+ HA_EXTRA_NO_ROWS,
+ /*
+ This option is used by most handlers and it resets the handler state
+ to the same state as after an open call.
+
+ It is called from the reset method in the handler interface. There are
+ three instances where this is called.
+
+ 1) After completing a INSERT ... SELECT ... query the handler for the
+ table inserted into is reset
+ 2) It is called from close_thread_table which in turn is called from
+ close_thread_tables except in the case where the tables are locked
+ in which case ha_commit_stmt is called instead.
+ It is only called from here if refresh_version hasn't changed and the
+ table is not an old table when calling close_thread_table.
+ close_thread_tables is called from many places as a general clean up
+ function after completing a query.
+ 3) It is called when deleting the QUICK_RANGE_SELECT object if the
+ QUICK_RANGE_SELECT object had its own handler object. It is called
+ immediatley before close of this local handler object.
+
+ If there is a READ CACHE it is reinit'ed. A cache is reinit'ed to
+ restart reading or to change type of cache between READ CACHE and
+ WRITE CACHE.
+
+ This extra function is always called immediately before calling
+ delete_all_rows on the handler for temporary tables.
+ There are cases however when HA_EXTRA_RESET_STATE isn't called in
+ a similar case for a temporary table in sql_union.cc.
+
+ The only case that delete_all_rows is called on non-temporary tables
+ is in sql_delete.cc when DELETE FROM table; is called by a user.
+ In this case no special extra calls are performed before or after this
+ call.
+ */
+ HA_EXTRA_RESET_STATE,
+ /*
+ Informs the handler that we will not stop the transaction if we get
+ duplicate key errors during insert/upate.
+ Always called in pair, triggered by INSERT IGNORE and other similar
+ SQL constructs.
+ Not used by MyISAM.
+ */
+ HA_EXTRA_IGNORE_DUP_KEY,
+ HA_EXTRA_NO_IGNORE_DUP_KEY,
+ /*
+ Only used by MyISAM, called in preparation for a DROP TABLE.
+ It's used mostly by Windows that cannot handle dropping an open file.
+ On other platforms it has the same effect as HA_EXTRA_FORCE_REOPEN.
+ */
+ HA_EXTRA_PREPARE_FOR_DROP,
+ /*
+ Remove read cache if problems.
+ This is called as part of a multi-table update. When the table to be
+ updated is also scanned then this informs MyISAM handler to drop any
+ caches if dynamic records are used (fixed size records do not care
+ about this call).
+ */
+ HA_EXTRA_PREPARE_FOR_UPDATE,
+ HA_EXTRA_PRELOAD_BUFFER_SIZE, /* Set buffer size for preloading */
+ /*
+ On-the-fly switching between unique and non-unique key inserting.
+ */
+ HA_EXTRA_CHANGE_KEY_TO_UNIQUE,
+ HA_EXTRA_CHANGE_KEY_TO_DUP,
+ /*
+ When using HA_EXTRA_KEYREAD, overwrite only key member fields and keep
+ other fields intact. When this is off (by default) InnoDB will use memcpy
+ to overwrite entire row.
+ This is a strictly InnoDB feature that is more or less undocumented.
+ */
+ HA_EXTRA_KEYREAD_PRESERVE_FIELDS,
+ /*
+ Ignore if the a tuple is not found, continue processing the
+ transaction and ignore that 'row'. Needed for idempotency
+ handling on the slave
+
+ Currently only used by NDB storage engine.
+ */
+ HA_EXTRA_IGNORE_NO_KEY,
+ HA_EXTRA_NO_IGNORE_NO_KEY,
+ /*
+ Mark the table as a log table. For some handlers (e.g. CSV) this results
+ in a special locking for the table.
+ */
+ HA_EXTRA_MARK_AS_LOG_TABLE,
+ /*
+ Informs handler that write_row() which tries to insert new row into the
+ table and encounters some already existing row with same primary/unique
+ key can replace old row with new row instead of reporting error (basically
+ it informs handler that we do REPLACE instead of simple INSERT).
+ Off by default.
+ */
+ HA_EXTRA_WRITE_CAN_REPLACE,
+ HA_EXTRA_WRITE_CANNOT_REPLACE,
+ /*
+ Inform handler that delete_row()/update_row() cannot batch deletes/updates
+ and should perform them immediately. This may be needed when table has
+ AFTER DELETE/UPDATE triggers which access to subject table.
+ These flags are reset by the handler::reset() call.
+ */
+ HA_EXTRA_DELETE_CANNOT_BATCH,
+ HA_EXTRA_UPDATE_CANNOT_BATCH,
+ /*
+ Inform handler that an "INSERT...ON DUPLICATE KEY UPDATE" will be
+ executed. This condition is unset by HA_EXTRA_NO_IGNORE_DUP_KEY.
+ */
+ HA_EXTRA_INSERT_WITH_UPDATE,
+ /*
+ Informs the handler we are about to attempt a rename of the table.
+ For handlers that have share open files (MyISAM key-file and
+ Archive writer) they must close the files before rename is possible
+ on Windows.
+ */
+ HA_EXTRA_PREPARE_FOR_RENAME,
+ /*
+ Special actions for MERGE tables.
+ */
+ HA_EXTRA_ADD_CHILDREN_LIST,
+ HA_EXTRA_ATTACH_CHILDREN,
+ HA_EXTRA_IS_ATTACHED_CHILDREN,
+ HA_EXTRA_DETACH_CHILDREN,
+ /*
+ Prepare table for export
+ (e.g. quiesce the table and write table metadata).
+ */
+ HA_EXTRA_EXPORT,
+ /** Do secondary sort by handler::ref (rowid) after key sort. */
+ HA_EXTRA_SECONDARY_SORT_ROWID,
+ /*
+ Skip Serializable isolation level on Views on DD tables.
+ This will make reads on DD Views non blocking */
+ HA_EXTRA_SKIP_SERIALIZABLE_DD_VIEW,
+ /* Begin of insertion into intermediate table during copy alter operation. */
+ HA_EXTRA_BEGIN_ALTER_COPY,
+ /* Insertion is done in intermediate table during copy alter operation. */
+ HA_EXTRA_END_ALTER_COPY,
+ /* Do not use auto-increment locking. */
+ HA_EXTRA_NO_AUTOINC_LOCKING,
+ /*
+ Allocate and use unique filter to weed out duplicates.
+ Used with multi-valued index.
+ */
+ HA_EXTRA_ENABLE_UNIQUE_RECORD_FILTER,
+ /* Disable and free unique record filter. */
+ HA_EXTRA_DISABLE_UNIQUE_RECORD_FILTER
+};
+
+/* Compatible option, to be deleted in 6.0 */
+#define HA_EXTRA_PREPARE_FOR_DELETE HA_EXTRA_PREPARE_FOR_DROP
+
+/* The following is parameter to ha_panic() */
+
+enum ha_panic_function {
+ HA_PANIC_CLOSE, /* Close all databases */
+ HA_PANIC_WRITE, /* Unlock and write status */
+ HA_PANIC_READ /* Lock and read keyinfo */
+};
+
+/* The following is parameter to ha_create(); keytypes */
+
+enum ha_base_keytype {
+ HA_KEYTYPE_END = 0,
+ HA_KEYTYPE_TEXT = 1, /* Key is sorted as letters */
+ HA_KEYTYPE_BINARY = 2, /* Key is sorted as unsigned chars */
+ HA_KEYTYPE_SHORT_INT = 3,
+ HA_KEYTYPE_LONG_INT = 4,
+ HA_KEYTYPE_FLOAT = 5,
+ HA_KEYTYPE_DOUBLE = 6,
+ HA_KEYTYPE_NUM = 7, /* Not packed num with pre-space */
+ HA_KEYTYPE_USHORT_INT = 8,
+ HA_KEYTYPE_ULONG_INT = 9,
+ HA_KEYTYPE_LONGLONG = 10,
+ HA_KEYTYPE_ULONGLONG = 11,
+ HA_KEYTYPE_INT24 = 12,
+ HA_KEYTYPE_UINT24 = 13,
+ HA_KEYTYPE_INT8 = 14,
+ /* Varchar (0-255 bytes) with length packed with 1 byte */
+ HA_KEYTYPE_VARTEXT1 = 15, /* Key is sorted as letters */
+ HA_KEYTYPE_VARBINARY1 = 16, /* Key is sorted as unsigned chars */
+ /* Varchar (0-65535 bytes) with length packed with 2 bytes */
+ HA_KEYTYPE_VARTEXT2 = 17, /* Key is sorted as letters */
+ HA_KEYTYPE_VARBINARY2 = 18, /* Key is sorted as unsigned chars */
+ HA_KEYTYPE_BIT = 19
+};
+
+#define HA_MAX_KEYTYPE 31 /* Must be log2-1 */
+
+/*
+ Flags for KEY::flags bitmap.
+
+ Also used for similar bitmaps in storage engines (HP_KEYDEF::flag,
+ MI_KEYDEF::flag, ...).
+*/
+
+/** Do not allow duplicate records. */
+#define HA_NOSAME 1
+/** Pack string key to previous key (optimization supported by MyISAM). */
+#define HA_PACK_KEY (1 << 1)
+/*
+ Bits in KEY::flags, MI/HP_KEYDEF::flag which are automatically
+ calculated based on other flags/members in these structures
+ (often from info about key parts).
+*/
+/** Some key part packs space. Internal to MyISAM. */
+#define HA_SPACE_PACK_USED (1 << 2)
+/** Some key part has variable length. Internal to MyISAM and Heap engines. */
+#define HA_VAR_LENGTH_KEY (1 << 3)
+/**
+ Auto-increment key.
+
+ @note Not used by SQL-layer/ for KEY::flags. Only set by MyISAM and
+ Heap SEs in MI/HP_KEYDEF::flag.
+*/
+#define HA_AUTO_KEY (1 << 4)
+/** Packing of all keys to previous key (optimization supported by MyISAM). */
+#define HA_BINARY_PACK_KEY (1 << 5)
+/** Some key part is nullable. */
+#define HA_NULL_PART_KEY (1 << 6)
+/** Full-text key. */
+#define HA_FULLTEXT (1 << 7)
+/**
+ Flag in MI_KEYDEF::flag which marks MyISAM's "uniques".
+
+ @note Internal to MyISAM. Current server doesn't use this feature.
+*/
+#define HA_UNIQUE_CHECK (1 << 8)
+/** Internal bit used when sorting records. Internal to MyISAM. */
+#define HA_SORT_ALLOWS_SAME (1 << 9)
+/** Spatial key. */
+#define HA_SPATIAL (1 << 10)
+/**
+ NULLs in key are compared as equal.
+
+ @note Used only for internal temporary tables created by optimizer.
+*/
+#define HA_NULL_ARE_EQUAL (1 << 11)
+/** Key has comment. */
+#define HA_USES_COMMENT (1 << 12)
+/** Key was automatically created to support Foreign Key constraint. */
+#define HA_GENERATED_KEY (1 << 13)
+
+/* The combination of the above can be used for key type comparison. */
+#define HA_KEYFLAG_MASK \
+ (HA_NOSAME | HA_PACK_KEY | HA_AUTO_KEY | HA_BINARY_PACK_KEY | HA_FULLTEXT | \
+ HA_UNIQUE_CHECK | HA_SPATIAL | HA_NULL_ARE_EQUAL | HA_GENERATED_KEY)
+
+/** Fulltext index uses [pre]parser */
+#define HA_USES_PARSER (1 << 14)
+/** Key uses KEY_BLOCK_SIZE option. */
+#define HA_USES_BLOCK_SIZE (1 << 15)
+/**
+ Key contains partial segments.
+
+ @note This flag is internal to SQL-layer by design. It is not supposed to
+ be used to storage engines. It is intended to pass information into
+ internal static sort_keys(KEY *, KEY *) function.
+
+ This flag can be calculated -- it's based on key lengths comparison.
+*/
+#define HA_KEY_HAS_PART_KEY_SEG (1 << 16)
+/**
+ Key was renamed (or is result of renaming a key).
+
+ This is another flag internal to SQL-layer.
+ Used by in-place ALTER TABLE implementation.
+
+ @note This flag can be set for keys which have other changes than
+ simple renaming as well. So from the point of view of storage
+ engine such key might have to be dropped and re-created with
+ new definition.
+*/
+#define HA_KEY_RENAMED (1 << 17)
+/** Set if a key is on any virtual generated columns */
+#define HA_VIRTUAL_GEN_KEY (1 << 18)
+/** Multi-valued key */
+#define HA_MULTI_VALUED_KEY (1 << 19)
+
+/* These flags can be added to key-seg-flag */
+
+#define HA_SPACE_PACK 1 /* Pack space in key-seg */
+#define HA_PART_KEY_SEG 4 /* Used by MySQL for part-key-cols */
+#define HA_VAR_LENGTH_PART 8
+#define HA_NULL_PART 16
+#define HA_BLOB_PART 32
+#define HA_SWAP_KEY 64
+#define HA_REVERSE_SORT 128 /* Sort key in reverse order */
+#define HA_NO_SORT 256 /* do not bother sorting on this keyseg */
+/*
+ End space in unique/varchar are considered equal. (Like 'a' and 'a ')
+ Only needed for internal temporary tables.
+*/
+#define HA_END_SPACE_ARE_EQUAL 512
+#define HA_BIT_PART 1024
+
+/*
+ Flags for HA_CREATE_INFO::table_options and TABLE_SHARE::db_create_options
+ TABLE_SHARE::db_options_in_use bitmaps.
+
+ @note These bitmaps are used for storing information about some table
+ option values/attributes.
+ @note HA_CREATE_INFO::table_options and TABLE_SHARE::db_create_options
+ are basically the same bitmap at the time of table creation and
+ at the time of table opening/usage correspondingly.
+ @note TABLE_SHARE::db_options_in_use is normally copy of db_create_options
+ but can be overriden by SE. E.g. MyISAM does this at handler::open()
+ and hander::info() time.
+
+ Also used for similar bitmaps in MyISAM (MYISAM_SHARE::options,
+ MI_ISAMINFO::options).
+*/
+
+/**
+ Indicates that storage engine needs to use packed row format.
+ Set for tables with ROW_FORMAT=DYNAMIC clause, for tables with BLOB fields,
+ and for tables with VARCHAR columns without ROW_FORMAT=FIXED.
+
+ This flag is respected by MyISAM only (it might also decide to use this
+ optimization for its own reasons). InnoDB relies on HA_CREATE_INFO::row_type
+ directly instead.
+*/
+#define HA_OPTION_PACK_RECORD 1
+/**
+ PACK_KEYS=1 option was specified.
+
+ PACK_KEYS=# option specifies whether key packing - optimization supported
+ by MyISAM, should be used.
+ * PACK_KEYS=1 means all keys should be packed,
+ * PACK_KEYS=0 (denoted by @sa HA_OPTION_NO_PACK_KEYS flag) means that key
+ packing should not be used at all.
+ * Not using this option or using PACK_KEYS=DEFAULT clause (denoted by
+ absence of both HA_OPTION_PACK_KEYS and HA_OPTION_NO_PACK_KEYS flags)
+ means that key packing will be used for long string columns.
+*/
+#define HA_OPTION_PACK_KEYS 2
+/**
+ Flag indicating that table is compressed. Used by MyISAM storage engine to
+ tell SQL-layer that tables is compressed. Not set or stored by SQL-layer,
+
+ MyISAM doesn't respect ROW_FORMAT=COMPRESSED clause and doesn't allow direct
+ creation of compressed tables. Existing tables can be compressed by external
+ tool. This tool marks such tables with HA_OPTION_COMPRESS_RECORD flag in
+ MYISAM_SHARE::options, MI_ISAMINFO::options. Then storage engine sets this
+ flag in TABLE_SHARE::db_options_in_use to let SQL-layer know about the fact.
+ It is never set in HA_CREATE_INFO::table_options or
+ TABLE_SHARE::db_create_options.
+*/
+#define HA_OPTION_COMPRESS_RECORD 4
+/**
+ Unused. Formerly HA_OPTION_LONG_BLOB_PTR - new ISAM format/portable
+ BLOB pointers.
+*/
+#define HA_OPTION_UNUSED1 8
+/**
+ Storage engine (MyISAM) internal flag for marking temporary tables.
+
+ Used in MYISAM_SHARE::options, MI_ISAMINFO::options, not used by SQL-layer,
+ in HA_CREATE_INFO::table_options or TABLE_SHARE::db_create_options.
+*/
+#define HA_OPTION_TMP_TABLE 16
+/**
+ CHECKSUM=1 option was specified.
+
+ This option enables live checksumming for MyISAM tables. Not used by InnoDB.
+ @sa HA_OPTION_NO_CHECKSUM.
+*/
+#define HA_OPTION_CHECKSUM 32
+/**
+ DELAY_KEY_WRITE=1 option was specified. This option enables MyISAM
+ optimization which postpones key updates until table is closed/expelled from
+ the table cache.
+
+ @sa HA_OPTION_NO_DELAY_KEY_WRITE.
+*/
+#define HA_OPTION_DELAY_KEY_WRITE 64
+/**
+ PACK_KEYS=0 option was specified.
+
+ @sa HA_OPTION_PACK_KEYS for further description.
+ @note Unlike HA_OPTION_PACK_KEYS this flag is SQL-layer only.
+*/
+#define HA_OPTION_NO_PACK_KEYS 128
+/**
+ Flag specific to table creation and HA_CREATE_INFO::table_options.
+ Indicates that storage engine instead of creating new table, needs
+ to discover existing one (which metadata was discovered from SE
+ earlier).
+ Not used in TABLE_SHARE::db_create_options/db_options_in_use.
+*/
+#define HA_OPTION_CREATE_FROM_ENGINE 256
+/**
+ Storage engine (MyISAM) internal flag for marking tables which
+ rely on SQL-layer because they have keys using fulltext parser plugin.
+
+ Used in MYISAM_SHARE::options, MI_ISAMINFO::options, not used by SQL-layer,
+ in HA_CREATE_INFO::table_options or TABLE_SHARE::db_create_options.
+*/
+#define HA_OPTION_RELIES_ON_SQL_LAYER 512
+/** Unused. Formerly HA_OPTION_NULL_FIELDS - reserved for Maria SE. */
+#define HA_OPTION_UNUSED2 1024
+/** Unused. Formerly HA_OPTION_PAGE_CHECKSUM - reserved for Maria SE. */
+#define HA_OPTION_UNUSED3 2048
+/** STATS_PERSISTENT=1 has been specified in the SQL command (either CREATE
+or ALTER TABLE). Table and index statistics that are collected by the
+storage engine and used by the optimizer for query optimization will be
+stored on disk and will not change after a server restart. */
+#define HA_OPTION_STATS_PERSISTENT 4096
+/** STATS_PERSISTENT=0 has been specified in CREATE/ALTER TABLE. Statistics
+for the table will be wiped away on server shutdown and new ones recalculated
+after the server is started again. If none of HA_OPTION_STATS_PERSISTENT or
+HA_OPTION_NO_STATS_PERSISTENT is set, this means that the setting is not
+explicitly set at table level and the corresponding table will use whatever
+is the global server default. */
+#define HA_OPTION_NO_STATS_PERSISTENT 8192
+/**
+ MyISAM internal flag used by myisamchk external tool.
+
+ Not used by SQL-layer/in HA_CREATE_INFO::table_options and
+ TABLE_SHARE::db_create_options.
+*/
+#define HA_OPTION_TEMP_COMPRESS_RECORD 16384
+/**
+ MyISAM internal flag which marks table as read-only.
+ Set by myisampack external tool.
+
+ Not used by SQL-layer/in HA_CREATE_INFO::table_options and
+ TABLE_SHARE::db_create_options.
+*/
+#define HA_OPTION_READ_ONLY_DATA 32768
+/**
+ CHECKSUM=0 option was specified. Only used by SQL-layer, in
+ HA_CREATE_INFO::table_options. Not persisted in data-dictionary.
+*/
+#define HA_OPTION_NO_CHECKSUM (1L << 17)
+/**
+ DELAY_KEY_WRITE=0 option was specified. Only used by SQL-layer, in
+ HA_CREATE_INFO::table_options. Not persisted in data-dictionary.
+*/
+#define HA_OPTION_NO_DELAY_KEY_WRITE (1L << 18)
+
+/* Bits in flag to create() */
+
+#define HA_DONT_TOUCH_DATA 1 /* Don't empty datafile (isamchk) */
+#define HA_PACK_RECORD 2 /* Request packed record format */
+#define HA_CREATE_TMP_TABLE 4
+#define HA_CREATE_CHECKSUM 8
+#define HA_CREATE_KEEP_FILES 16 /* don't overwrite .MYD and MYI */
+#define HA_CREATE_PAGE_CHECKSUM 32
+#define HA_CREATE_DELAY_KEY_WRITE 64
+#define HA_CREATE_RELIES_ON_SQL_LAYER 128
+#define HA_CREATE_INTERNAL_TABLE 256
+
+/*
+ The following flags (OR-ed) are passed to handler::info() method.
+ The method copies misc handler information out of the storage engine
+ to data structures accessible from MySQL
+
+ Same flags are also passed down to mi_status, myrg_status, etc.
+*/
+
+/* this one is not used */
+#define HA_STATUS_POS 1
+/*
+ assuming the table keeps shared actual copy of the 'info' and
+ local, possibly outdated copy, the following flag means that
+ it should not try to get the actual data (locking the shared structure)
+ slightly outdated version will suffice
+*/
+#define HA_STATUS_NO_LOCK 2
+/* update the time of the last modification (in handler::update_time) */
+#define HA_STATUS_TIME 4
+/*
+ Recalculate loads of constant variables. MyISAM also sets things
+ directly on the table share object.
+
+ Check whether this should be fixed since handlers should not
+ change things directly on the table object.
+
+ Monty comment: This should NOT be changed! It's the handlers
+ responsibility to correct table->s->keys_xxxx information if keys
+ have been disabled.
+
+ The most important parameters set here is records per key on
+ all indexes. block_size and primar key ref_length.
+
+ For each index there is an array of rec_per_key.
+ As an example if we have an index with three attributes a,b and c
+ we will have an array of 3 rec_per_key.
+ rec_per_key[0] is an estimate of number of records divided by
+ number of unique values of the field a.
+ rec_per_key[1] is an estimate of the number of records divided
+ by the number of unique combinations of the fields a and b.
+ rec_per_key[2] is an estimate of the number of records divided
+ by the number of unique combinations of the fields a,b and c.
+
+ Many handlers only set the value of rec_per_key when all fields
+ are bound (rec_per_key[2] in the example above).
+
+ If the handler doesn't support statistics, it should set all of the
+ above to 0.
+
+ update the 'constant' part of the info:
+ handler::max_data_file_length, max_index_file_length, create_time
+ sortkey, ref_length, block_size, data_file_name, index_file_name.
+ handler::table->s->keys_in_use, keys_for_keyread, rec_per_key
+*/
+#define HA_STATUS_CONST 8
+/*
+ update the 'variable' part of the info:
+ handler::records, deleted, data_file_length, index_file_length,
+ check_time, mean_rec_length
+*/
+#define HA_STATUS_VARIABLE 16
+/*
+ This flag is used to get index number of the unique index that
+ reported duplicate key.
+ update handler::errkey and handler::dupp_ref
+ see handler::get_dup_key()
+*/
+#define HA_STATUS_ERRKEY 32
+/*
+ update handler::auto_increment_value
+*/
+#define HA_STATUS_AUTO 64
+/*
+ Get also delete_length when HA_STATUS_VARIABLE is called. It's ok to set it
+ also when only HA_STATUS_VARIABLE but it won't be used.
+*/
+#define HA_STATUS_VARIABLE_EXTRA 128
+
+/*
+ Errorcodes given by handler functions
+
+ Do not add error numbers before HA_ERR_FIRST.
+ If necessary to add lower numbers, change HA_ERR_FIRST accordingly.
+*/
+/** Copy of first error nr.*/
+#define HA_ERR_FIRST 120
+/** Didn't find key on read or update */
+#define HA_ERR_KEY_NOT_FOUND 120
+/** Dupplicate key on write */
+#define HA_ERR_FOUND_DUPP_KEY 121
+/** Internal error */
+#define HA_ERR_INTERNAL_ERROR 122
+/** Uppdate with is recoverable */
+#define HA_ERR_RECORD_CHANGED 123
+/** Wrong index given to function */
+#define HA_ERR_WRONG_INDEX 124
+/** Indexfile is crashed */
+#define HA_ERR_CRASHED 126
+/** Record-file is crashed */
+#define HA_ERR_WRONG_IN_RECORD 127
+/** Record-file is crashed */
+#define HA_ERR_OUT_OF_MEM 128
+/** not a MYI file - no signature */
+#define HA_ERR_NOT_A_TABLE 130
+/** Command not supported */
+#define HA_ERR_WRONG_COMMAND 131
+/** old database file */
+#define HA_ERR_OLD_FILE 132
+/** No record read in update() */
+#define HA_ERR_NO_ACTIVE_RECORD 133
+/** A record is not there */
+#define HA_ERR_RECORD_DELETED 134
+/** No more room in file */
+#define HA_ERR_RECORD_FILE_FULL 135
+/** No more room in file */
+#define HA_ERR_INDEX_FILE_FULL 136
+/** end in next/prev/first/last */
+#define HA_ERR_END_OF_FILE 137
+/** unsupported extension used */
+#define HA_ERR_UNSUPPORTED 138
+/** Too big row */
+#define HA_ERR_TOO_BIG_ROW 139
+/** Wrong create option */
+#define HA_WRONG_CREATE_OPTION 140
+/** Dupplicate unique on write */
+#define HA_ERR_FOUND_DUPP_UNIQUE 141
+/** Can't open charset */
+#define HA_ERR_UNKNOWN_CHARSET 142
+/** conflicting tables in MERGE */
+#define HA_ERR_WRONG_MRG_TABLE_DEF 143
+/** Last (automatic?) repair failed */
+#define HA_ERR_CRASHED_ON_REPAIR 144
+/** Table must be repaired */
+#define HA_ERR_CRASHED_ON_USAGE 145
+#define HA_ERR_LOCK_WAIT_TIMEOUT 146
+#define HA_ERR_LOCK_TABLE_FULL 147
+/** Updates not allowed */
+#define HA_ERR_READ_ONLY_TRANSACTION 148
+#define HA_ERR_LOCK_DEADLOCK 149
+/** Cannot add a foreign key constr. */
+#define HA_ERR_CANNOT_ADD_FOREIGN 150
+/** Cannot add a child row */
+#define HA_ERR_NO_REFERENCED_ROW 151
+/** Cannot delete a parent row */
+#define HA_ERR_ROW_IS_REFERENCED 152
+/** No savepoint with that name */
+#define HA_ERR_NO_SAVEPOINT 153
+/** Non unique key block size */
+#define HA_ERR_NON_UNIQUE_BLOCK_SIZE 154
+/** The table does not exist in engine */
+#define HA_ERR_NO_SUCH_TABLE 155
+/** The table existed in storage engine */
+#define HA_ERR_TABLE_EXIST 156
+/** Could not connect to storage engine */
+#define HA_ERR_NO_CONNECTION 157
+/** NULLs are not supported in spatial index */
+#define HA_ERR_NULL_IN_SPATIAL 158
+/** The table changed in storage engine */
+#define HA_ERR_TABLE_DEF_CHANGED 159
+/** There's no partition in table for given value */
+#define HA_ERR_NO_PARTITION_FOUND 160
+/** Row-based binlogging of row failed */
+#define HA_ERR_RBR_LOGGING_FAILED 161
+/** Index needed in foreign key constraint */
+#define HA_ERR_DROP_INDEX_FK 162
+/** Upholding foreign key constraints would lead to a duplicate key error
+in some other table. */
+#define HA_ERR_FOREIGN_DUPLICATE_KEY 163
+/** The table changed in storage engine */
+#define HA_ERR_TABLE_NEEDS_UPGRADE 164
+/** The table is not writable */
+#define HA_ERR_TABLE_READONLY 165
+/** Failed to get next autoinc value */
+#define HA_ERR_AUTOINC_READ_FAILED 166
+/** Failed to set row autoinc value */
+#define HA_ERR_AUTOINC_ERANGE 167
+/** Generic error */
+#define HA_ERR_GENERIC 168
+/** row not actually updated: new values same as the old values */
+#define HA_ERR_RECORD_IS_THE_SAME 169
+/** It is not possible to log this statement */
+#define HA_ERR_LOGGING_IMPOSSIBLE 170
+/** The event was corrupt, leading to illegal data being read */
+#define HA_ERR_CORRUPT_EVENT 171
+/** New file format */
+#define HA_ERR_NEW_FILE 172
+/** The event could not be processed no other hanlder error happened */
+#define HA_ERR_ROWS_EVENT_APPLY 173
+/** Error during initialization */
+#define HA_ERR_INITIALIZATION 174
+/** File too short */
+#define HA_ERR_FILE_TOO_SHORT 175
+/** Wrong CRC on page */
+#define HA_ERR_WRONG_CRC 176
+/** Too many active concurrent transactions */
+#define HA_ERR_TOO_MANY_CONCURRENT_TRXS 177
+/** There's no explicitly listed partition in table for the given value */
+#define HA_ERR_NOT_IN_LOCK_PARTITIONS 178
+/** Index column length exceeds limit */
+#define HA_ERR_INDEX_COL_TOO_LONG 179
+/** InnoDB index corrupted */
+#define HA_ERR_INDEX_CORRUPT 180
+/** Undo log record too big */
+#define HA_ERR_UNDO_REC_TOO_BIG 181
+/** Invalid InnoDB Doc ID */
+#define HA_FTS_INVALID_DOCID 182
+/** Table being used in foreign key check */
+#define HA_ERR_TABLE_IN_FK_CHECK 183
+/** The tablespace existed in storage engine */
+#define HA_ERR_TABLESPACE_EXISTS 184
+/** Table has too many columns */
+#define HA_ERR_TOO_MANY_FIELDS 185
+/** Row in wrong partition */
+#define HA_ERR_ROW_IN_WRONG_PARTITION 186
+/** InnoDB is in read only mode. */
+#define HA_ERR_INNODB_READ_ONLY 187
+/** FTS query exceeds result cache limit */
+#define HA_ERR_FTS_EXCEED_RESULT_CACHE_LIMIT 188
+/** Temporary file write failure */
+#define HA_ERR_TEMP_FILE_WRITE_FAILURE 189
+/** Innodb is in force recovery mode */
+#define HA_ERR_INNODB_FORCED_RECOVERY 190
+/** Too many words in a phrase */
+#define HA_ERR_FTS_TOO_MANY_WORDS_IN_PHRASE 191
+/** FK cascade depth exceeded */
+#define HA_ERR_FK_DEPTH_EXCEEDED 192
+/** Option Missing during Create */
+#define HA_MISSING_CREATE_OPTION 193
+/** Out of memory in storage engine */
+#define HA_ERR_SE_OUT_OF_MEMORY 194
+/** Table/Clustered index is corrupted. */
+#define HA_ERR_TABLE_CORRUPT 195
+/** The query was interrupted */
+#define HA_ERR_QUERY_INTERRUPTED 196
+/** Missing Tablespace */
+#define HA_ERR_TABLESPACE_MISSING 197
+/** Tablespace is not empty */
+#define HA_ERR_TABLESPACE_IS_NOT_EMPTY 198
+/** Invalid Filename */
+#define HA_ERR_WRONG_FILE_NAME 199
+/** Operation is not allowed */
+#define HA_ERR_NOT_ALLOWED_COMMAND 200
+/** Compute generated column value failed */
+#define HA_ERR_COMPUTE_FAILED 201
+/** Table's row format has changed in the storage engine.
+Information in the data-dictionary needs to be updated. */
+#define HA_ERR_ROW_FORMAT_CHANGED 202
+/** Don't wait for record lock */
+#define HA_ERR_NO_WAIT_LOCK 203
+/** No more room in disk */
+#define HA_ERR_DISK_FULL_NOWAIT 204
+/** No session temporary space available */
+#define HA_ERR_NO_SESSION_TEMP 205
+/** Wrong or Invalid table name */
+#define HA_ERR_WRONG_TABLE_NAME 206
+/** Path is too long for the OS */
+#define HA_ERR_TOO_LONG_PATH 207
+/** Copy of last error number */
+#define HA_ERR_LAST 207
+
+/* Number of different errors */
+#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)
+
+/* Other constants */
+
+#define HA_NAMELEN 64 /* Max length of saved filename */
+#define NO_SUCH_KEY (~(uint)0) /* used as a key no. */
+
+typedef ulong key_part_map;
+#define HA_WHOLE_KEY (~(key_part_map)0)
+
+/* Intern constants in databases */
+
+/* bits in _search */
+#define SEARCH_FIND 1
+#define SEARCH_NO_FIND 2
+#define SEARCH_SAME 4
+#define SEARCH_BIGGER 8
+#define SEARCH_SMALLER 16
+#define SEARCH_SAVE_BUFF 32
+#define SEARCH_UPDATE 64
+#define SEARCH_PREFIX 128
+#define SEARCH_LAST 256
+#define MBR_CONTAIN 512
+#define MBR_INTERSECT 1024
+#define MBR_WITHIN 2048
+#define MBR_DISJOINT 4096
+#define MBR_EQUAL 8192
+#define MBR_DATA 16384
+#define SEARCH_NULL_ARE_EQUAL 32768 /* NULL in keys are equal */
+#define SEARCH_NULL_ARE_NOT_EQUAL 65536 /* NULL in keys are not equal */
+
+/* bits in opt_flag */
+#define QUICK_USED 1
+#define READ_CACHE_USED 2
+#define READ_CHECK_USED 4
+#define KEY_READ_USED 8
+#define WRITE_CACHE_USED 16
+#define OPT_NO_ROWS 32
+
+/* bits in update */
+#define HA_STATE_CHANGED 1 /* Database has changed */
+#define HA_STATE_AKTIV 2 /* Has a current record */
+#define HA_STATE_WRITTEN 4 /* Record is written */
+#define HA_STATE_DELETED 8
+#define HA_STATE_NEXT_FOUND 16 /* Next found record (record before) */
+#define HA_STATE_PREV_FOUND 32 /* Prev found record (record after) */
+#define HA_STATE_NO_KEY 64 /* Last read didn't find record */
+#define HA_STATE_KEY_CHANGED 128
+#define HA_STATE_WRITE_AT_END 256 /* set in _ps_find_writepos */
+#define HA_STATE_BUFF_SAVED 512 /* If current keybuff is info->buff */
+#define HA_STATE_ROW_CHANGED 1024 /* To invalide ROW cache */
+#define HA_STATE_EXTEND_BLOCK 2048
+
+/* myisampack expects no more than 32 field types. */
+enum en_fieldtype {
+ FIELD_LAST = -1,
+ FIELD_NORMAL,
+ FIELD_SKIP_ENDSPACE,
+ FIELD_SKIP_PRESPACE,
+ FIELD_SKIP_ZERO,
+ FIELD_BLOB,
+ FIELD_CONSTANT,
+ FIELD_INTERVALL,
+ FIELD_ZERO,
+ FIELD_VARCHAR,
+ FIELD_CHECK,
+ FIELD_enum_val_count
+};
+
+enum data_file_type {
+ STATIC_RECORD,
+ DYNAMIC_RECORD,
+ COMPRESSED_RECORD,
+ BLOCK_RECORD
+};
+
+/* For key ranges */
+
+enum key_range_flags {
+ NO_MIN_RANGE = 1 << 0, ///< from -inf
+ NO_MAX_RANGE = 1 << 1, ///< to +inf
+ /* X < key, i.e. not including the left endpoint */
+ NEAR_MIN = 1 << 2,
+ /* X > key, i.e. not including the right endpoint */
+ NEAR_MAX = 1 << 3,
+ /*
+ This flag means that index is a unique index, and the interval is
+ equivalent to "AND(keypart_i = const_i)", where all of const_i are
+ not NULLs.
+ */
+ UNIQUE_RANGE = 1 << 4,
+ /*
+ This flag means that the interval is equivalent to
+ "AND(keypart_i = const_i)", where not all key parts may be used
+ but all of const_i are not NULLs.
+ */
+ EQ_RANGE = 1 << 5,
+ /*
+ This flag has the same meaning as UNIQUE_RANGE, except that for at
+ least one keypart the condition is "keypart IS NULL".
+ */
+ NULL_RANGE = 1 << 6,
+ /**
+ This flag means that the index is an rtree index, and the interval is
+ specified using HA_READ_MBR_XXX defined in enum ha_rkey_function.
+ */
+ GEOM_FLAG = 1 << 7,
+ /* Deprecated, currently used only by NDB at row retrieval */
+ SKIP_RANGE = 1 << 8,
+ /*
+ Used to indicate that index dives can be skipped. This can happen when:
+ a) Query satisfies JOIN_TAB::check_skip_records_in_range_qualification. OR
+ b) Used together with EQ_RANGE to indicate that index statistics should be
+ used instead of sampling the index.
+ */
+ SKIP_RECORDS_IN_RANGE = 1 << 9,
+ /*
+ Keypart is reverse-ordered (DESC) and ranges needs to be scanned
+ backward. @see quick_range_seq_init, get_quick_keys.
+ */
+ DESC_FLAG = 1 << 10,
+};
+
+struct key_range {
+ const uchar *key;
+ uint length;
+ key_part_map keypart_map;
+ enum ha_rkey_function flag;
+};
+
+struct KEY_MULTI_RANGE {
+ key_range start_key;
+ key_range end_key;
+ char *ptr; /* Free to use by caller (ptr to row etc) */
+ uint range_flag; /* key range flags see above */
+};
+
+/* For number of records */
+#define rows2double(A) ulonglong2double(A)
+typedef my_off_t ha_rows;
+
+#define HA_POS_ERROR (~(ha_rows)0)
+#define HA_OFFSET_ERROR (~(my_off_t)0)
+
+#if SIZEOF_OFF_T == 4
+#define MAX_FILE_SIZE INT_MAX32
+#else
+#define MAX_FILE_SIZE LLONG_MAX
+#endif
+
+#define HA_VARCHAR_PACKLENGTH(field_length) ((field_length) < 256 ? 1 : 2)
+
+#endif /* _my_base_h */
diff --git a/contrib/libs/libmysql_r/include/my_basename.h b/contrib/libs/libmysql_r/include/my_basename.h
new file mode 100644
index 0000000000..4371007c7b
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_basename.h
@@ -0,0 +1,60 @@
+/* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MY_BASENAME_INCLUDED
+#define MY_BASENAME_INCLUDED
+
+/**
+ @file include/my_basename.h
+ A macro that gives __FILE__ without the directory name (e.g. foo.cc instead of
+ ../sql/foo.cc), calculated compile-time. Note that the entire __FILE__
+ string is still present in the binary; only the pointer is adjusted.
+*/
+
+static constexpr int basename_index(const char *const path, const int index) {
+ return (index == -1 || path[index] == '/' || path[index] == '\\')
+ ? index + 1
+ : basename_index(path, index - 1);
+}
+
+#define MY_BASENAME (&__FILE__[basename_index(__FILE__, sizeof(__FILE__) - 1)])
+
+#ifndef LOG_SUBSYSTEM_TAG
+constexpr const char *basename_prefix_eval(const char *const path) {
+ return (path[0] == 'r' && path[1] == 'p' && path[2] == 'l' && path[3] == '_')
+ ? "Repl"
+ : nullptr;
+}
+
+constexpr int basename_prefix_find(const char *const path, const int index) {
+ return (path[index] == '/' || path[index] == '\\')
+ ? index + 1
+ : basename_prefix_find(path, index - 1);
+}
+
+#define LOG_SUBSYSTEM_TAG \
+ basename_prefix_eval( \
+ &__FILE__[basename_prefix_find(__FILE__, sizeof(__FILE__) - 1)])
+
+#endif
+
+#endif // MY_BASENAME_INCLUDED
diff --git a/contrib/libs/libmysql_r/include/my_bit.h b/contrib/libs/libmysql_r/include/my_bit.h
new file mode 100644
index 0000000000..18ccfce260
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_bit.h
@@ -0,0 +1,152 @@
+/*
+ Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MY_BIT_INCLUDED
+#define MY_BIT_INCLUDED
+
+/**
+ @file include/my_bit.h
+ Some useful bit functions.
+*/
+
+#include <sys/types.h>
+
+#include "my_config.h"
+#include "my_inttypes.h"
+#include "my_macros.h"
+
+extern const char _my_bits_nbits[256];
+extern const uchar _my_bits_reverse_table[256];
+
+/*
+ Find smallest X in 2^X >= value
+ This can be used to divide a number with value by doing a shift instead
+*/
+
+static inline uint my_bit_log2(ulong value) {
+ uint bit;
+ for (bit = 0; value > 1; value >>= 1, bit++)
+ ;
+ return bit;
+}
+
+static inline uint my_count_bits(ulonglong v) {
+#if SIZEOF_LONG_LONG > 4
+ /* The following code is a bit faster on 16 bit machines than if we would
+ only shift v */
+ ulong v2 = (ulong)(v >> 32);
+ return (uint)(uchar)(
+ _my_bits_nbits[(uchar)v] + _my_bits_nbits[(uchar)(v >> 8)] +
+ _my_bits_nbits[(uchar)(v >> 16)] + _my_bits_nbits[(uchar)(v >> 24)] +
+ _my_bits_nbits[(uchar)(v2)] + _my_bits_nbits[(uchar)(v2 >> 8)] +
+ _my_bits_nbits[(uchar)(v2 >> 16)] + _my_bits_nbits[(uchar)(v2 >> 24)]);
+#else
+ return (uint)(uchar)(
+ _my_bits_nbits[(uchar)v] + _my_bits_nbits[(uchar)(v >> 8)] +
+ _my_bits_nbits[(uchar)(v >> 16)] + _my_bits_nbits[(uchar)(v >> 24)]);
+#endif
+}
+
+static inline uint my_count_bits_uint32(uint32 v) {
+ return (uint)(uchar)(
+ _my_bits_nbits[(uchar)v] + _my_bits_nbits[(uchar)(v >> 8)] +
+ _my_bits_nbits[(uchar)(v >> 16)] + _my_bits_nbits[(uchar)(v >> 24)]);
+}
+
+/*
+ Next highest power of two
+
+ SYNOPSIS
+ my_round_up_to_next_power()
+ v Value to check
+
+ RETURN
+ Next or equal power of 2
+ Note: 0 will return 0
+
+ NOTES
+ Algorithm by Sean Anderson, according to:
+ http://graphics.stanford.edu/~seander/bithacks.html
+ (Orignal code public domain)
+
+ Comments shows how this works with 01100000000000000000000000001011
+*/
+
+static inline uint32 my_round_up_to_next_power(uint32 v) {
+ v--; /* 01100000000000000000000000001010 */
+ v |= v >> 1; /* 01110000000000000000000000001111 */
+ v |= v >> 2; /* 01111100000000000000000000001111 */
+ v |= v >> 4; /* 01111111110000000000000000001111 */
+ v |= v >> 8; /* 01111111111111111100000000001111 */
+ v |= v >> 16; /* 01111111111111111111111111111111 */
+ return v + 1; /* 10000000000000000000000000000000 */
+}
+
+static inline uint32 my_clear_highest_bit(uint32 v) {
+ uint32 w = v >> 1;
+ w |= w >> 1;
+ w |= w >> 2;
+ w |= w >> 4;
+ w |= w >> 8;
+ w |= w >> 16;
+ return v & w;
+}
+
+static inline uint32 my_reverse_bits(uint32 key) {
+ return (_my_bits_reverse_table[key & 255] << 24) |
+ (_my_bits_reverse_table[(key >> 8) & 255] << 16) |
+ (_my_bits_reverse_table[(key >> 16) & 255] << 8) |
+ _my_bits_reverse_table[(key >> 24)];
+}
+
+/**
+ Determine if a single bit is set among some bits.
+ @tparam IntType an integer type
+ @param bits the bits to examine
+ @retval true if bits equals to a power of 2
+ @retval false otherwise
+*/
+
+template <typename IntType>
+constexpr bool is_single_bit(IntType bits) {
+ /*
+ Proof of correctness:
+ (1) is_single_bit(0)==false is left as an exercise to the reader.
+ (2) is_single_bit(1)==true is left as an exercise to the reader.
+ (3) is_single_bit(1<<(N+1))==true because the most significant set bit
+ in (bits - 1) would be 1<<N, and obviously (bits & (bits - 1)) == 0.
+ (4) In all other cases, is_single_bit(bits)==false.
+ In these cases, we must have multiple bits set, that is,
+ bits==m|1<<N such that N>=0 and m!=0 and the least significant
+ bit that is set in m is greater than 1<<N. In this case,
+ (bits-1)==m|((1<<N)-1), and (bits&(bits-1))==m, which we defined to be
+ nonzero. So, m==0 will not hold.
+
+ Note: The above proof (3),(4) is applicable also to the case where
+ IntType is signed using two's complement arithmetics, and the most
+ significant bit is set, or in other words, bits<0.
+ */
+ return bits != 0 && (bits & (bits - 1)) == 0;
+}
+
+#endif /* MY_BIT_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/my_bitmap.h b/contrib/libs/libmysql_r/include/my_bitmap.h
new file mode 100644
index 0000000000..376f3a52d5
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_bitmap.h
@@ -0,0 +1,140 @@
+/*
+ Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef _my_bitmap_h_
+#define _my_bitmap_h_
+
+/**
+ @file include/my_bitmap.h
+*/
+
+#define MY_BIT_NONE (~(uint)0)
+
+#include <string.h>
+#include <sys/types.h>
+
+#include "my_dbug.h"
+#include "my_inttypes.h"
+#include "mysql/psi/mysql_mutex.h" /* mysql_mutex_t */
+
+typedef uint32 my_bitmap_map;
+
+struct MY_BITMAP {
+ my_bitmap_map *bitmap{nullptr};
+ uint n_bits{0}; /* number of bits occupied by the above */
+ my_bitmap_map last_word_mask{0};
+ my_bitmap_map *last_word_ptr{nullptr};
+ /*
+ mutex will be acquired for the duration of each bitmap operation if
+ thread_safe flag in bitmap_init was set. Otherwise, we optimize by not
+ acquiring the mutex
+ */
+ mysql_mutex_t *mutex{nullptr};
+};
+
+extern void create_last_word_mask(MY_BITMAP *map);
+extern bool bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits,
+ bool thread_safe);
+extern bool bitmap_is_clear_all(const MY_BITMAP *map);
+extern bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size);
+extern bool bitmap_is_set_all(const MY_BITMAP *map);
+extern bool bitmap_is_subset(const MY_BITMAP *map1, const MY_BITMAP *map2);
+extern bool bitmap_is_overlapping(const MY_BITMAP *map1, const MY_BITMAP *map2);
+extern bool bitmap_test_and_set(MY_BITMAP *map, uint bitmap_bit);
+extern bool bitmap_test_and_clear(MY_BITMAP *map, uint bitmap_bit);
+extern bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit);
+extern uint bitmap_set_next(MY_BITMAP *map);
+extern uint bitmap_get_first(const MY_BITMAP *map);
+extern uint bitmap_get_first_set(const MY_BITMAP *map);
+extern uint bitmap_get_next_set(const MY_BITMAP *map, uint bitmap_bit);
+extern uint bitmap_bits_set(const MY_BITMAP *map);
+extern void bitmap_free(MY_BITMAP *map);
+extern void bitmap_set_above(MY_BITMAP *map, uint from_byte, uint use_bit);
+extern void bitmap_set_prefix(MY_BITMAP *map, uint prefix_size);
+extern void bitmap_intersect(MY_BITMAP *map, const MY_BITMAP *map2);
+extern void bitmap_subtract(MY_BITMAP *map, const MY_BITMAP *map2);
+extern void bitmap_union(MY_BITMAP *map, const MY_BITMAP *map2);
+extern void bitmap_xor(MY_BITMAP *map, const MY_BITMAP *map2);
+extern void bitmap_invert(MY_BITMAP *map);
+extern void bitmap_copy(MY_BITMAP *map, const MY_BITMAP *map2);
+
+extern uint bitmap_lock_set_next(MY_BITMAP *map);
+extern void bitmap_lock_clear_bit(MY_BITMAP *map, uint bitmap_bit);
+/* Fast, not thread safe, bitmap functions */
+#define bitmap_buffer_size(bits) (((bits) + 31) / 32) * 4
+#define no_bytes_in_map(map) (((map)->n_bits + 7) / 8)
+#define no_words_in_map(map) (((map)->n_bits + 31) / 32)
+
+static inline void bitmap_set_bit(MY_BITMAP *map, uint bit) {
+ DBUG_ASSERT(bit < map->n_bits);
+ ((uchar *)map->bitmap)[bit / 8] |= (1 << (bit & 7));
+}
+
+static inline void bitmap_flip_bit(MY_BITMAP *map, uint bit) {
+ DBUG_ASSERT(bit < map->n_bits);
+ ((uchar *)map->bitmap)[bit / 8] ^= (1 << (bit & 7));
+}
+
+static inline void bitmap_clear_bit(MY_BITMAP *map, uint bit) {
+ DBUG_ASSERT(bit < map->n_bits);
+ ((uchar *)map->bitmap)[bit / 8] &= ~(1 << (bit & 7));
+}
+
+static inline bool bitmap_is_set(const MY_BITMAP *map, uint bit) {
+ DBUG_ASSERT(bit < map->n_bits);
+ return ((uchar *)map->bitmap)[bit / 8] & (1 << (bit & 7));
+}
+
+/**
+ Quite unlike other C comparison functions ending with 'cmp', e.g. memcmp(),
+ strcmp(), this function returns true if the bitmaps are equal, and false
+ otherwise.
+
+ @retval true The bitmaps are equal.
+ @retval false The bitmaps differ.
+ */
+static inline bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2) {
+ DBUG_ASSERT(map1->n_bits > 0);
+ DBUG_ASSERT(map2->n_bits > 0);
+
+ if (memcmp(map1->bitmap, map2->bitmap, 4 * (no_words_in_map(map1) - 1)) != 0)
+ return false;
+ return ((*map1->last_word_ptr | map1->last_word_mask) ==
+ (*map2->last_word_ptr | map2->last_word_mask));
+}
+
+/*
+ Clears all bits. This is allowed even for a zero-size bitmap.
+ */
+static inline void bitmap_clear_all(MY_BITMAP *map) {
+ memset(map->bitmap, 0, 4 * no_words_in_map(map));
+}
+
+/*
+ Sets all bits. This is allowed even for a zero-size bitmap.
+ */
+static inline void bitmap_set_all(MY_BITMAP *map) {
+ memset(map->bitmap, 0xFF, 4 * no_words_in_map(map));
+}
+
+#endif /* _my_bitmap_h_ */
diff --git a/contrib/libs/libmysql_r/include/my_byteorder.h b/contrib/libs/libmysql_r/include/my_byteorder.h
new file mode 100644
index 0000000000..d8cb4f5a3a
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_byteorder.h
@@ -0,0 +1,260 @@
+#ifndef MY_BYTEORDER_INCLUDED
+#define MY_BYTEORDER_INCLUDED
+
+/* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/my_byteorder.h
+ Functions for reading and storing in machine-independent format.
+ The little-endian variants are 'korr' (assume 'corrector') variants
+ for integer types, but 'get' (assume 'getter') for floating point types.
+*/
+
+#include "my_config.h"
+
+#include <string.h>
+#include <sys/types.h>
+
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#if defined(_MSC_VER)
+#include <stdlib.h>
+#endif
+
+#if defined(_WIN32) && defined(WIN32_LEAN_AND_MEAN)
+#include <winsock2.h>
+#endif
+
+#ifdef WORDS_BIGENDIAN
+#error #include "big_endian.h" // IWYU pragma: export
+#else
+#include "little_endian.h" // IWYU pragma: export
+#endif
+
+#include "my_inttypes.h"
+
+#ifdef __cplusplus
+#include "template_utils.h"
+#endif
+
+static inline int32 sint3korr(const uchar *A) {
+ return ((int32)(((A[2]) & 128)
+ ? (((uint32)255L << 24) | (((uint32)A[2]) << 16) |
+ (((uint32)A[1]) << 8) | ((uint32)A[0]))
+ : (((uint32)A[2]) << 16) | (((uint32)A[1]) << 8) |
+ ((uint32)A[0])));
+}
+
+static inline uint32 uint3korr(const uchar *A) {
+ return (uint32)(((uint32)(A[0])) + (((uint32)(A[1])) << 8) +
+ (((uint32)(A[2])) << 16));
+}
+
+static inline ulonglong uint5korr(const uchar *A) {
+ return ((ulonglong)(((uint32)(A[0])) + (((uint32)(A[1])) << 8) +
+ (((uint32)(A[2])) << 16) + (((uint32)(A[3])) << 24)) +
+ (((ulonglong)(A[4])) << 32));
+}
+
+static inline ulonglong uint6korr(const uchar *A) {
+ return ((ulonglong)(((uint32)(A[0])) + (((uint32)(A[1])) << 8) +
+ (((uint32)(A[2])) << 16) + (((uint32)(A[3])) << 24)) +
+ (((ulonglong)(A[4])) << 32) + (((ulonglong)(A[5])) << 40));
+}
+
+/**
+ int3store
+
+ Stores an unsinged integer in a platform independent way
+
+ @param T The destination buffer. Must be at least 3 bytes long
+ @param A The integer to store.
+
+ _Example:_
+ A @ref a_protocol_type_int3 "int \<3\>" with the value 1 is stored as:
+ ~~~~~~~~~~~~~~~~~~~~~
+ 01 00 00
+ ~~~~~~~~~~~~~~~~~~~~~
+*/
+static inline void int3store(uchar *T, uint A) {
+ *(T) = (uchar)(A);
+ *(T + 1) = (uchar)(A >> 8);
+ *(T + 2) = (uchar)(A >> 16);
+}
+
+static inline void int5store(uchar *T, ulonglong A) {
+ *(T) = (uchar)(A);
+ *(T + 1) = (uchar)(A >> 8);
+ *(T + 2) = (uchar)(A >> 16);
+ *(T + 3) = (uchar)(A >> 24);
+ *(T + 4) = (uchar)(A >> 32);
+}
+
+static inline void int6store(uchar *T, ulonglong A) {
+ *(T) = (uchar)(A);
+ *(T + 1) = (uchar)(A >> 8);
+ *(T + 2) = (uchar)(A >> 16);
+ *(T + 3) = (uchar)(A >> 24);
+ *(T + 4) = (uchar)(A >> 32);
+ *(T + 5) = (uchar)(A >> 40);
+}
+
+#ifdef __cplusplus
+
+static inline int16 sint2korr(const char *pT) {
+ return sint2korr(static_cast<const uchar *>(static_cast<const void *>(pT)));
+}
+
+static inline uint16 uint2korr(const char *pT) {
+ return uint2korr(static_cast<const uchar *>(static_cast<const void *>(pT)));
+}
+
+static inline uint32 uint3korr(const char *pT) {
+ return uint3korr(static_cast<const uchar *>(static_cast<const void *>(pT)));
+}
+
+static inline int32 sint3korr(const char *pT) {
+ return sint3korr(static_cast<const uchar *>(static_cast<const void *>(pT)));
+}
+
+static inline uint32 uint4korr(const char *pT) {
+ return uint4korr(static_cast<const uchar *>(static_cast<const void *>(pT)));
+}
+
+static inline int32 sint4korr(const char *pT) {
+ return sint4korr(static_cast<const uchar *>(static_cast<const void *>(pT)));
+}
+
+static inline ulonglong uint6korr(const char *pT) {
+ return uint6korr(static_cast<const uchar *>(static_cast<const void *>(pT)));
+}
+
+static inline ulonglong uint8korr(const char *pT) {
+ return uint8korr(static_cast<const uchar *>(static_cast<const void *>(pT)));
+}
+
+static inline longlong sint8korr(const char *pT) {
+ return sint8korr(static_cast<const uchar *>(static_cast<const void *>(pT)));
+}
+
+static inline void int2store(char *pT, uint16 A) {
+ int2store(static_cast<uchar *>(static_cast<void *>(pT)), A);
+}
+
+static inline void int3store(char *pT, uint A) {
+ int3store(static_cast<uchar *>(static_cast<void *>(pT)), A);
+}
+
+static inline void int4store(char *pT, uint32 A) {
+ int4store(static_cast<uchar *>(static_cast<void *>(pT)), A);
+}
+
+static inline void int5store(char *pT, ulonglong A) {
+ int5store(static_cast<uchar *>(static_cast<void *>(pT)), A);
+}
+
+static inline void int6store(char *pT, ulonglong A) {
+ int6store(static_cast<uchar *>(static_cast<void *>(pT)), A);
+}
+
+static inline void int8store(char *pT, ulonglong A) {
+ int8store(static_cast<uchar *>(static_cast<void *>(pT)), A);
+}
+
+/*
+ Functions for reading and storing in machine format from/to
+ short/long to/from some place in memory V should be a variable
+ and M a pointer to byte.
+*/
+
+static inline void float4store(char *V, float M) {
+ float4store(static_cast<uchar *>(static_cast<void *>(V)), M);
+}
+
+static inline void float8get(double *V, const char *M) {
+ float8get(V, static_cast<const uchar *>(static_cast<const void *>(M)));
+}
+
+static inline void float8store(char *V, double M) {
+ float8store(static_cast<uchar *>(static_cast<void *>(V)), M);
+}
+
+/*
+ Functions for big-endian loads and stores. These are safe to use
+ no matter what the compiler, CPU or alignment, and also with -fstrict-aliasing.
+
+ The stores return a pointer just past the value that was written.
+*/
+
+static inline uint16 load16be(const char *ptr) {
+ uint16 val;
+ memcpy(&val, ptr, sizeof(val));
+ return ntohs(val);
+}
+
+static inline uint32 load32be(const char *ptr) {
+ uint32 val;
+ memcpy(&val, ptr, sizeof(val));
+ return ntohl(val);
+}
+
+static ALWAYS_INLINE char *store16be(char *ptr, uint16 val) {
+#if defined(_MSC_VER)
+ // _byteswap_ushort is an intrinsic on MSVC, but htons is not.
+ val = _byteswap_ushort(val);
+#else
+ val = htons(val);
+#endif
+ memcpy(ptr, &val, sizeof(val));
+ return ptr + sizeof(val);
+}
+
+static inline char *store32be(char *ptr, uint32 val) {
+ val = htonl(val);
+ memcpy(ptr, &val, sizeof(val));
+ return ptr + sizeof(val);
+}
+
+// Adapters for using uchar * instead of char *.
+
+static inline uint16 load16be(const uchar *ptr) {
+ return load16be(pointer_cast<const char *>(ptr));
+}
+
+static inline uint32 load32be(const uchar *ptr) {
+ return load32be(pointer_cast<const char *>(ptr));
+}
+
+static ALWAYS_INLINE uchar *store16be(uchar *ptr, uint16 val) {
+ return pointer_cast<uchar *>(store16be(pointer_cast<char *>(ptr), val));
+}
+
+static inline uchar *store32be(uchar *ptr, uint32 val) {
+ return pointer_cast<uchar *>(store32be(pointer_cast<char *>(ptr), val));
+}
+
+#endif /* __cplusplus */
+
+#endif /* MY_BYTEORDER_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/my_command.h b/contrib/libs/libmysql_r/include/my_command.h
new file mode 100644
index 0000000000..13b8993549
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_command.h
@@ -0,0 +1,102 @@
+/* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License, version 2.0,
+as published by the Free Software Foundation.
+
+This program is also distributed with certain software (including
+but not limited to OpenSSL) that is licensed under separate terms,
+as designated in a particular file or component or in included license
+documentation. The authors of MySQL hereby grant you an additional
+permission to link the program and your derivative works with the
+separately licensed software that they have included with MySQL.
+
+Without limiting anything contained in the foregoing, this file,
+which is part of C Driver for MySQL (Connector/C), is also subject to the
+Universal FOSS Exception, version 1.0, a copy of which can be found at
+http://oss.oracle.com/licenses/universal-foss-exception.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License, version 2.0, for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef _mysql_command_h
+#define _mysql_command_h
+
+/**
+ @file include/my_command.h
+*/
+
+/**
+ @enum enum_server_command
+
+ @brief A list of all MySQL protocol commands.
+
+ These are the top level commands the server can receive
+ while it listens for a new command in ::dispatch_command
+
+ @par Warning
+ Add new commands to the end of this list, otherwise old
+ servers won't be able to handle them as 'unsupported'.
+*/
+enum enum_server_command {
+ /**
+ Currently refused by the server. See ::dispatch_command.
+ Also used internally to mark the start of a session.
+ */
+ COM_SLEEP,
+ COM_QUIT, /**< See @ref page_protocol_com_quit */
+ COM_INIT_DB, /**< See @ref page_protocol_com_init_db */
+ COM_QUERY, /**< See @ref page_protocol_com_query */
+ COM_FIELD_LIST, /**< Deprecated. See @ref page_protocol_com_field_list */
+ COM_CREATE_DB, /**< Currently refused by the server. See ::dispatch_command */
+ COM_DROP_DB, /**< Currently refused by the server. See ::dispatch_command */
+ COM_REFRESH, /**< Deprecated. See @ref page_protocol_com_refresh */
+ COM_DEPRECATED_1, /**< Deprecated, used to be COM_SHUTDOWN */
+ COM_STATISTICS, /**< See @ref page_protocol_com_statistics */
+ COM_PROCESS_INFO, /**< Deprecated. See @ref page_protocol_com_process_info */
+ COM_CONNECT, /**< Currently refused by the server. */
+ COM_PROCESS_KILL, /**< Deprecated. See @ref page_protocol_com_process_kill */
+ COM_DEBUG, /**< See @ref page_protocol_com_debug */
+ COM_PING, /**< See @ref page_protocol_com_ping */
+ COM_TIME, /**< Currently refused by the server. */
+ COM_DELAYED_INSERT, /**< Functionality removed. */
+ COM_CHANGE_USER, /**< See @ref page_protocol_com_change_user */
+ COM_BINLOG_DUMP, /**< See @ref page_protocol_com_binlog_dump */
+ COM_TABLE_DUMP,
+ COM_CONNECT_OUT,
+ COM_REGISTER_SLAVE,
+ COM_STMT_PREPARE, /**< See @ref page_protocol_com_stmt_prepare */
+ COM_STMT_EXECUTE, /**< See @ref page_protocol_com_stmt_execute */
+ /** See @ref page_protocol_com_stmt_send_long_data */
+ COM_STMT_SEND_LONG_DATA,
+ COM_STMT_CLOSE, /**< See @ref page_protocol_com_stmt_close */
+ COM_STMT_RESET, /**< See @ref page_protocol_com_stmt_reset */
+ COM_SET_OPTION, /**< See @ref page_protocol_com_set_option */
+ COM_STMT_FETCH, /**< See @ref page_protocol_com_stmt_fetch */
+ /**
+ Currently refused by the server. See ::dispatch_command.
+ Also used internally to mark the session as a "daemon",
+ i.e. non-client THD. Currently the scheduler and the GTID
+ code does use this state.
+ These threads won't be killed by `KILL`
+
+ @sa Event_scheduler::start, ::init_thd, ::kill_one_thread,
+ ::Find_thd_with_id
+ */
+ COM_DAEMON,
+ COM_BINLOG_DUMP_GTID,
+ COM_RESET_CONNECTION, /**< See @ref page_protocol_com_reset_connection */
+ COM_CLONE,
+ /* don't forget to update const char *command_name[] in sql_parse.cc */
+
+ /* Must be last */
+ COM_END /**< Not a real command. Refused. */
+};
+
+#endif /* _mysql_command_h */
diff --git a/contrib/libs/libmysql_r/include/my_compare.h b/contrib/libs/libmysql_r/include/my_compare.h
new file mode 100644
index 0000000000..d0790aae07
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_compare.h
@@ -0,0 +1,120 @@
+/* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef _my_compare_h
+#define _my_compare_h
+
+/**
+ @file include/my_compare.h
+*/
+
+#include <sys/types.h>
+
+#include "m_ctype.h" /* CHARSET_INFO */
+#include "my_inttypes.h"
+#include "myisampack.h"
+
+/*
+ There is a hard limit for the maximum number of keys as there are only
+ 8 bits in the index file header for the number of keys in a table.
+ This means that 0..255 keys can exist for a table. The idea of
+ HA_MAX_POSSIBLE_KEY is to ensure that one can use myisamchk & tools on
+ a MyISAM table for which one has more keys than MyISAM is normally
+ compiled for. If you don't have this, you will get a core dump when
+ running myisamchk compiled for 128 keys on a table with 255 keys.
+*/
+
+#define HA_MAX_POSSIBLE_KEY 255 /* For myisamchk */
+/*
+ The following defines can be increased if necessary.
+ But beware the dependency of MI_MAX_POSSIBLE_KEY_BUFF and HA_MAX_KEY_LENGTH.
+*/
+
+#define HA_MAX_KEY_LENGTH 1000 /* Max length in bytes */
+#define HA_MAX_KEY_SEG 16 /* Max segments for key */
+
+#define HA_MAX_POSSIBLE_KEY_BUFF (HA_MAX_KEY_LENGTH + 24 + 6 + 6)
+#define HA_MAX_KEY_BUFF (HA_MAX_KEY_LENGTH + HA_MAX_KEY_SEG * 6 + 8 + 8)
+
+struct HA_KEYSEG /* Key-portion */
+{
+ const CHARSET_INFO *charset;
+ uint32 start; /* Start of key in record */
+ uint32 null_pos; /* position to NULL indicator */
+ uint16 bit_pos; /* Position to bit part */
+ uint16 flag;
+ uint16 length; /* Keylength */
+ uint16 language;
+ uint8 type; /* Type of key (for sort) */
+ uint8 null_bit; /* bitmask to test for NULL */
+ uint8 bit_start, bit_end; /* if bit field */
+ uint8 bit_length; /* Length of bit part */
+};
+
+static inline uint get_key_length(const uchar **key) {
+ if (**key != 255) return *(*key)++;
+ uint length = mi_uint2korr((*key) + 1);
+ (*key) += 3;
+ return length;
+}
+
+static inline uint get_key_pack_length(const uchar **key, uint *length_pack) {
+ *length_pack = (**key != 255) ? 1 : 3;
+ return get_key_length(key);
+}
+
+#define store_key_length_inc(key, length) \
+ { \
+ if ((length) < 255) { \
+ *(key)++ = (length); \
+ } else { \
+ *(key) = 255; \
+ mi_int2store((key) + 1, (length)); \
+ (key) += 3; \
+ } \
+ }
+
+#define size_to_store_key_length(length) ((length) < 255 ? 1 : 3)
+
+#define get_rec_bits(bit_ptr, bit_ofs, bit_len) \
+ (((((uint16)(bit_ptr)[1] << 8) | (uint16)(bit_ptr)[0]) >> (bit_ofs)) & \
+ ((1 << (bit_len)) - 1))
+
+#define set_rec_bits(bits, bit_ptr, bit_ofs, bit_len) \
+ { \
+ (bit_ptr)[0] = ((bit_ptr)[0] & ~(((1 << (bit_len)) - 1) << (bit_ofs))) | \
+ ((bits) << (bit_ofs)); \
+ if ((bit_ofs) + (bit_len) > 8) \
+ (bit_ptr)[1] = \
+ ((bit_ptr)[1] & ~((1 << ((bit_len)-8 + (bit_ofs))) - 1)) | \
+ ((bits) >> (8 - (bit_ofs))); \
+ }
+
+#define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \
+ set_rec_bits(0, bit_ptr, bit_ofs, bit_len)
+
+extern int ha_compare_text(const CHARSET_INFO *, const uchar *, uint,
+ const uchar *, uint, bool);
+extern int ha_key_cmp(const HA_KEYSEG *keyseg, const uchar *a, const uchar *b,
+ uint key_length, uint nextflag, uint *diff_pos);
+
+#endif /* _my_compare_h */
diff --git a/contrib/libs/libmysql_r/include/my_compiler.h b/contrib/libs/libmysql_r/include/my_compiler.h
new file mode 100644
index 0000000000..9ef2153b38
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_compiler.h
@@ -0,0 +1,150 @@
+#ifndef MY_COMPILER_INCLUDED
+#define MY_COMPILER_INCLUDED
+
+/* Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/my_compiler.h
+ Header for compiler-dependent features.
+
+ Intended to contain a set of reusable wrappers for preprocessor
+ macros, attributes, pragmas, and any other features that are
+ specific to a target compiler.
+*/
+
+#ifndef MYSQL_ABI_CHECK
+#include <assert.h>
+#include <stddef.h> /* size_t */
+#endif
+
+#include "my_config.h"
+
+/*
+ The macros below are borrowed from include/linux/compiler.h in the
+ Linux kernel. Use them to indicate the likelyhood of the truthfulness
+ of a condition. This serves two purposes - newer versions of gcc will be
+ able to optimize for branch predication, which could yield siginficant
+ performance gains in frequently executed sections of the code, and the
+ other reason to use them is for documentation
+*/
+#ifdef HAVE_BUILTIN_EXPECT
+
+// likely/unlikely are likely to clash with other symbols, do not #define
+#if defined(__cplusplus)
+inline bool likely(bool expr) { return __builtin_expect(expr, true); }
+inline bool unlikely(bool expr) { return __builtin_expect(expr, false); }
+#else
+#define likely(x) __builtin_expect((x), 1)
+#define unlikely(x) __builtin_expect((x), 0)
+#endif
+
+#else /* HAVE_BUILTIN_EXPECT */
+
+#if defined(__cplusplus)
+inline bool likely(bool expr) { return expr; }
+inline bool unlikely(bool expr) { return expr; }
+#else
+#define likely(x) (x)
+#define unlikely(x) (x)
+#endif
+
+#endif /* HAVE_BUILTIN_EXPECT */
+
+/* Comunicate to the compiler the unreachability of the code. */
+#ifdef HAVE_BUILTIN_UNREACHABLE
+#define MY_ASSERT_UNREACHABLE() __builtin_unreachable()
+#else
+#define MY_ASSERT_UNREACHABLE() \
+ do { \
+ assert(0); \
+ } while (0)
+#endif
+
+/* Visual Studio requires '__inline' for C code */
+#if !defined(__cplusplus) && defined(_MSC_VER)
+#define inline __inline
+#endif
+
+/* Provide __func__ macro definition for Visual Studio. */
+#if defined(_MSC_VER)
+#define __func__ __FUNCTION__
+#endif
+
+/*
+ Disable MY_ATTRIBUTE for Sun Studio and Visual Studio.
+ Note that Sun Studio supports some __attribute__ variants,
+ but not format or unused which we use quite a lot.
+*/
+#ifndef MY_ATTRIBUTE
+#if defined(__GNUC__) || defined(__clang__)
+#define MY_ATTRIBUTE(A) __attribute__(A)
+#else
+#define MY_ATTRIBUTE(A)
+#endif
+#endif
+
+#if defined(_MSC_VER)
+#define ALWAYS_INLINE __forceinline
+#else
+#define ALWAYS_INLINE __attribute__((always_inline)) inline
+#endif
+
+#if defined(_MSC_VER)
+#define NO_INLINE __declspec(noinline)
+#else
+#define NO_INLINE __attribute__((noinline))
+#endif
+
+#ifndef __has_attribute
+#define __has_attribute(x) 0
+#endif
+
+#ifndef SUPPRESS_UBSAN
+// clang -fsanitize=undefined
+#if defined(HAVE_UBSAN) && defined(__clang__)
+#define SUPPRESS_UBSAN MY_ATTRIBUTE((no_sanitize("undefined")))
+// gcc -fsanitize=undefined
+#elif defined(HAVE_UBSAN) && __has_attribute(no_sanitize_undefined)
+#define SUPPRESS_UBSAN MY_ATTRIBUTE((no_sanitize_undefined))
+#else
+#define SUPPRESS_UBSAN
+#endif
+#endif /* SUPPRESS_UBSAN */
+
+#ifndef SUPPRESS_TSAN
+#if defined(HAVE_TSAN) && defined(__clang__)
+#define SUPPRESS_TSAN MY_ATTRIBUTE((no_sanitize("thread")))
+#elif defined(HAVE_TSAN) && __has_attribute(no_sanitize_thread)
+#define SUPPRESS_TSAN MY_ATTRIBUTE((no_sanitize_thread))
+#else
+#define SUPPRESS_TSAN
+#endif
+#endif /* SUPPRESS_TSAN */
+
+#ifdef _WIN32
+#define STDCALL __stdcall
+#else
+#define STDCALL
+#endif
+
+#endif /* MY_COMPILER_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/my_config-linux.h b/contrib/libs/libmysql_r/include/my_config-linux.h
new file mode 100644
index 0000000000..d01414c8c4
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_config-linux.h
@@ -0,0 +1,366 @@
+/* Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MY_CONFIG_H
+#define MY_CONFIG_H
+
+/*
+ * From configure.cmake, in order of appearance
+ */
+/* #undef HAVE_LLVM_LIBCPP */
+
+/* Libraries */
+#define HAVE_LIBM 1
+/* #undef HAVE_LIBNSL */
+#define HAVE_LIBCRYPT 1
+/* #undef HAVE_LIBSOCKET */
+#define HAVE_LIBDL 1
+#define HAVE_LIBRT 1
+/* #undef HAVE_LIBWRAP */
+/* #undef HAVE_LIBWRAP_PROTOTYPES */
+
+/* Header files */
+#define HAVE_ALLOCA_H 1
+#define HAVE_ARPA_INET_H 1
+#define HAVE_DLFCN_H 1
+#define HAVE_EXECINFO_H 1
+#define HAVE_FPU_CONTROL_H 1
+#define HAVE_GRP_H 1
+/* #undef HAVE_IEEEFP_H */
+#define HAVE_LANGINFO_H 1
+/* #undef HAVE_LSAN_INTERFACE_H */
+#define HAVE_MALLOC_H 1
+#define HAVE_NETINET_IN_H 1
+#define HAVE_POLL_H 1
+#define HAVE_PWD_H 1
+#define HAVE_STRINGS_H 1
+#define HAVE_SYS_CDEFS_H 1
+#define HAVE_SYS_IOCTL_H 1
+#define HAVE_SYS_MMAN_H 1
+#define HAVE_SYS_PRCTL_H 1
+#define HAVE_SYS_RESOURCE_H 1
+#define HAVE_SYS_SELECT_H 1
+#define HAVE_SYS_SOCKET_H 1
+#define HAVE_TERM_H 1
+#define HAVE_TERMIOS_H 1
+#define HAVE_TERMIO_H 1
+#define HAVE_UNISTD_H 1
+#define HAVE_SYS_WAIT_H 1
+#define HAVE_SYS_PARAM_H 1
+#define HAVE_FNMATCH_H 1
+#define HAVE_SYS_UN_H 1
+/* #undef HAVE_VIS_H */
+/* #undef HAVE_SASL_SASL_H */
+
+/* Libevent */
+/* #undef HAVE_DEVPOLL */
+/* #undef HAVE_SYS_DEVPOLL_H */
+#define HAVE_SYS_EPOLL_H 1
+#define HAVE_TAILQFOREACH 1
+
+/* Functions */
+/* #undef HAVE_ALIGNED_MALLOC */
+#define HAVE_BACKTRACE 1
+#define HAVE_INDEX 1
+#define HAVE_CHOWN 1
+#define HAVE_CUSERID 1
+/* #undef HAVE_DIRECTIO */
+#define HAVE_FTRUNCATE 1
+#define HAVE_FCHMOD 1
+#define HAVE_FCNTL 1
+#define HAVE_FDATASYNC 1
+#define HAVE_DECL_FDATASYNC 1
+#define HAVE_FEDISABLEEXCEPT 1
+#define HAVE_FSEEKO 1
+#define HAVE_FSYNC 1
+/* #undef HAVE_GETHRTIME */
+#define HAVE_GETNAMEINFO 1
+#define HAVE_GETPASS 1
+/* #undef HAVE_GETPASSPHRASE */
+#define HAVE_GETPWNAM 1
+#define HAVE_GETPWUID 1
+#define HAVE_GETRLIMIT 1
+#define HAVE_GETRUSAGE 1
+#define HAVE_INITGROUPS 1
+/* #undef HAVE_ISSETUGID */
+#define HAVE_GETUID 1
+#define HAVE_GETEUID 1
+#define HAVE_GETGID 1
+#define HAVE_GETEGID 1
+/* #undef HAVE_LSAN_DO_RECOVERABLE_LEAK_CHECK */
+#define HAVE_MADVISE 1
+#define HAVE_MALLOC_INFO 1
+#define HAVE_MEMRCHR 1
+#define HAVE_MLOCK 1
+#define HAVE_MLOCKALL 1
+#define HAVE_MMAP64 1
+#define HAVE_POLL 1
+#define HAVE_POSIX_FALLOCATE 1
+#define HAVE_POSIX_MEMALIGN 1
+#define HAVE_PREAD 1
+#define HAVE_PTHREAD_CONDATTR_SETCLOCK 1
+#define HAVE_PTHREAD_GETAFFINITY_NP 1
+#define HAVE_PTHREAD_SIGMASK 1
+/* #undef HAVE_SETFD */
+#define HAVE_SIGACTION 1
+#define HAVE_SLEEP 1
+#define HAVE_STPCPY 1
+#define HAVE_STPNCPY 1
+/* #undef HAVE_STRLCPY */
+/* #undef HAVE_STRLCAT */
+#define HAVE_STRSIGNAL 1
+/* #undef HAVE_FGETLN */
+#define HAVE_STRSEP 1
+/* #undef HAVE_TELL */
+#define HAVE_VASPRINTF 1
+#define HAVE_MEMALIGN 1
+#define HAVE_NL_LANGINFO 1
+/* #undef HAVE_HTONLL */
+#define HAVE_EPOLL 1
+/* #undef HAVE_EVENT_PORTS */
+#define HAVE_INET_NTOP 1
+/* #undef HAVE_WORKING_KQUEUE */
+#define HAVE_TIMERADD 1
+#define HAVE_TIMERCLEAR 1
+#define HAVE_TIMERCMP 1
+#define HAVE_TIMERISSET 1
+
+/* WL2373 */
+#define HAVE_SYS_TIME_H 1
+#define HAVE_SYS_TIMES_H 1
+#define HAVE_TIMES 1
+#define HAVE_GETTIMEOFDAY 1
+
+/* Symbols */
+#define HAVE_LRAND48 1
+#define GWINSZ_IN_SYS_IOCTL 1
+#define FIONREAD_IN_SYS_IOCTL 1
+/* #undef FIONREAD_IN_SYS_FILIO */
+#define HAVE_MADV_DONTDUMP 1
+#define HAVE_O_TMPFILE
+
+#define HAVE_ISINF 1
+
+/* #undef HAVE_KQUEUE */
+#define HAVE_SETNS 1
+/* #undef HAVE_KQUEUE_TIMERS */
+#define HAVE_POSIX_TIMERS 1
+
+/* Endianess */
+/* #undef WORDS_BIGENDIAN */
+
+/* Type sizes */
+#define SIZEOF_VOIDP 8
+#define SIZEOF_CHARP 8
+#define SIZEOF_LONG 8
+#define SIZEOF_SHORT 2
+#define SIZEOF_INT 4
+#define SIZEOF_LONG_LONG 8
+#define SIZEOF_OFF_T 8
+#define SIZEOF_TIME_T 8
+#define HAVE_ULONG 1
+#define HAVE_U_INT32_T 1
+#define HAVE_TM_GMTOFF 1
+
+/* Support for tagging symbols with __attribute__((visibility("hidden"))) */
+#define HAVE_VISIBILITY_HIDDEN 1
+
+/* Code tests*/
+#define HAVE_CLOCK_GETTIME 1
+#define HAVE_CLOCK_REALTIME 1
+#define STACK_DIRECTION -1
+#define TIME_WITH_SYS_TIME 1
+/* #undef NO_FCNTL_NONBLOCK */
+#define HAVE_PAUSE_INSTRUCTION 1
+/* #undef HAVE_FAKE_PAUSE_INSTRUCTION */
+/* #undef HAVE_HMT_PRIORITY_INSTRUCTION */
+#define HAVE_ABI_CXA_DEMANGLE 1
+#define HAVE_BUILTIN_UNREACHABLE 1
+#define HAVE_BUILTIN_EXPECT 1
+#define HAVE_BUILTIN_STPCPY 1
+#define HAVE_GCC_ATOMIC_BUILTINS 1
+#define HAVE_GCC_SYNC_BUILTINS 1
+/* #undef HAVE_VALGRIND */
+#define HAVE_SYS_GETTID 1
+/* #undef HAVE_PTHREAD_GETTHREADID_NP */
+/* #undef HAVE_PTHREAD_THREADID_NP */
+#define HAVE_INTEGER_PTHREAD_SELF 1
+#define HAVE_PTHREAD_SETNAME_NP 1
+
+/* IPV6 */
+/* #undef HAVE_NETINET_IN6_H */
+/* #undef HAVE_STRUCT_IN6_ADDR */
+
+/*
+ * Platform specific CMake files
+ */
+#define MACHINE_TYPE "x86_64"
+/* #undef LINUX_ALPINE */
+/* #undef LINUX_SUSE */
+#define HAVE_LINUX_LARGE_PAGES 1
+/* #undef HAVE_SOLARIS_LARGE_PAGES */
+/* #undef HAVE_SOLARIS_ATOMIC */
+#define SYSTEM_TYPE "Linux"
+/* This should mean case insensitive file system */
+/* #undef FN_NO_CASE_SENSE */
+
+/*
+ * From main CMakeLists.txt
+ */
+#define MAX_INDEXES 64U
+/* #undef WITH_INNODB_MEMCACHED */
+/* #undef ENABLE_MEMCACHED_SASL */
+/* #undef ENABLE_MEMCACHED_SASL_PWDB */
+#define ENABLED_PROFILING 1
+/* #undef HAVE_ASAN */
+/* #undef HAVE_LSAN */
+/* #undef HAVE_UBSAN */
+/* #undef HAVE_TSAN */
+/* #undef ENABLED_LOCAL_INFILE */
+
+/* Lock Order */
+/* #undef WITH_LOCK_ORDER */
+
+/* Character sets and collations */
+#define DEFAULT_MYSQL_HOME "/var/empty/mysql-8.0.17"
+#define SHAREDIR "/var/empty/mysql-8.0.17/share/mysql"
+#define DEFAULT_BASEDIR "/var/empty/mysql-8.0.17"
+#define MYSQL_DATADIR "/var/lib/mysql"
+#define MYSQL_KEYRINGDIR "/var/empty/mysql-8.0.17/keyring"
+#define DEFAULT_CHARSET_HOME "/var/empty/mysql-8.0.17"
+#define PLUGINDIR "/var/empty/mysql-8.0.17/lib/mysql/plugin"
+#define DEFAULT_SYSCONFDIR "/var/empty/mysql-8.0.17/etc"
+#define DEFAULT_TMPDIR P_tmpdir
+/*
+ * Readline
+ */
+#define HAVE_MBSTATE_T
+#define HAVE_LANGINFO_CODESET
+#define HAVE_WCSDUP
+#define HAVE_WCHAR_T 1
+#define HAVE_WINT_T 1
+/* #undef HAVE_CURSES_H */
+/* #undef HAVE_NCURSES_H */
+#define USE_LIBEDIT_INTERFACE 1
+#define HAVE_HIST_ENTRY 1
+#define USE_NEW_EDITLINE_INTERFACE 1
+
+/*
+ * Libedit
+ */
+/* #undef HAVE_DECL_TGOTO */
+
+/*
+ * Character sets
+ */
+#define MYSQL_DEFAULT_CHARSET_NAME "utf8mb4"
+#define MYSQL_DEFAULT_COLLATION_NAME "utf8mb4_0900_ai_ci"
+
+/*
+ * Performance schema
+ */
+#define WITH_PERFSCHEMA_STORAGE_ENGINE 1
+/* #undef DISABLE_PSI_THREAD */
+/* #undef DISABLE_PSI_MUTEX */
+/* #undef DISABLE_PSI_RWLOCK */
+/* #undef DISABLE_PSI_COND */
+/* #undef DISABLE_PSI_FILE */
+/* #undef DISABLE_PSI_TABLE */
+/* #undef DISABLE_PSI_SOCKET */
+/* #undef DISABLE_PSI_STAGE */
+/* #undef DISABLE_PSI_STATEMENT */
+/* #undef DISABLE_PSI_SP */
+/* #undef DISABLE_PSI_PS */
+/* #undef DISABLE_PSI_IDLE */
+/* #undef DISABLE_PSI_ERROR */
+/* #undef DISABLE_PSI_STATEMENT_DIGEST */
+/* #undef DISABLE_PSI_METADATA */
+/* #undef DISABLE_PSI_MEMORY */
+/* #undef DISABLE_PSI_TRANSACTION */
+
+/*
+ * MySQL version
+ */
+#define MYSQL_VERSION_MAJOR 8
+#define MYSQL_VERSION_MINOR 0
+#define MYSQL_VERSION_PATCH 17
+#define MYSQL_VERSION_EXTRA ""
+#define PACKAGE "mysql"
+#define PACKAGE_VERSION "8.0.17"
+#define VERSION "8.0.17"
+#define PROTOCOL_VERSION 10
+
+/*
+ * CPU info
+ */
+#define CPU_LEVEL1_DCACHE_LINESIZE 64
+
+
+/*
+ * NDB
+ */
+/* #undef WITH_NDBCLUSTER_STORAGE_ENGINE */
+/* #undef HAVE_PTHREAD_SETSCHEDPARAM */
+
+/*
+ * Other
+ */
+/* #undef EXTRA_DEBUG */
+
+/*
+ * Hardcoded values needed by libevent/NDB/memcached
+ */
+#define HAVE_FCNTL_H 1
+#define HAVE_GETADDRINFO 1
+#define HAVE_INTTYPES_H 1
+/* libevent's select.c is not Windows compatible */
+#ifndef _WIN32
+#define HAVE_SELECT 1
+#endif
+#define HAVE_SIGNAL_H 1
+#define HAVE_STDARG_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRTOK_R 1
+#define HAVE_STRTOLL 1
+#define HAVE_SYS_STAT_H 1
+#define HAVE_SYS_TYPES_H 1
+#define SIZEOF_CHAR 1
+
+/*
+ * Needed by libevent
+ */
+#define HAVE_SOCKLEN_T 1
+
+/* For --secure-file-priv */
+#define DEFAULT_SECURE_FILE_PRIV_DIR "NULL"
+#define HAVE_LIBNUMA 1
+
+/* For default value of --early_plugin_load */
+/* #undef DEFAULT_EARLY_PLUGIN_LOAD */
+
+/* For default value of --partial_revokes */
+#define DEFAULT_PARTIAL_REVOKES 0
+
+#define SO_EXT ".so"
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/my_config-musl.h b/contrib/libs/libmysql_r/include/my_config-musl.h
new file mode 100644
index 0000000000..40dd6ca5bd
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_config-musl.h
@@ -0,0 +1,5 @@
+#pragma once
+#define HAVE_STRLCAT 1
+#define HAVE_STRLCPY 1
+#undef HAVE_BACKTRACE
+#undef HAVE_EXECINFO_H
diff --git a/contrib/libs/libmysql_r/include/my_config-osx.h b/contrib/libs/libmysql_r/include/my_config-osx.h
new file mode 100644
index 0000000000..466887cc68
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_config-osx.h
@@ -0,0 +1,365 @@
+/* Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MY_CONFIG_H
+#define MY_CONFIG_H
+
+/*
+ * From configure.cmake, in order of appearance
+ */
+#define HAVE_LLVM_LIBCPP 1
+
+/* Libraries */
+/* #undef HAVE_LIBM */
+/* #undef HAVE_LIBNSL */
+/* #undef HAVE_LIBCRYPT */
+/* #undef HAVE_LIBSOCKET */
+/* #undef HAVE_LIBDL */
+/* #undef HAVE_LIBRT */
+/* #undef HAVE_LIBWRAP */
+/* #undef HAVE_LIBWRAP_PROTOTYPES */
+
+/* Header files */
+#define HAVE_ALLOCA_H 1
+#define HAVE_ARPA_INET_H 1
+#define HAVE_DLFCN_H 1
+#define HAVE_EXECINFO_H 1
+/* #undef HAVE_FPU_CONTROL_H */
+#define HAVE_GRP_H 1
+/* #undef HAVE_IEEEFP_H */
+#define HAVE_LANGINFO_H 1
+/* #undef HAVE_LSAN_INTERFACE_H */
+/* #undef HAVE_MALLOC_H */
+#define HAVE_NETINET_IN_H 1
+#define HAVE_POLL_H 1
+#define HAVE_PWD_H 1
+#define HAVE_STRINGS_H 1
+#define HAVE_SYS_CDEFS_H 1
+#define HAVE_SYS_IOCTL_H 1
+#define HAVE_SYS_MMAN_H 1
+/* #undef HAVE_SYS_PRCTL_H */
+#define HAVE_SYS_RESOURCE_H 1
+#define HAVE_SYS_SELECT_H 1
+#define HAVE_SYS_SOCKET_H 1
+#define HAVE_TERM_H 1
+#define HAVE_TERMIOS_H 1
+/* #undef HAVE_TERMIO_H */
+#define HAVE_UNISTD_H 1
+#define HAVE_SYS_WAIT_H 1
+#define HAVE_SYS_PARAM_H 1
+#define HAVE_FNMATCH_H 1
+#define HAVE_SYS_UN_H 1
+#define HAVE_VIS_H 1
+/* #undef HAVE_SASL_SASL_H */
+
+/* Libevent */
+/* #undef HAVE_DEVPOLL */
+/* #undef HAVE_SYS_DEVPOLL_H */
+/* #undef HAVE_SYS_EPOLL_H */
+#define HAVE_TAILQFOREACH 1
+
+/* Functions */
+/* #undef HAVE_ALIGNED_MALLOC */
+#define HAVE_BACKTRACE 1
+#define HAVE_INDEX 1
+#define HAVE_CHOWN 1
+/* #undef HAVE_CUSERID */
+/* #undef HAVE_DIRECTIO */
+#define HAVE_FTRUNCATE 1
+#define HAVE_FCHMOD 1
+#define HAVE_FCNTL 1
+#define HAVE_FDATASYNC 1
+/* #undef HAVE_DECL_FDATASYNC */
+/* #undef HAVE_FEDISABLEEXCEPT */
+#define HAVE_FSEEKO 1
+#define HAVE_FSYNC 1
+/* #undef HAVE_GETHRTIME */
+#define HAVE_GETNAMEINFO 1
+#define HAVE_GETPASS 1
+/* #undef HAVE_GETPASSPHRASE */
+#define HAVE_GETPWNAM 1
+#define HAVE_GETPWUID 1
+#define HAVE_GETRLIMIT 1
+#define HAVE_GETRUSAGE 1
+#define HAVE_INITGROUPS 1
+#define HAVE_ISSETUGID 1
+#define HAVE_GETUID 1
+#define HAVE_GETEUID 1
+#define HAVE_GETGID 1
+#define HAVE_GETEGID 1
+/* #undef HAVE_LSAN_DO_RECOVERABLE_LEAK_CHECK */
+#define HAVE_MADVISE 1
+/* #undef HAVE_MALLOC_INFO */
+/* #undef HAVE_MEMRCHR */
+#define HAVE_MLOCK 1
+#define HAVE_MLOCKALL 1
+/* #undef HAVE_MMAP64 */
+#define HAVE_POLL 1
+/* #undef HAVE_POSIX_FALLOCATE */
+#define HAVE_POSIX_MEMALIGN 1
+#define HAVE_PREAD 1
+/* #undef HAVE_PTHREAD_CONDATTR_SETCLOCK */
+/* #undef HAVE_PTHREAD_GETAFFINITY_NP */
+#define HAVE_PTHREAD_SIGMASK 1
+/* #undef HAVE_SETFD */
+#define HAVE_SIGACTION 1
+#define HAVE_SLEEP 1
+#define HAVE_STPCPY 1
+#define HAVE_STPNCPY 1
+#define HAVE_STRLCPY 1
+#define HAVE_STRLCAT 1
+#define HAVE_STRSIGNAL 1
+#define HAVE_FGETLN 1
+#define HAVE_STRSEP 1
+/* #undef HAVE_TELL */
+#define HAVE_VASPRINTF 1
+/* #undef HAVE_MEMALIGN */
+#define HAVE_NL_LANGINFO 1
+/* #undef HAVE_HTONLL */
+/* #undef HAVE_EPOLL */
+/* #undef HAVE_EVENT_PORTS */
+#define HAVE_INET_NTOP 1
+#define HAVE_WORKING_KQUEUE 1
+#define HAVE_TIMERADD 1
+#define HAVE_TIMERCLEAR 1
+#define HAVE_TIMERCMP 1
+#define HAVE_TIMERISSET 1
+
+/* WL2373 */
+#define HAVE_SYS_TIME_H 1
+#define HAVE_SYS_TIMES_H 1
+#define HAVE_TIMES 1
+#define HAVE_GETTIMEOFDAY 1
+
+/* Symbols */
+#define HAVE_LRAND48 1
+#define GWINSZ_IN_SYS_IOCTL 1
+#define FIONREAD_IN_SYS_IOCTL 1
+#define FIONREAD_IN_SYS_FILIO 1
+/* #undef HAVE_MADV_DONTDUMP */
+/* #undef HAVE_O_TMPFILE */
+
+#define HAVE_ISINF 1
+
+#define HAVE_KQUEUE 1
+/* #undef HAVE_SETNS */
+#define HAVE_KQUEUE_TIMERS 1
+/* #undef HAVE_POSIX_TIMERS */
+
+/* Endianess */
+/* #undef WORDS_BIGENDIAN */
+
+/* Type sizes */
+#define SIZEOF_VOIDP 8
+#define SIZEOF_CHARP 8
+#define SIZEOF_LONG 8
+#define SIZEOF_SHORT 2
+#define SIZEOF_INT 4
+#define SIZEOF_LONG_LONG 8
+#define SIZEOF_OFF_T 8
+#define SIZEOF_TIME_T 8
+/* #undef HAVE_ULONG */
+#define HAVE_U_INT32_T 1
+#define HAVE_TM_GMTOFF 1
+
+/* Support for tagging symbols with __attribute__((visibility("hidden"))) */
+#define HAVE_VISIBILITY_HIDDEN 1
+
+/* Code tests*/
+#define HAVE_CLOCK_GETTIME 1
+#define HAVE_CLOCK_REALTIME 1
+#define STACK_DIRECTION -1
+#define TIME_WITH_SYS_TIME 1
+/* #undef NO_FCNTL_NONBLOCK */
+#define HAVE_PAUSE_INSTRUCTION 1
+/* #undef HAVE_FAKE_PAUSE_INSTRUCTION */
+/* #undef HAVE_HMT_PRIORITY_INSTRUCTION */
+#define HAVE_ABI_CXA_DEMANGLE 1
+#define HAVE_BUILTIN_UNREACHABLE 1
+#define HAVE_BUILTIN_EXPECT 1
+#define HAVE_BUILTIN_STPCPY 1
+#define HAVE_GCC_ATOMIC_BUILTINS 1
+#define HAVE_GCC_SYNC_BUILTINS 1
+/* #undef HAVE_VALGRIND */
+#define HAVE_SYS_GETTID 1
+/* #undef HAVE_PTHREAD_GETTHREADID_NP */
+#define HAVE_PTHREAD_THREADID_NP 1
+/* #undef HAVE_INTEGER_PTHREAD_SELF */
+/* #undef HAVE_PTHREAD_SETNAME_NP */
+
+/* IPV6 */
+/* #undef HAVE_NETINET_IN6_H */
+/* #undef HAVE_STRUCT_IN6_ADDR */
+
+/*
+ * Platform specific CMake files
+ */
+#define MACHINE_TYPE "x86_64"
+/* #undef LINUX_ALPINE */
+/* #undef LINUX_SUSE */
+/* #undef HAVE_LINUX_LARGE_PAGES */
+/* #undef HAVE_SOLARIS_LARGE_PAGES */
+/* #undef HAVE_SOLARIS_ATOMIC */
+#define SYSTEM_TYPE "osx10.12"
+/* This should mean case insensitive file system */
+/* #undef FN_NO_CASE_SENSE */
+
+/*
+ * From main CMakeLists.txt
+ */
+#define MAX_INDEXES 64U
+/* #undef WITH_INNODB_MEMCACHED */
+/* #undef ENABLE_MEMCACHED_SASL */
+/* #undef ENABLE_MEMCACHED_SASL_PWDB */
+#define ENABLED_PROFILING 1
+/* #undef HAVE_ASAN */
+/* #undef HAVE_LSAN */
+/* #undef HAVE_UBSAN */
+/* #undef HAVE_TSAN */
+/* #undef ENABLED_LOCAL_INFILE */
+
+/* Lock Order */
+/* #undef WITH_LOCK_ORDER */
+
+/* Character sets and collations */
+#define DEFAULT_MYSQL_HOME "/tmp/nds-install-mysql80"
+#define SHAREDIR "/tmp/nds-install-mysql80/share/mysql"
+#define DEFAULT_BASEDIR "/tmp/nds-install-mysql80"
+#define MYSQL_DATADIR "/var/lib/mysql"
+#define MYSQL_KEYRINGDIR "/tmp/nds-install-mysql80/keyring"
+#define DEFAULT_CHARSET_HOME "/tmp/nds-install-mysql80"
+#define PLUGINDIR "/tmp/nds-install-mysql80/lib/mysql/plugin"
+#define DEFAULT_SYSCONFDIR "/tmp/nds-install-mysql80/etc"
+#define DEFAULT_TMPDIR P_tmpdir
+/*
+ * Readline
+ */
+#define HAVE_MBSTATE_T
+#define HAVE_LANGINFO_CODESET
+#define HAVE_WCSDUP
+#define HAVE_WCHAR_T 1
+#define HAVE_WINT_T 1
+/* #undef HAVE_CURSES_H */
+/* #undef HAVE_NCURSES_H */
+#define USE_LIBEDIT_INTERFACE 1
+#define HAVE_HIST_ENTRY 1
+#define USE_NEW_EDITLINE_INTERFACE 1
+
+/*
+ * Libedit
+ */
+/* #undef HAVE_DECL_TGOTO */
+
+/*
+ * Character sets
+ */
+#define MYSQL_DEFAULT_CHARSET_NAME "utf8mb4"
+#define MYSQL_DEFAULT_COLLATION_NAME "utf8mb4_0900_ai_ci"
+
+/*
+ * Performance schema
+ */
+#define WITH_PERFSCHEMA_STORAGE_ENGINE 1
+/* #undef DISABLE_PSI_THREAD */
+/* #undef DISABLE_PSI_MUTEX */
+/* #undef DISABLE_PSI_RWLOCK */
+/* #undef DISABLE_PSI_COND */
+/* #undef DISABLE_PSI_FILE */
+/* #undef DISABLE_PSI_TABLE */
+/* #undef DISABLE_PSI_SOCKET */
+/* #undef DISABLE_PSI_STAGE */
+/* #undef DISABLE_PSI_STATEMENT */
+/* #undef DISABLE_PSI_SP */
+/* #undef DISABLE_PSI_PS */
+/* #undef DISABLE_PSI_IDLE */
+/* #undef DISABLE_PSI_ERROR */
+/* #undef DISABLE_PSI_STATEMENT_DIGEST */
+/* #undef DISABLE_PSI_METADATA */
+/* #undef DISABLE_PSI_MEMORY */
+/* #undef DISABLE_PSI_TRANSACTION */
+
+/*
+ * MySQL version
+ */
+#define MYSQL_VERSION_MAJOR 8
+#define MYSQL_VERSION_MINOR 0
+#define MYSQL_VERSION_PATCH 17
+#define MYSQL_VERSION_EXTRA ""
+#define PACKAGE "mysql"
+#define PACKAGE_VERSION "8.0.17"
+#define VERSION "8.0.17"
+#define PROTOCOL_VERSION 10
+
+/*
+ * CPU info
+ */
+#define CPU_LEVEL1_DCACHE_LINESIZE 64
+
+/*
+ * NDB
+ */
+/* #undef WITH_NDBCLUSTER_STORAGE_ENGINE */
+/* #undef HAVE_PTHREAD_SETSCHEDPARAM */
+
+/*
+ * Other
+ */
+/* #undef EXTRA_DEBUG */
+
+/*
+ * Hardcoded values needed by libevent/NDB/memcached
+ */
+#define HAVE_FCNTL_H 1
+#define HAVE_GETADDRINFO 1
+#define HAVE_INTTYPES_H 1
+/* libevent's select.c is not Windows compatible */
+#ifndef _WIN32
+#define HAVE_SELECT 1
+#endif
+#define HAVE_SIGNAL_H 1
+#define HAVE_STDARG_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRTOK_R 1
+#define HAVE_STRTOLL 1
+#define HAVE_SYS_STAT_H 1
+#define HAVE_SYS_TYPES_H 1
+#define SIZEOF_CHAR 1
+
+/*
+ * Needed by libevent
+ */
+#define HAVE_SOCKLEN_T 1
+
+/* For --secure-file-priv */
+#define DEFAULT_SECURE_FILE_PRIV_DIR "NULL"
+/* #undef HAVE_LIBNUMA */
+
+/* For default value of --early_plugin_load */
+/* #undef DEFAULT_EARLY_PLUGIN_LOAD */
+
+/* For default value of --partial_revokes */
+#define DEFAULT_PARTIAL_REVOKES 0
+
+#define SO_EXT ".so"
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/my_config-win.h b/contrib/libs/libmysql_r/include/my_config-win.h
new file mode 100644
index 0000000000..a37cf11fbb
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_config-win.h
@@ -0,0 +1,365 @@
+/* Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MY_CONFIG_H
+#define MY_CONFIG_H
+
+/*
+ * From configure.cmake, in order of appearance
+ */
+/* #undef HAVE_LLVM_LIBCPP */
+
+/* Libraries */
+/* #undef HAVE_LIBM */
+/* #undef HAVE_LIBNSL */
+/* #undef HAVE_LIBCRYPT */
+/* #undef HAVE_LIBSOCKET */
+/* #undef HAVE_LIBDL */
+/* #undef HAVE_LIBRT */
+/* #undef HAVE_LIBWRAP */
+/* #undef HAVE_LIBWRAP_PROTOTYPES */
+
+/* Header files */
+/* #undef HAVE_ALLOCA_H */
+/* #undef HAVE_ARPA_INET_H */
+/* #undef HAVE_DLFCN_H */
+/* #undef HAVE_EXECINFO_H */
+/* #undef HAVE_FPU_CONTROL_H */
+/* #undef HAVE_GRP_H */
+/* #undef HAVE_IEEEFP_H */
+/* #undef HAVE_LANGINFO_H */
+/* #undef HAVE_LSAN_INTERFACE_H */
+#define HAVE_MALLOC_H 1
+/* #undef HAVE_NETINET_IN_H */
+/* #undef HAVE_POLL_H */
+/* #undef HAVE_PWD_H */
+/* #undef HAVE_STRINGS_H */
+/* #undef HAVE_SYS_CDEFS_H */
+/* #undef HAVE_SYS_IOCTL_H */
+/* #undef HAVE_SYS_MMAN_H */
+/* #undef HAVE_SYS_PRCTL_H */
+/* #undef HAVE_SYS_RESOURCE_H */
+/* #undef HAVE_SYS_SELECT_H */
+/* #undef HAVE_SYS_SOCKET_H */
+/* #undef HAVE_TERM_H */
+/* #undef HAVE_TERMIOS_H */
+/* #undef HAVE_TERMIO_H */
+/* #undef HAVE_UNISTD_H */
+/* #undef HAVE_SYS_WAIT_H */
+/* #undef HAVE_SYS_PARAM_H */
+/* #undef HAVE_FNMATCH_H */
+/* #undef HAVE_SYS_UN_H */
+/* #undef HAVE_VIS_H */
+/* #undef HAVE_SASL_SASL_H */
+
+/* Libevent */
+/* #undef HAVE_DEVPOLL */
+/* #undef HAVE_SYS_DEVPOLL_H */
+/* #undef HAVE_SYS_EPOLL_H */
+/* #undef HAVE_TAILQFOREACH */
+
+/* Functions */
+#define HAVE_ALIGNED_MALLOC 1
+/* #undef HAVE_BACKTRACE */
+/* #undef HAVE_INDEX */
+/* #undef HAVE_CHOWN */
+/* #undef HAVE_CUSERID */
+/* #undef HAVE_DIRECTIO */
+/* #undef HAVE_FTRUNCATE */
+/* #undef HAVE_FCHMOD */
+/* #undef HAVE_FCNTL */
+/* #undef HAVE_FDATASYNC */
+/* #undef HAVE_DECL_FDATASYNC */
+/* #undef HAVE_FEDISABLEEXCEPT */
+/* #undef HAVE_FSEEKO */
+/* #undef HAVE_FSYNC */
+/* #undef HAVE_GETHRTIME */
+#define HAVE_GETNAMEINFO 1
+/* #undef HAVE_GETPASS */
+/* #undef HAVE_GETPASSPHRASE */
+/* #undef HAVE_GETPWNAM */
+/* #undef HAVE_GETPWUID */
+/* #undef HAVE_GETRLIMIT */
+/* #undef HAVE_GETRUSAGE */
+/* #undef HAVE_INITGROUPS */
+/* #undef HAVE_ISSETUGID */
+/* #undef HAVE_GETUID */
+/* #undef HAVE_GETEUID */
+/* #undef HAVE_GETGID */
+/* #undef HAVE_GETEGID */
+/* #undef HAVE_LSAN_DO_RECOVERABLE_LEAK_CHECK */
+/* #undef HAVE_MADVISE */
+/* #undef HAVE_MALLOC_INFO */
+/* #undef HAVE_MEMRCHR */
+/* #undef HAVE_MLOCK */
+/* #undef HAVE_MLOCKALL */
+/* #undef HAVE_MMAP64 */
+/* #undef HAVE_POLL */
+/* #undef HAVE_POSIX_FALLOCATE */
+/* #undef HAVE_POSIX_MEMALIGN */
+/* #undef HAVE_PREAD */
+/* #undef HAVE_PTHREAD_CONDATTR_SETCLOCK */
+/* #undef HAVE_PTHREAD_GETAFFINITY_NP */
+/* #undef HAVE_PTHREAD_SIGMASK */
+/* #undef HAVE_SETFD */
+/* #undef HAVE_SIGACTION */
+/* #undef HAVE_SLEEP */
+/* #undef HAVE_STPCPY */
+/* #undef HAVE_STPNCPY */
+/* #undef HAVE_STRLCPY */
+/* #undef HAVE_STRLCAT */
+/* #undef HAVE_STRSIGNAL */
+/* #undef HAVE_FGETLN */
+/* #undef HAVE_STRSEP */
+#define HAVE_TELL 1
+/* #undef HAVE_VASPRINTF */
+/* #undef HAVE_MEMALIGN */
+/* #undef HAVE_NL_LANGINFO */
+/* #undef HAVE_HTONLL */
+/* #undef HAVE_EPOLL */
+/* #undef HAVE_EVENT_PORTS */
+#define HAVE_INET_NTOP 1
+/* #undef HAVE_WORKING_KQUEUE */
+/* #undef HAVE_TIMERADD */
+/* #undef HAVE_TIMERCLEAR */
+/* #undef HAVE_TIMERCMP */
+/* #undef HAVE_TIMERISSET */
+
+/* WL2373 */
+/* #undef HAVE_SYS_TIME_H */
+/* #undef HAVE_SYS_TIMES_H */
+/* #undef HAVE_TIMES */
+/* #undef HAVE_GETTIMEOFDAY */
+
+/* Symbols */
+/* #undef HAVE_LRAND48 */
+/* #undef GWINSZ_IN_SYS_IOCTL */
+/* #undef FIONREAD_IN_SYS_IOCTL */
+/* #undef FIONREAD_IN_SYS_FILIO */
+/* #undef HAVE_MADV_DONTDUMP */
+/* #undef HAVE_O_TMPFILE */
+
+#define HAVE_ISINF 1
+
+/* #undef HAVE_KQUEUE */
+/* #undef HAVE_SETNS */
+/* #undef HAVE_KQUEUE_TIMERS */
+/* #undef HAVE_POSIX_TIMERS */
+
+/* Endianess */
+/* #undef WORDS_BIGENDIAN */
+
+/* Type sizes */
+#define SIZEOF_VOIDP 8
+#define SIZEOF_CHARP 8
+#define SIZEOF_LONG 4
+#define SIZEOF_SHORT 2
+#define SIZEOF_INT 4
+#define SIZEOF_LONG_LONG 8
+#define SIZEOF_OFF_T 4
+#define SIZEOF_TIME_T 8
+/* #undef HAVE_ULONG */
+/* #undef HAVE_U_INT32_T */
+/* #undef HAVE_TM_GMTOFF */
+
+/* Support for tagging symbols with __attribute__((visibility("hidden"))) */
+/* #undef HAVE_VISIBILITY_HIDDEN */
+
+/* Code tests*/
+/* #undef HAVE_CLOCK_GETTIME */
+/* #undef HAVE_CLOCK_REALTIME */
+#define STACK_DIRECTION -1
+/* #undef TIME_WITH_SYS_TIME */
+#define NO_FCNTL_NONBLOCK 1
+/* #undef HAVE_PAUSE_INSTRUCTION */
+/* #undef HAVE_FAKE_PAUSE_INSTRUCTION */
+/* #undef HAVE_HMT_PRIORITY_INSTRUCTION */
+/* #undef HAVE_ABI_CXA_DEMANGLE */
+/* #undef HAVE_BUILTIN_UNREACHABLE */
+/* #undef HAVE_BUILTIN_EXPECT */
+/* #undef HAVE_BUILTIN_STPCPY */
+/* #undef HAVE_GCC_ATOMIC_BUILTINS */
+/* #undef HAVE_GCC_SYNC_BUILTINS */
+/* #undef HAVE_VALGRIND */
+/* #undef HAVE_SYS_GETTID */
+/* #undef HAVE_PTHREAD_GETTHREADID_NP */
+/* #undef HAVE_PTHREAD_THREADID_NP */
+/* #undef HAVE_INTEGER_PTHREAD_SELF */
+/* #undef HAVE_PTHREAD_SETNAME_NP */
+
+/* IPV6 */
+/* #undef HAVE_NETINET_IN6_H */
+#define HAVE_STRUCT_IN6_ADDR 1
+
+/*
+ * Platform specific CMake files
+ */
+#define MACHINE_TYPE "x86_64"
+/* #undef LINUX_ALPINE */
+/* #undef LINUX_SUSE */
+/* #undef HAVE_LINUX_LARGE_PAGES */
+/* #undef HAVE_SOLARIS_LARGE_PAGES */
+/* #undef HAVE_SOLARIS_ATOMIC */
+#define SYSTEM_TYPE "Win64"
+/* This should mean case insensitive file system */
+#define FN_NO_CASE_SENSE 1
+
+/*
+ * From main CMakeLists.txt
+ */
+#define MAX_INDEXES 64U
+/* #undef WITH_INNODB_MEMCACHED */
+/* #undef ENABLE_MEMCACHED_SASL */
+/* #undef ENABLE_MEMCACHED_SASL_PWDB */
+#define ENABLED_PROFILING 1
+/* #undef HAVE_ASAN */
+/* #undef HAVE_LSAN */
+/* #undef HAVE_UBSAN */
+/* #undef HAVE_TSAN */
+/* #undef ENABLED_LOCAL_INFILE */
+
+/* Lock Order */
+/* #undef WITH_LOCK_ORDER */
+
+/* Character sets and collations */
+#define DEFAULT_MYSQL_HOME "C:/Program Files/MySQL/MySQL Server 8.0"
+#define SHAREDIR "share"
+#define DEFAULT_BASEDIR "C:/Program Files/MySQL/MySQL Server 8.0"
+#define MYSQL_DATADIR "C:/Program Files/MySQL/MySQL Server 8.0/data"
+#define MYSQL_KEYRINGDIR "C:/Program Files/MySQL/MySQL Server 8.0/keyring"
+#define DEFAULT_CHARSET_HOME "C:/Program Files/MySQL/MySQL Server 8.0"
+#define PLUGINDIR "C:/Program Files/MySQL/MySQL Server 8.0/lib/plugin"
+/* #undef DEFAULT_SYSCONFDIR */
+#define DEFAULT_TMPDIR ""
+/*
+ * Readline
+ */
+/* #undef HAVE_MBSTATE_T */
+/* #undef HAVE_LANGINFO_CODESET */
+/* #undef HAVE_WCSDUP */
+/* #undef HAVE_WCHAR_T */
+/* #undef HAVE_WINT_T */
+/* #undef HAVE_CURSES_H */
+/* #undef HAVE_NCURSES_H */
+/* #undef USE_LIBEDIT_INTERFACE */
+/* #undef HAVE_HIST_ENTRY */
+/* #undef USE_NEW_EDITLINE_INTERFACE */
+
+/*
+ * Libedit
+ */
+/* #undef HAVE_DECL_TGOTO */
+
+/*
+ * Character sets
+ */
+#define MYSQL_DEFAULT_CHARSET_NAME "utf8mb4"
+#define MYSQL_DEFAULT_COLLATION_NAME "utf8mb4_0900_ai_ci"
+
+/*
+ * Performance schema
+ */
+#define WITH_PERFSCHEMA_STORAGE_ENGINE 1
+/* #undef DISABLE_PSI_THREAD */
+/* #undef DISABLE_PSI_MUTEX */
+/* #undef DISABLE_PSI_RWLOCK */
+/* #undef DISABLE_PSI_COND */
+/* #undef DISABLE_PSI_FILE */
+/* #undef DISABLE_PSI_TABLE */
+/* #undef DISABLE_PSI_SOCKET */
+/* #undef DISABLE_PSI_STAGE */
+/* #undef DISABLE_PSI_STATEMENT */
+/* #undef DISABLE_PSI_SP */
+/* #undef DISABLE_PSI_PS */
+/* #undef DISABLE_PSI_IDLE */
+/* #undef DISABLE_PSI_ERROR */
+/* #undef DISABLE_PSI_STATEMENT_DIGEST */
+/* #undef DISABLE_PSI_METADATA */
+/* #undef DISABLE_PSI_MEMORY */
+/* #undef DISABLE_PSI_TRANSACTION */
+
+/*
+ * MySQL version
+ */
+#define MYSQL_VERSION_MAJOR 8
+#define MYSQL_VERSION_MINOR 0
+#define MYSQL_VERSION_PATCH 17
+#define MYSQL_VERSION_EXTRA ""
+#define PACKAGE "mysql"
+#define PACKAGE_VERSION "8.0.17"
+#define VERSION "8.0.17"
+#define PROTOCOL_VERSION 10
+
+/*
+ * CPU info
+ */
+#define CPU_LEVEL1_DCACHE_LINESIZE 64
+
+/*
+ * NDB
+ */
+/* #undef WITH_NDBCLUSTER_STORAGE_ENGINE */
+/* #undef HAVE_PTHREAD_SETSCHEDPARAM */
+
+/*
+ * Other
+ */
+/* #undef EXTRA_DEBUG */
+
+/*
+ * Hardcoded values needed by libevent/NDB/memcached
+ */
+#define HAVE_FCNTL_H 1
+#define HAVE_GETADDRINFO 1
+#define HAVE_INTTYPES_H 1
+/* libevent's select.c is not Windows compatible */
+#ifndef _WIN32
+#define HAVE_SELECT 1
+#endif
+#define HAVE_SIGNAL_H 1
+#define HAVE_STDARG_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRTOK_R 1
+#define HAVE_STRTOLL 1
+#define HAVE_SYS_STAT_H 1
+#define HAVE_SYS_TYPES_H 1
+#define SIZEOF_CHAR 1
+
+/*
+ * Needed by libevent
+ */
+/* #undef HAVE_SOCKLEN_T */
+
+/* For --secure-file-priv */
+#define DEFAULT_SECURE_FILE_PRIV_DIR "NULL"
+/* #undef HAVE_LIBNUMA */
+
+/* For default value of --early_plugin_load */
+/* #undef DEFAULT_EARLY_PLUGIN_LOAD */
+
+/* For default value of --partial_revokes */
+#define DEFAULT_PARTIAL_REVOKES 0
+
+#define SO_EXT ".dll"
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/my_config.h b/contrib/libs/libmysql_r/include/my_config.h
new file mode 100644
index 0000000000..e6ff481f51
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_config.h
@@ -0,0 +1,17 @@
+#pragma once
+
+#if defined(__linux__)
+#include "my_config-linux.h"
+#endif
+
+#if defined(__APPLE__)
+#include "my_config-osx.h"
+#endif
+
+#if defined(_MSC_VER)
+#include "my_config-win.h"
+#endif
+
+#if defined(_musl_)
+#include "my_config-musl.h"
+#endif
diff --git a/contrib/libs/libmysql_r/include/my_dbug.h b/contrib/libs/libmysql_r/include/my_dbug.h
new file mode 100644
index 0000000000..4e298c8a05
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_dbug.h
@@ -0,0 +1,320 @@
+/* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MY_DBUG_INCLUDED
+#define MY_DBUG_INCLUDED
+
+/**
+ @file include/my_dbug.h
+*/
+
+#ifdef MY_MSCRT_DEBUG
+#include <crtdbg.h>
+#endif
+#include <stdlib.h>
+
+#include "my_compiler.h"
+
+#if !defined(DBUG_OFF)
+#include <assert.h> // IWYU pragma: keep
+#include <stdio.h>
+#include <string.h>
+#endif
+
+#if !defined(DBUG_OFF)
+
+struct _db_stack_frame_ {
+ const char *func; /* function name of the previous stack frame */
+ int func_len; /* how much to print from func */
+ const char *file; /* filename of the function of previous frame */
+ unsigned int level; /* this nesting level, highest bit enables tracing */
+ struct _db_stack_frame_ *prev; /* pointer to the previous frame */
+};
+
+struct CODE_STATE;
+
+extern int _db_keyword_(struct CODE_STATE *, const char *, int);
+extern int _db_explain_(struct CODE_STATE *cs, char *buf, size_t len);
+extern int _db_explain_init_(char *buf, size_t len);
+extern int _db_is_pushed_(void);
+extern void _db_process_(const char *name);
+extern void _db_push_(const char *control);
+extern void _db_pop_(void);
+extern void _db_set_(const char *control);
+extern void _db_set_init_(const char *control);
+extern void _db_enter_(const char *_func_, int func_len, const char *_file_,
+ unsigned int _line_,
+ struct _db_stack_frame_ *_stack_frame_);
+extern void _db_return_(unsigned int _line_,
+ struct _db_stack_frame_ *_stack_frame_);
+extern void _db_pargs_(unsigned int _line_, const char *keyword);
+extern int _db_enabled_();
+extern void _db_doprnt_(const char *format, ...)
+ MY_ATTRIBUTE((format(printf, 1, 2)));
+extern void _db_dump_(unsigned int _line_, const char *keyword,
+ const unsigned char *memory, size_t length);
+extern void _db_end_(void);
+extern void _db_lock_file_(void);
+extern void _db_unlock_file_(void);
+extern FILE *_db_fp_(void);
+extern void _db_flush_();
+extern const char *_db_get_func_(void);
+
+#ifdef __cplusplus
+
+#if defined(__GNUC__)
+// GCC, Clang, and compatible compilers.
+#define DBUG_PRETTY_FUNCTION __PRETTY_FUNCTION__
+#elif defined(__FUNCSIG__)
+// For MSVC; skips the __cdecl. (__PRETTY_FUNCTION__ in GCC is not a
+// preprocessor constant, but __FUNCSIG__ in MSVC is.)
+#define DBUG_PRETTY_FUNCTION strchr(__FUNCSIG__, ' ') + 1
+#else
+// Standard C++; does not include the class name.
+#define DBUG_PRETTY_FUNCTION __func__
+#endif
+
+/**
+ A RAII helper to do DBUG_ENTER / DBUG_RETURN for you automatically. Use like
+ this:
+
+ int foo() {
+ DBUG_TRACE;
+ return 42;
+ }
+ */
+class AutoDebugTrace {
+ public:
+ AutoDebugTrace(const char *function, const char *filename, int line) {
+ // Remove the return type, if it's there.
+ const char *begin = strchr(function, ' ');
+ if (begin != nullptr) {
+ function = begin + 1;
+ }
+
+ // Cut it off at the first parenthesis; the argument list is
+ // often too long to be interesting.
+ const char *end = strchr(function, '(');
+
+ if (end == nullptr) {
+ _db_enter_(function, strlen(function), filename, line, &m_stack_frame);
+ } else {
+ _db_enter_(function, end - function, filename, line, &m_stack_frame);
+ }
+ }
+
+ ~AutoDebugTrace() { _db_return_(0, &m_stack_frame); }
+
+ private:
+ _db_stack_frame_ m_stack_frame;
+};
+
+#define DBUG_TRACE \
+ AutoDebugTrace _db_trace(DBUG_PRETTY_FUNCTION, __FILE__, __LINE__)
+#endif
+
+#define DBUG_ENTER(a) \
+ struct _db_stack_frame_ _db_stack_frame_; \
+ _db_enter_(a, ::strlen(a), __FILE__, __LINE__, &_db_stack_frame_)
+#define DBUG_LEAVE _db_return_(__LINE__, &_db_stack_frame_)
+#define DBUG_RETURN(a1) \
+ do { \
+ DBUG_LEAVE; \
+ return (a1); \
+ } while (0)
+#define DBUG_VOID_RETURN \
+ do { \
+ DBUG_LEAVE; \
+ return; \
+ } while (0)
+#define DBUG_EXECUTE(keyword, a1) \
+ do { \
+ if (_db_keyword_(0, (keyword), 0)) { \
+ a1 \
+ } \
+ } while (0)
+#define DBUG_EXECUTE_IF(keyword, a1) \
+ do { \
+ if (_db_keyword_(0, (keyword), 1)) { \
+ a1 \
+ } \
+ } while (0)
+#define DBUG_EVALUATE(keyword, a1, a2) \
+ (_db_keyword_(0, (keyword), 0) ? (a1) : (a2))
+#define DBUG_EVALUATE_IF(keyword, a1, a2) \
+ (_db_keyword_(0, (keyword), 1) ? (a1) : (a2))
+#define DBUG_PRINT(keyword, arglist) \
+ do { \
+ _db_pargs_(__LINE__, keyword); \
+ if (_db_enabled_()) { \
+ _db_doprnt_ arglist; \
+ } \
+ } while (0)
+
+#define DBUG_PUSH(a1) _db_push_(a1)
+#define DBUG_POP() _db_pop_()
+#define DBUG_SET(a1) _db_set_(a1)
+#define DBUG_SET_INITIAL(a1) _db_set_init_(a1)
+#define DBUG_PROCESS(a1) _db_process_(a1)
+#define DBUG_FILE _db_fp_()
+#define DBUG_DUMP(keyword, a1, a2) _db_dump_(__LINE__, keyword, a1, a2)
+#define DBUG_END() _db_end_()
+#define DBUG_LOCK_FILE _db_lock_file_()
+#define DBUG_UNLOCK_FILE _db_unlock_file_()
+#define DBUG_ASSERT(A) assert(A)
+#define DBUG_EXPLAIN(buf, len) _db_explain_(0, (buf), (len))
+#define DBUG_EXPLAIN_INITIAL(buf, len) _db_explain_init_((buf), (len))
+#ifndef _WIN32
+#define DBUG_ABORT() (_db_flush_(), abort())
+#define DBUG_EXIT() (_db_flush_(), exit(2))
+#else
+#include <crtdbg.h>
+
+#define DBUG_ABORT() \
+ (_db_flush_(), (void)_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE), \
+ (void)_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR), abort())
+#define DBUG_EXIT() \
+ (_db_flush_(), (void)_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE), \
+ (void)_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR), _exit(2))
+#endif
+
+/*
+ Make the program fail, without creating a core file.
+ abort() will send SIGABRT which (most likely) generates core.
+ Use SIGKILL instead, which cannot be caught.
+ We also pause the current thread, until the signal is actually delivered.
+ An alternative would be to use _exit(EXIT_FAILURE),
+ but then valgrind would report lots of memory leaks.
+ */
+#ifdef _WIN32
+#define DBUG_SUICIDE() DBUG_EXIT()
+#else
+extern void _db_suicide_() MY_ATTRIBUTE((noreturn));
+extern void _db_flush_gcov_();
+#define DBUG_SUICIDE() (_db_flush_(), _db_suicide_())
+#endif
+
+#else /* No debugger */
+
+#ifdef __cplusplus
+#define DBUG_TRACE \
+ do { \
+ } while (false)
+#endif
+#define DBUG_ENTER(a1)
+#define DBUG_LEAVE
+#define DBUG_RETURN(a1) \
+ do { \
+ return (a1); \
+ } while (0)
+#define DBUG_VOID_RETURN \
+ do { \
+ return; \
+ } while (0)
+#define DBUG_EXECUTE(keyword, a1) \
+ do { \
+ } while (0)
+#define DBUG_EXECUTE_IF(keyword, a1) \
+ do { \
+ } while (0)
+#define DBUG_EVALUATE(keyword, a1, a2) (a2)
+#define DBUG_EVALUATE_IF(keyword, a1, a2) (a2)
+#define DBUG_PRINT(keyword, arglist) \
+ do { \
+ } while (0)
+#define DBUG_PUSH(a1) \
+ do { \
+ } while (0)
+#define DBUG_SET(a1) \
+ do { \
+ } while (0)
+#define DBUG_SET_INITIAL(a1) \
+ do { \
+ } while (0)
+#define DBUG_POP() \
+ do { \
+ } while (0)
+#define DBUG_PROCESS(a1) \
+ do { \
+ } while (0)
+#define DBUG_DUMP(keyword, a1, a2) \
+ do { \
+ } while (0)
+#define DBUG_END() \
+ do { \
+ } while (0)
+#define DBUG_ASSERT(A) \
+ do { \
+ } while (0)
+#define DBUG_LOCK_FILE \
+ do { \
+ } while (0)
+#define DBUG_FILE (stderr)
+#define DBUG_UNLOCK_FILE \
+ do { \
+ } while (0)
+#define DBUG_EXPLAIN(buf, len)
+#define DBUG_EXPLAIN_INITIAL(buf, len)
+#define DBUG_ABORT() \
+ do { \
+ } while (0)
+#define DBUG_SUICIDE() \
+ do { \
+ } while (0)
+
+#endif
+
+#ifdef __cplusplus
+#if !defined(DBUG_OFF)
+#include <sstream>
+#include <string>
+
+/*
+ A C++ interface to the DBUG_PRINT macro. The DBUG_LOG macro takes two
+ arguments. The first argument is the keyword, as that of the
+ DBUG_PRINT. The 2nd argument 'v' will be passed to a C++ output stream.
+ This enables the use of C++ style output stream operator. In the code, it
+ will be used as follows:
+
+ DBUG_LOG("blob", "space: " << space_id);
+
+ Note: DBUG_PRINT() has a limitation of 1024 bytes for a single
+ print out. So, this limitation is there for DBUG_LOG macro also.
+*/
+
+#define DBUG_LOG(keyword, v) \
+ do { \
+ std::ostringstream sout; \
+ sout << v; \
+ DBUG_PRINT(keyword, ("%s", sout.str().c_str())); \
+ } while (0)
+
+void dump_trace();
+
+#else /* DBUG_OFF */
+#define DBUG_LOG(keyword, v) \
+ do { \
+ } while (0)
+#endif /* DBUG_OFF */
+#endif /* __cplusplus */
+
+#endif /* MY_DBUG_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/my_default.h b/contrib/libs/libmysql_r/include/my_default.h
new file mode 100644
index 0000000000..f419ea27b9
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_default.h
@@ -0,0 +1,72 @@
+/* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MY_DEFAULT_INCLUDED
+#define MY_DEFAULT_INCLUDED
+
+/**
+ @file include/my_default.h
+*/
+
+#include <sys/types.h>
+
+#include "my_inttypes.h"
+#include "my_macros.h"
+
+struct MEM_ROOT;
+
+extern const char *my_defaults_extra_file;
+extern const char *my_defaults_group_suffix;
+extern const char *my_defaults_file;
+extern bool my_getopt_use_args_separator;
+extern bool my_defaults_read_login_file;
+extern bool no_defaults;
+extern char datadir_buffer[];
+
+/* Define the type of function to be passed to process_default_option_files */
+typedef int (*Process_option_func)(void *ctx, const char *group_name,
+ const char *option, const char *cnf_file);
+void set_persist_args_separator(char **arg);
+bool my_getopt_is_args_separator(const char *arg);
+bool my_getopt_is_ro_persist_args_separator(const char *arg);
+int get_defaults_options(int argc, char **argv, char **defaults,
+ char **extra_defaults, char **group_suffix,
+ char **login_path, bool found_no_defaults);
+
+// extern "C" since it is an (undocumented) part of the libmysql ABI.
+extern "C" int my_load_defaults(const char *conf_file, const char **groups,
+ int *argc, char ***argv, MEM_ROOT *alloc,
+ const char ***);
+int check_file_permissions(const char *file_name, bool is_login_file);
+int load_defaults(const char *conf_file, const char **groups, int *argc,
+ char ***argv, MEM_ROOT *alloc);
+int my_search_option_files(const char *conf_file, int *argc, char ***argv,
+ uint *args_used, Process_option_func func,
+ void *func_ctx, const char **default_directories,
+ bool is_login_file, bool found_no_defaults);
+void my_print_default_files(const char *conf_file);
+void print_defaults(const char *conf_file, const char **groups);
+void init_variable_default_paths();
+void update_variable_source(const char *opt_name, const char *config_file);
+void set_variable_source(const char *opt_name, void *value);
+
+#endif // MY_DEFAULT_INCLUDED
diff --git a/contrib/libs/libmysql_r/include/my_dir.h b/contrib/libs/libmysql_r/include/my_dir.h
new file mode 100644
index 0000000000..c179ad8cc4
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_dir.h
@@ -0,0 +1,96 @@
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MY_DIR_H
+#define MY_DIR_H
+
+/**
+ @file include/my_dir.h
+*/
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include "my_inttypes.h"
+
+/* Defines for my_dir and my_stat */
+
+#ifdef _WIN32
+#define S_IROTH _S_IREAD
+#define S_IFIFO _S_IFIFO
+#endif
+
+#define MY_S_IFMT S_IFMT /* type of file */
+#define MY_S_IFDIR S_IFDIR /* directory */
+#define MY_S_IFCHR S_IFCHR /* character special */
+#define MY_S_IFBLK S_IFBLK /* block special */
+#define MY_S_IFREG S_IFREG /* regular */
+#define MY_S_IFIFO S_IFIFO /* fifo */
+#define MY_S_ISUID S_ISUID /* set user id on execution */
+#define MY_S_ISGID S_ISGID /* set group id on execution */
+#define MY_S_ISVTX S_ISVTX /* save swapped text even after use */
+#define MY_S_IREAD S_IREAD /* read permission, owner */
+#define MY_S_IWRITE S_IWRITE /* write permission, owner */
+#define MY_S_IEXEC S_IEXEC /* execute/search permission, owner */
+
+#define MY_S_ISDIR(m) (((m)&MY_S_IFMT) == MY_S_IFDIR)
+#define MY_S_ISCHR(m) (((m)&MY_S_IFMT) == MY_S_IFCHR)
+#define MY_S_ISBLK(m) (((m)&MY_S_IFMT) == MY_S_IFBLK)
+#define MY_S_ISREG(m) (((m)&MY_S_IFMT) == MY_S_IFREG)
+#define MY_S_ISFIFO(m) (((m)&MY_S_IFMT) == MY_S_IFIFO)
+
+#define MY_DONT_SORT 512 /* my_lib; Don't sort files */
+#define MY_WANT_STAT 1024 /* my_lib; stat files */
+
+/* typedefs for my_dir & my_stat */
+
+#ifdef _WIN32
+#define MY_STAT struct _stati64 /* 64 bit file size */
+#else
+#define MY_STAT struct stat /* Orginal struct have what we need */
+#endif
+
+/* Struct describing one file returned from my_dir */
+typedef struct fileinfo {
+ char *name;
+ MY_STAT *mystat;
+} FILEINFO;
+
+struct MY_DIR /* Struct returned from my_dir */
+{
+ /*
+ These members are just copies of parts of Prealloced_array structure,
+ which is allocated right after the end of MY_DIR structure (MEM_ROOT
+ for storing names is also resides there). We've left them here because
+ we don't want to change code that uses my_dir.
+ */
+ struct fileinfo *dir_entry;
+ uint number_off_files;
+};
+
+extern MY_DIR *my_dir(const char *path, myf MyFlags);
+extern void my_dirend(MY_DIR *buffer);
+extern MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags);
+extern int my_fstat(int filenr, MY_STAT *stat_area);
+
+#endif /* MY_DIR_H */
diff --git a/contrib/libs/libmysql_r/include/my_double2ulonglong.h b/contrib/libs/libmysql_r/include/my_double2ulonglong.h
new file mode 100644
index 0000000000..ad57c566fe
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_double2ulonglong.h
@@ -0,0 +1,52 @@
+/*
+ Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MY_DOUBLE2ULONGLONG_INCLUDED
+#define MY_DOUBLE2ULONGLONG_INCLUDED
+
+/**
+ @file include/my_double2ulonglong.h
+ Utility functions for converting between ulonglong and double.
+*/
+
+#include "my_inttypes.h"
+
+#ifdef _WIN32
+inline unsigned long long my_double2ulonglong(double d) {
+ double t = d - (double)0x8000000000000000ULL;
+
+ if (t >= 0) return ((unsigned long long)t) + 0x8000000000000000ULL;
+ return (unsigned long long)d;
+}
+#define double2ulonglong my_double2ulonglong
+#endif /* _WIN32 */
+
+#ifndef ulonglong2double
+#define ulonglong2double(A) ((double)(ulonglong)(A))
+#define my_off_t2double(A) ((double)(my_off_t)(A))
+#endif
+#ifndef double2ulonglong
+#define double2ulonglong(A) ((ulonglong)(double)(A))
+#endif
+
+#endif // MY_DOUBLE2ULONGLONG_INCLUDED
diff --git a/contrib/libs/libmysql_r/include/my_getopt.h b/contrib/libs/libmysql_r/include/my_getopt.h
new file mode 100644
index 0000000000..94139ca00a
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_getopt.h
@@ -0,0 +1,177 @@
+/*
+ Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef _my_getopt_h
+#define _my_getopt_h
+
+/**
+ @file include/my_getopt.h
+*/
+
+#include <stdio.h>
+#include <sys/types.h>
+
+#include <mysql/components/services/system_variable_source_type.h> /* enum_variable_source */
+#include "my_config.h"
+#include "my_inttypes.h"
+#include "my_io.h"
+#include "my_macros.h"
+#include "my_sys.h" /* loglevel */
+
+#define GET_NO_ARG 1
+#define GET_BOOL 2
+#define GET_INT 3
+#define GET_UINT 4
+#define GET_LONG 5
+#define GET_ULONG 6
+#define GET_LL 7
+#define GET_ULL 8
+#define GET_STR 9
+#define GET_STR_ALLOC 10
+#define GET_DISABLED 11
+#define GET_ENUM 12
+#define GET_SET 13
+#define GET_DOUBLE 14
+#define GET_FLAGSET 15
+#define GET_PASSWORD 16
+
+#if SIZEOF_INT == 4
+#define GET_INT32 GET_INT
+#define GET_UINT32 GET_UINT
+#elif SIZEOF_LONG == 4
+#define GET_INT32 GET_LONG
+#define GET_UINT32 GET_ULONG
+#else
+#error Neither int or long is of 4 bytes width
+#endif
+
+#define GET_ASK_ADDR 128
+#define GET_TYPE_MASK 127
+
+/**
+ Enumeration of the my_option::arg_type attributes.
+ It should be noted that for historical reasons variables with the combination
+ arg_type=NO_ARG, my_option::var_type=GET_BOOL still accepts
+ arguments. This is someone counter intuitive and care should be taken
+ if the code is refactored.
+*/
+enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG };
+
+struct get_opt_arg_source {
+ /**
+ config file path OR compiled default values
+ */
+ char m_path_name[FN_REFLEN];
+ enum enum_variable_source m_source;
+};
+
+struct TYPELIB;
+
+struct my_option {
+ const char *name; /**< Name of the option. name=NULL
+ marks the end of the my_option[]
+ array.
+ */
+ int id; /**< For 0<id<=255 it's means one
+ character for a short option
+ (like -A), if >255 no short option
+ is created, but a long option still
+ can be identified uniquely in the
+ my_get_one_option() callback.
+ If an opton needs neither special
+ treatment in the my_get_one_option()
+ nor one-letter short equivalent
+ use id=0.
+ id=-1 is a special case and is used
+ to generate deprecation warnings for
+ plugin options. It should not be
+ used for anything else.
+ */
+ const char *comment; /**< option comment, for autom. --help.
+ if it's NULL the option is not
+ visible in --help.
+ */
+ void *value; /**< A pointer to the variable value */
+ void *u_max_value; /**< The user def. max variable value */
+ TYPELIB *typelib; /**< Pointer to possible values */
+ ulong var_type; /**< GET_BOOL, GET_ULL, etc */
+ enum get_opt_arg_type arg_type; /**< e.g. REQUIRED_ARG or OPT_ARG */
+ longlong def_value; /**< Default value */
+ longlong min_value; /**< Min allowed value (for numbers) */
+ ulonglong max_value; /**< Max allowed value (for numbers) */
+ struct get_opt_arg_source *arg_source; /**< Represents source/path from where
+ this variable is set. */
+ long block_size; /**< Value should be a mult. of this (for numbers) */
+ void *app_type; /**< To be used by an application */
+};
+
+typedef bool (*my_get_one_option)(int, const struct my_option *, char *);
+/**
+ Used to retrieve a reference to the object (variable) that holds the value
+ for the given option. For example, if var_type is GET_UINT, the function
+ must return a pointer to a variable of type uint. A argument is stored in
+ the location pointed to by the returned pointer.
+*/
+typedef void *(*my_getopt_value)(const char *, size_t, const struct my_option *,
+ int *);
+
+extern char *disabled_my_option;
+extern bool my_getopt_print_errors;
+extern bool my_getopt_skip_unknown;
+extern bool log_slave_updates_supplied;
+extern bool slave_preserve_commit_order_supplied;
+extern my_error_reporter my_getopt_error_reporter;
+
+extern "C" int handle_options(int *argc, char ***argv,
+ const struct my_option *longopts,
+ my_get_one_option);
+extern int my_handle_options(int *argc, char ***argv,
+ const struct my_option *longopts,
+ my_get_one_option, const char **command_list,
+ bool ignore_unknown_option);
+extern void print_cmdline_password_warning();
+extern void my_cleanup_options(const struct my_option *options);
+extern void my_print_help(const struct my_option *options);
+extern void my_print_variables(const struct my_option *options);
+extern void my_print_variables_ex(const struct my_option *options, FILE *file);
+extern void my_getopt_register_get_addr(my_getopt_value);
+
+ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp,
+ bool *fix);
+longlong getopt_ll_limit_value(longlong, const struct my_option *, bool *fix);
+double getopt_double_limit_value(double num, const struct my_option *optp,
+ bool *fix);
+ulonglong max_of_int_range(int var_type);
+
+ulonglong getopt_double2ulonglong(double);
+double getopt_ulonglong2double(ulonglong);
+int findopt(char *, uint, const struct my_option **);
+
+bool is_key_cache_variable_suffix(const char *suffix);
+
+// Declared here, so we can unit test it.
+template <typename LLorULL>
+LLorULL eval_num_suffix(const char *argument, int *error,
+ const char *option_name);
+
+#endif /* _my_getopt_h */
diff --git a/contrib/libs/libmysql_r/include/my_getpwnam.h b/contrib/libs/libmysql_r/include/my_getpwnam.h
new file mode 100644
index 0000000000..4ad1135c32
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_getpwnam.h
@@ -0,0 +1,75 @@
+/*
+ Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MY_GETPWNAM_INCLUDED
+#define MY_GETPWNAM_INCLUDED
+
+/**
+ @file include/my_getpwnam.h
+*/
+#include <string>
+#include "my_config.h"
+
+#ifdef HAVE_GETPWNAM
+#include <pwd.h>
+#include <sys/types.h>
+
+/**
+ Shadow struct for passwd which has proper value semantics, so that
+ it can be safely copied and assigned to.
+ */
+struct PasswdValue {
+ std::string pw_name;
+ std::string pw_passwd;
+ uid_t pw_uid{0};
+ gid_t pw_gid{0};
+ std::string pw_gecos;
+ std::string pw_dir;
+ std::string pw_shell;
+
+ /** Constructs from a passwd instance. */
+ PasswdValue(const passwd &p)
+ : pw_name{p.pw_name},
+ pw_passwd{p.pw_passwd},
+ pw_uid{p.pw_uid},
+ pw_gid{p.pw_gid},
+ pw_gecos{p.pw_gecos},
+ pw_dir{p.pw_dir},
+ pw_shell{p.pw_shell} {}
+
+ /** Default constructor creates a void value. */
+ PasswdValue() = default;
+
+ /**
+ Returns true if this PasswdValue instance does not represent a
+ real passwd entry.
+ */
+ bool IsVoid() const { return pw_name.empty(); }
+};
+
+PasswdValue my_getpwnam(const char *);
+PasswdValue my_getpwuid(uid_t);
+
+#endif /* HAVE_GETPWNAM */
+
+#endif // MY_GETPWNAM_INCLUDED
diff --git a/contrib/libs/libmysql_r/include/my_hostname.h b/contrib/libs/libmysql_r/include/my_hostname.h
new file mode 100644
index 0000000000..32bf5363f2
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_hostname.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2.0,
+ * as published by the Free Software Foundation.
+ *
+ * This program is also distributed with certain software (including
+ * but not limited to OpenSSL) that is licensed under separate terms,
+ * as designated in a particular file or component or in included license
+ * documentation. The authors of MySQL hereby grant you an additional
+ * permission to link the program and your derivative works with the
+ * separately licensed software that they have included with MySQL.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License, version 2.0, for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ @file include/my_hostname.h
+ Common definition used by mysys, performance schema and server & client.
+*/
+
+#ifndef MY_HOSTNAME_INCLUDED
+#define MY_HOSTNAME_INCLUDED
+
+/*
+ Note that this is the actual length available, and that room
+ for a trailing '\0' is not included in this size.
+
+ The metadata columns storing hostname use single byte character
+ as they are using ASCII character set.
+
+ pre 8.0.17: 60 characters
+*/
+static constexpr int HOSTNAME_LENGTH = 255;
+
+/*
+ Number of characters that a port number can have.
+ As per rfc6335 section 6, the range is 0 to 65535.
+*/
+static constexpr int PORTNUMBER_LENGTH = 5;
+
+/**
+ Number of bytes required to hold "hostname:portnumber"
+*/
+static constexpr int HOST_AND_PORT_LENGTH =
+ (HOSTNAME_LENGTH + 1 + PORTNUMBER_LENGTH + 1);
+
+#endif /* MY_HOSTNAME_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/my_inttypes.h b/contrib/libs/libmysql_r/include/my_inttypes.h
new file mode 100644
index 0000000000..6cb396557d
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_inttypes.h
@@ -0,0 +1,144 @@
+/*
+ Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MY_INTTYPES_INCLUDED
+#define MY_INTTYPES_INCLUDED
+
+/**
+ @file include/my_inttypes.h
+ Some integer typedefs for easier portability.
+
+ @deprecated Use <stdint.h> instead. Prefer int to sized types.
+*/
+
+#include "my_config.h"
+
+#ifndef MYSQL_ABI_CHECK
+#include <stddef.h>
+#include <stdint.h>
+#include <sys/types.h>
+#endif
+
+#ifdef _WIN32
+#include <BaseTsd.h>
+typedef unsigned int uint;
+typedef unsigned short ushort;
+#endif
+#if !defined(HAVE_ULONG)
+typedef unsigned long ulong; /* Short for unsigned long */
+#endif
+
+typedef unsigned char uchar; /* Short for unsigned char */
+
+// Legacy typedefs. Prefer the standard intXX_t (or std::intXX_t) to these.
+// Note that the Google C++ style guide says you should generally not use
+// unsigned types unless you need defined wraparound semantics or store
+// things like bitfields. Your default choice of type should be simply int.
+typedef int8_t int8;
+typedef uint8_t uint8;
+typedef int16_t int16;
+typedef uint16_t uint16;
+typedef int32_t int32;
+typedef uint32_t uint32;
+typedef intptr_t intptr;
+
+// These are not defined as [u]int64_t, since we have code that assumes that
+// [u]int64 == [unsigned] long long. This is also legacy behavior; use
+// [u]int64_t when possible.
+typedef long long int64;
+typedef unsigned long long uint64;
+
+// We have both ulonglong and my_ulonglong, which can be different. Don't use
+// any of them in new code; use [u]int64_t.
+typedef long long int longlong;
+typedef unsigned long long int ulonglong;
+#if defined(_WIN32)
+typedef unsigned __int64 my_ulonglong;
+#else
+typedef unsigned long long my_ulonglong;
+#endif
+
+#if defined(_WIN32)
+typedef unsigned long long my_off_t;
+#else
+#if SIZEOF_OFF_T > 4
+typedef ulonglong my_off_t;
+#else
+typedef unsigned long my_off_t;
+#endif
+#endif /*_WIN32*/
+#define MY_FILEPOS_ERROR (~(my_off_t)0)
+
+#if defined(_WIN32)
+/*
+ off_t is 32 bit long. We do not use C runtime functions
+ with off_t but native Win32 file IO APIs, that work with
+ 64 bit offsets.
+*/
+#undef SIZEOF_OFF_T
+#define SIZEOF_OFF_T 8
+#endif
+
+#define INT_MIN64 (~0x7FFFFFFFFFFFFFFFLL)
+#define INT_MAX64 0x7FFFFFFFFFFFFFFFLL
+#define INT_MIN32 (~0x7FFFFFFFL)
+#define INT_MAX32 0x7FFFFFFFL
+#define UINT_MAX32 0xFFFFFFFFL
+#define INT_MIN24 (~0x007FFFFF)
+#define INT_MAX24 0x007FFFFF
+#define UINT_MAX24 0x00FFFFFF
+#define INT_MIN16 (~0x7FFF)
+#define INT_MAX16 0x7FFF
+#define UINT_MAX16 0xFFFF
+#define INT_MIN8 (~0x7F)
+#define INT_MAX8 0x7F
+#define UINT_MAX8 0xFF
+
+#ifndef SIZE_T_MAX
+#define SIZE_T_MAX (~((size_t)0))
+#endif
+
+typedef int myf; /* Type of MyFlags in my_funcs */
+
+/* Macros for converting *constants* to the right type */
+#define MYF(v) (myf)(v)
+
+/* Length of decimal number represented by INT32. */
+#define MY_INT32_NUM_DECIMAL_DIGITS 11U
+
+/* Length of decimal number represented by INT64. */
+#define MY_INT64_NUM_DECIMAL_DIGITS 21U
+
+#ifdef _WIN32
+typedef SSIZE_T ssize_t;
+#endif
+
+/*
+ This doesn't really belong here, but it was the only reasonable place
+ at the time.
+*/
+#ifdef _WIN32
+typedef int sigset_t;
+#endif
+
+#endif // MY_INTTYPES_INCLUDED
diff --git a/contrib/libs/libmysql_r/include/my_io.h b/contrib/libs/libmysql_r/include/my_io.h
new file mode 100644
index 0000000000..a5f6d9bfe5
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_io.h
@@ -0,0 +1,201 @@
+/*
+ Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MY_IO_INCLUDED
+#define MY_IO_INCLUDED 1
+
+/**
+ @file include/my_io.h
+ Common \#defines and includes for file and socket I/O.
+*/
+
+#include <mysql/components/services/my_io_bits.h>
+
+#ifdef _WIN32
+
+/* Define missing access() modes. */
+#define F_OK 0
+#define W_OK 2
+#define R_OK 4 /* Test for read permission. */
+
+/* Define missing file locking constants. */
+#define F_RDLCK 1
+#define F_WRLCK 2
+#define F_UNLCK 3
+
+#define O_NONBLOCK 1 /* For emulation of fcntl() */
+
+/*
+ SHUT_RDWR is called SD_BOTH in windows and
+ is defined to 2 in winsock2.h
+ #define SD_BOTH 0x02
+*/
+#define SHUT_RDWR 0x02
+
+#endif // _WIN32
+
+/* file create flags */
+
+#ifdef _WIN32
+/* Only for my_fopen() - _O_BINARY is set by default for my_open() */
+#define MY_FOPEN_BINARY _O_BINARY
+#else
+#define MY_FOPEN_BINARY 0 /* Ignore on non-Windows */
+#endif
+
+#ifdef _WIN32
+#define O_NOFOLLOW 0 /* Ignore on Windows */
+#endif
+
+/* additional file share flags for win32 */
+#ifdef _WIN32
+#define _SH_DENYRWD 0x110 /* deny read/write mode & delete */
+#define _SH_DENYWRD 0x120 /* deny write mode & delete */
+#define _SH_DENYRDD 0x130 /* deny read mode & delete */
+#define _SH_DENYDEL 0x140 /* deny delete only */
+#endif /* _WIN32 */
+
+/* General constants */
+#define FN_LEN 256 /* Max file name len */
+#define FN_HEADLEN 253 /* Max length of filepart of file name */
+#define FN_EXTLEN 20 /* Max length of extension (part of FN_LEN) */
+#define FN_REFLEN 512 /* Max length of full path-name */
+#define FN_REFLEN_SE 4000 /* Max length of full path-name in SE */
+#define FN_EXTCHAR '.'
+#define FN_HOMELIB '~' /* ~/ is used as abbrev for home dir */
+#define FN_CURLIB '.' /* ./ is used as abbrev for current dir */
+#define FN_PARENTDIR ".." /* Parent directory; Must be a string */
+
+#ifdef _WIN32
+#define FN_LIBCHAR '\\'
+#define FN_LIBCHAR2 '/'
+#define FN_DIRSEP "/\\" /* Valid directory separators */
+#define FN_EXEEXT ".exe"
+#define FN_SOEXT ".dll"
+#define FN_ROOTDIR "\\"
+#define FN_DEVCHAR ':'
+#define FN_NETWORK_DRIVES /* Uses \\ to indicate network drives */
+#else
+#define FN_LIBCHAR '/'
+/*
+ FN_LIBCHAR2 is not defined on !Windows. Use is_directory_separator().
+*/
+#define FN_DIRSEP "/" /* Valid directory separators */
+#define FN_EXEEXT ""
+#define FN_SOEXT ".so"
+#define FN_ROOTDIR "/"
+#endif
+
+static inline int is_directory_separator(char c) {
+#ifdef _WIN32
+ return c == FN_LIBCHAR || c == FN_LIBCHAR2;
+#else
+ return c == FN_LIBCHAR;
+#endif
+}
+
+/*
+ MY_FILE_MIN is Windows speciality and is used to quickly detect
+ the mismatch of CRT and mysys file IO usage on Windows at runtime.
+ CRT file descriptors can be in the range 0-2047, whereas descriptors
+ returned by my_open() will start with 2048. If a file descriptor with value
+ less then MY_FILE_MIN is passed to mysys IO function, chances are it stemms
+ from open()/fileno() and not my_open()/my_fileno.
+
+ For Posix, mysys functions are light wrappers around libc, and MY_FILE_MIN
+ is logically 0.
+*/
+
+#ifdef _WIN32
+#define MY_FILE_MIN 2048
+#else
+#define MY_FILE_MIN 0
+#endif
+
+/*
+ MY_NFILE is the default size of my_file_info array.
+
+ It is larger on Windows, because it all file handles are stored in
+ my_file_info Default size is 16384 and this should be enough for most cases.If
+ it is not enough, --max-open-files with larger value can be used.
+
+ For Posix , my_file_info array is only used to store filenames for
+ error reporting and its size is not a limitation for number of open files.
+*/
+#ifdef _WIN32
+#define MY_NFILE (16384 + MY_FILE_MIN)
+#else
+#define MY_NFILE 64
+#endif
+
+#define OS_FILE_LIMIT UINT_MAX
+
+/*
+ Io buffer size; Must be a power of 2 and a multiple of 512. May be
+ smaller what the disk page size. This influences the speed of the
+ isam btree library. eg to big to slow.
+*/
+#define IO_SIZE 4096
+
+#if defined(_WIN32)
+#define socket_errno WSAGetLastError()
+#define SOCKET_EINTR WSAEINTR
+#define SOCKET_EAGAIN WSAEINPROGRESS
+#define SOCKET_EWOULDBLOCK WSAEWOULDBLOCK
+#define SOCKET_EADDRINUSE WSAEADDRINUSE
+#define SOCKET_ETIMEDOUT WSAETIMEDOUT
+#define SOCKET_ECONNRESET WSAECONNRESET
+#define SOCKET_ENFILE ENFILE
+#define SOCKET_EMFILE EMFILE
+#else /* Unix */
+#define socket_errno errno
+#define closesocket(A) close(A)
+#define SOCKET_EINTR EINTR
+#define SOCKET_EAGAIN EAGAIN
+#define SOCKET_EWOULDBLOCK EWOULDBLOCK
+#define SOCKET_EADDRINUSE EADDRINUSE
+#define SOCKET_ETIMEDOUT ETIMEDOUT
+#define SOCKET_ECONNRESET ECONNRESET
+#define SOCKET_ENFILE ENFILE
+#define SOCKET_EMFILE EMFILE
+#endif
+
+#ifndef _WIN32
+#define INVALID_SOCKET -1
+#endif /* _WIN32 */
+
+/* File permissions */
+#define USER_READ (1L << 0)
+#define USER_WRITE (1L << 1)
+#define USER_EXECUTE (1L << 2)
+#define GROUP_READ (1L << 3)
+#define GROUP_WRITE (1L << 4)
+#define GROUP_EXECUTE (1L << 5)
+#define OTHERS_READ (1L << 6)
+#define OTHERS_WRITE (1L << 7)
+#define OTHERS_EXECUTE (1L << 8)
+#define USER_RWX USER_READ | USER_WRITE | USER_EXECUTE
+#define GROUP_RWX GROUP_READ | GROUP_WRITE | GROUP_EXECUTE
+#define OTHERS_RWX OTHERS_READ | OTHERS_WRITE | OTHERS_EXECUTE
+
+#endif // MY_IO_INCLUDED
diff --git a/contrib/libs/libmysql_r/include/my_list.h b/contrib/libs/libmysql_r/include/my_list.h
new file mode 100644
index 0000000000..a19e414c53
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_list.h
@@ -0,0 +1,70 @@
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ Without limiting anything contained in the foregoing, this file,
+ which is part of C Driver for MySQL (Connector/C), is also subject to the
+ Universal FOSS Exception, version 1.0, a copy of which can be found at
+ http://oss.oracle.com/licenses/universal-foss-exception.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef _list_h_
+#define _list_h_
+
+/**
+ @file include/my_list.h
+*/
+
+/*
+ NOTE: This file should really include mysql/service_mysql_alloc.h
+ (due to the my_free() call in list_pop), but that is not acceptable
+ in client code, so it has been kept out.
+*/
+
+typedef struct LIST {
+#if defined(__cplusplus) && __cplusplus >= 201103L
+ struct LIST *prev{nullptr}, *next{nullptr};
+ void *data{nullptr};
+#else
+ struct LIST *prev, *next;
+ void *data;
+#endif
+} LIST;
+
+typedef int (*list_walk_action)(void *, void *);
+
+extern LIST *list_add(LIST *root, LIST *element);
+extern LIST *list_delete(LIST *root, LIST *element);
+extern LIST *list_cons(void *data, LIST *root);
+extern LIST *list_reverse(LIST *root);
+extern void list_free(LIST *root, unsigned int free_data);
+extern unsigned int list_length(LIST *);
+extern int list_walk(LIST *, list_walk_action action, unsigned char *argument);
+
+#define list_rest(a) ((a)->next)
+#define list_push(a, b) (a) = list_cons((b), (a))
+#define list_pop(A) \
+ { \
+ LIST *old = (A); \
+ (A) = list_delete(old, old); \
+ my_free(old); \
+ }
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/my_loglevel.h b/contrib/libs/libmysql_r/include/my_loglevel.h
new file mode 100644
index 0000000000..8554cba583
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_loglevel.h
@@ -0,0 +1,39 @@
+/*
+ Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MY_LOGLEVEL_H
+#define MY_LOGLEVEL_H
+
+/**
+ @file include/my_loglevel.h
+ Definition of the global "loglevel" enumeration.
+*/
+
+enum loglevel {
+ SYSTEM_LEVEL = 0,
+ ERROR_LEVEL = 1,
+ WARNING_LEVEL = 2,
+ INFORMATION_LEVEL = 3
+};
+
+#endif // MY_LOGLEVEL_H
diff --git a/contrib/libs/libmysql_r/include/my_macros.h b/contrib/libs/libmysql_r/include/my_macros.h
new file mode 100644
index 0000000000..02f6a048aa
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_macros.h
@@ -0,0 +1,89 @@
+/*
+ Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MY_MACROS_INCLUDED
+#define MY_MACROS_INCLUDED
+
+/**
+ @file include/my_macros.h
+ Some common macros. Note that some of these should probably be replaced
+ with code from \<algorithm\> or similar.
+*/
+
+#ifndef MYSQL_ABI_CHECK
+#include <stddef.h>
+#endif
+
+/* Macros to make switching between C and C++ mode easier */
+#ifdef __cplusplus
+#define C_MODE_START extern "C" {
+#define C_MODE_END }
+#else
+#define C_MODE_START
+#define C_MODE_END
+#endif
+
+/* Make it easier to add conditional code in _expressions_ */
+#ifdef _WIN32
+#define IF_WIN(A, B) A
+#else
+#define IF_WIN(A, B) B
+#endif
+
+/*
+ Two levels of macros are needed to stringify the
+ result of expansion of a macro argument.
+*/
+#define QUOTE_ARG(x) #x /* Quote argument (before cpp) */
+#define STRINGIFY_ARG(x) QUOTE_ARG(x) /* Quote argument, after cpp */
+
+#define MY_TEST(a) ((a) ? 1 : 0)
+#define MY_MAX(a, b) ((a) > (b) ? (a) : (b))
+#define MY_MIN(a, b) ((a) < (b) ? (a) : (b))
+#define set_if_bigger(a, b) \
+ do { \
+ if ((a) < (b)) (a) = (b); \
+ } while (0)
+#define set_if_smaller(a, b) \
+ do { \
+ if ((a) > (b)) (a) = (b); \
+ } while (0)
+#define test_all_bits(a, b) (((a) & (b)) == (b))
+
+/* Bug in developerstudio: use the C version */
+#if defined(__cplusplus) && !defined(__SUNPRO_CC)
+
+template <class T, size_t N>
+constexpr size_t array_elements(T (&)[N]) noexcept {
+ return N;
+}
+
+#else
+
+// Less type-safe version that e.g. allows sending in pointers
+// or STL containers without an error.
+#define array_elements(A) ((size_t)(sizeof(A) / sizeof(A[0])))
+
+#endif
+
+#endif // MY_MACROS_INCLUDED
diff --git a/contrib/libs/libmysql_r/include/my_md5.h b/contrib/libs/libmysql_r/include/my_md5.h
new file mode 100644
index 0000000000..9b96d94d4c
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_md5.h
@@ -0,0 +1,51 @@
+#ifndef MY_MD5_INCLUDED
+#define MY_MD5_INCLUDED
+
+/* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#include <sys/types.h>
+
+#include "m_string.h"
+#include "my_inttypes.h"
+
+/**
+ @file include/my_md5.h
+ Wrapper function for MD5 implementation.
+*/
+
+int compute_md5_hash(char *digest, const char *buf, int len);
+
+/*
+ Convert an array of bytes to a hexadecimal representation.
+
+ Used to generate a hexadecimal representation of a message digest.
+*/
+static inline void array_to_hex(char *to, const unsigned char *str, uint len) {
+ const unsigned char *str_end = str + len;
+ for (; str != str_end; ++str) {
+ *to++ = _dig_vec_lower[((uchar)*str) >> 4];
+ *to++ = _dig_vec_lower[((uchar)*str) & 0x0F];
+ }
+}
+
+#endif /* MY_MD5_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/my_murmur3.h b/contrib/libs/libmysql_r/include/my_murmur3.h
new file mode 100644
index 0000000000..eed2a469b1
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_murmur3.h
@@ -0,0 +1,37 @@
+#ifndef MY_MURMUR3_INCLUDED
+#define MY_MURMUR3_INCLUDED
+
+/* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/my_murmur3.h
+*/
+
+#include <stddef.h>
+
+#include "my_inttypes.h"
+#include "my_macros.h"
+
+uint32 murmur3_32(const uchar *key, size_t len, uint32 seed);
+
+#endif /* MY_MURMUR3_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/my_pointer_arithmetic.h b/contrib/libs/libmysql_r/include/my_pointer_arithmetic.h
new file mode 100644
index 0000000000..475867fd27
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_pointer_arithmetic.h
@@ -0,0 +1,51 @@
+#ifndef MY_POINTER_ARITHMETIC_INCLUDED
+#define MY_POINTER_ARITHMETIC_INCLUDED
+/*
+ Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#include <stdint.h>
+
+/**
+ @file include/my_pointer_arithmetic.h
+ Some macros for dealing with pointer arithmetic, e.g., aligning
+ of buffers to a given size.
+*/
+
+#define MY_ALIGN(A, L) (((A) + (L)-1) & ~((L)-1))
+#define ALIGN_SIZE(A) MY_ALIGN((A), sizeof(double))
+
+#ifdef __cplusplus
+
+template <typename T>
+bool is_aligned_to(T *t, int increment) {
+ return reinterpret_cast<uintptr_t>(t) % increment == 0;
+}
+
+template <typename T>
+bool is_aligned(T *t) {
+ return is_aligned_to(t, alignof(T));
+}
+
+#endif // __cplusplus
+
+#endif // MY_POINTER_ARITHMETIC_INCLUDED
diff --git a/contrib/libs/libmysql_r/include/my_psi_config.h b/contrib/libs/libmysql_r/include/my_psi_config.h
new file mode 100644
index 0000000000..5389734278
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_psi_config.h
@@ -0,0 +1,259 @@
+/*
+ Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MY_PSI_CONFIG_INCLUDED
+#define MY_PSI_CONFIG_INCLUDED
+
+/**
+ @file include/my_psi_config.h
+ Defines various enable/disable and HAVE_ macros related to the
+ performance schema instrumentation system, without pulling in
+ any system \#include files (which breaks the ABI checker).
+
+*/
+
+#include "my_config.h"
+
+#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
+#define HAVE_PSI_INTERFACE
+#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
+
+#ifdef HAVE_PSI_INTERFACE
+
+/**
+ @def DISABLE_PSI_MUTEX
+ Compiling option to disable the mutex instrumentation.
+ This option is mostly intended to be used during development,
+ when doing special builds with only a subset of the performance schema
+ instrumentation, for code analysis / profiling / performance tuning of a
+ specific instrumentation alone.
+ @sa DISABLE_PSI_COND
+ @sa DISABLE_PSI_DATA_LOCK
+ @sa DISABLE_PSI_ERROR
+ @sa DISABLE_PSI_FILE
+ @sa DISABLE_PSI_IDLE
+ @sa DISABLE_PSI_MEMORY
+ @sa DISABLE_PSI_METADATA
+ @sa DISABLE_PSI_PS
+ @sa DISABLE_PSI_RWLOCK
+ @sa DISABLE_PSI_SOCKET
+ @sa DISABLE_PSI_SP
+ @sa DISABLE_PSI_STAGE
+ @sa DISABLE_PSI_STATEMENT
+ @sa DISABLE_PSI_STATEMENT_DIGEST
+ @sa DISABLE_PSI_SYSTEM
+ @sa DISABLE_PSI_TABLE
+ @sa DISABLE_PSI_THREAD
+ @sa DISABLE_PSI_TRANSACTION
+ */
+
+#ifndef DISABLE_PSI_MUTEX
+#define HAVE_PSI_MUTEX_INTERFACE
+#endif /* DISABLE_PSI_MUTEX */
+
+/**
+ @def DISABLE_PSI_RWLOCK
+ Compiling option to disable the rwlock instrumentation.
+ @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_RWLOCK
+#define HAVE_PSI_RWLOCK_INTERFACE
+#endif /* DISABLE_PSI_RWLOCK */
+
+/**
+ @def DISABLE_PSI_COND
+ Compiling option to disable the cond instrumentation.
+ @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_COND
+#define HAVE_PSI_COND_INTERFACE
+#endif /* DISABLE_PSI_COND */
+
+/**
+ @def DISABLE_PSI_FILE
+ Compiling option to disable the file instrumentation.
+ @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_FILE
+#define HAVE_PSI_FILE_INTERFACE
+#endif /* DISABLE_PSI_FILE */
+
+/**
+ @def DISABLE_PSI_THREAD
+ Compiling option to disable the thread instrumentation.
+ @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_THREAD
+#define HAVE_PSI_THREAD_INTERFACE
+#endif /* DISABLE_PSI_THREAD */
+
+/**
+ @def DISABLE_PSI_TABLE
+ Compiling option to disable the table instrumentation.
+ @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_TABLE
+#define HAVE_PSI_TABLE_INTERFACE
+#endif /* DISABLE_PSI_TABLE */
+
+/**
+ @def DISABLE_PSI_STAGE
+ Compiling option to disable the stage instrumentation.
+ @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_STAGE
+#define HAVE_PSI_STAGE_INTERFACE
+#endif /* DISABLE_PSI_STAGE */
+
+/**
+ @def DISABLE_PSI_STATEMENT
+ Compiling option to disable the statement instrumentation.
+ @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_STATEMENT
+#define HAVE_PSI_STATEMENT_INTERFACE
+#endif /* DISABLE_PSI_STATEMENT */
+
+/**
+ @def DISABLE_PSI_SP
+ Compiling option to disable the stored program instrumentation.
+ @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_SP
+#define HAVE_PSI_SP_INTERFACE
+#endif /* DISABLE_PSI_SP */
+
+/**
+ @def DISABLE_PSI_PS
+ Compiling option to disable the prepared statement instrumentation.
+ @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_STATEMENT
+#ifndef DISABLE_PSI_PS
+#define HAVE_PSI_PS_INTERFACE
+#endif /* DISABLE_PSI_PS */
+#endif /* DISABLE_PSI_STATEMENT */
+
+/**
+ @def DISABLE_PSI_STATEMENT_DIGEST
+ Compiling option to disable the statement digest instrumentation.
+*/
+
+#ifndef DISABLE_PSI_STATEMENT
+#ifndef DISABLE_PSI_STATEMENT_DIGEST
+#define HAVE_PSI_STATEMENT_DIGEST_INTERFACE
+#endif /* DISABLE_PSI_STATEMENT_DIGEST */
+#endif /* DISABLE_PSI_STATEMENT */
+
+/**
+ @def DISABLE_PSI_TRANSACTION
+ Compiling option to disable the transaction instrumentation.
+ @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_TRANSACTION
+#define HAVE_PSI_TRANSACTION_INTERFACE
+#endif /* DISABLE_PSI_TRANSACTION */
+
+/**
+ @def DISABLE_PSI_SOCKET
+ Compiling option to disable the statement instrumentation.
+ @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_SOCKET
+#define HAVE_PSI_SOCKET_INTERFACE
+#endif /* DISABLE_PSI_SOCKET */
+
+/**
+ @def DISABLE_PSI_MEMORY
+ Compiling option to disable the memory instrumentation.
+ @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_MEMORY
+#define HAVE_PSI_MEMORY_INTERFACE
+#endif /* DISABLE_PSI_MEMORY */
+
+/**
+ @def DISABLE_PSI_ERROR
+ Compiling option to disable the error instrumentation.
+ @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_ERROR
+#define HAVE_PSI_ERROR_INTERFACE
+#endif /* DISABLE_PSI_ERROR */
+
+/**
+ @def DISABLE_PSI_IDLE
+ Compiling option to disable the idle instrumentation.
+ @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_IDLE
+#define HAVE_PSI_IDLE_INTERFACE
+#endif /* DISABLE_PSI_IDLE */
+
+/**
+ @def DISABLE_PSI_METADATA
+ Compiling option to disable the metadata instrumentation.
+ @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_METADATA
+#define HAVE_PSI_METADATA_INTERFACE
+#endif /* DISABLE_PSI_METADATA */
+
+/**
+ @def DISABLE_PSI_DATA_LOCK
+ Compiling option to disable the data lock instrumentation.
+ @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_DATA_LOCK
+#define HAVE_PSI_DATA_LOCK_INTERFACE
+#endif /* DISABLE_PSI_DATA_LOCK */
+
+/**
+ @def DISABLE_PSI_SYSTEM
+ Compiling option to disable the system instrumentation.
+ @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_SYSTEM
+#define HAVE_PSI_SYSTEM_INTERFACE
+#endif /* DISABLE_PSI_SYSTEM */
+
+#endif /* HAVE_PSI_INTERFACE */
+
+#endif // MY_PSI_CONFIG_INCLUDED
diff --git a/contrib/libs/libmysql_r/include/my_rdtsc.h b/contrib/libs/libmysql_r/include/my_rdtsc.h
new file mode 100644
index 0000000000..65f7df1945
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_rdtsc.h
@@ -0,0 +1,132 @@
+/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/my_rdtsc.h
+ Multi-platform timer code.
+*/
+
+#ifndef MY_RDTSC_H
+#define MY_RDTSC_H
+
+#include "my_inttypes.h"
+#include "my_macros.h"
+
+/**
+ Characteristics of a timer.
+*/
+struct my_timer_unit_info {
+ /** Routine used for the timer. */
+ ulonglong routine;
+ /** Overhead of the timer. */
+ ulonglong overhead;
+ /** Frequency of the timer. */
+ ulonglong frequency;
+ /** Resolution of the timer. */
+ ulonglong resolution;
+};
+
+/**
+ Characteristics of all the supported timers.
+ @sa my_timer_init().
+*/
+struct my_timer_info {
+ /** Characteristics of the cycle timer. */
+ struct my_timer_unit_info cycles;
+ /** Characteristics of the nanosecond timer. */
+ struct my_timer_unit_info nanoseconds;
+ /** Characteristics of the microsecond timer. */
+ struct my_timer_unit_info microseconds;
+ /** Characteristics of the millisecond timer. */
+ struct my_timer_unit_info milliseconds;
+ /** Characteristics of the tick timer. */
+ struct my_timer_unit_info ticks;
+};
+
+typedef struct my_timer_info MY_TIMER_INFO;
+
+/**
+ A cycle timer.
+ @return the current timer value, in cycles.
+*/
+ulonglong my_timer_cycles(void);
+
+/**
+ A namoseconds timer.
+ @return the current timer value, in nanoseconds.
+*/
+ulonglong my_timer_nanoseconds(void);
+
+/**
+ A microseconds timer.
+ @return the current timer value, in microseconds.
+*/
+ulonglong my_timer_microseconds(void);
+
+/**
+ A millisecond timer.
+ @return the current timer value, in milliseconds.
+*/
+ulonglong my_timer_milliseconds(void);
+
+/**
+ A ticks timer.
+ @return the current timer value, in ticks.
+*/
+ulonglong my_timer_ticks(void);
+
+/**
+ Timer initialization function.
+ @param [out] mti the timer characteristics.
+*/
+void my_timer_init(MY_TIMER_INFO *mti);
+
+#define MY_TIMER_ROUTINE_ASM_X86 1
+#define MY_TIMER_ROUTINE_ASM_X86_64 2
+/* #define MY_TIMER_ROUTINE_RDTSCLL 3 - No longer used */
+/* #define MY_TIMER_ROUTINE_ASM_X86_WIN 4 - No longer used */
+#define MY_TIMER_ROUTINE_RDTSC 5
+#define MY_TIMER_ROUTINE_ASM_IA64 6
+#define MY_TIMER_ROUTINE_ASM_PPC 7
+/* #define MY_TIMER_ROUTINE_SGI_CYCLE 8 - No longer used */
+#define MY_TIMER_ROUTINE_GETHRTIME 9
+/* #define MY_TIMER_ROUTINE_READ_REAL_TIME 10 - No longer used */
+#define MY_TIMER_ROUTINE_CLOCK_GETTIME 11
+#define MY_TIMER_ROUTINE_NXGETTIME 12
+#define MY_TIMER_ROUTINE_GETTIMEOFDAY 13
+#define MY_TIMER_ROUTINE_QUERYPERFORMANCECOUNTER 14
+#define MY_TIMER_ROUTINE_GETTICKCOUNT 15
+/* #define MY_TIMER_ROUTINE_TIME 16 - No longer used */
+#define MY_TIMER_ROUTINE_TIMES 17
+/* #define MY_TIMER_ROUTINE_FTIME 18 - No longer used */
+#define MY_TIMER_ROUTINE_ASM_PPC64 19
+#define MY_TIMER_ROUTINE_ASM_SUNPRO_SPARC64 20
+#define MY_TIMER_ROUTINE_ASM_SUNPRO_SPARC32 21
+#define MY_TIMER_ROUTINE_ASM_SUNPRO_I386 22
+#define MY_TIMER_ROUTINE_ASM_GCC_SPARC64 23
+#define MY_TIMER_ROUTINE_ASM_GCC_SPARC32 24
+#define MY_TIMER_ROUTINE_MACH_ABSOLUTE_TIME 25
+#define MY_TIMER_ROUTINE_GETSYSTEMTIMEASFILETIME 26
+#define MY_TIMER_ROUTINE_ASM_SUNPRO_X86_64 27
+#define MY_TIMER_ROUTINE_ASM_AARCH64 28
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/my_rnd.h b/contrib/libs/libmysql_r/include/my_rnd.h
new file mode 100644
index 0000000000..8aa6dedf5d
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_rnd.h
@@ -0,0 +1,39 @@
+#ifndef MY_RANDOM_INCLUDED
+#define MY_RANDOM_INCLUDED
+
+/*
+ Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/my_rnd.h
+ A wrapper to use OpenSSL/wolfSSL PRNGs.
+*/
+
+#include <stddef.h>
+
+#include "mysql_com.h" // IWYU pragma: keep
+
+double my_rnd_ssl(struct rand_struct *rand_st);
+int my_rand_buffer(unsigned char *buffer, size_t buffer_size);
+
+#endif /* MY_RANDOM_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/my_sharedlib.h b/contrib/libs/libmysql_r/include/my_sharedlib.h
new file mode 100644
index 0000000000..6a6317a780
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_sharedlib.h
@@ -0,0 +1,73 @@
+/*
+ Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MY_SHAREDLIB_INCLUDED
+#define MY_SHAREDLIB_INCLUDED
+
+/**
+ @file include/my_sharedlib.h
+ Functions related to handling of plugins and other dynamically loaded
+ libraries.
+*/
+
+#if defined(_WIN32)
+#define dlsym(lib, name) (void *)GetProcAddress((HMODULE)lib, name)
+#define dlopen(libname, unused) LoadLibraryEx(libname, NULL, 0)
+#define dlclose(lib) FreeLibrary((HMODULE)lib)
+#define DLERROR_GENERATE(errmsg, error_number) \
+ char win_errormsg[2048]; \
+ if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, error_number, 0, \
+ win_errormsg, 2048, NULL)) { \
+ char *ptr; \
+ for (ptr = &win_errormsg[0] + strlen(win_errormsg) - 1; \
+ ptr >= &win_errormsg[0] && strchr("\r\n\t\0x20", *ptr); ptr--) \
+ *ptr = 0; \
+ errmsg = win_errormsg; \
+ } else \
+ errmsg = ""
+#define dlerror() ""
+#define dlopen_errno GetLastError()
+
+#else /* _WIN32 */
+
+#ifndef MYSQL_ABI_CHECK
+#include <dlfcn.h>
+#include <errno.h>
+#endif
+
+#define DLERROR_GENERATE(errmsg, error_number) errmsg = dlerror()
+#define dlopen_errno errno
+#endif /* _WIN32 */
+
+/*
+ MYSQL_PLUGIN_IMPORT macro is used to export mysqld data
+ (i.e variables) for usage in storage engine loadable plugins.
+ Outside of Windows, it is dummy.
+*/
+#if (defined(_WIN32) && defined(MYSQL_DYNAMIC_PLUGIN))
+#define MYSQL_PLUGIN_IMPORT __declspec(dllimport)
+#else
+#define MYSQL_PLUGIN_IMPORT
+#endif
+
+#endif // MY_SHAREDLIB_INCLUDED
diff --git a/contrib/libs/libmysql_r/include/my_shm_defaults.h b/contrib/libs/libmysql_r/include/my_shm_defaults.h
new file mode 100644
index 0000000000..83228b09a0
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_shm_defaults.h
@@ -0,0 +1,39 @@
+/*
+ Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MY_SHM_DEFAULTS_INCLUDED
+#define MY_SHM_DEFAULTS_INCLUDED
+
+/**
+ @file include/my_shm_defaults.h
+ A few default values for shared memory, used in multiple places.
+*/
+
+#if defined(_WIN32)
+
+/* Shared memory and named pipe connections are supported. */
+#define shared_memory_buffer_length 16000
+#define default_shared_memory_base_name "MYSQL"
+#endif /* _WIN32*/
+
+#endif // MY_SHM_DEFAULTS_INCLUDED
diff --git a/contrib/libs/libmysql_r/include/my_sqlcommand.h b/contrib/libs/libmysql_r/include/my_sqlcommand.h
new file mode 100644
index 0000000000..4b1ba29292
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_sqlcommand.h
@@ -0,0 +1,209 @@
+/* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License, version 2.0,
+as published by the Free Software Foundation.
+
+This program is also distributed with certain software (including
+but not limited to OpenSSL) that is licensed under separate terms,
+as designated in a particular file or component or in included license
+documentation. The authors of MySQL hereby grant you an additional
+permission to link the program and your derivative works with the
+separately licensed software that they have included with MySQL.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License, version 2.0, for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef _mysql_sql_command_h
+#define _mysql_sql_command_h
+
+/**
+ @file include/my_sqlcommand.h
+*/
+
+/*
+ @enum enum_sql_command
+ @brief SQL Commands
+
+ SQL Command is resolved during SQL parsing and assigned to the Lex
+ object, accessible from the THD.
+
+ When a command is added here, be sure it's also added in mysqld.cc
+ in "struct show_var_st status_vars[]= {" ...
+
+ If the command returns a result set or is not allowed in stored
+ functions or triggers, please also make sure that
+ sp_get_flags_for_command (sp_head.cc) returns proper flags for the
+ added SQLCOM_.
+*/
+enum enum_sql_command {
+ SQLCOM_SELECT,
+ SQLCOM_CREATE_TABLE,
+ SQLCOM_CREATE_INDEX,
+ SQLCOM_ALTER_TABLE,
+ SQLCOM_UPDATE,
+ SQLCOM_INSERT,
+ SQLCOM_INSERT_SELECT,
+ SQLCOM_DELETE,
+ SQLCOM_TRUNCATE,
+ SQLCOM_DROP_TABLE,
+ SQLCOM_DROP_INDEX,
+ SQLCOM_SHOW_DATABASES,
+ SQLCOM_SHOW_TABLES,
+ SQLCOM_SHOW_FIELDS,
+ SQLCOM_SHOW_KEYS,
+ SQLCOM_SHOW_VARIABLES,
+ SQLCOM_SHOW_STATUS,
+ SQLCOM_SHOW_ENGINE_LOGS,
+ SQLCOM_SHOW_ENGINE_STATUS,
+ SQLCOM_SHOW_ENGINE_MUTEX,
+ SQLCOM_SHOW_PROCESSLIST,
+ SQLCOM_SHOW_MASTER_STAT,
+ SQLCOM_SHOW_SLAVE_STAT,
+ SQLCOM_SHOW_GRANTS,
+ SQLCOM_SHOW_CREATE,
+ SQLCOM_SHOW_CHARSETS,
+ SQLCOM_SHOW_COLLATIONS,
+ SQLCOM_SHOW_CREATE_DB,
+ SQLCOM_SHOW_TABLE_STATUS,
+ SQLCOM_SHOW_TRIGGERS,
+ SQLCOM_LOAD,
+ SQLCOM_SET_OPTION,
+ SQLCOM_LOCK_TABLES,
+ SQLCOM_UNLOCK_TABLES,
+ SQLCOM_GRANT,
+ SQLCOM_CHANGE_DB,
+ SQLCOM_CREATE_DB,
+ SQLCOM_DROP_DB,
+ SQLCOM_ALTER_DB,
+ SQLCOM_REPAIR,
+ SQLCOM_REPLACE,
+ SQLCOM_REPLACE_SELECT,
+ SQLCOM_CREATE_FUNCTION,
+ SQLCOM_DROP_FUNCTION,
+ SQLCOM_REVOKE,
+ SQLCOM_OPTIMIZE,
+ SQLCOM_CHECK,
+ SQLCOM_ASSIGN_TO_KEYCACHE,
+ SQLCOM_PRELOAD_KEYS,
+ SQLCOM_FLUSH,
+ SQLCOM_KILL,
+ SQLCOM_ANALYZE,
+ SQLCOM_ROLLBACK,
+ SQLCOM_ROLLBACK_TO_SAVEPOINT,
+ SQLCOM_COMMIT,
+ SQLCOM_SAVEPOINT,
+ SQLCOM_RELEASE_SAVEPOINT,
+ SQLCOM_SLAVE_START,
+ SQLCOM_SLAVE_STOP,
+ SQLCOM_START_GROUP_REPLICATION,
+ SQLCOM_STOP_GROUP_REPLICATION,
+ SQLCOM_BEGIN,
+ SQLCOM_CHANGE_MASTER,
+ SQLCOM_CHANGE_REPLICATION_FILTER,
+ SQLCOM_RENAME_TABLE,
+ SQLCOM_RESET,
+ SQLCOM_PURGE,
+ SQLCOM_PURGE_BEFORE,
+ SQLCOM_SHOW_BINLOGS,
+ SQLCOM_SHOW_OPEN_TABLES,
+ SQLCOM_HA_OPEN,
+ SQLCOM_HA_CLOSE,
+ SQLCOM_HA_READ,
+ SQLCOM_SHOW_SLAVE_HOSTS,
+ SQLCOM_DELETE_MULTI,
+ SQLCOM_UPDATE_MULTI,
+ SQLCOM_SHOW_BINLOG_EVENTS,
+ SQLCOM_DO,
+ SQLCOM_SHOW_WARNS,
+ SQLCOM_EMPTY_QUERY,
+ SQLCOM_SHOW_ERRORS,
+ SQLCOM_SHOW_STORAGE_ENGINES,
+ SQLCOM_SHOW_PRIVILEGES,
+ SQLCOM_HELP,
+ SQLCOM_CREATE_USER,
+ SQLCOM_DROP_USER,
+ SQLCOM_RENAME_USER,
+ SQLCOM_REVOKE_ALL,
+ SQLCOM_CHECKSUM,
+ SQLCOM_CREATE_PROCEDURE,
+ SQLCOM_CREATE_SPFUNCTION,
+ SQLCOM_CALL,
+ SQLCOM_DROP_PROCEDURE,
+ SQLCOM_ALTER_PROCEDURE,
+ SQLCOM_ALTER_FUNCTION,
+ SQLCOM_SHOW_CREATE_PROC,
+ SQLCOM_SHOW_CREATE_FUNC,
+ SQLCOM_SHOW_STATUS_PROC,
+ SQLCOM_SHOW_STATUS_FUNC,
+ SQLCOM_PREPARE,
+ SQLCOM_EXECUTE,
+ SQLCOM_DEALLOCATE_PREPARE,
+ SQLCOM_CREATE_VIEW,
+ SQLCOM_DROP_VIEW,
+ SQLCOM_CREATE_TRIGGER,
+ SQLCOM_DROP_TRIGGER,
+ SQLCOM_XA_START,
+ SQLCOM_XA_END,
+ SQLCOM_XA_PREPARE,
+ SQLCOM_XA_COMMIT,
+ SQLCOM_XA_ROLLBACK,
+ SQLCOM_XA_RECOVER,
+ SQLCOM_SHOW_PROC_CODE,
+ SQLCOM_SHOW_FUNC_CODE,
+ SQLCOM_ALTER_TABLESPACE,
+ SQLCOM_INSTALL_PLUGIN,
+ SQLCOM_UNINSTALL_PLUGIN,
+ SQLCOM_BINLOG_BASE64_EVENT,
+ SQLCOM_SHOW_PLUGINS,
+ SQLCOM_CREATE_SERVER,
+ SQLCOM_DROP_SERVER,
+ SQLCOM_ALTER_SERVER,
+ SQLCOM_CREATE_EVENT,
+ SQLCOM_ALTER_EVENT,
+ SQLCOM_DROP_EVENT,
+ SQLCOM_SHOW_CREATE_EVENT,
+ SQLCOM_SHOW_EVENTS,
+ SQLCOM_SHOW_CREATE_TRIGGER,
+ SQLCOM_SHOW_PROFILE,
+ SQLCOM_SHOW_PROFILES,
+ SQLCOM_SIGNAL,
+ SQLCOM_RESIGNAL,
+ SQLCOM_SHOW_RELAYLOG_EVENTS,
+ SQLCOM_GET_DIAGNOSTICS,
+ SQLCOM_ALTER_USER,
+ SQLCOM_EXPLAIN_OTHER,
+ SQLCOM_SHOW_CREATE_USER,
+ SQLCOM_SHUTDOWN,
+ SQLCOM_SET_PASSWORD,
+ SQLCOM_ALTER_INSTANCE,
+ SQLCOM_INSTALL_COMPONENT,
+ SQLCOM_UNINSTALL_COMPONENT,
+ SQLCOM_CREATE_ROLE,
+ SQLCOM_DROP_ROLE,
+ SQLCOM_SET_ROLE,
+ SQLCOM_GRANT_ROLE,
+ SQLCOM_REVOKE_ROLE,
+ SQLCOM_ALTER_USER_DEFAULT_ROLE,
+ SQLCOM_IMPORT,
+ SQLCOM_CREATE_RESOURCE_GROUP,
+ SQLCOM_ALTER_RESOURCE_GROUP,
+ SQLCOM_DROP_RESOURCE_GROUP,
+ SQLCOM_SET_RESOURCE_GROUP,
+ SQLCOM_CLONE,
+ SQLCOM_LOCK_INSTANCE,
+ SQLCOM_UNLOCK_INSTANCE,
+ SQLCOM_RESTART_SERVER,
+ SQLCOM_CREATE_SRS,
+ SQLCOM_DROP_SRS,
+ /* This should be the last !!! */
+ SQLCOM_END
+};
+
+#endif /* _mysql_sql_command_h */
diff --git a/contrib/libs/libmysql_r/include/my_stacktrace.h b/contrib/libs/libmysql_r/include/my_stacktrace.h
new file mode 100644
index 0000000000..1fb7c96537
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_stacktrace.h
@@ -0,0 +1,126 @@
+/* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MY_STACKTRACE_INCLUDED
+#define MY_STACKTRACE_INCLUDED
+
+/**
+ @file include/my_stacktrace.h
+*/
+
+#include <stddef.h>
+#include <sys/types.h>
+
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
+#include "my_compiler.h"
+#include "my_config.h"
+#include "my_inttypes.h"
+#include "my_macros.h"
+
+/*
+ HAVE_BACKTRACE - Linux, FreeBSD, OSX, Solaris
+ _WIN32 - Windows
+*/
+#if defined(HAVE_BACKTRACE) || defined(_WIN32)
+#define HAVE_STACKTRACE 1
+void my_init_stacktrace();
+void my_print_stacktrace(uchar *stack_bottom, ulong thread_stack);
+void my_safe_puts_stderr(const char *val, size_t max_len);
+
+#ifdef _WIN32
+void my_set_exception_pointers(EXCEPTION_POINTERS *ep);
+void my_create_minidump(const char *name, HANDLE process, DWORD pid);
+#endif
+#endif /* HAVE_BACKTRACE || _WIN32 */
+
+void my_write_core(int sig);
+
+/**
+ Async-signal-safe utility functions used by signal handler routines.
+ Declared here in order to unit-test them.
+ These are not general-purpose, but tailored to the signal handling routines.
+*/
+/**
+ Converts a longlong value to string.
+ @param base 10 for decimal, 16 for hex values (0..9a..f)
+ @param val The value to convert
+ @param buf Assumed to point to the *end* of the buffer.
+ @returns Pointer to the first character of the converted string.
+ Negative values:
+ for base-10 the return string will be prepended with '-'
+ for base-16 the return string will contain 16 characters
+ Implemented with simplicity, and async-signal-safety in mind.
+*/
+char *my_safe_itoa(int base, longlong val, char *buf);
+
+/**
+ Converts a ulonglong value to string.
+ @param base 10 for decimal, 16 for hex values (0..9a..f)
+ @param val The value to convert
+ @param buf Assumed to point to the *end* of the buffer.
+ @returns Pointer to the first character of the converted string.
+ Implemented with simplicity, and async-signal-safety in mind.
+*/
+char *my_safe_utoa(int base, ulonglong val, char *buf);
+
+/**
+ A (very) limited version of snprintf.
+ @param to Destination buffer.
+ @param n Size of destination buffer.
+ @param fmt printf() style format string.
+ @returns Number of bytes written, including terminating '\0'
+ Supports 'd' 'i' 'u' 'x' 'p' 's' conversion.
+ Supports 'l' and 'll' modifiers for integral types.
+ Does not support any width/precision.
+ Implemented with simplicity, and async-signal-safety in mind.
+*/
+size_t my_safe_snprintf(char *to, size_t n, const char *fmt, ...)
+ MY_ATTRIBUTE((format(printf, 3, 4)));
+
+/**
+ A (very) limited version of snprintf, which writes the result to STDERR.
+ @sa my_safe_snprintf
+ Implemented with simplicity, and async-signal-safety in mind.
+ @note Has an internal buffer capacity of 512 bytes,
+ which should suffice for our signal handling routines.
+*/
+size_t my_safe_printf_stderr(const char *fmt, ...)
+ MY_ATTRIBUTE((format(printf, 1, 2)));
+
+/**
+ Writes up to count bytes from buffer to STDERR.
+ Implemented with simplicity, and async-signal-safety in mind.
+ @param buf Buffer containing data to be written.
+ @param count Number of bytes to write.
+ @returns Number of bytes written.
+*/
+size_t my_write_stderr(const void *buf, size_t count);
+
+/**
+ Writes system time to STDERR without allocating new memory.
+*/
+void my_safe_print_system_time();
+
+#endif // MY_STACKTRACE_INCLUDED
diff --git a/contrib/libs/libmysql_r/include/my_sys.h b/contrib/libs/libmysql_r/include/my_sys.h
new file mode 100644
index 0000000000..152422d511
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_sys.h
@@ -0,0 +1,1048 @@
+/* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef _my_sys_h
+#define _my_sys_h
+
+/**
+ @defgroup MYSYS Mysys - low level utilities for MySQL
+ @ingroup Runtime_Environment
+ @{
+ @file include/my_sys.h Common header for many mysys elements.
+ @note Many mysys implementation files now have their own header file.
+*/
+
+#include "my_config.h"
+
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
+#include <limits.h>
+#ifdef _WIN32
+#include <malloc.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <stdarg.h>
+#include <stdio.h>
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#include <sys/types.h>
+#include <time.h>
+
+#include "m_string.h" /* IWYU pragma: keep */
+#include "my_compiler.h"
+#include "my_inttypes.h"
+#include "my_loglevel.h"
+#include "my_psi_config.h" /* IWYU pragma: keep */
+#include "my_sharedlib.h"
+#include "mysql/components/services/my_io_bits.h"
+#include "mysql/components/services/mysql_cond_bits.h"
+#include "mysql/components/services/mysql_mutex_bits.h"
+#include "mysql/components/services/psi_file_bits.h"
+#include "mysql/components/services/psi_memory_bits.h"
+#include "mysql/components/services/psi_stage_bits.h"
+#include "mysql/psi/psi_base.h"
+#include "sql/stream_cipher.h"
+
+struct CHARSET_INFO;
+struct MY_CHARSET_LOADER;
+
+struct PSI_cond_bootstrap;
+struct PSI_data_lock_bootstrap;
+struct PSI_error_bootstrap;
+struct PSI_file_bootstrap;
+struct PSI_idle_bootstrap;
+struct PSI_mdl_bootstrap;
+struct PSI_memory_bootstrap;
+struct PSI_mutex_bootstrap;
+struct PSI_rwlock_bootstrap;
+struct PSI_socket_bootstrap;
+struct PSI_stage_bootstrap;
+struct PSI_statement_bootstrap;
+struct PSI_system_bootstrap;
+struct PSI_table_bootstrap;
+struct PSI_thread_bootstrap;
+struct PSI_transaction_bootstrap;
+struct MEM_ROOT;
+
+#define MY_INIT(name) \
+ { \
+ my_progname = name; \
+ my_init(); \
+ }
+
+/**
+ Max length of an error message generated by mysys utilities.
+ Some mysys functions produce error messages. These mostly go
+ to stderr.
+ This constant defines the size of the buffer used to format
+ the message. It should be kept in sync with MYSQL_ERRMSG_SIZE,
+ since sometimes mysys errors are stored in the server diagnostics
+ area, and we would like to avoid unexpected truncation.
+*/
+#define MYSYS_ERRMSG_SIZE (512)
+#define MYSYS_STRERROR_SIZE (128)
+
+#define MY_FILE_ERROR ((size_t)-1)
+
+/* General bitmaps for my_func's */
+#define MY_FFNF 1 /* Fatal if file not found */
+#define MY_FNABP 2 /* Fatal if not all bytes read/writen */
+#define MY_NABP 4 /* Error if not all bytes read/writen */
+#define MY_FAE 8 /* Fatal if any error */
+#define MY_WME 16 /* Write message on error */
+#define MY_WAIT_IF_FULL 32 /* Wait and try again if disk full error */
+#define MY_IGNORE_BADFD 32 /* my_sync: ignore 'bad descriptor' errors */
+#define MY_SYNC_DIR 8192 /* my_create/delete/rename: sync directory */
+#define MY_REPORT_WAITING_IF_FULL 64 /* my_write: set status as waiting */
+#define MY_FULL_IO 512 /* For my_read - loop intil I/O is complete */
+#define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */
+#define MY_LINK_WARNING 32 /* my_redel() gives warning if links */
+#define MY_COPYTIME 64 /* my_redel() copys time */
+#define MY_DELETE_OLD 256 /* my_create_with_symlink() */
+#define MY_RESOLVE_LINK 128 /* my_realpath(); Only resolve links */
+#define MY_HOLD_ORIGINAL_MODES 128 /* my_copy() holds to file modes */
+#define MY_SEEK_NOT_DONE 32 /* my_lock may have to do a seek */
+#define MY_DONT_WAIT 64 /* my_lock() don't wait if can't lock */
+#define MY_ZEROFILL 32 /* my_malloc(), fill array with zero */
+#define MY_ALLOW_ZERO_PTR 64 /* my_realloc() ; zero ptr -> malloc */
+#define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */
+#define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */
+#define MY_DONT_OVERWRITE_FILE 1024 /* my_copy: Don't overwrite file */
+#define MY_THREADSAFE 2048 /* my_seek(): lock fd mutex */
+#define MY_SYNC 4096 /* my_copy(): sync dst file */
+
+#define MYF_RW MYF(MY_WME + MY_NABP) /* For my_read & my_write */
+
+#define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */
+#define MY_GIVE_INFO 2 /* Give time info about process*/
+#define MY_DONT_FREE_DBUG 4 /* Do not call DBUG_END() in my_end() */
+
+/* Flags for my_error() */
+#define ME_BELL 4 /* DEPRECATED: Ring bell then printing message */
+#define ME_ERRORLOG 64 /* Write the error message to error log */
+#define ME_FATALERROR 1024 /* Fatal statement error */
+
+/* Bits in last argument to fn_format */
+#define MY_REPLACE_DIR 1 /* replace dir in name with 'dir' */
+#define MY_REPLACE_EXT 2 /* replace extension with 'ext' */
+#define MY_UNPACK_FILENAME 4 /* Unpack name (~ -> home) */
+/* 8 Unused. Previously used for MY_PACK_FILENAME. */
+#define MY_RESOLVE_SYMLINKS 16 /* Resolve all symbolic links */
+#define MY_RETURN_REAL_PATH 32 /* return full path for file */
+#define MY_SAFE_PATH 64 /* Return NULL if too long path */
+#define MY_RELATIVE_PATH 128 /* name is relative to 'dir' */
+#define MY_APPEND_EXT 256 /* add 'ext' as additional extension*/
+
+/* My seek flags */
+#define MY_SEEK_SET 0
+#define MY_SEEK_CUR 1
+#define MY_SEEK_END 2
+
+/* Some constants */
+#define MY_WAIT_FOR_USER_TO_FIX_PANIC 60 /* in seconds */
+#define MY_WAIT_GIVE_USER_A_MESSAGE 10 /* Every 10 times of prev */
+#define MIN_COMPRESS_LENGTH 50 /* Don't compress small bl. */
+#define DFLT_INIT_HITS 3
+
+/* root_alloc flags */
+#define MY_KEEP_PREALLOC 1
+#define MY_MARK_BLOCKS_FREE 2 /* move used to free list and reuse them */
+
+/* Internal error numbers (for assembler functions) */
+#define MY_ERRNO_EDOM 33
+#define MY_ERRNO_ERANGE 34
+
+/* defines when allocating data */
+extern void *my_multi_malloc(PSI_memory_key key, myf flags, ...);
+
+/*
+ Switch to my_malloc() if the memory block to be allocated is bigger than
+ max_alloca_sz.
+*/
+extern PSI_memory_key key_memory_max_alloca;
+#define my_safe_alloca(size, max_alloca_sz) \
+ ((size <= max_alloca_sz) ? my_alloca(size) \
+ : my_malloc(key_memory_max_alloca, size, MYF(0)))
+#define my_safe_afree(ptr, size, max_alloca_sz) \
+ if (size > max_alloca_sz) my_free(ptr)
+
+#if defined(ENABLED_DEBUG_SYNC)
+extern "C" void (*debug_sync_C_callback_ptr)(const char *, size_t);
+#define DEBUG_SYNC_C(_sync_point_name_) \
+ do { \
+ if (debug_sync_C_callback_ptr != NULL) \
+ (*debug_sync_C_callback_ptr)(STRING_WITH_LEN(_sync_point_name_)); \
+ } while (0)
+#define DEBUG_SYNC_C_IF_THD(thd, _sync_point_name_) \
+ do { \
+ if (debug_sync_C_callback_ptr != NULL && thd) \
+ (*debug_sync_C_callback_ptr)(STRING_WITH_LEN(_sync_point_name_)); \
+ } while (0)
+#else
+#define DEBUG_SYNC_C(_sync_point_name_)
+#define DEBUG_SYNC_C_IF_THD(thd, _sync_point_name_)
+#endif /* defined(ENABLED_DEBUG_SYNC) */
+
+#ifdef HAVE_LINUX_LARGE_PAGES
+extern uint my_get_large_page_size(void);
+#else
+#define my_get_large_page_size() (0)
+#endif /* HAVE_LINUX_LARGE_PAGES */
+
+#define my_alloca(SZ) alloca((size_t)(SZ))
+
+extern char *home_dir; /* Home directory for user */
+extern const char *my_progname; /* program-name (printed in errors) */
+extern void (*error_handler_hook)(uint my_err, const char *str, myf MyFlags);
+extern void (*fatal_error_handler_hook)(uint my_err, const char *str,
+ myf MyFlags);
+extern void (*local_message_hook)(enum loglevel ll, uint ecode, va_list args);
+extern uint my_file_limit;
+extern MYSQL_PLUGIN_IMPORT ulong my_thread_stack_size;
+
+/*
+ Hooks for reporting execution stage information. The server implementation
+ of these will also set THD::current_cond/current_mutex.
+ By having hooks, we avoid direct dependencies on server code.
+*/
+extern void (*enter_cond_hook)(void *opaque_thd, mysql_cond_t *cond,
+ mysql_mutex_t *mutex,
+ const PSI_stage_info *stage,
+ PSI_stage_info *old_stage,
+ const char *src_function, const char *src_file,
+ int src_line);
+
+extern void (*exit_cond_hook)(void *opaque_thd, const PSI_stage_info *stage,
+ const char *src_function, const char *src_file,
+ int src_line);
+
+extern void (*enter_stage_hook)(void *opaque_thd,
+ const PSI_stage_info *new_stage,
+ PSI_stage_info *old_stage,
+ const char *src_function, const char *src_file,
+ int src_line);
+
+/*
+ Hook for setting THD waiting_for_disk_space flag.
+*/
+extern void (*set_waiting_for_disk_space_hook)(void *opaque_thd, bool waiting);
+/*
+ Hook for checking if the thread has been killed.
+*/
+extern int (*is_killed_hook)(const void *opaque_thd);
+
+/* charsets */
+#define MY_ALL_CHARSETS_SIZE 2048
+extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *default_charset_info;
+extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *all_charsets[MY_ALL_CHARSETS_SIZE];
+extern CHARSET_INFO compiled_charsets[];
+
+/* statistics */
+extern ulong my_file_opened, my_stream_opened, my_tmp_file_created;
+extern ulong my_file_total_opened;
+extern bool my_init_done;
+
+extern MYSQL_PLUGIN_IMPORT int my_umask; /* Default creation mask */
+extern int my_umask_dir;
+
+extern ulong my_default_record_cache_size;
+extern bool my_disable_locking, my_enable_symlinks;
+
+extern const char *charsets_dir;
+
+enum cache_type {
+ TYPE_NOT_SET = 0,
+ READ_CACHE,
+ WRITE_CACHE,
+ SEQ_READ_APPEND /* sequential read or append */,
+ READ_FIFO,
+ READ_NET,
+ WRITE_NET
+};
+
+enum flush_type {
+ FLUSH_KEEP, /* flush block and keep it in the cache */
+ FLUSH_RELEASE, /* flush block and remove it from the cache */
+ FLUSH_IGNORE_CHANGED, /* remove block from the cache */
+ /*
+ As my_disable_flush_pagecache_blocks is always 0, the following option
+ is strictly equivalent to FLUSH_KEEP
+ */
+ FLUSH_FORCE_WRITE
+};
+
+/*
+ How was this file opened (for debugging purposes).
+ The important part is whether it is UNOPEN or not.
+ */
+enum file_type {
+ UNOPEN = 0,
+ FILE_BY_OPEN,
+ FILE_BY_CREATE,
+ STREAM_BY_FOPEN,
+ STREAM_BY_FDOPEN,
+ FILE_BY_MKSTEMP,
+ FILE_BY_O_TMPFILE
+};
+
+struct st_my_file_info {
+ char *name;
+#ifdef _WIN32
+ HANDLE fhandle; /* win32 file handle */
+ int oflag; /* open flags, e.g O_APPEND */
+#endif
+ enum file_type type;
+};
+
+extern struct st_my_file_info *my_file_info;
+
+struct DYNAMIC_ARRAY {
+ uchar *buffer{nullptr};
+ uint elements{0}, max_element{0};
+ uint alloc_increment{0};
+ uint size_of_element{0};
+ PSI_memory_key m_psi_key{PSI_NOT_INSTRUMENTED};
+};
+
+struct MY_TMPDIR {
+ char **list{nullptr};
+ uint cur{0}, max{0};
+ mysql_mutex_t mutex;
+};
+
+struct DYNAMIC_STRING {
+ char *str;
+ size_t length, max_length, alloc_increment;
+};
+
+struct IO_CACHE;
+typedef int (*IO_CACHE_CALLBACK)(IO_CACHE *);
+
+struct IO_CACHE_SHARE {
+ mysql_mutex_t mutex; /* To sync on reads into buffer. */
+ mysql_cond_t cond; /* To wait for signals. */
+ mysql_cond_t cond_writer; /* For a synchronized writer. */
+ /* Offset in file corresponding to the first byte of buffer. */
+ my_off_t pos_in_file;
+ /* If a synchronized write cache is the source of the data. */
+ IO_CACHE *source_cache;
+ uchar *buffer; /* The read buffer. */
+ uchar *read_end; /* Behind last valid byte of buffer. */
+ int running_threads; /* threads not in lock. */
+ int total_threads; /* threads sharing the cache. */
+ int error; /* Last error. */
+};
+
+struct IO_CACHE /* Used when cacheing files */
+{
+ /* Offset in file corresponding to the first byte of uchar* buffer. */
+ my_off_t pos_in_file{0};
+ /*
+ The offset of end of file for READ_CACHE and WRITE_CACHE.
+ For SEQ_READ_APPEND it the maximum of the actual end of file and
+ the position represented by read_end.
+ */
+ my_off_t end_of_file{0};
+ /* Points to current read position in the buffer */
+ uchar *read_pos{nullptr};
+ /* the non-inclusive boundary in the buffer for the currently valid read */
+ uchar *read_end{nullptr};
+ uchar *buffer{nullptr}; /* The read buffer */
+ /* Used in ASYNC_IO */
+ uchar *request_pos{nullptr};
+
+ /* Only used in WRITE caches and in SEQ_READ_APPEND to buffer writes */
+ uchar *write_buffer{nullptr};
+ /*
+ Only used in SEQ_READ_APPEND, and points to the current read position
+ in the write buffer. Note that reads in SEQ_READ_APPEND caches can
+ happen from both read buffer (uchar* buffer) and write buffer
+ (uchar* write_buffer).
+ */
+ uchar *append_read_pos{nullptr};
+ /* Points to current write position in the write buffer */
+ uchar *write_pos{nullptr};
+ /* The non-inclusive boundary of the valid write area */
+ uchar *write_end{nullptr};
+
+ /*
+ Current_pos and current_end are convenience variables used by
+ my_b_tell() and other routines that need to know the current offset
+ current_pos points to &write_pos, and current_end to &write_end in a
+ WRITE_CACHE, and &read_pos and &read_end respectively otherwise
+ */
+ uchar **current_pos{nullptr}, **current_end{nullptr};
+
+ /*
+ The lock is for append buffer used in SEQ_READ_APPEND cache
+ need mutex copying from append buffer to read buffer.
+ */
+ mysql_mutex_t append_buffer_lock;
+ /*
+ The following is used when several threads are reading the
+ same file in parallel. They are synchronized on disk
+ accesses reading the cached part of the file asynchronously.
+ It should be set to NULL to disable the feature. Only
+ READ_CACHE mode is supported.
+ */
+ IO_CACHE_SHARE *share{nullptr};
+
+ /*
+ A caller will use my_b_read() macro to read from the cache
+ if the data is already in cache, it will be simply copied with
+ memcpy() and internal variables will be accordinging updated with
+ no functions invoked. However, if the data is not fully in the cache,
+ my_b_read() will call read_function to fetch the data. read_function
+ must never be invoked directly.
+ */
+ int (*read_function)(IO_CACHE *, uchar *, size_t){nullptr};
+ /*
+ Same idea as in the case of read_function, except my_b_write() needs to
+ be replaced with my_b_append() for a SEQ_READ_APPEND cache
+ */
+ int (*write_function)(IO_CACHE *, const uchar *, size_t){nullptr};
+ /*
+ Specifies the type of the cache. Depending on the type of the cache
+ certain operations might not be available and yield unpredicatable
+ results. Details to be documented later
+ */
+ cache_type type{TYPE_NOT_SET};
+ /*
+ Callbacks when the actual read I/O happens. These were added and
+ are currently used for binary logging of LOAD DATA INFILE - when a
+ block is read from the file, we create a block create/append event, and
+ when IO_CACHE is closed, we create an end event. These functions could,
+ of course be used for other things
+ */
+ IO_CACHE_CALLBACK pre_read{nullptr};
+ IO_CACHE_CALLBACK post_read{nullptr};
+ IO_CACHE_CALLBACK pre_close{nullptr};
+ /*
+ Counts the number of times, when we were forced to use disk. We use it to
+ increase the binlog_cache_disk_use and binlog_stmt_cache_disk_use status
+ variables.
+ */
+ ulong disk_writes{0};
+ void *arg{nullptr}; /* for use by pre/post_read */
+ char *file_name{nullptr}; /* if used with 'open_cached_file' */
+ char *dir{nullptr}, *prefix{nullptr};
+ File file{-1}; /* file descriptor */
+ PSI_file_key file_key{PSI_NOT_INSTRUMENTED}; /* instrumented file key */
+
+ /*
+ seek_not_done is set by my_b_seek() to inform the upcoming read/write
+ operation that a seek needs to be preformed prior to the actual I/O
+ error is 0 if the cache operation was successful, -1 if there was a
+ "hard" error, and the actual number of I/O-ed bytes if the read/write was
+ partial.
+ */
+ bool seek_not_done{false};
+ int error{0};
+ /* buffer_length is memory size allocated for buffer or write_buffer */
+ size_t buffer_length{0};
+ /* read_length is the same as buffer_length except when we use async io */
+ size_t read_length{0};
+ myf myflags{0}; /* Flags used to my_read/my_write */
+ /*
+ alloced_buffer is 1 if the buffer was allocated by init_io_cache() and
+ 0 if it was supplied by the user.
+ Currently READ_NET is the only one that will use a buffer allocated
+ somewhere else
+ */
+ bool alloced_buffer{false};
+ // This is an encryptor for encrypting the temporary file of the IO cache.
+ Stream_cipher *m_encryptor = nullptr;
+ // This is a decryptor for decrypting the temporary file of the IO cache.
+ Stream_cipher *m_decryptor = nullptr;
+};
+
+typedef int (*qsort2_cmp)(const void *, const void *, const void *);
+
+/*
+ Subset of struct stat fields filled by stat/lstat/fstat that uniquely
+ identify a file
+*/
+struct ST_FILE_ID {
+ dev_t st_dev;
+ ino_t st_ino;
+};
+
+typedef void (*my_error_reporter)(enum loglevel level, uint ecode, ...);
+
+extern my_error_reporter my_charset_error_reporter;
+
+/* defines for mf_iocache */
+extern PSI_file_key key_file_io_cache;
+
+/* Test if buffer is inited */
+inline void my_b_clear(IO_CACHE *info) { info->buffer = nullptr; }
+
+inline bool my_b_inited(const IO_CACHE *info) {
+ return info->buffer != nullptr;
+}
+
+constexpr int my_b_EOF = INT_MIN;
+
+inline int my_b_read(IO_CACHE *info, uchar *buffer, size_t count) {
+ if (info->read_pos + count <= info->read_end) {
+ memcpy(buffer, info->read_pos, count);
+ info->read_pos += count;
+ return 0;
+ }
+ return (*info->read_function)(info, buffer, count);
+}
+
+inline int my_b_write(IO_CACHE *info, const uchar *buffer, size_t count) {
+ if (info->write_pos + count <= info->write_end) {
+ memcpy(info->write_pos, buffer, count);
+ info->write_pos += count;
+ return 0;
+ }
+ return (*info->write_function)(info, buffer, count);
+}
+
+extern int _my_b_get(IO_CACHE *info);
+
+inline int my_b_get(IO_CACHE *info) {
+ if (info->read_pos != info->read_end) {
+ info->read_pos++;
+ return info->read_pos[-1];
+ }
+ return _my_b_get(info);
+}
+
+inline my_off_t my_b_tell(const IO_CACHE *info) {
+ return info->pos_in_file + *info->current_pos - info->request_pos;
+}
+
+inline uchar *my_b_get_buffer_start(const IO_CACHE *info) {
+ return info->request_pos;
+}
+
+inline size_t my_b_get_bytes_in_buffer(const IO_CACHE *info) {
+ return info->read_end - my_b_get_buffer_start(info);
+}
+
+inline my_off_t my_b_get_pos_in_file(const IO_CACHE *info) {
+ return info->pos_in_file;
+}
+
+/* tell write offset in the SEQ_APPEND cache */
+int my_b_copy_to_file(IO_CACHE *cache, FILE *file);
+
+inline size_t my_b_bytes_in_cache(const IO_CACHE *info) {
+ return *info->current_end - *info->current_pos;
+}
+
+typedef uint32 ha_checksum;
+
+/*
+ How much overhead does malloc have. The code often allocates
+ something like 1024-MALLOC_OVERHEAD bytes
+*/
+#define MALLOC_OVERHEAD 8
+
+/* Typical record cache */
+#define RECORD_CACHE_SIZE (uint)(64 * 1024 - MALLOC_OVERHEAD)
+
+/** struct for once_alloc (block) */
+struct USED_MEM {
+ USED_MEM *next; /**< Next block in use */
+ unsigned int left; /**< memory left in block */
+ unsigned int size; /**< size of block */
+};
+
+/* Prototypes for mysys and my_func functions */
+
+extern int my_copy(const char *from, const char *to, myf MyFlags);
+extern int my_delete(const char *name, myf MyFlags);
+extern int my_getwd(char *buf, size_t size, myf MyFlags);
+extern int my_setwd(const char *dir, myf MyFlags);
+extern void *my_once_alloc(size_t Size, myf MyFlags);
+extern void my_once_free(void);
+extern char *my_once_strdup(const char *src, myf myflags);
+extern void *my_once_memdup(const void *src, size_t len, myf myflags);
+extern File my_open(const char *FileName, int Flags, myf MyFlags);
+extern File my_register_filename(File fd, const char *FileName,
+ enum file_type type_of_file,
+ uint error_message_number, myf MyFlags);
+extern File my_create(const char *FileName, int CreateFlags, int AccessFlags,
+ myf MyFlags);
+extern int my_close(File Filedes, myf MyFlags);
+extern int my_mkdir(const char *dir, int Flags, myf MyFlags);
+extern int my_readlink(char *to, const char *filename, myf MyFlags);
+extern int my_is_symlink(const char *filename, ST_FILE_ID *file_id);
+extern int my_realpath(char *to, const char *filename, myf MyFlags);
+extern int my_is_same_file(File file, const ST_FILE_ID *file_id);
+extern File my_create_with_symlink(const char *linkname, const char *filename,
+ int createflags, int access_flags,
+ myf MyFlags);
+extern int my_delete_with_symlink(const char *name, myf MyFlags);
+extern int my_rename_with_symlink(const char *from, const char *to,
+ myf MyFlags);
+#ifndef _WIN32
+extern int my_symlink(const char *content, const char *linkname, myf MyFlags);
+#endif
+extern size_t my_read(File Filedes, uchar *Buffer, size_t Count, myf MyFlags);
+extern size_t my_pread(File Filedes, uchar *Buffer, size_t Count,
+ my_off_t offset, myf MyFlags);
+extern int my_rename(const char *from, const char *to, myf MyFlags);
+extern my_off_t my_seek(File fd, my_off_t pos, int whence, myf MyFlags);
+extern my_off_t my_tell(File fd, myf MyFlags);
+extern size_t my_write(File Filedes, const uchar *Buffer, size_t Count,
+ myf MyFlags);
+extern size_t my_pwrite(File Filedes, const uchar *Buffer, size_t Count,
+ my_off_t offset, myf MyFlags);
+extern size_t my_fread(FILE *stream, uchar *Buffer, size_t Count, myf MyFlags);
+extern size_t my_fwrite(FILE *stream, const uchar *Buffer, size_t Count,
+ myf MyFlags);
+extern my_off_t my_fseek(FILE *stream, my_off_t pos, int whence);
+extern my_off_t my_ftell(FILE *stream);
+
+/* implemented in my_syslog.c */
+
+// Maximum size of message that will be logged.
+#define MAX_SYSLOG_MESSAGE_SIZE 1024
+
+/* Platform-independent SysLog support */
+enum my_syslog_options { MY_SYSLOG_PIDS = 1 };
+
+extern int my_openlog(const char *eventSourceName, int option, int facility);
+extern int my_closelog();
+extern int my_syslog(const CHARSET_INFO *cs, enum loglevel level,
+ const char *msg);
+
+#ifdef _WIN32
+extern int my_access(const char *path, int amode);
+#else
+#define my_access access
+#endif
+
+extern int check_if_legal_filename(const char *path);
+extern int check_if_legal_tablename(const char *path);
+
+#ifdef _WIN32
+extern bool is_filename_allowed(const char *name, size_t length,
+ bool allow_current_dir);
+#else /* _WIN32 */
+#define is_filename_allowed(name, length, allow_cwd) (true)
+#endif /* _WIN32 */
+
+#ifdef _WIN32
+extern int nt_share_delete(const char *name, myf MyFlags);
+#define my_delete_allow_opened(fname, flags) nt_share_delete((fname), (flags))
+#else
+#define my_delete_allow_opened(fname, flags) my_delete((fname), (flags))
+#endif
+
+#ifdef _WIN32
+/* Windows-only functions (CRT equivalents)*/
+extern HANDLE my_get_osfhandle(File fd);
+extern void my_osmaperr(unsigned long last_error);
+#endif
+
+extern const char *get_global_errmsg(int nr);
+extern void wait_for_free_space(const char *filename, int errors);
+extern FILE *my_fopen(const char *FileName, int Flags, myf MyFlags);
+extern FILE *my_fdopen(File Filedes, const char *name, int Flags, myf MyFlags);
+extern FILE *my_freopen(const char *path, const char *mode, FILE *stream);
+extern int my_fclose(FILE *fd, myf MyFlags);
+extern File my_fileno(FILE *fd);
+extern int my_chsize(File fd, my_off_t newlength, int filler, myf MyFlags);
+extern int my_fallocator(File fd, my_off_t newlength, int filler, myf MyFlags);
+extern void thr_set_sync_wait_callback(void (*before_sync)(void),
+ void (*after_sync)(void));
+extern int my_sync(File fd, myf my_flags);
+extern int my_sync_dir(const char *dir_name, myf my_flags);
+extern int my_sync_dir_by_file(const char *file_name, myf my_flags);
+extern char *my_strerror(char *buf, size_t len, int errnum);
+extern const char *my_get_err_msg(int nr);
+extern void my_error(int nr, myf MyFlags, ...);
+extern void my_printf_error(uint my_err, const char *format, myf MyFlags, ...)
+ MY_ATTRIBUTE((format(printf, 2, 4)));
+extern void my_printv_error(uint error, const char *format, myf MyFlags,
+ va_list ap) MY_ATTRIBUTE((format(printf, 2, 0)));
+extern int my_error_register(const char *(*get_errmsg)(int), int first,
+ int last);
+extern bool my_error_unregister(int first, int last);
+extern void my_message(uint my_err, const char *str, myf MyFlags);
+extern void my_message_stderr(uint my_err, const char *str, myf MyFlags);
+void my_message_local_stderr(enum loglevel, uint ecode, va_list args);
+extern void my_message_local(enum loglevel ll, uint ecode, ...);
+extern bool my_init(void);
+extern void my_end(int infoflag);
+extern const char *my_filename(File fd);
+extern MY_MODE get_file_perm(ulong perm_flags);
+extern bool my_chmod(const char *filename, ulong perm_flags, myf my_flags);
+
+#ifdef EXTRA_DEBUG
+void my_print_open_files(void);
+#else
+#define my_print_open_files()
+#endif
+
+extern bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist);
+extern char *my_tmpdir(MY_TMPDIR *tmpdir);
+extern void free_tmpdir(MY_TMPDIR *tmpdir);
+
+extern size_t dirname_part(char *to, const char *name, size_t *to_res_length);
+extern size_t dirname_length(const char *name);
+#define base_name(A) (A + dirname_length(A))
+extern int test_if_hard_path(const char *dir_name);
+extern bool has_path(const char *name);
+extern char *convert_dirname(char *to, const char *from, const char *from_end);
+extern void to_unix_path(char *name);
+extern char *fn_ext(char *name);
+extern const char *fn_ext(const char *name);
+extern char *fn_same(char *toname, const char *name, int flag);
+extern char *fn_format(char *to, const char *name, const char *dir,
+ const char *form, uint flag);
+extern size_t strlength(const char *str);
+extern size_t normalize_dirname(char *to, const char *from);
+extern size_t unpack_dirname(char *to, const char *from);
+extern size_t cleanup_dirname(char *to, const char *from);
+extern size_t system_filename(char *to, const char *from);
+extern size_t unpack_filename(char *to, const char *from);
+extern char *intern_filename(char *to, const char *from);
+extern char *my_path(char *to, const char *progname,
+ const char *own_pathname_part);
+extern char *my_load_path(char *to, const char *path,
+ const char *own_path_prefix);
+extern bool array_append_string_unique(const char *str, const char **array,
+ size_t size);
+
+void my_store_ptr(uchar *buff, size_t pack_length, my_off_t pos);
+my_off_t my_get_ptr(uchar *ptr, size_t pack_length);
+extern int init_io_cache_ext(IO_CACHE *info, File file, size_t cachesize,
+ enum cache_type type, my_off_t seek_offset,
+ bool use_async_io, myf cache_myflags,
+ PSI_file_key file_key);
+extern int init_io_cache(IO_CACHE *info, File file, size_t cachesize,
+ enum cache_type type, my_off_t seek_offset,
+ bool use_async_io, myf cache_myflags);
+extern bool reinit_io_cache(IO_CACHE *info, enum cache_type type,
+ my_off_t seek_offset, bool use_async_io,
+ bool clear_cache);
+extern void setup_io_cache(IO_CACHE *info);
+extern int _my_b_read(IO_CACHE *info, uchar *Buffer, size_t Count);
+extern int _my_b_read_r(IO_CACHE *info, uchar *Buffer, size_t Count);
+extern void init_io_cache_share(IO_CACHE *read_cache, IO_CACHE_SHARE *cshare,
+ IO_CACHE *write_cache, uint num_threads);
+extern void remove_io_thread(IO_CACHE *info);
+extern int _my_b_seq_read(IO_CACHE *info, uchar *Buffer, size_t Count);
+extern int _my_b_net_read(IO_CACHE *info, uchar *Buffer, size_t Count);
+extern int _my_b_write(IO_CACHE *info, const uchar *Buffer, size_t Count);
+extern int my_b_append(IO_CACHE *info, const uchar *Buffer, size_t Count);
+extern int my_b_safe_write(IO_CACHE *info, const uchar *Buffer, size_t Count);
+
+extern int my_block_write(IO_CACHE *info, const uchar *Buffer, size_t Count,
+ my_off_t pos);
+extern int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock);
+
+#define flush_io_cache(info) my_b_flush_io_cache((info), 1)
+
+extern int end_io_cache(IO_CACHE *info);
+extern size_t my_b_fill(IO_CACHE *info);
+extern void my_b_seek(IO_CACHE *info, my_off_t pos);
+extern size_t my_b_gets(IO_CACHE *info, char *to, size_t max_length);
+extern my_off_t my_b_filelength(IO_CACHE *info);
+extern size_t my_b_printf(IO_CACHE *info, const char *fmt, ...)
+ MY_ATTRIBUTE((format(printf, 2, 3)));
+extern size_t my_b_vprintf(IO_CACHE *info, const char *fmt, va_list ap);
+extern bool open_cached_file(IO_CACHE *cache, const char *dir,
+ const char *prefix, size_t cache_size,
+ myf cache_myflags);
+extern bool real_open_cached_file(IO_CACHE *cache);
+extern void close_cached_file(IO_CACHE *cache);
+
+enum UnlinkOrKeepFile { UNLINK_FILE, KEEP_FILE };
+File create_temp_file(char *to, const char *dir, const char *pfx, int mode,
+ UnlinkOrKeepFile unlink_or_keep, myf MyFlags);
+
+// Use Prealloced_array or std::vector or something similar in C++
+extern bool my_init_dynamic_array(DYNAMIC_ARRAY *array, PSI_memory_key key,
+ uint element_size, void *init_buffer,
+ uint init_alloc, uint alloc_increment);
+/* init_dynamic_array() function is deprecated */
+
+#define dynamic_element(array, array_index, type) \
+ ((type)((array)->buffer) + (array_index))
+
+/* Some functions are still in use in C++, because HASH uses DYNAMIC_ARRAY */
+extern bool insert_dynamic(DYNAMIC_ARRAY *array, const void *element);
+extern void *alloc_dynamic(DYNAMIC_ARRAY *array);
+extern void *pop_dynamic(DYNAMIC_ARRAY *);
+extern void claim_dynamic(DYNAMIC_ARRAY *array);
+extern void delete_dynamic(DYNAMIC_ARRAY *array);
+extern void freeze_size(DYNAMIC_ARRAY *array);
+static inline void reset_dynamic(DYNAMIC_ARRAY *array) { array->elements = 0; }
+
+extern bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str,
+ size_t init_alloc, size_t alloc_increment);
+extern bool dynstr_append(DYNAMIC_STRING *str, const char *append);
+bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append, size_t length);
+extern bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append,
+ ...);
+extern bool dynstr_set(DYNAMIC_STRING *str, const char *init_str);
+extern bool dynstr_realloc(DYNAMIC_STRING *str, size_t additional_size);
+extern bool dynstr_trunc(DYNAMIC_STRING *str, size_t n);
+extern void dynstr_free(DYNAMIC_STRING *str);
+#define alloc_root_inited(A) ((A)->inited())
+extern void *multi_alloc_root(MEM_ROOT *mem_root, ...);
+extern char *strdup_root(MEM_ROOT *root, const char *str);
+extern char *safe_strdup_root(MEM_ROOT *root, const char *str);
+extern char *strmake_root(MEM_ROOT *root, const char *str, size_t len);
+extern void *memdup_root(MEM_ROOT *root, const void *str, size_t len);
+extern bool my_compress(uchar *, size_t *, size_t *);
+extern bool my_uncompress(uchar *, size_t, size_t *);
+extern uchar *my_compress_alloc(const uchar *packet, size_t *len,
+ size_t *complen);
+extern ha_checksum my_checksum(ha_checksum crc, const uchar *mem, size_t count);
+
+extern uint my_set_max_open_files(uint files);
+void my_free_open_file_info(void);
+
+extern bool my_gethwaddr(uchar *to);
+
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+
+#ifndef MAP_NOSYNC
+#define MAP_NOSYNC 0
+#endif
+
+/*
+ Not defined in FreeBSD 11.
+ Was never implemented in FreeBSD, so we just set it to 0.
+*/
+#ifndef MAP_NORESERVE
+#define MAP_NORESERVE 0
+#endif
+
+#ifdef HAVE_MMAP64
+#define my_mmap(a, b, c, d, e, f) mmap64(a, b, c, d, e, f)
+#else
+#define my_mmap(a, b, c, d, e, f) mmap(a, b, c, d, e, f)
+#endif
+#define my_munmap(a, b) munmap((a), (b))
+
+#else
+/* not a complete set of mmap() flags, but only those that nesessary */
+#define PROT_READ 1
+#define PROT_WRITE 2
+#define MAP_NORESERVE 0
+#define MAP_SHARED 0x0001
+#define MAP_PRIVATE 0x0002
+#define MAP_NOSYNC 0x0800
+#define MAP_FAILED ((void *)-1)
+#define MS_SYNC 0x0000
+
+void *my_mmap(void *, size_t, int, int, int, my_off_t);
+int my_munmap(void *, size_t);
+#endif
+
+/* my_getpagesize */
+static inline int my_getpagesize() {
+#ifndef _WIN32
+ return getpagesize();
+#else
+ SYSTEM_INFO si;
+ GetSystemInfo(&si);
+ return (int)si.dwPageSize;
+#endif
+}
+
+int my_msync(int, void *, size_t, int);
+
+/* character sets */
+extern void my_charset_loader_init_mysys(MY_CHARSET_LOADER *loader);
+extern uint get_charset_number(const char *cs_name, uint cs_flags);
+extern uint get_collation_number(const char *name);
+extern const char *get_charset_name(uint cs_number);
+
+extern CHARSET_INFO *get_charset(uint cs_number, myf flags);
+extern CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags);
+extern CHARSET_INFO *my_collation_get_by_name(MY_CHARSET_LOADER *loader,
+ const char *name, myf flags);
+extern CHARSET_INFO *get_charset_by_csname(const char *cs_name, uint cs_flags,
+ myf my_flags);
+extern CHARSET_INFO *my_charset_get_by_name(MY_CHARSET_LOADER *loader,
+ const char *name, uint cs_flags,
+ myf my_flags);
+extern bool resolve_charset(const char *cs_name, const CHARSET_INFO *default_cs,
+ const CHARSET_INFO **cs);
+extern bool resolve_collation(const char *cl_name,
+ const CHARSET_INFO *default_cl,
+ const CHARSET_INFO **cl);
+extern char *get_charsets_dir(char *buf);
+extern bool my_charset_same(const CHARSET_INFO *cs1, const CHARSET_INFO *cs2);
+extern bool init_compiled_charsets(myf flags);
+extern void add_compiled_collation(CHARSET_INFO *cs);
+extern size_t escape_string_for_mysql(const CHARSET_INFO *charset_info,
+ char *to, size_t to_length,
+ const char *from, size_t length);
+extern void charset_uninit();
+#ifdef _WIN32
+/* File system character set */
+extern CHARSET_INFO *fs_character_set(void);
+#endif
+extern size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info, char *to,
+ size_t to_length, const char *from,
+ size_t length, char quote);
+#ifdef _WIN32
+extern bool have_tcpip; /* Is set if tcpip is used */
+
+/* implemented in my_windac.c */
+
+int my_security_attr_create(SECURITY_ATTRIBUTES **psa, const char **perror,
+ DWORD owner_rights, DWORD everybody_rights);
+
+void my_security_attr_free(SECURITY_ATTRIBUTES *sa);
+
+/* implemented in my_conio.c */
+bool my_win_is_console(FILE *file);
+char *my_win_console_readline(const CHARSET_INFO *cs, char *mbbuf,
+ size_t mbbufsize, size_t *nread);
+void my_win_console_write(const CHARSET_INFO *cs, const char *data,
+ size_t datalen);
+void my_win_console_fputs(const CHARSET_INFO *cs, const char *data);
+void my_win_console_putc(const CHARSET_INFO *cs, int c);
+void my_win_console_vfprintf(const CHARSET_INFO *cs, const char *fmt,
+ va_list args);
+int my_win_translate_command_line_args(const CHARSET_INFO *cs, int *ac,
+ char ***av);
+#endif /* _WIN32 */
+
+#ifdef HAVE_PSI_INTERFACE
+void my_init_mysys_psi_keys(void);
+
+extern MYSQL_PLUGIN_IMPORT PSI_cond_bootstrap *psi_cond_hook;
+extern void set_psi_cond_service(void *psi);
+extern MYSQL_PLUGIN_IMPORT PSI_data_lock_bootstrap *psi_data_lock_hook;
+extern void set_psi_data_lock_service(void *psi);
+extern MYSQL_PLUGIN_IMPORT PSI_error_bootstrap *psi_error_hook;
+extern void set_psi_error_service(void *psi);
+extern MYSQL_PLUGIN_IMPORT PSI_file_bootstrap *psi_file_hook;
+extern void set_psi_file_service(void *psi);
+extern MYSQL_PLUGIN_IMPORT PSI_idle_bootstrap *psi_idle_hook;
+extern void set_psi_idle_service(void *psi);
+extern MYSQL_PLUGIN_IMPORT PSI_mdl_bootstrap *psi_mdl_hook;
+extern void set_psi_mdl_service(void *psi);
+extern MYSQL_PLUGIN_IMPORT PSI_memory_bootstrap *psi_memory_hook;
+extern void set_psi_memory_service(void *psi);
+extern MYSQL_PLUGIN_IMPORT PSI_mutex_bootstrap *psi_mutex_hook;
+extern void set_psi_mutex_service(void *psi);
+extern MYSQL_PLUGIN_IMPORT PSI_rwlock_bootstrap *psi_rwlock_hook;
+extern void set_psi_rwlock_service(void *psi);
+extern MYSQL_PLUGIN_IMPORT PSI_socket_bootstrap *psi_socket_hook;
+extern void set_psi_socket_service(void *psi);
+extern MYSQL_PLUGIN_IMPORT PSI_stage_bootstrap *psi_stage_hook;
+extern void set_psi_stage_service(void *psi);
+extern MYSQL_PLUGIN_IMPORT PSI_statement_bootstrap *psi_statement_hook;
+extern void set_psi_statement_service(void *psi);
+extern MYSQL_PLUGIN_IMPORT PSI_system_bootstrap *psi_system_hook;
+extern void set_psi_system_service(void *psi);
+extern MYSQL_PLUGIN_IMPORT PSI_table_bootstrap *psi_table_hook;
+extern void set_psi_table_service(void *psi);
+extern MYSQL_PLUGIN_IMPORT PSI_thread_bootstrap *psi_thread_hook;
+extern void set_psi_thread_service(void *psi);
+extern MYSQL_PLUGIN_IMPORT PSI_transaction_bootstrap *psi_transaction_hook;
+extern void set_psi_transaction_service(void *psi);
+#endif /* HAVE_PSI_INTERFACE */
+
+struct MYSQL_FILE;
+extern MYSQL_FILE *mysql_stdin;
+
+/**
+ @} (end of group MYSYS)
+*/
+
+// True if the temporary file of binlog cache is encrypted.
+#ifndef DBUG_OFF
+extern bool binlog_cache_temporary_file_is_encrypted;
+#endif
+
+/**
+ This is a wrapper around mysql_file_seek. Seek to a position in the
+ temporary file of a binlog cache, and set the encryption/decryption
+ stream offset if binlog_encryption is on.
+
+ @param cache The handler of a binlog cache to seek.
+ @param pos The expected position (absolute or relative)
+ @param whence A direction parameter and one of
+ {SEEK_SET, SEEK_CUR, SEEK_END}
+ @param flags The bitmap of different flags
+ MY_WME | MY_FAE | MY_NABP | MY_FNABP |
+ MY_DONT_CHECK_FILESIZE and so on.
+
+ @retval The new position in the file, or MY_FILEPOS_ERROR on error.
+*/
+my_off_t mysql_encryption_file_seek(IO_CACHE *cache, my_off_t pos, int whence,
+ myf flags);
+/**
+ This is a wrapper around mysql_file_read. Read data from the temporary
+ file of a binlog cache, and take care of decrypting the data if
+ binlog_encryption is on.
+
+
+ @param cache The handler of a binlog cache to read.
+ @param[out] buffer The memory buffer to write to.
+ @param count The length of data in the temporary file to be read in bytes.
+ @param flags The bitmap of different flags
+ MY_WME | MY_FAE | MY_NABP | MY_FNABP |
+ MY_DONT_CHECK_FILESIZE and so on.
+
+ @retval The length of bytes to be read, or MY_FILE_ERROR on error.
+*/
+size_t mysql_encryption_file_read(IO_CACHE *cache, uchar *buffer, size_t count,
+ myf flags);
+/**
+ This is a wrapper around mysql_file_write. Write data in buffer to the
+ temporary file of a binlog cache, and take care of encrypting the data
+ if binlog_encryption is on.
+
+ @param cache The handler of a binlog cache to write.
+ @param buffer The memory buffer to write from.
+ @param count The length of data in buffer to be written in bytes.
+ @param flags The bitmap of different flags
+ MY_WME | MY_FAE | MY_NABP | MY_FNABP |
+ MY_DONT_CHECK_FILESIZE and so on
+
+ if (flags & (MY_NABP | MY_FNABP)) {
+ @retval 0 if count == 0
+ @retval 0 success
+ @retval MY_FILE_ERROR error
+ } else {
+ @retval 0 if count == 0
+ @retval The number of bytes written on success.
+ @retval MY_FILE_ERROR error
+ @retval The actual number of bytes written on partial success (if
+ less than count bytes were written).
+ }
+*/
+size_t mysql_encryption_file_write(IO_CACHE *cache, const uchar *buffer,
+ size_t count, myf flags);
+#endif /* _my_sys_h */
diff --git a/contrib/libs/libmysql_r/include/my_systime.h b/contrib/libs/libmysql_r/include/my_systime.h
new file mode 100644
index 0000000000..53fd312026
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_systime.h
@@ -0,0 +1,200 @@
+/*
+ Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MY_SYSTIME_INCLUDED
+#define MY_SYSTIME_INCLUDED
+
+/**
+ @file include/my_systime.h
+ Defines for getting and processing the current system type programmatically.
+*/
+
+#include <time.h> // time_t, struct timespec (C11/C++17)
+#include <chrono> // std::chrono::microseconds
+#include <cstdint> // std::int64_t
+#include <limits> // std::numeric_limits
+#include <thread> // std::this_thread::wait_for
+
+#include "my_config.h"
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h> // clock_gettime()
+#endif /* HAVE_SYS_TIME_H */
+
+using UTC_clock = std::chrono::system_clock;
+
+/* Bits for get_date timeflag */
+constexpr const int GETDATE_DATE_TIME = 1;
+constexpr const int GETDATE_SHORT_DATE = 2;
+constexpr const int GETDATE_HHMMSSTIME = 4;
+constexpr const int GETDATE_GMT = 8;
+constexpr const int GETDATE_FIXEDLENGTH = 16;
+constexpr const int GETDATE_T_DELIMITER = 32;
+constexpr const int GETDATE_SHORT_DATE_FULL_YEAR = 64;
+
+/**
+ Wait a given number of microseconds.
+
+ @param m_seconds number of microseconds to wait.
+*/
+inline void my_sleep(time_t m_seconds) {
+ std::this_thread::sleep_for(std::chrono::microseconds{m_seconds});
+}
+
+#ifdef _WIN32
+
+#include <windows.h>
+
+/****************************************************************************
+** Replacements for localtime_r and gmtime_r
+****************************************************************************/
+
+inline static struct tm *localtime_r(const time_t *timep, struct tm *tmp) {
+ localtime_s(tmp, timep);
+ return tmp;
+}
+
+inline static struct tm *gmtime_r(const time_t *clock, struct tm *res) {
+ gmtime_s(res, clock);
+ return res;
+}
+
+/**
+ Sleep the given number of seconds. POSIX compatibility.
+
+ @param seconds number of seconds to wait
+*/
+inline void sleep(unsigned long seconds) {
+ std::this_thread::sleep_for(std::chrono::seconds{seconds});
+}
+
+#endif /* _WIN32 */
+
+/**
+ Get high-resolution time. Forwards to std::chrono.
+
+ @deprecated New code should use std::chrono directly.
+
+ @return current high-resolution time in multiples of 100 nanoseconds.
+*/
+inline unsigned long long int my_getsystime() {
+#ifdef HAVE_CLOCK_GETTIME
+ // Performance regression testing showed this to be preferable
+ struct timespec tp;
+ clock_gettime(CLOCK_REALTIME, &tp);
+ return (static_cast<unsigned long long int>(tp.tv_sec) * 10000000 +
+ static_cast<unsigned long long int>(tp.tv_nsec) / 100);
+#else
+ return std::chrono::duration_cast<
+ std::chrono::duration<std::int64_t, std::ratio<1, 10000000>>>(
+ UTC_clock::now().time_since_epoch())
+ .count();
+#endif /* HAVE_CLOCK_GETTIME */
+}
+
+/**
+ The maximum timespec value used to represent "inifinity" (as when
+ requesting an "inifinite" timeout.
+ */
+constexpr const timespec TIMESPEC_POSINF = {
+ std::numeric_limits<decltype(timespec::tv_sec)>::max(), 999999999};
+
+/** Type alias to reduce chance of coversion errors on timeout values. */
+using Timeout_type = std::uint64_t;
+
+/** Value representing "infinite" timeout. */
+constexpr const Timeout_type TIMEOUT_INF =
+ std::numeric_limits<Timeout_type>::max() - 1;
+
+void set_timespec_nsec(struct timespec *abstime, Timeout_type nsec);
+void set_timespec(struct timespec *abstime, Timeout_type sec);
+timespec timespec_now();
+
+/**
+ Compare two timespec structs.
+
+ @retval 1 If ts1 ends after ts2.
+ @retval -1 If ts1 ends before ts2.
+ @retval 0 If ts1 is equal to ts2.
+*/
+inline int cmp_timespec(struct timespec *ts1, struct timespec *ts2) {
+ if (ts1->tv_sec > ts2->tv_sec ||
+ (ts1->tv_sec == ts2->tv_sec && ts1->tv_nsec > ts2->tv_nsec))
+ return 1;
+ if (ts1->tv_sec < ts2->tv_sec ||
+ (ts1->tv_sec == ts2->tv_sec && ts1->tv_nsec < ts2->tv_nsec))
+ return -1;
+ return 0;
+}
+
+/**
+ Calculate the diff between two timespec values.
+
+ @return difference in nanoseconds between ts1 and ts2
+*/
+inline unsigned long long int diff_timespec(struct timespec *ts1,
+ struct timespec *ts2) {
+ return (ts1->tv_sec - ts2->tv_sec) * 1000000000ULL + ts1->tv_nsec -
+ ts2->tv_nsec;
+}
+
+/**
+ Return current time. Takes an int argument
+ for backward compatibility. This argument is ignored.
+
+ @deprecated New code should use std::time() directly.
+
+ @retval current time.
+*/
+inline time_t my_time(int) { return time(nullptr); }
+
+/**
+ Return time in microseconds. Uses std::chrono::high_resolution_clock
+
+ @remark This function is to be used to measure performance in
+ micro seconds.
+
+ @deprecated New code should use std::chrono directly.
+
+ @retval Number of microseconds since the Epoch, 1970-01-01 00:00:00 +0000
+ (UTC)
+*/
+inline unsigned long long int my_micro_time() {
+#ifdef _WIN32
+ return std::chrono::duration_cast<std::chrono::microseconds>(
+ UTC_clock::now().time_since_epoch())
+ .count();
+#else
+ struct timeval t;
+ /*
+ The following loop is here because gettimeofday may fail on some systems
+ */
+ while (gettimeofday(&t, nullptr) != 0) {
+ }
+ return (static_cast<unsigned long long int>(t.tv_sec) * 1000000 + t.tv_usec);
+#endif /* _WIN32 */
+}
+
+void get_date(char *to, int flag, time_t date);
+
+#endif // MY_SYSTIME_INCLUDED
diff --git a/contrib/libs/libmysql_r/include/my_thread.h b/contrib/libs/libmysql_r/include/my_thread.h
new file mode 100644
index 0000000000..7de93bde32
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_thread.h
@@ -0,0 +1,174 @@
+/* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/my_thread.h
+ Defines to make different thread packages compatible.
+*/
+
+#ifndef MY_THREAD_INCLUDED
+#define MY_THREAD_INCLUDED
+
+#include <errno.h>
+#include <stdbool.h>
+#include <stddef.h>
+
+#include <mysql/components/services/my_thread_bits.h>
+
+#include "my_compiler.h"
+#include "my_config.h"
+#include "my_inttypes.h"
+#include "my_macros.h"
+
+#ifndef ETIME
+#define ETIME ETIMEDOUT /* For FreeBSD */
+#endif
+
+#ifndef ETIMEDOUT
+#define ETIMEDOUT 145 /* Win32 doesn't have this */
+#endif
+
+#if defined(__sparc) && (defined(__SUNPRO_CC) || defined(__SUNPRO_C))
+#define STACK_MULTIPLIER 2UL
+#elif defined HAVE_UBSAN
+#define STACK_MULTIPLIER 3UL
+#elif defined HAVE_LSAN
+#define STACK_MULTIPLIER 4UL
+#else
+#define STACK_MULTIPLIER 1UL
+#endif
+
+#if SIZEOF_CHARP > 4
+#define DEFAULT_THREAD_STACK (STACK_MULTIPLIER * 280UL * 1024UL)
+#else
+#define DEFAULT_THREAD_STACK (STACK_MULTIPLIER * 216UL * 1024UL)
+#endif
+
+static inline int is_timeout(int e) {
+#if ETIMEDOUT == ETIME
+ return e == ETIMEDOUT;
+#else
+ return e == ETIMEDOUT || e == ETIME;
+#endif
+}
+
+#ifdef _WIN32
+#define MY_THREAD_CREATE_JOINABLE 0
+#define MY_THREAD_CREATE_DETACHED 1
+typedef void *(__cdecl *my_start_routine)(void *);
+#else
+#define MY_THREAD_CREATE_JOINABLE PTHREAD_CREATE_JOINABLE
+#define MY_THREAD_CREATE_DETACHED PTHREAD_CREATE_DETACHED
+typedef void *(*my_start_routine)(void *);
+#endif
+
+static inline my_thread_t my_thread_self() {
+#ifdef _WIN32
+ return GetCurrentThreadId();
+#else
+ return pthread_self();
+#endif
+}
+
+static inline int my_thread_equal(my_thread_t t1, my_thread_t t2) {
+#ifdef _WIN32
+ return t1 == t2;
+#else
+ return pthread_equal(t1, t2);
+#endif
+}
+
+static inline int my_thread_attr_init(my_thread_attr_t *attr) {
+#ifdef _WIN32
+ attr->dwStackSize = 0;
+ /* Set to joinable by default to match Linux */
+ attr->detachstate = MY_THREAD_CREATE_JOINABLE;
+ return 0;
+#else
+ return pthread_attr_init(attr);
+#endif
+}
+
+static inline int my_thread_attr_destroy(my_thread_attr_t *attr) {
+#ifdef _WIN32
+ attr->dwStackSize = 0;
+ /* Set to joinable by default to match Linux */
+ attr->detachstate = MY_THREAD_CREATE_JOINABLE;
+ return 0;
+#else
+ return pthread_attr_destroy(attr);
+#endif
+}
+
+static inline int my_thread_attr_setstacksize(my_thread_attr_t *attr,
+ size_t stacksize) {
+#ifdef _WIN32
+ attr->dwStackSize = (DWORD)stacksize;
+ return 0;
+#else
+ return pthread_attr_setstacksize(attr, stacksize);
+#endif
+}
+
+static inline int my_thread_attr_setdetachstate(my_thread_attr_t *attr,
+ int detachstate) {
+#ifdef _WIN32
+ attr->detachstate = detachstate;
+ return 0;
+#else
+ return pthread_attr_setdetachstate(attr, detachstate);
+#endif
+}
+
+static inline int my_thread_attr_getstacksize(my_thread_attr_t *attr,
+ size_t *stacksize) {
+#ifdef _WIN32
+ *stacksize = (size_t)attr->dwStackSize;
+ return 0;
+#else
+ return pthread_attr_getstacksize(attr, stacksize);
+#endif
+}
+
+static inline void my_thread_yield() {
+#ifdef _WIN32
+ SwitchToThread();
+#else
+ sched_yield();
+#endif
+}
+
+int my_thread_create(my_thread_handle *thread, const my_thread_attr_t *attr,
+ my_start_routine func, void *arg);
+int my_thread_join(my_thread_handle *thread, void **value_ptr);
+int my_thread_cancel(my_thread_handle *thread);
+void my_thread_exit(void *value_ptr) MY_ATTRIBUTE((noreturn));
+
+extern bool my_thread_global_init();
+extern void my_thread_global_reinit();
+extern void my_thread_global_end();
+
+// Need to be extern "C" for the time being, due to memcached.
+extern "C" bool my_thread_init();
+extern "C" void my_thread_end();
+
+#endif /* MY_THREAD_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/my_thread_local.h b/contrib/libs/libmysql_r/include/my_thread_local.h
new file mode 100644
index 0000000000..423a1fb6ab
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_thread_local.h
@@ -0,0 +1,68 @@
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MY_THREAD_LOCAL_INCLUDED
+#define MY_THREAD_LOCAL_INCLUDED
+
+/**
+ @file include/my_thread_local.h
+*/
+
+#include "my_inttypes.h"
+#include "my_macros.h"
+
+typedef uint32 my_thread_id;
+
+/**
+ Retrieve the MySQL thread-local storage variant of errno.
+*/
+int my_errno();
+
+/**
+ Set the MySQL thread-local storage variant of errno.
+*/
+void set_my_errno(int my_errno);
+
+#ifdef _WIN32
+/*
+ thr_winerr is used for returning the original OS error-code in Windows,
+ my_osmaperr() returns EINVAL for all unknown Windows errors, hence we
+ preserve the original Windows Error code in thr_winerr.
+*/
+int thr_winerr();
+
+void set_thr_winerr(int winerr);
+
+#endif
+
+#ifndef DBUG_OFF
+/* Return pointer to DBUG for holding current state */
+struct CODE_STATE;
+CODE_STATE **my_thread_var_dbug();
+
+my_thread_id my_thread_var_id();
+
+void set_my_thread_var_id(my_thread_id id);
+
+#endif
+
+#endif // MY_THREAD_LOCAL_INCLUDED
diff --git a/contrib/libs/libmysql_r/include/my_time.h b/contrib/libs/libmysql_r/include/my_time.h
new file mode 100644
index 0000000000..74ddd7d740
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_time.h
@@ -0,0 +1,583 @@
+/* Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MY_TIME_INCLUDED
+#define MY_TIME_INCLUDED
+
+/**
+ @ingroup MY_TIME
+ @{
+
+ @file include/my_time.h
+
+ Interface for low level time utilities.
+*/
+
+#include "my_config.h"
+
+#include <assert.h> // assert
+#include <cstddef> // std::size_t
+#include <cstdint> // std::int32_t
+#include <limits> // std::numeric_limits
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h> // struct timeval
+#endif /* HAVE_SYS_TIME_H */
+#ifdef _WIN32
+#include <winsock2.h> // struct timeval
+#endif /* _WIN32 */
+
+#include "mysql_time.h" // struct MYSQL_TIME, shared with client code
+
+enum enum_field_types : int;
+
+extern const unsigned long long int log_10_int[20];
+extern const unsigned char days_in_month[];
+extern const char my_zero_datetime6[]; /* "0000-00-00 00:00:00.000000" */
+
+/**
+ Portable time_t replacement.
+ Should be signed and hold seconds for 1902 -- 2038-01-19 range
+ i.e at least a 32bit variable
+
+ Using the system built in time_t is not an option as
+ we rely on the above requirements in the time functions
+*/
+using my_time_t = long int;
+
+constexpr const my_time_t MY_TIME_T_MAX = std::numeric_limits<my_time_t>::max();
+constexpr const my_time_t MY_TIME_T_MIN = std::numeric_limits<my_time_t>::min();
+
+/** Time handling defaults */
+constexpr const int TIMESTAMP_MAX_YEAR = 2038;
+
+/** Two-digit years < this are 20XX; >= this are 19XX */
+constexpr const int YY_PART_YEAR = 70;
+constexpr const int TIMESTAMP_MIN_YEAR = (1900 + YY_PART_YEAR - 1);
+
+constexpr const int TIMESTAMP_MAX_VALUE =
+ std::numeric_limits<std::int32_t>::max();
+constexpr const int TIMESTAMP_MIN_VALUE = 1;
+
+/** Flags to str_to_datetime and number_to_datetime */
+using my_time_flags_t = unsigned int;
+
+/** Allow zero day and zero month */
+constexpr const my_time_flags_t TIME_FUZZY_DATE = 1;
+
+/** Only allow full datetimes. */
+constexpr const my_time_flags_t TIME_DATETIME_ONLY = 2;
+
+constexpr const my_time_flags_t TIME_FRAC_TRUNCATE = 4;
+constexpr const my_time_flags_t TIME_NO_DATE_FRAC_WARN = 8;
+
+/** Don't allow zero day or zero month */
+constexpr const my_time_flags_t TIME_NO_ZERO_IN_DATE = 16;
+
+/** Don't allow 0000-00-00 date */
+constexpr const my_time_flags_t TIME_NO_ZERO_DATE = 32;
+
+/** Allow 2000-02-31 */
+constexpr const my_time_flags_t TIME_INVALID_DATES = 64;
+
+/** Allow only HH:MM:SS or MM:SS time formats */
+constexpr const my_time_flags_t TIME_STRICT_COLON = 128;
+
+/** Conversion warnings */
+constexpr const int MYSQL_TIME_WARN_TRUNCATED = 1;
+constexpr const int MYSQL_TIME_WARN_OUT_OF_RANGE = 2;
+constexpr const int MYSQL_TIME_WARN_INVALID_TIMESTAMP = 4;
+constexpr const int MYSQL_TIME_WARN_ZERO_DATE = 8;
+constexpr const int MYSQL_TIME_NOTE_TRUNCATED = 16;
+constexpr const int MYSQL_TIME_WARN_ZERO_IN_DATE = 32;
+constexpr const int MYSQL_TIME_WARN_DATETIME_OVERFLOW = 64;
+
+/** Usefull constants */
+constexpr const long int SECONDS_IN_24H = 86400L;
+
+/** Limits for the TIME data type */
+constexpr const int TIME_MAX_HOUR = 838;
+constexpr const int TIME_MAX_MINUTE = 59;
+constexpr const int TIME_MAX_SECOND = 59;
+
+/**
+ Note that this MUST be a signed type, as we use the unary - operator on it.
+ */
+constexpr const int TIME_MAX_VALUE =
+ TIME_MAX_HOUR * 10000 + TIME_MAX_MINUTE * 100 + TIME_MAX_SECOND;
+
+constexpr const int TIME_MAX_VALUE_SECONDS =
+ TIME_MAX_HOUR * 3600 + TIME_MAX_MINUTE * 60 + TIME_MAX_SECOND;
+
+constexpr const int DATETIME_MAX_DECIMALS = 6;
+
+/** Flags for calc_week() function. */
+constexpr const unsigned int WEEK_MONDAY_FIRST = 1;
+constexpr const unsigned int WEEK_YEAR = 2;
+constexpr const unsigned int WEEK_FIRST_WEEKDAY = 4;
+
+/**
+ Structure to return status from
+ str_to_datetime(), str_to_time(), number_to_datetime(), number_to_time()
+ @note Implicit default constructor initializes all members to 0.
+*/
+struct MYSQL_TIME_STATUS {
+ int warnings{0};
+ unsigned int fractional_digits{0};
+ unsigned int nanoseconds{0};
+};
+
+/**
+ Struct representing a duration. Content is similar to MYSQL_TIME
+ but member variables are unsigned.
+ */
+struct Interval {
+ unsigned long int year;
+ unsigned long int month;
+ unsigned long int day;
+ unsigned long int hour;
+ unsigned long long int minute;
+ unsigned long long int second;
+ unsigned long long int second_part;
+ bool neg;
+};
+
+void my_init_time();
+
+long calc_daynr(unsigned int year, unsigned int month, unsigned int day);
+unsigned int calc_days_in_year(unsigned int year);
+unsigned int year_2000_handling(unsigned int year);
+
+void get_date_from_daynr(long daynr, unsigned int *year, unsigned int *month,
+ unsigned int *day);
+int calc_weekday(long daynr, bool sunday_first_day_of_week);
+bool valid_period(long long int period);
+unsigned long int convert_period_to_month(unsigned long int period);
+unsigned long int convert_month_to_period(unsigned long int month);
+
+/**
+ Check for valid times only if the range of time_t is greater than
+ the range of my_time_t. Which is almost always the case and even time_t
+ does have the same range, the compiler will optimize away
+ the unnecessary test (checked with compiler explorer).
+*/
+inline bool is_time_t_valid_for_timestamp(time_t x) {
+ return x <= TIMESTAMP_MAX_VALUE && x >= TIMESTAMP_MIN_VALUE;
+}
+
+unsigned int calc_week(const MYSQL_TIME &l_time, unsigned int week_behaviour,
+ unsigned int *year);
+
+bool check_date(const MYSQL_TIME &ltime, bool not_zero_date,
+ my_time_flags_t flags, int *was_cut);
+bool str_to_datetime(const char *str, std::size_t length, MYSQL_TIME *l_time,
+ my_time_flags_t flags, MYSQL_TIME_STATUS *status);
+long long int number_to_datetime(long long int nr, MYSQL_TIME *time_res,
+ my_time_flags_t flags, int *was_cut);
+bool number_to_time(long long int nr, MYSQL_TIME *ltime, int *warnings);
+unsigned long long int TIME_to_ulonglong_datetime(const MYSQL_TIME &my_time);
+unsigned long long int TIME_to_ulonglong_date(const MYSQL_TIME &my_time);
+unsigned long long int TIME_to_ulonglong_time(const MYSQL_TIME &my_time);
+unsigned long long int TIME_to_ulonglong(const MYSQL_TIME &my_time);
+
+unsigned long long int TIME_to_ulonglong_datetime_round(
+ const MYSQL_TIME &my_time, int *warnings);
+unsigned long long int TIME_to_ulonglong_time_round(const MYSQL_TIME &my_time);
+
+/**
+ Round any MYSQL_TIME timepoint and convert to ulonglong.
+ @param my_time input
+ @param[out] warnings warning vector
+ @return time point as ulonglong
+ */
+inline unsigned long long int TIME_to_ulonglong_round(const MYSQL_TIME &my_time,
+ int *warnings) {
+ switch (my_time.time_type) {
+ case MYSQL_TIMESTAMP_TIME:
+ return TIME_to_ulonglong_time_round(my_time);
+ case MYSQL_TIMESTAMP_DATETIME:
+ return TIME_to_ulonglong_datetime_round(my_time, warnings);
+ case MYSQL_TIMESTAMP_DATE:
+ return TIME_to_ulonglong_date(my_time);
+ default:
+ assert(false);
+ return 0;
+ }
+}
+
+/**
+ Extract the microsecond part of a MYSQL_TIME struct as an n *
+ (1/10^6) fraction as a double.
+
+ @return microseconds part as double
+ */
+inline double TIME_microseconds(const MYSQL_TIME &my_time) {
+ return static_cast<double>(my_time.second_part) / 1000000.0;
+}
+
+/**
+ Convert a MYSQL_TIME datetime to double where the integral part is
+ the timepoint as an ulonglong, and the fractional part is the
+ fraction of the second.
+
+ @param my_time datetime to convert
+ @return datetime as double
+ */
+inline double TIME_to_double_datetime(const MYSQL_TIME &my_time) {
+ return static_cast<double>(TIME_to_ulonglong_datetime(my_time)) +
+ TIME_microseconds(my_time);
+}
+
+/**
+ Convert a MYSQL_TIME time to double where the integral part is
+ the timepoint as an ulonglong, and the fractional part is the
+ fraction of the second.
+
+ @param my_time time to convert
+ @return datetime as double
+ */
+inline double TIME_to_double_time(const MYSQL_TIME &my_time) {
+ return static_cast<double>(TIME_to_ulonglong_time(my_time)) +
+ TIME_microseconds(my_time);
+}
+
+/**
+ Convert a MYSQL_TIME to double where the integral part is the
+ timepoint as an ulonglong, and the fractional part is the fraction
+ of the second. The actual time type is extracted from
+ MYSQL_TIME::time_type.
+
+ @param my_time MYSQL_TIME to convert
+ @return MYSQL_TIME as double
+ */
+inline double TIME_to_double(const MYSQL_TIME &my_time) {
+ return static_cast<double>(TIME_to_ulonglong(my_time)) +
+ TIME_microseconds(my_time);
+}
+
+/**
+ Return the fraction of the second as the number of microseconds.
+
+ @param i timepoint as longlong
+ @return frational part of an timepoint represented as an (u)longlong
+*/
+inline long long int my_packed_time_get_frac_part(long long int i) {
+ return (i % (1LL << 24));
+}
+
+long long int year_to_longlong_datetime_packed(long year);
+long long int TIME_to_longlong_datetime_packed(const MYSQL_TIME &my_time);
+long long int TIME_to_longlong_date_packed(const MYSQL_TIME &my_time);
+long long int TIME_to_longlong_time_packed(const MYSQL_TIME &my_time);
+long long int TIME_to_longlong_packed(const MYSQL_TIME &my_time);
+
+void TIME_from_longlong_datetime_packed(MYSQL_TIME *ltime, long long int nr);
+void TIME_from_longlong_time_packed(MYSQL_TIME *ltime, long long int nr);
+void TIME_from_longlong_date_packed(MYSQL_TIME *ltime, long long int nr);
+void TIME_set_yymmdd(MYSQL_TIME *ltime, unsigned int yymmdd);
+void TIME_set_hhmmss(MYSQL_TIME *ltime, unsigned int hhmmss);
+
+void my_datetime_packed_to_binary(long long int nr, unsigned char *ptr,
+ unsigned int dec);
+long long int my_datetime_packed_from_binary(const unsigned char *ptr,
+ unsigned int dec);
+
+void my_time_packed_to_binary(long long int nr, unsigned char *ptr,
+ unsigned int dec);
+long long int my_time_packed_from_binary(const unsigned char *ptr,
+ unsigned int dec);
+
+void my_timestamp_to_binary(const struct timeval *tm, unsigned char *ptr,
+ unsigned int dec);
+void my_timestamp_from_binary(struct timeval *tm, const unsigned char *ptr,
+ unsigned int dec);
+
+bool str_to_time(const char *str, std::size_t length, MYSQL_TIME *l_time,
+ MYSQL_TIME_STATUS *status, my_time_flags_t flags = 0);
+
+bool check_time_mmssff_range(const MYSQL_TIME &my_time);
+bool check_time_range_quick(const MYSQL_TIME &my_time);
+bool check_datetime_range(const MYSQL_TIME &my_time);
+void adjust_time_range(MYSQL_TIME *, int *warning);
+
+/**
+ Function to check sanity of a TIMESTAMP value.
+
+ Check if a given MYSQL_TIME value fits in TIMESTAMP range.
+ This function doesn't make precise check, but rather a rough
+ estimate.
+
+ @param my_time timepoint to check
+ @retval true The value seems sane
+ @retval false The MYSQL_TIME value is definitely out of range
+*/
+inline bool validate_timestamp_range(const MYSQL_TIME &my_time) {
+ if ((my_time.year > TIMESTAMP_MAX_YEAR ||
+ my_time.year < TIMESTAMP_MIN_YEAR) ||
+ (my_time.year == TIMESTAMP_MAX_YEAR &&
+ (my_time.month > 1 || my_time.day > 19)) ||
+ (my_time.year == TIMESTAMP_MIN_YEAR &&
+ (my_time.month < 12 || my_time.day < 31)))
+ return false;
+
+ return true;
+}
+
+my_time_t my_system_gmt_sec(const MYSQL_TIME &my_time, long *my_timezone,
+ bool *in_dst_time_gap);
+
+void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type);
+void set_max_time(MYSQL_TIME *tm, bool neg);
+void set_max_hhmmss(MYSQL_TIME *tm);
+
+/**
+ Required buffer length for my_time_to_str, my_date_to_str,
+ my_datetime_to_str and TIME_to_string functions. Note, that the
+ caller is still responsible to check that given TIME structure
+ has values in valid ranges, otherwise size of the buffer could
+ be not enough. We also rely on the fact that even wrong values
+ sent using binary protocol fit in this buffer.
+*/
+constexpr const std::size_t MAX_DATE_STRING_REP_LENGTH = 30;
+
+int my_time_to_str(const MYSQL_TIME &my_time, char *to, unsigned int dec);
+int my_date_to_str(const MYSQL_TIME &my_time, char *to);
+int my_datetime_to_str(const MYSQL_TIME &my_time, char *to, unsigned int dec);
+int my_TIME_to_str(const MYSQL_TIME &my_time, char *to, unsigned int dec);
+
+void my_date_to_binary(const MYSQL_TIME *ltime, unsigned char *ptr);
+int my_timeval_to_str(const struct timeval *tm, char *to, unsigned int dec);
+
+/**
+ Available interval types used in any statement.
+
+ 'interval_type' must be sorted so that simple intervals comes first,
+ ie year, quarter, month, week, day, hour, etc. The order based on
+ interval size is also important and the intervals should be kept in a
+ large to smaller order. (get_interval_value() depends on this)
+
+ @note If you change the order of elements in this enum you should fix
+ order of elements in 'interval_type_to_name' and 'interval_names'
+ arrays
+
+ @see interval_type_to_name, get_interval_value, interval_names
+*/
+enum interval_type {
+ INTERVAL_YEAR,
+ INTERVAL_QUARTER,
+ INTERVAL_MONTH,
+ INTERVAL_WEEK,
+ INTERVAL_DAY,
+ INTERVAL_HOUR,
+ INTERVAL_MINUTE,
+ INTERVAL_SECOND,
+ INTERVAL_MICROSECOND,
+ INTERVAL_YEAR_MONTH,
+ INTERVAL_DAY_HOUR,
+ INTERVAL_DAY_MINUTE,
+ INTERVAL_DAY_SECOND,
+ INTERVAL_HOUR_MINUTE,
+ INTERVAL_HOUR_SECOND,
+ INTERVAL_MINUTE_SECOND,
+ INTERVAL_DAY_MICROSECOND,
+ INTERVAL_HOUR_MICROSECOND,
+ INTERVAL_MINUTE_MICROSECOND,
+ INTERVAL_SECOND_MICROSECOND,
+ INTERVAL_LAST
+};
+
+bool date_add_interval(MYSQL_TIME *ltime, interval_type int_type,
+ Interval interval, int *warnings);
+
+/**
+ Round the input argument to the specified precision by computing
+ the remainder modulo log10 of the difference between max and
+ desired precison.
+
+ @param nr number to round
+ @param decimals desired precision
+ @return nr rounded according to the desired precision.
+*/
+inline long my_time_fraction_remainder(long nr, unsigned int decimals) {
+ assert(decimals <= DATETIME_MAX_DECIMALS);
+ return nr % static_cast<long>(log_10_int[DATETIME_MAX_DECIMALS - decimals]);
+}
+
+/**
+ Truncate the number of microseconds in MYSQL_TIME::second_part to
+ the desired precision.
+
+ @param ltime time point
+ @param decimals desired precision
+*/
+inline void my_time_trunc(MYSQL_TIME *ltime, unsigned int decimals) {
+ ltime->second_part -=
+ my_time_fraction_remainder(ltime->second_part, decimals);
+}
+
+/**
+ Alias for my_time_trunc.
+
+ @param ltime time point
+ @param decimals desired precision
+ */
+inline void my_datetime_trunc(MYSQL_TIME *ltime, unsigned int decimals) {
+ return my_time_trunc(ltime, decimals);
+}
+
+/**
+ Truncate the tv_usec member of a posix timeval struct to the
+ specified number of decimals.
+
+ @param tv timepoint/duration
+ @param decimals desired precision
+ */
+inline void my_timeval_trunc(struct timeval *tv, unsigned int decimals) {
+ tv->tv_usec -= my_time_fraction_remainder(tv->tv_usec, decimals);
+}
+
+/**
+ Predicate for fuzzyness of date.
+
+ @param my_time time point to check
+ @param fuzzydate bitfield indicating if fuzzy dates are premitted
+ @retval true if TIME_FUZZY_DATE is unset and either month or day is 0
+ @retval false otherwise
+ */
+inline bool check_fuzzy_date(const MYSQL_TIME &my_time,
+ my_time_flags_t fuzzydate) {
+ return !(fuzzydate & TIME_FUZZY_DATE) && (!my_time.month || !my_time.day);
+}
+
+/**
+ Predicate which returns true if at least one of the date members are non-zero.
+
+ @param my_time time point to check.
+ @retval false if all the date members are zero
+ @retval true otherwise
+ */
+inline bool non_zero_date(const MYSQL_TIME &my_time) {
+ return my_time.year || my_time.month || my_time.day;
+}
+
+/**
+ Predicate which returns true if at least one of the time members are non-zero.
+
+ @param my_time time point to check.
+ @retval false if all the time members are zero
+ @retval true otherwise
+*/
+inline bool non_zero_time(const MYSQL_TIME &my_time) {
+ return my_time.hour || my_time.minute || my_time.second ||
+ my_time.second_part;
+}
+
+/**
+ "Casts" MYSQL_TIME datetime to a MYSQL_TIME time. Sets
+ MYSQL_TIME::time_type to MYSQL_TIMESTAMP_TIME and zeroes out the
+ date members.
+
+ @param ltime timepoint to cast
+ */
+inline void datetime_to_time(MYSQL_TIME *ltime) {
+ ltime->year = 0;
+ ltime->month = 0;
+ ltime->day = 0;
+ ltime->time_type = MYSQL_TIMESTAMP_TIME;
+}
+
+/**
+ "Casts" MYSQL_TIME datetime to a MYSQL_TIME date. Sets
+ MYSQL_TIME::time_type to MYSQL_TIMESTAMP_DATE and zeroes out the
+ time members.
+
+ @param ltime timepoint to cast
+*/
+inline void datetime_to_date(MYSQL_TIME *ltime) {
+ ltime->hour = 0;
+ ltime->minute = 0;
+ ltime->second = 0;
+ ltime->second_part = 0;
+ ltime->time_type = MYSQL_TIMESTAMP_DATE;
+}
+
+/**
+ "Casts" a MYSQL_TIME to datetime by setting MYSQL_TIME::time_type to
+ MYSQL_TIMESTAMP_DATETIME.
+ @note There is no check to ensure that the result is a valid datetime.
+
+ @param ltime timpoint to cast
+*/
+inline void date_to_datetime(MYSQL_TIME *ltime) {
+ ltime->time_type = MYSQL_TIMESTAMP_DATETIME;
+}
+
+bool time_add_nanoseconds_with_truncate(MYSQL_TIME *ltime,
+ unsigned int nanoseconds,
+ int *warnings);
+bool datetime_add_nanoseconds_with_truncate(MYSQL_TIME *ltime,
+ unsigned int nanoseconds);
+bool time_add_nanoseconds_with_round(MYSQL_TIME *ltime,
+ unsigned int nanoseconds, int *warnings);
+
+bool datetime_add_nanoseconds_with_round(MYSQL_TIME *ltime,
+ unsigned int nanoseconds,
+ int *warnings);
+
+bool time_add_nanoseconds_adjust_frac(MYSQL_TIME *ltime,
+ unsigned int nanoseconds, int *warnings,
+ bool truncate);
+
+bool datetime_add_nanoseconds_adjust_frac(MYSQL_TIME *ltime,
+ unsigned int nanoseconds,
+ int *warnings, bool truncate);
+
+bool my_time_adjust_frac(MYSQL_TIME *ltime, unsigned int dec, bool truncate);
+bool my_datetime_adjust_frac(MYSQL_TIME *ltime, unsigned int dec, int *warnings,
+ bool truncate);
+bool my_timeval_round(struct timeval *tv, unsigned int decimals);
+void mix_date_and_time(MYSQL_TIME *ldate, const MYSQL_TIME &my_time);
+
+void localtime_to_TIME(MYSQL_TIME *to, const struct tm *from);
+void calc_time_from_sec(MYSQL_TIME *to, long long int seconds,
+ long microseconds);
+bool calc_time_diff(const MYSQL_TIME &my_time1, const MYSQL_TIME &my_time2,
+ int l_sign, long long int *seconds_out,
+ long *microseconds_out);
+int my_time_compare(const MYSQL_TIME &my_time_a, const MYSQL_TIME &my_time_b);
+
+long long int TIME_to_longlong_packed(const MYSQL_TIME &my_time,
+ enum enum_field_types type);
+
+void TIME_from_longlong_packed(MYSQL_TIME *ltime, enum enum_field_types type,
+ long long int packed_value);
+
+long long int longlong_from_datetime_packed(enum enum_field_types type,
+ long long int packed_value);
+
+double double_from_datetime_packed(enum enum_field_types type,
+ long long int packed_value);
+
+/**
+ @} (end of ingroup MY_TIME)
+*/
+#endif /* MY_TIME_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/my_timer.h b/contrib/libs/libmysql_r/include/my_timer.h
new file mode 100644
index 0000000000..f1d64b3a55
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_timer.h
@@ -0,0 +1,75 @@
+/* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MY_TIMER_H
+#define MY_TIMER_H
+
+/**
+ @file include/my_timer.h
+*/
+
+#include "my_config.h"
+
+/* POSIX timers API. */
+#ifdef HAVE_POSIX_TIMERS
+#include <time.h> /* timer_t */
+
+typedef timer_t os_timer_t;
+#elif defined(HAVE_KQUEUE_TIMERS)
+#include <sys/types.h> /* uintptr_t */
+
+typedef uintptr_t os_timer_t;
+#elif defined(_WIN32)
+struct os_timer_t {
+ HANDLE timer_handle;
+ bool timer_state;
+};
+#endif
+
+/* Non-copyable timer object. */
+struct my_timer_t {
+ /* Timer ID used to identify the timer in timer requests. */
+ os_timer_t id;
+
+ /** Timer expiration notification function. */
+ void (*notify_function)(my_timer_t *);
+};
+
+/* Initialize internal components. */
+int my_timer_initialize();
+
+/* Release any resources acquired. */
+void my_timer_deinitialize();
+
+/* Create a timer object. */
+int my_timer_create(my_timer_t *timer);
+
+/* Set the time (in milliseconds) until the next expiration of the timer. */
+int my_timer_set(my_timer_t *timer, unsigned long time);
+
+/* Cancel the timer */
+int my_timer_cancel(my_timer_t *timer, int *state);
+
+/* Delete a timer object. */
+void my_timer_delete(my_timer_t *timer);
+
+#endif /* MY_TIMER_H */
diff --git a/contrib/libs/libmysql_r/include/my_tree.h b/contrib/libs/libmysql_r/include/my_tree.h
new file mode 100644
index 0000000000..b255399630
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_tree.h
@@ -0,0 +1,110 @@
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef _tree_h
+#define _tree_h
+
+/**
+ @file include/my_tree.h
+*/
+
+#include <stddef.h>
+#include <sys/types.h>
+
+#include "my_alloc.h" /* MEM_ROOT */
+#include "my_base.h" /* get 'enum ha_rkey_function' */
+#include "my_inttypes.h"
+#include "my_sys.h" /* qsort2_cmp */
+
+/* Worst case tree is half full. This gives use 2^(MAX_TREE_HEIGHT/2) leafs */
+#define MAX_TREE_HEIGHT 64
+
+#define ELEMENT_KEY(tree, element) \
+ (tree->offset_to_key ? (void *)((uchar *)element + tree->offset_to_key) \
+ : *((void **)(element + 1)))
+
+#define tree_set_pointer(element, ptr) \
+ *((uchar **)(element + 1)) = ((uchar *)(ptr))
+
+#define TREE_NO_DUPS 1
+
+typedef enum { left_root_right, right_root_left } TREE_WALK;
+typedef uint32 element_count;
+typedef int (*tree_walk_action)(void *, element_count, void *);
+
+typedef enum { free_init, free_free, free_end } TREE_FREE;
+typedef void (*tree_element_free)(void *, TREE_FREE, const void *);
+
+struct TREE_ELEMENT {
+ TREE_ELEMENT() : count(0), colour(0) {}
+
+ TREE_ELEMENT *left{nullptr}, *right{nullptr};
+ uint32 count : 31, colour : 1; /* black is marked as 1 */
+};
+
+#define ELEMENT_CHILD(element, offs) \
+ (*(TREE_ELEMENT **)((char *)element + offs))
+
+struct TREE {
+ TREE_ELEMENT *root{nullptr}, null_element;
+ TREE_ELEMENT **parents[MAX_TREE_HEIGHT]{nullptr};
+ uint offset_to_key{0}, elements_in_tree{0}, size_of_element{0};
+ ulong memory_limit{0}, allocated{0};
+ qsort2_cmp compare{nullptr};
+ const void *custom_arg{nullptr};
+ MEM_ROOT mem_root;
+ bool with_delete{false};
+ tree_element_free free{nullptr};
+ uint flag{0};
+};
+
+/* Functions on whole tree */
+void init_tree(TREE *tree, size_t default_alloc_size, ulong memory_limit,
+ int size, qsort2_cmp compare, bool with_delete,
+ tree_element_free free_element, const void *custom_arg);
+void delete_tree(TREE *);
+void reset_tree(TREE *);
+/* similar to delete tree, except we do not my_free() blocks in mem_root
+ */
+#define is_tree_inited(tree) ((tree)->root != 0)
+
+/* Functions on leafs */
+TREE_ELEMENT *tree_insert(TREE *tree, void *key, uint key_size,
+ const void *custom_arg);
+void *tree_search(TREE *tree, void *key, const void *custom_arg);
+int tree_walk(TREE *tree, tree_walk_action action, void *argument,
+ TREE_WALK visit);
+int tree_delete(TREE *tree, void *key, uint key_size, const void *custom_arg);
+void *tree_search_key(TREE *tree, const void *key, TREE_ELEMENT **parents,
+ TREE_ELEMENT ***last_pos, enum ha_rkey_function flag,
+ const void *custom_arg);
+void *tree_search_edge(TREE *tree, TREE_ELEMENT **parents,
+ TREE_ELEMENT ***last_pos, int child_offs);
+void *tree_search_next(TREE *tree, TREE_ELEMENT ***last_pos, int l_offs,
+ int r_offs);
+ha_rows tree_record_pos(TREE *tree, const void *key,
+ enum ha_rkey_function search_flag,
+ const void *custom_arg);
+
+#define TREE_ELEMENT_EXTRA_SIZE (sizeof(TREE_ELEMENT) + sizeof(void *))
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/my_uctype.h b/contrib/libs/libmysql_r/include/my_uctype.h
new file mode 100644
index 0000000000..667f343e52
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_uctype.h
@@ -0,0 +1,1022 @@
+#ifndef MY_UCTYPE_INCLUDED
+#define MY_UCTYPE_INCLUDED
+
+/* Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#include <stddef.h>
+
+#include "m_ctype.h"
+
+/*
+ Unicode ctype data
+ Generated from UnicodeData-5.0.0d9.txt
+*/
+static unsigned char uctype_page00[256] = {
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16,
+ 16, 16, 16, 16, 16, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129,
+ 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129,
+ 129, 16, 16, 16, 16, 16, 16, 130, 130, 130, 130, 130, 130, 130, 130,
+ 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130,
+ 130, 130, 130, 16, 16, 16, 16, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 8, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 2, 16, 16, 32, 16, 16, 16, 16, 20, 20,
+ 16, 2, 16, 16, 16, 20, 2, 16, 20, 20, 20, 16, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 16, 1, 1, 1, 1, 1, 1, 1, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 16, 2, 2, 2, 2, 2, 2, 2,
+ 2};
+
+static unsigned char uctype_page01[256] = {
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1,
+ 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 1, 2, 1, 2, 1, 2, 2, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 1, 2, 2, 1, 1,
+ 1, 1, 2, 1, 1, 2, 1, 1, 1, 2, 2, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1,
+ 2, 1, 2, 2, 1, 2, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 2, 2, 2, 1, 2, 2, 2,
+ 2, 2, 2, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1,
+ 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 2, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2};
+
+static unsigned char uctype_page02[256] = {
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1,
+ 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 2, 2, 2, 2,
+ 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 1, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 16, 16, 16, 16, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 2, 2, 2, 2,
+ 2, 16, 16, 16, 16, 16, 16, 16, 16, 16, 2, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16};
+
+static unsigned char uctype_page03[256] = {
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0,
+ 0, 0, 16, 16, 0, 0, 0, 0, 2, 2, 2, 2, 16, 0, 0, 0, 0, 0, 16,
+ 16, 1, 16, 1, 1, 1, 0, 1, 0, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2,
+ 2, 1, 1, 1, 2, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 2, 2, 2, 1, 2, 16,
+ 1, 2, 1, 1, 2, 2, 1, 1, 1};
+
+static unsigned char uctype_page04[256] = {
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 16, 18,
+ 18, 18, 18, 0, 18, 18, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1,
+ 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2};
+
+static unsigned char uctype_page05[256] = {
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1,
+ 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 2, 16, 16, 16, 16, 16,
+ 16, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 0, 16, 16, 0, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 16, 18, 16, 18, 18, 16, 18, 18, 16, 18, 0, 0, 0, 0, 0, 0, 0, 0, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 2, 2, 2, 16, 16, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_page06[256] = {
+ 32, 32, 32, 32, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, 18, 18, 18,
+ 18, 18, 18, 0, 0, 0, 0, 0, 16, 0, 0, 16, 16, 0, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, 16, 16, 2, 2, 18, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 16, 2, 18, 18, 18, 18, 18, 18, 18, 32, 18, 18, 18, 18, 18, 18,
+ 18, 2, 2, 18, 18, 16, 18, 18, 18, 18, 2, 2, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 2, 2, 2, 16, 16, 2};
+
+static unsigned char uctype_page07[256] = {
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 32, 2, 18, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0,
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 18, 18, 18, 18, 18, 2, 2, 16,
+ 16, 16, 16, 2, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_page09[256] = {
+ 0, 18, 18, 18, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 0, 0, 18, 2, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 0, 0, 2, 18, 18, 18, 18, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 18, 18, 16, 16, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 0, 18, 18, 18, 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2,
+ 2, 2, 2, 2, 2, 2, 0, 2, 0, 0, 0, 2, 2, 2, 2, 0, 0, 18, 2,
+ 18, 18, 18, 18, 18, 18, 18, 0, 0, 18, 18, 0, 0, 18, 18, 18, 2, 0, 0,
+ 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 2, 2, 0, 2, 2, 2, 18, 18,
+ 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 16, 16, 20, 20, 20,
+ 20, 20, 20, 16, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_page0A[256] = {
+ 0, 18, 18, 18, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 0, 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 0, 2, 2, 0, 2,
+ 2, 0, 0, 18, 0, 18, 18, 18, 18, 18, 0, 0, 0, 0, 18, 18, 0, 0, 18,
+ 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 2,
+ 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 18, 18,
+ 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 18, 18, 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 0, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2,
+ 2, 2, 2, 2, 2, 2, 0, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, 18, 2,
+ 18, 18, 18, 18, 18, 18, 18, 18, 0, 18, 18, 18, 0, 18, 18, 18, 0, 0, 2,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 18, 18,
+ 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 16, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_page0B[256] = {
+ 0, 18, 18, 18, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 0, 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 0, 2, 2, 2, 2,
+ 2, 0, 0, 18, 2, 18, 18, 18, 18, 18, 18, 0, 0, 0, 18, 18, 0, 0, 18,
+ 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 18, 18, 0, 0, 0, 0, 2, 2, 0,
+ 2, 2, 2, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 2,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 2, 0,
+ 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 0, 2, 2, 2, 2, 0, 0,
+ 0, 2, 2, 0, 2, 0, 2, 2, 0, 0, 0, 2, 2, 0, 0, 0, 2, 2, 2,
+ 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0,
+ 18, 18, 18, 18, 18, 0, 0, 0, 18, 18, 18, 0, 18, 18, 18, 18, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 20, 20, 20, 16, 16, 16, 16,
+ 16, 16, 16, 16, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_page0C[256] = {
+ 0, 18, 18, 18, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 0, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2,
+ 2, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 0, 18, 18, 18, 0, 18, 18,
+ 18, 18, 0, 0, 0, 0, 0, 0, 0, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 2, 2, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 18, 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, 18, 2,
+ 18, 18, 18, 18, 18, 18, 18, 0, 18, 18, 18, 0, 18, 18, 18, 18, 0, 0, 0,
+ 0, 0, 0, 0, 18, 18, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 2, 18, 18,
+ 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 16, 16, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_page0D[256] = {
+ 0, 0, 18, 18, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 0, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 0, 0, 18, 18, 18, 0, 18, 18,
+ 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0,
+ 0, 2, 2, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 18, 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0,
+ 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2,
+ 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 18, 0, 0, 0, 0, 18, 18,
+ 18, 18, 18, 18, 0, 18, 0, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 18, 16, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_page0E[256] = {
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 18, 2, 2, 18, 18, 18, 18, 18,
+ 18, 18, 0, 0, 0, 0, 16, 2, 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 18,
+ 18, 18, 18, 16, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 2,
+ 0, 0, 2, 2, 0, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2,
+ 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 0, 2, 0, 2, 0, 0, 2,
+ 2, 0, 2, 2, 2, 2, 18, 2, 2, 18, 18, 18, 18, 18, 18, 0, 18, 18, 2,
+ 0, 0, 2, 2, 2, 2, 2, 0, 2, 0, 18, 18, 18, 18, 18, 18, 0, 0, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_page0F[256] = {
+ 2, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 18, 18, 16, 16, 16, 16, 16, 16, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 16, 18, 16, 18, 16,
+ 18, 16, 16, 16, 16, 18, 18, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 16, 18, 18, 2, 2, 2, 2, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18,
+ 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0,
+ 16, 16, 16, 16, 16, 16, 16, 16, 18, 16, 16, 16, 16, 16, 16, 0, 0, 16, 16,
+ 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_page10[256] = {
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2,
+ 0, 2, 2, 0, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 18, 18, 18, 18, 0, 0,
+ 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, 16, 16, 16, 16,
+ 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 2, 0, 0, 0};
+
+static unsigned char uctype_page11[256] = {
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_page12[256] = {
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 0, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 2, 2, 2, 2, 0, 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 0, 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0,
+ 2, 0, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2};
+
+static unsigned char uctype_page13[256] = {
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2,
+ 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0,
+ 18, 16, 16, 16, 16, 16, 16, 16, 16, 16, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_page14[256] = {
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2};
+
+static unsigned char uctype_page16[256] = {
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16,
+ 16, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 16, 16, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 16, 7, 7, 7, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_page17[256] = {
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 18,
+ 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 18, 18, 18, 16, 16, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 0,
+ 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 32, 32, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 16, 16, 16, 2, 16, 16, 16, 16, 2, 18, 0, 0, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_page18[256] = {
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 18, 18, 18, 8, 0, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_page19[256] = {
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 0, 0, 0, 0, 16, 0, 0, 0, 16, 16, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2,
+ 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0,
+ 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 2, 2, 2, 2, 2, 2, 2, 18, 18, 0, 0, 0, 0, 0, 0, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16};
+
+static unsigned char uctype_page1A[256] = {
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 18, 18, 18, 18, 18, 0, 0, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_page1B[256] = {
+ 18, 18, 18, 18, 18, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 2, 2, 2, 2, 2, 2, 2,
+ 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_page1D[256] = {
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 18};
+
+static unsigned char uctype_page1E[256] = {
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_page1F[256] = {
+ 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,
+ 2, 2, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1,
+ 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 1, 0, 1, 0, 1, 2, 2, 2, 2,
+ 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1,
+ 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,
+ 2, 0, 2, 2, 1, 1, 1, 1, 1, 16, 2, 16, 16, 16, 2, 2, 2, 0, 2, 2,
+ 1, 1, 1, 1, 1, 16, 16, 16, 2, 2, 2, 2, 0, 0, 2, 2, 1, 1, 1, 1,
+ 0, 16, 16, 16, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 16, 16, 16,
+ 0, 0, 2, 2, 2, 0, 2, 2, 1, 1, 1, 1, 1, 16, 16, 0};
+
+static unsigned char uctype_page20[256] = {
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 32, 32, 32, 32, 32, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 8, 8, 32, 32, 32, 32, 32, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 8, 32, 32, 32, 32, 0, 0, 0, 0, 0, 0, 32, 32, 32, 32, 32, 32, 20, 2,
+ 0, 0, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16, 16, 2, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 16, 16, 16, 16, 16, 0, 2, 2, 2, 2, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_page21[256] = {
+ 16, 16, 1, 16, 16, 16, 16, 1, 16, 16, 2, 1, 1, 1, 2, 2, 1, 1, 1,
+ 2, 16, 1, 16, 16, 16, 1, 1, 1, 1, 1, 16, 16, 16, 16, 16, 16, 1, 16,
+ 1, 16, 1, 16, 1, 1, 1, 1, 16, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2,
+ 2, 16, 16, 2, 2, 1, 1, 16, 16, 16, 16, 16, 1, 2, 2, 2, 2, 16, 16,
+ 16, 16, 2, 0, 0, 0, 0, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 1, 2,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16};
+
+static unsigned char uctype_page23[256] = {
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_page24[256] = {
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20};
+
+static unsigned char uctype_page26[256] = {
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_page27[256] = {
+ 0, 16, 16, 16, 16, 0, 16, 16, 16, 16, 0, 0, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 0, 16, 0, 16, 16, 16, 16, 0, 0, 0, 16, 0, 16, 16, 16, 16, 16, 16, 16,
+ 0, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 16, 0, 0, 0,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16};
+
+static unsigned char uctype_page2B[256] = {
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 16, 16, 16, 16, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_page2C[256] = {
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 1, 1, 1, 2, 2, 1, 2, 1, 2, 1, 2, 0,
+ 0, 0, 0, 0, 0, 0, 2, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2, 2, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 20, 16, 16};
+
+static unsigned char uctype_page2D[256] = {
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0,
+ 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0,
+ 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0,
+ 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_page2E[256] = {
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 0, 0, 0, 0, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_page2F[256] = {
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 0, 0, 0, 0};
+
+static unsigned char uctype_page30[256] = {
+ 8, 16, 16, 16, 16, 2, 2, 7, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 18, 18, 18, 18, 18, 18, 16, 2, 2, 2, 2, 2, 16, 16, 7,
+ 7, 7, 2, 2, 16, 16, 16, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0,
+ 0, 18, 18, 16, 16, 2, 2, 2, 16, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 16, 2, 2, 2, 2};
+
+static unsigned char uctype_page31[256] = {
+ 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 16, 16, 20, 20, 20, 20, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0,
+ 0, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2};
+
+static unsigned char uctype_page32[256] = {
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 16, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 0};
+
+static unsigned char uctype_page4D[256] = {
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16};
+
+static unsigned char uctype_page9F[256] = {
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_pageA4[256] = {
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_pageA7[256] = {
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 2, 2, 2, 2, 0, 0, 0, 0, 0, 16, 16, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_pageA8[256] = {
+ 2, 2, 18, 2, 2, 2, 18, 2, 2, 2, 2, 18, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 18,
+ 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 16, 16,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_pageD7[256] = {
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_pageD8[256] = {
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_pageDB[256] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 32, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32};
+
+static unsigned char uctype_pageDC[256] = {
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_pageDF[256] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32};
+
+static unsigned char uctype_pageE0[256] = {
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_pageF8[256] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32};
+
+static unsigned char uctype_pageFA[256] = {
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+static unsigned char uctype_pageFB[256] = {
+ 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2,
+ 0, 0, 0, 0, 0, 2, 18, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 0, 2, 0, 2, 2, 0, 2, 2, 0, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2};
+
+static unsigned char uctype_pageFD[256] = {
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 0, 0};
+
+static unsigned char uctype_pageFE[256] = {
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 18, 18, 18, 18, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 0, 16, 16, 16, 16, 0, 0, 0, 0, 2, 2,
+ 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 0, 0, 32};
+
+static unsigned char uctype_pageFF[256] = {
+ 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 16, 16, 16, 16, 16, 16, 16, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 16, 16, 16, 16, 16, 16, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 0,
+ 0, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 0, 0, 0, 16, 16, 16, 16,
+ 16, 16, 16, 0, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 32, 32, 32, 16, 16, 0, 0};
+
+MY_UNI_CTYPE my_uni_ctype[256] = {
+ {0, uctype_page00}, {0, uctype_page01}, {0, uctype_page02},
+ {0, uctype_page03}, {0, uctype_page04}, {0, uctype_page05},
+ {0, uctype_page06}, {0, uctype_page07}, {0, NULL},
+ {0, uctype_page09}, {0, uctype_page0A}, {0, uctype_page0B},
+ {0, uctype_page0C}, {0, uctype_page0D}, {0, uctype_page0E},
+ {0, uctype_page0F}, {0, uctype_page10}, {0, uctype_page11},
+ {0, uctype_page12}, {0, uctype_page13}, {0, uctype_page14},
+ {2, NULL}, {0, uctype_page16}, {0, uctype_page17},
+ {0, uctype_page18}, {0, uctype_page19}, {0, uctype_page1A},
+ {0, uctype_page1B}, {0, NULL}, {0, uctype_page1D},
+ {0, uctype_page1E}, {0, uctype_page1F}, {0, uctype_page20},
+ {0, uctype_page21}, {16, NULL}, {0, uctype_page23},
+ {0, uctype_page24}, {16, NULL}, {0, uctype_page26},
+ {0, uctype_page27}, {16, NULL}, {16, NULL},
+ {16, NULL}, {0, uctype_page2B}, {0, uctype_page2C},
+ {0, uctype_page2D}, {0, uctype_page2E}, {0, uctype_page2F},
+ {0, uctype_page30}, {0, uctype_page31}, {0, uctype_page32},
+ {16, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {0, uctype_page4D},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {0, uctype_page9F}, {2, NULL}, {2, NULL},
+ {2, NULL}, {2, NULL}, {0, uctype_pageA4},
+ {0, NULL}, {0, NULL}, {0, uctype_pageA7},
+ {0, uctype_pageA8}, {0, NULL}, {0, NULL},
+ {0, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {3, NULL},
+ {3, NULL}, {3, NULL}, {0, uctype_pageD7},
+ {0, uctype_pageD8}, {0, NULL}, {0, NULL},
+ {0, uctype_pageDB}, {0, uctype_pageDC}, {0, NULL},
+ {0, NULL}, {0, uctype_pageDF}, {0, uctype_pageE0},
+ {0, NULL}, {0, NULL}, {0, NULL},
+ {0, NULL}, {0, NULL}, {0, NULL},
+ {0, NULL}, {0, NULL}, {0, NULL},
+ {0, NULL}, {0, NULL}, {0, NULL},
+ {0, NULL}, {0, NULL}, {0, NULL},
+ {0, NULL}, {0, NULL}, {0, NULL},
+ {0, NULL}, {0, NULL}, {0, NULL},
+ {0, NULL}, {0, NULL}, {0, uctype_pageF8},
+ {2, NULL}, {0, uctype_pageFA}, {0, uctype_pageFB},
+ {2, NULL}, {0, uctype_pageFD}, {0, uctype_pageFE},
+ {0, uctype_pageFF}};
+
+#endif /* MY_UCTYPE_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/my_user.h b/contrib/libs/libmysql_r/include/my_user.h
new file mode 100644
index 0000000000..4c8d660317
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_user.h
@@ -0,0 +1,39 @@
+/* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/*
+ This is a header for libraries containing functions used in both server and
+ only some of clients (but not in libmysql)...
+*/
+
+#ifndef _my_user_h_
+#define _my_user_h_
+
+#include <stddef.h>
+
+#include "my_macros.h"
+
+void parse_user(const char *user_id_str, size_t user_id_len,
+ char *user_name_str, size_t *user_name_len, char *host_name_str,
+ size_t *host_name_len);
+
+#endif /* _my_user_h_ */
diff --git a/contrib/libs/libmysql_r/include/my_xml.h b/contrib/libs/libmysql_r/include/my_xml.h
new file mode 100644
index 0000000000..0ecf3f546e
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/my_xml.h
@@ -0,0 +1,98 @@
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef _my_xml_h
+#define _my_xml_h
+
+/**
+ @file include/my_xml.h
+*/
+
+#include <stddef.h>
+#include <sys/types.h>
+
+#define MY_XML_OK 0
+#define MY_XML_ERROR 1
+
+/*
+ A flag whether to use absolute tag names in call-back functions,
+ like "a", "a.b" and "a.b.c" (used in character set file parser),
+ or relative names like "a", "b" and "c".
+*/
+#define MY_XML_FLAG_RELATIVE_NAMES 1
+
+/*
+ A flag whether to skip normilization of text values before calling
+ call-back functions: i.e. skip leading/trailing spaces,
+ \r, \n, \t characters.
+*/
+#define MY_XML_FLAG_SKIP_TEXT_NORMALIZATION 2
+
+enum my_xml_node_type {
+ MY_XML_NODE_TAG, /* can have TAG, ATTR and TEXT children */
+ MY_XML_NODE_ATTR, /* can have TEXT children */
+ MY_XML_NODE_TEXT /* cannot have children */
+};
+
+struct MY_XML_PARSER {
+ int flags;
+ enum my_xml_node_type current_node_type;
+ char errstr[128];
+
+ struct {
+ char static_buffer[128];
+ char *buffer;
+ size_t buffer_size;
+ char *start;
+ char *end;
+ } attr;
+
+ const char *beg;
+ const char *cur;
+ const char *end;
+ void *user_data;
+ int (*enter)(MY_XML_PARSER *st, const char *val, size_t len);
+ int (*value)(MY_XML_PARSER *st, const char *val, size_t len);
+ int (*leave_xml)(MY_XML_PARSER *st, const char *val, size_t len);
+};
+
+void my_xml_parser_create(MY_XML_PARSER *st);
+void my_xml_parser_free(MY_XML_PARSER *st);
+int my_xml_parse(MY_XML_PARSER *st, const char *str, size_t len);
+
+void my_xml_set_value_handler(MY_XML_PARSER *st,
+ int (*)(MY_XML_PARSER *, const char *,
+ size_t len));
+void my_xml_set_enter_handler(MY_XML_PARSER *st,
+ int (*)(MY_XML_PARSER *, const char *,
+ size_t len));
+void my_xml_set_leave_handler(MY_XML_PARSER *st,
+ int (*)(MY_XML_PARSER *, const char *,
+ size_t len));
+void my_xml_set_user_data(MY_XML_PARSER *st, void *);
+
+size_t my_xml_error_pos(MY_XML_PARSER *st);
+uint my_xml_error_lineno(MY_XML_PARSER *st);
+
+const char *my_xml_error_string(MY_XML_PARSER *st);
+
+#endif /* _my_xml_h */
diff --git a/contrib/libs/libmysql_r/include/myisampack.h b/contrib/libs/libmysql_r/include/myisampack.h
new file mode 100644
index 0000000000..4e1c17c588
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/myisampack.h
@@ -0,0 +1,306 @@
+#ifndef MYISAMPACK_INCLUDED
+#define MYISAMPACK_INCLUDED
+
+/* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/myisampack.h
+ Storing of values in high byte first order.
+
+ Integer keys and file pointers are stored with high byte first to get
+ better compression.
+*/
+
+#include "my_config.h"
+
+#ifdef HAVE_ENDIAN_H
+#include <endian.h>
+#endif
+#include <sys/types.h>
+
+#include "my_inttypes.h"
+
+/* these two are for uniformity */
+
+static inline int8 mi_sint1korr(const uchar *A) { return *A; }
+
+static inline uint8 mi_uint1korr(const uchar *A) { return *A; }
+
+static inline int16 mi_sint2korr(const uchar *A) {
+ return (int16)((uint32)(A[1]) + ((uint32)(A[0]) << 8));
+}
+
+static inline int32 mi_sint3korr(const uchar *A) {
+ return (int32)((A[0] & 128) ? ((255U << 24) | ((uint32)(A[0]) << 16) |
+ ((uint32)(A[1]) << 8) | ((uint32)A[2]))
+ : (((uint32)(A[0]) << 16) |
+ ((uint32)(A[1]) << 8) | ((uint32)(A[2]))));
+}
+
+static inline int32 mi_sint4korr(const uchar *A) {
+ return (int32)((uint32)(A[3]) + ((uint32)(A[2]) << 8) +
+ ((uint32)(A[1]) << 16) + ((uint32)(A[0]) << 24));
+}
+
+static inline uint16 mi_uint2korr(const uchar *A) {
+ return (uint16)((uint16)A[1]) + ((uint16)A[0] << 8);
+}
+
+static inline uint32 mi_uint3korr(const uchar *A) {
+ return (uint32)((uint32)A[2] + ((uint32)A[1] << 8) + ((uint32)A[0] << 16));
+}
+
+static inline uint32 mi_uint4korr(const uchar *A) {
+ return (uint32)((uint32)A[3] + ((uint32)A[2] << 8) + ((uint32)A[1] << 16) +
+ ((uint32)A[0] << 24));
+}
+
+static inline ulonglong mi_uint5korr(const uchar *A) {
+ return (ulonglong)((uint32)A[4] + ((uint32)A[3] << 8) + ((uint32)A[2] << 16) +
+ ((uint32)A[1] << 24)) +
+ ((ulonglong)A[0] << 32);
+}
+
+static inline ulonglong mi_uint6korr(const uchar *A) {
+ return (ulonglong)((uint32)A[5] + ((uint32)A[4] << 8) + ((uint32)A[3] << 16) +
+ ((uint32)A[2] << 24)) +
+ (((ulonglong)((uint32)A[1] + ((uint32)A[0] << 8))) << 32);
+}
+
+static inline ulonglong mi_uint7korr(const uchar *A) {
+ return (ulonglong)((uint32)A[6] + ((uint32)A[5] << 8) + ((uint32)A[4] << 16) +
+ ((uint32)A[3] << 24)) +
+ (((ulonglong)((uint32)A[2] + ((uint32)A[1] << 8) +
+ ((uint32)A[0] << 16)))
+ << 32);
+}
+
+static inline ulonglong mi_uint8korr(const uchar *A) {
+ return (ulonglong)((uint32)A[7] + ((uint32)A[6] << 8) + ((uint32)A[5] << 16) +
+ ((uint32)A[4] << 24)) +
+ (((ulonglong)((uint32)A[3] + ((uint32)A[2] << 8) +
+ ((uint32)A[1] << 16) + ((uint32)A[0] << 24)))
+ << 32);
+}
+
+static inline longlong mi_sint8korr(const uchar *A) {
+ return (longlong)mi_uint8korr(A);
+}
+
+/* This one is for uniformity */
+#define mi_int1store(T, A) *((uchar *)(T)) = (uchar)(A)
+
+#define mi_int2store(T, A) \
+ { \
+ uint def_temp = (uint)(A); \
+ ((uchar *)(T))[1] = (uchar)(def_temp); \
+ ((uchar *)(T))[0] = (uchar)(def_temp >> 8); \
+ }
+#define mi_int3store(T, A) \
+ { /*lint -save -e734 */ \
+ ulong def_temp = (ulong)(A); \
+ ((uchar *)(T))[2] = (uchar)(def_temp); \
+ ((uchar *)(T))[1] = (uchar)(def_temp >> 8); \
+ ((uchar *)(T))[0] = (uchar)(def_temp >> 16); \
+ /*lint -restore */}
+#define mi_int4store(T, A) \
+ { \
+ ulong def_temp = (ulong)(A); \
+ ((uchar *)(T))[3] = (uchar)(def_temp); \
+ ((uchar *)(T))[2] = (uchar)(def_temp >> 8); \
+ ((uchar *)(T))[1] = (uchar)(def_temp >> 16); \
+ ((uchar *)(T))[0] = (uchar)(def_temp >> 24); \
+ }
+#define mi_int5store(T, A) \
+ { \
+ ulong def_temp = (ulong)(A), def_temp2 = (ulong)((A) >> 32); \
+ ((uchar *)(T))[4] = (uchar)(def_temp); \
+ ((uchar *)(T))[3] = (uchar)(def_temp >> 8); \
+ ((uchar *)(T))[2] = (uchar)(def_temp >> 16); \
+ ((uchar *)(T))[1] = (uchar)(def_temp >> 24); \
+ ((uchar *)(T))[0] = (uchar)(def_temp2); \
+ }
+#define mi_int6store(T, A) \
+ { \
+ ulong def_temp = (ulong)(A), def_temp2 = (ulong)((A) >> 32); \
+ ((uchar *)(T))[5] = (uchar)(def_temp); \
+ ((uchar *)(T))[4] = (uchar)(def_temp >> 8); \
+ ((uchar *)(T))[3] = (uchar)(def_temp >> 16); \
+ ((uchar *)(T))[2] = (uchar)(def_temp >> 24); \
+ ((uchar *)(T))[1] = (uchar)(def_temp2); \
+ ((uchar *)(T))[0] = (uchar)(def_temp2 >> 8); \
+ }
+#define mi_int7store(T, A) \
+ { \
+ ulong def_temp = (ulong)(A), def_temp2 = (ulong)((A) >> 32); \
+ ((uchar *)(T))[6] = (uchar)(def_temp); \
+ ((uchar *)(T))[5] = (uchar)(def_temp >> 8); \
+ ((uchar *)(T))[4] = (uchar)(def_temp >> 16); \
+ ((uchar *)(T))[3] = (uchar)(def_temp >> 24); \
+ ((uchar *)(T))[2] = (uchar)(def_temp2); \
+ ((uchar *)(T))[1] = (uchar)(def_temp2 >> 8); \
+ ((uchar *)(T))[0] = (uchar)(def_temp2 >> 16); \
+ }
+#define mi_int8store(T, A) \
+ { \
+ ulong def_temp3 = (ulong)(A), def_temp4 = (ulong)((A) >> 32); \
+ mi_int4store((uchar *)(T) + 0, def_temp4); \
+ mi_int4store((uchar *)(T) + 4, def_temp3); \
+ }
+
+#ifdef WORDS_BIGENDIAN
+
+#define mi_float4store(T, A) \
+ { \
+ ((uchar *)(T))[0] = ((uchar *)&A)[0]; \
+ ((uchar *)(T))[1] = ((uchar *)&A)[1]; \
+ ((uchar *)(T))[2] = ((uchar *)&A)[2]; \
+ ((uchar *)(T))[3] = ((uchar *)&A)[3]; \
+ }
+
+static inline float mi_float4get(const uchar *M) {
+ float def_temp;
+ ((uchar *)&def_temp)[0] = M[0];
+ ((uchar *)&def_temp)[1] = M[1];
+ ((uchar *)&def_temp)[2] = M[2];
+ ((uchar *)&def_temp)[3] = M[3];
+ return def_temp;
+}
+
+#define mi_float8store(T, V) \
+ { \
+ ((uchar *)(T))[0] = ((uchar *)&V)[0]; \
+ ((uchar *)(T))[1] = ((uchar *)&V)[1]; \
+ ((uchar *)(T))[2] = ((uchar *)&V)[2]; \
+ ((uchar *)(T))[3] = ((uchar *)&V)[3]; \
+ ((uchar *)(T))[4] = ((uchar *)&V)[4]; \
+ ((uchar *)(T))[5] = ((uchar *)&V)[5]; \
+ ((uchar *)(T))[6] = ((uchar *)&V)[6]; \
+ ((uchar *)(T))[7] = ((uchar *)&V)[7]; \
+ }
+
+static inline double mi_float8get(const uchar *M) {
+ double def_temp;
+ ((uchar *)&def_temp)[0] = M[0];
+ ((uchar *)&def_temp)[1] = M[1];
+ ((uchar *)&def_temp)[2] = M[2];
+ ((uchar *)&def_temp)[3] = M[3];
+ ((uchar *)&def_temp)[4] = M[4];
+ ((uchar *)&def_temp)[5] = M[5];
+ ((uchar *)&def_temp)[6] = M[6];
+ ((uchar *)&def_temp)[7] = M[7];
+ return def_temp;
+}
+#else
+
+#define mi_float4store(T, A) \
+ { \
+ ((uchar *)(T))[0] = ((uchar *)&A)[3]; \
+ ((uchar *)(T))[1] = ((uchar *)&A)[2]; \
+ ((uchar *)(T))[2] = ((uchar *)&A)[1]; \
+ ((uchar *)(T))[3] = ((uchar *)&A)[0]; \
+ }
+
+static inline float mi_float4get(const uchar *M) {
+ float def_temp;
+ ((uchar *)&def_temp)[0] = M[3];
+ ((uchar *)&def_temp)[1] = M[2];
+ ((uchar *)&def_temp)[2] = M[1];
+ ((uchar *)&def_temp)[3] = M[0];
+ return def_temp;
+}
+
+#if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
+#define mi_float8store(T, V) \
+ { \
+ ((uchar *)(T))[0] = ((uchar *)&V)[3]; \
+ ((uchar *)(T))[1] = ((uchar *)&V)[2]; \
+ ((uchar *)(T))[2] = ((uchar *)&V)[1]; \
+ ((uchar *)(T))[3] = ((uchar *)&V)[0]; \
+ ((uchar *)(T))[4] = ((uchar *)&V)[7]; \
+ ((uchar *)(T))[5] = ((uchar *)&V)[6]; \
+ ((uchar *)(T))[6] = ((uchar *)&V)[5]; \
+ ((uchar *)(T))[7] = ((uchar *)&V)[4]; \
+ }
+
+static inline double mi_float8get(const uchar *M) {
+ double def_temp;
+ ((uchar *)&def_temp)[0] = M[3];
+ ((uchar *)&def_temp)[1] = M[2];
+ ((uchar *)&def_temp)[2] = M[1];
+ ((uchar *)&def_temp)[3] = M[0];
+ ((uchar *)&def_temp)[4] = M[7];
+ ((uchar *)&def_temp)[5] = M[6];
+ ((uchar *)&def_temp)[6] = M[5];
+ ((uchar *)&def_temp)[7] = M[4];
+ return def_temp;
+}
+
+#else
+#define mi_float8store(T, V) \
+ { \
+ ((uchar *)(T))[0] = ((uchar *)&V)[7]; \
+ ((uchar *)(T))[1] = ((uchar *)&V)[6]; \
+ ((uchar *)(T))[2] = ((uchar *)&V)[5]; \
+ ((uchar *)(T))[3] = ((uchar *)&V)[4]; \
+ ((uchar *)(T))[4] = ((uchar *)&V)[3]; \
+ ((uchar *)(T))[5] = ((uchar *)&V)[2]; \
+ ((uchar *)(T))[6] = ((uchar *)&V)[1]; \
+ ((uchar *)(T))[7] = ((uchar *)&V)[0]; \
+ }
+
+static inline double mi_float8get(const uchar *M) {
+ double def_temp;
+ ((uchar *)&def_temp)[0] = M[7];
+ ((uchar *)&def_temp)[1] = M[6];
+ ((uchar *)&def_temp)[2] = M[5];
+ ((uchar *)&def_temp)[3] = M[4];
+ ((uchar *)&def_temp)[4] = M[3];
+ ((uchar *)&def_temp)[5] = M[2];
+ ((uchar *)&def_temp)[6] = M[1];
+ ((uchar *)&def_temp)[7] = M[0];
+ return def_temp;
+}
+
+#endif /* __FLOAT_WORD_ORDER */
+#endif /* WORDS_BIGENDIAN */
+
+#define mi_rowstore(T, A) mi_int8store(T, A)
+#define mi_rowkorr(T) mi_uint8korr(T)
+
+#if SIZEOF_OFF_T > 4
+#define mi_sizestore(T, A) mi_int8store(T, A)
+#define mi_sizekorr(T) mi_uint8korr(T)
+#else
+#define mi_sizestore(T, A) \
+ { \
+ if ((A) == HA_OFFSET_ERROR) \
+ memset((T), 255, 8); \
+ else { \
+ mi_int4store((T), 0); \
+ mi_int4store(((T) + 4), A); \
+ } \
+ }
+#define mi_sizekorr(T) mi_uint4korr((uchar *)(T) + 4)
+#endif
+#endif /* MYISAMPACK_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/mysql.h b/contrib/libs/libmysql_r/include/mysql.h
new file mode 100644
index 0000000000..561960cd92
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql.h
@@ -0,0 +1,791 @@
+/* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ Without limiting anything contained in the foregoing, this file,
+ which is part of C Driver for MySQL (Connector/C), is also subject to the
+ Universal FOSS Exception, version 1.0, a copy of which can be found at
+ http://oss.oracle.com/licenses/universal-foss-exception.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/mysql.h
+ This file defines the client API to MySQL and also the ABI of the
+ dynamically linked libmysqlclient.
+
+ The ABI should never be changed in a released product of MySQL,
+ thus you need to take great care when changing the file. In case
+ the file is changed so the ABI is broken, you must also update
+ the SHARED_LIB_MAJOR_VERSION in cmake/mysql_version.cmake
+*/
+
+#ifndef _mysql_h
+#define _mysql_h
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdbool.h>
+#include <stddef.h>
+#include <sys/types.h>
+#endif
+
+// Small extra definitions to avoid pulling in my_inttypes.h in client code.
+// IWYU pragma: no_include "my_inttypes.h"
+#if defined(_WIN32)
+typedef unsigned __int64 my_ulonglong;
+#else
+typedef unsigned long long my_ulonglong;
+#endif /* _WIN32 */
+
+#ifndef my_socket_defined
+#define my_socket_defined
+#ifdef _WIN32
+#include <windows.h>
+#ifdef WIN32_LEAN_AND_MEAN
+#include <winsock2.h>
+#endif
+#define my_socket SOCKET
+#else
+typedef int my_socket;
+#endif /* _WIN32 */
+#endif /* my_socket_defined */
+
+// Small extra definition to avoid pulling in my_compiler.h in client code.
+// IWYU pragma: no_include "my_compiler.h"
+#ifndef MY_COMPILER_INCLUDED
+#if !defined(_WIN32)
+#define STDCALL
+#else
+#define STDCALL __stdcall
+#endif
+#endif /* MY_COMPILER_INCLUDED */
+
+#include "field_types.h"
+#include "my_list.h"
+#include "mysql_com.h"
+
+/* Include declarations of plug-in API */
+#include "mysql/client_plugin.h" // IWYU pragma: keep
+
+/*
+ The client should be able to know which version it is compiled against,
+ even if mysql.h doesn't use this information directly.
+*/
+#include "mysql_version.h" // IWYU pragma: keep
+
+// MYSQL_TIME is part of our public API.
+#include "mysql_time.h" // IWYU pragma: keep
+
+// The error messages are part of our public API.
+#include "errmsg.h" // IWYU pragma: keep
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern unsigned int mysql_port;
+extern char *mysql_unix_port;
+
+#define CLIENT_NET_RETRY_COUNT 1 /* Retry count */
+#define CLIENT_NET_READ_TIMEOUT 365 * 24 * 3600 /* Timeout on read */
+#define CLIENT_NET_WRITE_TIMEOUT 365 * 24 * 3600 /* Timeout on write */
+
+#define IS_PRI_KEY(n) ((n)&PRI_KEY_FLAG)
+#define IS_NOT_NULL(n) ((n)&NOT_NULL_FLAG)
+#define IS_BLOB(n) ((n)&BLOB_FLAG)
+/**
+ Returns true if the value is a number which does not need quotes for
+ the sql_lex.cc parser to parse correctly.
+*/
+#define IS_NUM(t) \
+ (((t) <= MYSQL_TYPE_INT24 && (t) != MYSQL_TYPE_TIMESTAMP) || \
+ (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL)
+#define IS_LONGDATA(t) ((t) >= MYSQL_TYPE_TINY_BLOB && (t) <= MYSQL_TYPE_STRING)
+
+typedef struct MYSQL_FIELD {
+ char *name; /* Name of column */
+ char *org_name; /* Original column name, if an alias */
+ char *table; /* Table of column if column was a field */
+ char *org_table; /* Org table name, if table was an alias */
+ char *db; /* Database for table */
+ char *catalog; /* Catalog for table */
+ char *def; /* Default value (set by mysql_list_fields) */
+ unsigned long length; /* Width of column (create length) */
+ unsigned long max_length; /* Max width for selected set */
+ unsigned int name_length;
+ unsigned int org_name_length;
+ unsigned int table_length;
+ unsigned int org_table_length;
+ unsigned int db_length;
+ unsigned int catalog_length;
+ unsigned int def_length;
+ unsigned int flags; /* Div flags */
+ unsigned int decimals; /* Number of decimals in field */
+ unsigned int charsetnr; /* Character set */
+ enum enum_field_types type; /* Type of field. See mysql_com.h for types */
+ void *extension;
+} MYSQL_FIELD;
+
+typedef char **MYSQL_ROW; /* return data as array of strings */
+typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */
+
+#define MYSQL_COUNT_ERROR (~(my_ulonglong)0)
+
+/* backward compatibility define - to be removed eventually */
+#define ER_WARN_DATA_TRUNCATED WARN_DATA_TRUNCATED
+
+typedef struct MYSQL_ROWS {
+ struct MYSQL_ROWS *next; /* list of rows */
+ MYSQL_ROW data;
+ unsigned long length;
+} MYSQL_ROWS;
+
+typedef MYSQL_ROWS *MYSQL_ROW_OFFSET; /* offset to current row */
+
+struct MEM_ROOT;
+
+typedef struct MYSQL_DATA {
+ MYSQL_ROWS *data;
+ struct MEM_ROOT *alloc;
+ my_ulonglong rows;
+ unsigned int fields;
+} MYSQL_DATA;
+
+enum mysql_option {
+ MYSQL_OPT_CONNECT_TIMEOUT,
+ MYSQL_OPT_COMPRESS,
+ MYSQL_OPT_NAMED_PIPE,
+ MYSQL_INIT_COMMAND,
+ MYSQL_READ_DEFAULT_FILE,
+ MYSQL_READ_DEFAULT_GROUP,
+ MYSQL_SET_CHARSET_DIR,
+ MYSQL_SET_CHARSET_NAME,
+ MYSQL_OPT_LOCAL_INFILE,
+ MYSQL_OPT_PROTOCOL,
+ MYSQL_SHARED_MEMORY_BASE_NAME,
+ MYSQL_OPT_READ_TIMEOUT,
+ MYSQL_OPT_WRITE_TIMEOUT,
+ MYSQL_OPT_USE_RESULT,
+ MYSQL_REPORT_DATA_TRUNCATION,
+ MYSQL_OPT_RECONNECT,
+ MYSQL_PLUGIN_DIR,
+ MYSQL_DEFAULT_AUTH,
+ MYSQL_OPT_BIND,
+ MYSQL_OPT_SSL_KEY,
+ MYSQL_OPT_SSL_CERT,
+ MYSQL_OPT_SSL_CA,
+ MYSQL_OPT_SSL_CAPATH,
+ MYSQL_OPT_SSL_CIPHER,
+ MYSQL_OPT_SSL_CRL,
+ MYSQL_OPT_SSL_CRLPATH,
+ MYSQL_OPT_CONNECT_ATTR_RESET,
+ MYSQL_OPT_CONNECT_ATTR_ADD,
+ MYSQL_OPT_CONNECT_ATTR_DELETE,
+ MYSQL_SERVER_PUBLIC_KEY,
+ MYSQL_ENABLE_CLEARTEXT_PLUGIN,
+ MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS,
+ MYSQL_OPT_MAX_ALLOWED_PACKET,
+ MYSQL_OPT_NET_BUFFER_LENGTH,
+ MYSQL_OPT_TLS_VERSION,
+ MYSQL_OPT_SSL_MODE,
+ MYSQL_OPT_GET_SERVER_PUBLIC_KEY,
+ MYSQL_OPT_RETRY_COUNT,
+ MYSQL_OPT_OPTIONAL_RESULTSET_METADATA,
+ MYSQL_OPT_SSL_FIPS_MODE,
+ MYSQL_OPT_TLS_CIPHERSUITES
+};
+
+/**
+ @todo remove the "extension", move st_mysql_options completely
+ out of mysql.h
+*/
+struct st_mysql_options_extention;
+
+struct st_mysql_options {
+ unsigned int connect_timeout, read_timeout, write_timeout;
+ unsigned int port, protocol;
+ unsigned long client_flag;
+ char *host, *user, *password, *unix_socket, *db;
+ struct Init_commands_array *init_commands;
+ char *my_cnf_file, *my_cnf_group, *charset_dir, *charset_name;
+ char *ssl_key; /* PEM key file */
+ char *ssl_cert; /* PEM cert file */
+ char *ssl_ca; /* PEM CA file */
+ char *ssl_capath; /* PEM directory of CA-s? */
+ char *ssl_cipher; /* cipher to use */
+ char *shared_memory_base_name;
+ unsigned long max_allowed_packet;
+ bool compress, named_pipe;
+ /**
+ The local address to bind when connecting to remote server.
+ */
+ char *bind_address;
+ /* 0 - never report, 1 - always report (default) */
+ bool report_data_truncation;
+
+ /* function pointers for local infile support */
+ int (*local_infile_init)(void **, const char *, void *);
+ int (*local_infile_read)(void *, char *, unsigned int);
+ void (*local_infile_end)(void *);
+ int (*local_infile_error)(void *, char *, unsigned int);
+ void *local_infile_userdata;
+ struct st_mysql_options_extention *extension;
+};
+
+enum mysql_status {
+ MYSQL_STATUS_READY,
+ MYSQL_STATUS_GET_RESULT,
+ MYSQL_STATUS_USE_RESULT,
+ MYSQL_STATUS_STATEMENT_GET_RESULT
+};
+
+enum mysql_protocol_type {
+ MYSQL_PROTOCOL_DEFAULT,
+ MYSQL_PROTOCOL_TCP,
+ MYSQL_PROTOCOL_SOCKET,
+ MYSQL_PROTOCOL_PIPE,
+ MYSQL_PROTOCOL_MEMORY
+};
+
+enum mysql_ssl_mode {
+ SSL_MODE_DISABLED = 1,
+ SSL_MODE_PREFERRED,
+ SSL_MODE_REQUIRED,
+ SSL_MODE_VERIFY_CA,
+ SSL_MODE_VERIFY_IDENTITY
+};
+
+enum mysql_ssl_fips_mode {
+ SSL_FIPS_MODE_OFF = 0,
+ SSL_FIPS_MODE_ON = 1,
+ SSL_FIPS_MODE_STRICT
+};
+
+typedef struct character_set {
+ unsigned int number; /* character set number */
+ unsigned int state; /* character set state */
+ const char *csname; /* collation name */
+ const char *name; /* character set name */
+ const char *comment; /* comment */
+ const char *dir; /* character set directory */
+ unsigned int mbminlen; /* min. length for multibyte strings */
+ unsigned int mbmaxlen; /* max. length for multibyte strings */
+} MY_CHARSET_INFO;
+
+struct MYSQL_METHODS;
+struct MYSQL_STMT;
+
+typedef struct MYSQL {
+ NET net; /* Communication parameters */
+ unsigned char *connector_fd; /* ConnectorFd for SSL */
+ char *host, *user, *passwd, *unix_socket, *server_version, *host_info;
+ char *info, *db;
+ struct CHARSET_INFO *charset;
+ MYSQL_FIELD *fields;
+ struct MEM_ROOT *field_alloc;
+ my_ulonglong affected_rows;
+ my_ulonglong insert_id; /* id if insert on table with NEXTNR */
+ my_ulonglong extra_info; /* Not used */
+ unsigned long thread_id; /* Id for connection in server */
+ unsigned long packet_length;
+ unsigned int port;
+ unsigned long client_flag, server_capabilities;
+ unsigned int protocol_version;
+ unsigned int field_count;
+ unsigned int server_status;
+ unsigned int server_language;
+ unsigned int warning_count;
+ struct st_mysql_options options;
+ enum mysql_status status;
+ enum enum_resultset_metadata resultset_metadata;
+ bool free_me; /* If free in mysql_close */
+ bool reconnect; /* set to 1 if automatic reconnect */
+
+ /* session-wide random string */
+ char scramble[SCRAMBLE_LENGTH + 1];
+
+ LIST *stmts; /* list of all statements */
+ const struct MYSQL_METHODS *methods;
+ void *thd;
+ /*
+ Points to boolean flag in MYSQL_RES or MYSQL_STMT. We set this flag
+ from mysql_stmt_close if close had to cancel result set of this object.
+ */
+ bool *unbuffered_fetch_owner;
+ void *extension;
+} MYSQL;
+
+typedef struct MYSQL_RES {
+ my_ulonglong row_count;
+ MYSQL_FIELD *fields;
+ struct MYSQL_DATA *data;
+ MYSQL_ROWS *data_cursor;
+ unsigned long *lengths; /* column lengths of current row */
+ MYSQL *handle; /* for unbuffered reads */
+ const struct MYSQL_METHODS *methods;
+ MYSQL_ROW row; /* If unbuffered read */
+ MYSQL_ROW current_row; /* buffer to current row */
+ struct MEM_ROOT *field_alloc;
+ unsigned int field_count, current_field;
+ bool eof; /* Used by mysql_fetch_row */
+ /* mysql_stmt_close() had to cancel this result */
+ bool unbuffered_fetch_cancelled;
+ enum enum_resultset_metadata metadata;
+ void *extension;
+} MYSQL_RES;
+
+/**
+ Flag to indicate that COM_BINLOG_DUMP_GTID should
+ be used rather than COM_BINLOG_DUMP in the @sa mysql_binlog_open().
+*/
+#define MYSQL_RPL_GTID (1 << 16)
+/**
+ Skip HEARBEAT events in the @sa mysql_binlog_fetch().
+*/
+#define MYSQL_RPL_SKIP_HEARTBEAT (1 << 17)
+
+/**
+ Struct for information about a replication stream.
+
+ @sa mysql_binlog_open()
+ @sa mysql_binlog_fetch()
+ @sa mysql_binlog_close()
+*/
+typedef struct MYSQL_RPL {
+ size_t file_name_length; /** Length of the 'file_name' or 0 */
+ const char *file_name; /** Filename of the binary log to read */
+ my_ulonglong start_position; /** Position in the binary log to */
+ /* start reading from */
+ unsigned int server_id; /** Server ID to use when identifying */
+ /* with the master */
+ unsigned int flags; /** Flags, e.g. MYSQL_RPL_GTID */
+
+ /** Size of gtid set data */
+ size_t gtid_set_encoded_size;
+ /** Callback function which is called */
+ /* from @sa mysql_binlog_open() to */
+ /* fill command packet gtid set */
+ void (*fix_gtid_set)(struct MYSQL_RPL *rpl, unsigned char *packet_gtid_set);
+ void *gtid_set_arg; /** GTID set data or an argument for */
+ /* fix_gtid_set() callback function */
+
+ unsigned long size; /** Size of the packet returned by */
+ /* mysql_binlog_fetch() */
+ const unsigned char *buffer; /** Pointer to returned data */
+} MYSQL_RPL;
+
+/*
+ Set up and bring down the server; to ensure that applications will
+ work when linked against either the standard client library or the
+ embedded server library, these functions should be called.
+*/
+int STDCALL mysql_server_init(int argc, char **argv, char **groups);
+void STDCALL mysql_server_end(void);
+
+/*
+ mysql_server_init/end need to be called when using libmysqld or
+ libmysqlclient (exactly, mysql_server_init() is called by mysql_init() so
+ you don't need to call it explicitely; but you need to call
+ mysql_server_end() to free memory). The names are a bit misleading
+ (mysql_SERVER* to be used when using libmysqlCLIENT). So we add more general
+ names which suit well whether you're using libmysqld or libmysqlclient. We
+ intend to promote these aliases over the mysql_server* ones.
+*/
+#define mysql_library_init mysql_server_init
+#define mysql_library_end mysql_server_end
+
+/*
+ Set up and bring down a thread; these function should be called
+ for each thread in an application which opens at least one MySQL
+ connection. All uses of the connection(s) should be between these
+ function calls.
+*/
+bool STDCALL mysql_thread_init(void);
+void STDCALL mysql_thread_end(void);
+
+/*
+ Functions to get information from the MYSQL and MYSQL_RES structures
+ Should definitely be used if one uses shared libraries.
+*/
+
+my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res);
+unsigned int STDCALL mysql_num_fields(MYSQL_RES *res);
+bool STDCALL mysql_eof(MYSQL_RES *res);
+MYSQL_FIELD *STDCALL mysql_fetch_field_direct(MYSQL_RES *res,
+ unsigned int fieldnr);
+MYSQL_FIELD *STDCALL mysql_fetch_fields(MYSQL_RES *res);
+MYSQL_ROW_OFFSET STDCALL mysql_row_tell(MYSQL_RES *res);
+MYSQL_FIELD_OFFSET STDCALL mysql_field_tell(MYSQL_RES *res);
+enum enum_resultset_metadata STDCALL mysql_result_metadata(MYSQL_RES *result);
+
+unsigned int STDCALL mysql_field_count(MYSQL *mysql);
+my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql);
+my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql);
+unsigned int STDCALL mysql_errno(MYSQL *mysql);
+const char *STDCALL mysql_error(MYSQL *mysql);
+const char *STDCALL mysql_sqlstate(MYSQL *mysql);
+unsigned int STDCALL mysql_warning_count(MYSQL *mysql);
+const char *STDCALL mysql_info(MYSQL *mysql);
+unsigned long STDCALL mysql_thread_id(MYSQL *mysql);
+const char *STDCALL mysql_character_set_name(MYSQL *mysql);
+int STDCALL mysql_set_character_set(MYSQL *mysql, const char *csname);
+
+MYSQL *STDCALL mysql_init(MYSQL *mysql);
+bool STDCALL mysql_ssl_set(MYSQL *mysql, const char *key, const char *cert,
+ const char *ca, const char *capath,
+ const char *cipher);
+const char *STDCALL mysql_get_ssl_cipher(MYSQL *mysql);
+bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
+ const char *passwd, const char *db);
+MYSQL *STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
+ const char *user, const char *passwd,
+ const char *db, unsigned int port,
+ const char *unix_socket,
+ unsigned long clientflag);
+int STDCALL mysql_select_db(MYSQL *mysql, const char *db);
+int STDCALL mysql_query(MYSQL *mysql, const char *q);
+int STDCALL mysql_send_query(MYSQL *mysql, const char *q, unsigned long length);
+int STDCALL mysql_real_query(MYSQL *mysql, const char *q, unsigned long length);
+MYSQL_RES *STDCALL mysql_store_result(MYSQL *mysql);
+MYSQL_RES *STDCALL mysql_use_result(MYSQL *mysql);
+
+enum net_async_status STDCALL mysql_real_connect_nonblocking(
+ MYSQL *mysql, const char *host, const char *user, const char *passwd,
+ const char *db, unsigned int port, const char *unix_socket,
+ unsigned long clientflag);
+enum net_async_status STDCALL mysql_send_query_nonblocking(
+ MYSQL *mysql, const char *query, unsigned long length);
+enum net_async_status STDCALL mysql_real_query_nonblocking(
+ MYSQL *mysql, const char *query, unsigned long length);
+enum net_async_status STDCALL
+mysql_store_result_nonblocking(MYSQL *mysql, MYSQL_RES **result);
+enum net_async_status STDCALL mysql_next_result_nonblocking(MYSQL *mysql);
+enum net_async_status STDCALL mysql_select_db_nonblocking(MYSQL *mysql,
+ const char *db,
+ bool *error);
+void STDCALL mysql_get_character_set_info(MYSQL *mysql,
+ MY_CHARSET_INFO *charset);
+
+int STDCALL mysql_session_track_get_first(MYSQL *mysql,
+ enum enum_session_state_type type,
+ const char **data, size_t *length);
+int STDCALL mysql_session_track_get_next(MYSQL *mysql,
+ enum enum_session_state_type type,
+ const char **data, size_t *length);
+/* local infile support */
+
+#define LOCAL_INFILE_ERROR_LEN 512
+
+void mysql_set_local_infile_handler(
+ MYSQL *mysql, int (*local_infile_init)(void **, const char *, void *),
+ int (*local_infile_read)(void *, char *, unsigned int),
+ void (*local_infile_end)(void *),
+ int (*local_infile_error)(void *, char *, unsigned int), void *);
+
+void mysql_set_local_infile_default(MYSQL *mysql);
+int STDCALL mysql_shutdown(MYSQL *mysql,
+ enum mysql_enum_shutdown_level shutdown_level);
+int STDCALL mysql_dump_debug_info(MYSQL *mysql);
+int STDCALL mysql_refresh(MYSQL *mysql, unsigned int refresh_options);
+int STDCALL mysql_kill(MYSQL *mysql, unsigned long pid);
+int STDCALL mysql_set_server_option(MYSQL *mysql,
+ enum enum_mysql_set_option option);
+int STDCALL mysql_ping(MYSQL *mysql);
+const char *STDCALL mysql_stat(MYSQL *mysql);
+const char *STDCALL mysql_get_server_info(MYSQL *mysql);
+const char *STDCALL mysql_get_client_info(void);
+unsigned long STDCALL mysql_get_client_version(void);
+const char *STDCALL mysql_get_host_info(MYSQL *mysql);
+unsigned long STDCALL mysql_get_server_version(MYSQL *mysql);
+unsigned int STDCALL mysql_get_proto_info(MYSQL *mysql);
+MYSQL_RES *STDCALL mysql_list_dbs(MYSQL *mysql, const char *wild);
+MYSQL_RES *STDCALL mysql_list_tables(MYSQL *mysql, const char *wild);
+MYSQL_RES *STDCALL mysql_list_processes(MYSQL *mysql);
+int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
+ const void *arg);
+int STDCALL mysql_options4(MYSQL *mysql, enum mysql_option option,
+ const void *arg1, const void *arg2);
+int STDCALL mysql_get_option(MYSQL *mysql, enum mysql_option option,
+ const void *arg);
+void STDCALL mysql_free_result(MYSQL_RES *result);
+enum net_async_status STDCALL mysql_free_result_nonblocking(MYSQL_RES *result);
+void STDCALL mysql_data_seek(MYSQL_RES *result, my_ulonglong offset);
+MYSQL_ROW_OFFSET STDCALL mysql_row_seek(MYSQL_RES *result,
+ MYSQL_ROW_OFFSET offset);
+MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result,
+ MYSQL_FIELD_OFFSET offset);
+MYSQL_ROW STDCALL mysql_fetch_row(MYSQL_RES *result);
+enum net_async_status STDCALL mysql_fetch_row_nonblocking(MYSQL_RES *res,
+ MYSQL_ROW *row);
+
+unsigned long *STDCALL mysql_fetch_lengths(MYSQL_RES *result);
+MYSQL_FIELD *STDCALL mysql_fetch_field(MYSQL_RES *result);
+MYSQL_RES *STDCALL mysql_list_fields(MYSQL *mysql, const char *table,
+ const char *wild);
+unsigned long STDCALL mysql_escape_string(char *to, const char *from,
+ unsigned long from_length);
+unsigned long STDCALL mysql_hex_string(char *to, const char *from,
+ unsigned long from_length);
+unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql, char *to,
+ const char *from,
+ unsigned long length);
+unsigned long STDCALL mysql_real_escape_string_quote(MYSQL *mysql, char *to,
+ const char *from,
+ unsigned long length,
+ char quote);
+void STDCALL mysql_debug(const char *debug);
+void STDCALL myodbc_remove_escape(MYSQL *mysql, char *name);
+unsigned int STDCALL mysql_thread_safe(void);
+bool STDCALL mysql_read_query_result(MYSQL *mysql);
+int STDCALL mysql_reset_connection(MYSQL *mysql);
+
+int STDCALL mysql_binlog_open(MYSQL *mysql, MYSQL_RPL *rpl);
+int STDCALL mysql_binlog_fetch(MYSQL *mysql, MYSQL_RPL *rpl);
+void STDCALL mysql_binlog_close(MYSQL *mysql, MYSQL_RPL *rpl);
+
+/*
+ The following definitions are added for the enhanced
+ client-server protocol
+*/
+
+/* statement state */
+enum enum_mysql_stmt_state {
+ MYSQL_STMT_INIT_DONE = 1,
+ MYSQL_STMT_PREPARE_DONE,
+ MYSQL_STMT_EXECUTE_DONE,
+ MYSQL_STMT_FETCH_DONE
+};
+
+/*
+ This structure is used to define bind information, and
+ internally by the client library.
+ Public members with their descriptions are listed below
+ (conventionally `On input' refers to the binds given to
+ mysql_stmt_bind_param, `On output' refers to the binds given
+ to mysql_stmt_bind_result):
+
+ buffer_type - One of the MYSQL_* types, used to describe
+ the host language type of buffer.
+ On output: if column type is different from
+ buffer_type, column value is automatically converted
+ to buffer_type before it is stored in the buffer.
+ buffer - On input: points to the buffer with input data.
+ On output: points to the buffer capable to store
+ output data.
+ The type of memory pointed by buffer must correspond
+ to buffer_type. See the correspondence table in
+ the comment to mysql_stmt_bind_param.
+
+ The two above members are mandatory for any kind of bind.
+
+ buffer_length - the length of the buffer. You don't have to set
+ it for any fixed length buffer: float, double,
+ int, etc. It must be set however for variable-length
+ types, such as BLOBs or STRINGs.
+
+ length - On input: in case when lengths of input values
+ are different for each execute, you can set this to
+ point at a variable containining value length. This
+ way the value length can be different in each execute.
+ If length is not NULL, buffer_length is not used.
+ Note, length can even point at buffer_length if
+ you keep bind structures around while fetching:
+ this way you can change buffer_length before
+ each execution, everything will work ok.
+ On output: if length is set, mysql_stmt_fetch will
+ write column length into it.
+
+ is_null - On input: points to a boolean variable that should
+ be set to TRUE for NULL values.
+ This member is useful only if your data may be
+ NULL in some but not all cases.
+ If your data is never NULL, is_null should be set to 0.
+ If your data is always NULL, set buffer_type
+ to MYSQL_TYPE_NULL, and is_null will not be used.
+
+ is_unsigned - On input: used to signify that values provided for one
+ of numeric types are unsigned.
+ On output describes signedness of the output buffer.
+ If, taking into account is_unsigned flag, column data
+ is out of range of the output buffer, data for this column
+ is regarded truncated. Note that this has no correspondence
+ to the sign of result set column, if you need to find it out
+ use mysql_stmt_result_metadata.
+ error - where to write a truncation error if it is present.
+ possible error value is:
+ 0 no truncation
+ 1 value is out of range or buffer is too small
+
+ Please note that MYSQL_BIND also has internals members.
+*/
+
+typedef struct MYSQL_BIND {
+ unsigned long *length; /* output length pointer */
+ bool *is_null; /* Pointer to null indicator */
+ void *buffer; /* buffer to get/put data */
+ /* set this if you want to track data truncations happened during fetch */
+ bool *error;
+ unsigned char *row_ptr; /* for the current data position */
+ void (*store_param_func)(NET *net, struct MYSQL_BIND *param);
+ void (*fetch_result)(struct MYSQL_BIND *, MYSQL_FIELD *, unsigned char **row);
+ void (*skip_result)(struct MYSQL_BIND *, MYSQL_FIELD *, unsigned char **row);
+ /* output buffer length, must be set when fetching str/binary */
+ unsigned long buffer_length;
+ unsigned long offset; /* offset position for char/binary fetch */
+ unsigned long length_value; /* Used if length is 0 */
+ unsigned int param_number; /* For null count and error messages */
+ unsigned int pack_length; /* Internal length for packed data */
+ enum enum_field_types buffer_type; /* buffer type */
+ bool error_value; /* used if error is 0 */
+ bool is_unsigned; /* set if integer type is unsigned */
+ bool long_data_used; /* If used with mysql_send_long_data */
+ bool is_null_value; /* Used if is_null is 0 */
+ void *extension;
+} MYSQL_BIND;
+
+struct MYSQL_STMT_EXT;
+
+/* statement handler */
+typedef struct MYSQL_STMT {
+ struct MEM_ROOT *mem_root; /* root allocations */
+ LIST list; /* list to keep track of all stmts */
+ MYSQL *mysql; /* connection handle */
+ MYSQL_BIND *params; /* input parameters */
+ MYSQL_BIND *bind; /* output parameters */
+ MYSQL_FIELD *fields; /* result set metadata */
+ MYSQL_DATA result; /* cached result set */
+ MYSQL_ROWS *data_cursor; /* current row in cached result */
+ /*
+ mysql_stmt_fetch() calls this function to fetch one row (it's different
+ for buffered, unbuffered and cursor fetch).
+ */
+ int (*read_row_func)(struct MYSQL_STMT *stmt, unsigned char **row);
+ /* copy of mysql->affected_rows after statement execution */
+ my_ulonglong affected_rows;
+ my_ulonglong insert_id; /* copy of mysql->insert_id */
+ unsigned long stmt_id; /* Id for prepared statement */
+ unsigned long flags; /* i.e. type of cursor to open */
+ unsigned long prefetch_rows; /* number of rows per one COM_FETCH */
+ /*
+ Copied from mysql->server_status after execute/fetch to know
+ server-side cursor status for this statement.
+ */
+ unsigned int server_status;
+ unsigned int last_errno; /* error code */
+ unsigned int param_count; /* input parameter count */
+ unsigned int field_count; /* number of columns in result set */
+ enum enum_mysql_stmt_state state; /* statement state */
+ char last_error[MYSQL_ERRMSG_SIZE]; /* error message */
+ char sqlstate[SQLSTATE_LENGTH + 1];
+ /* Types of input parameters should be sent to server */
+ bool send_types_to_server;
+ bool bind_param_done; /* input buffers were supplied */
+ unsigned char bind_result_done; /* output buffers were supplied */
+ /* mysql_stmt_close() had to cancel this result */
+ bool unbuffered_fetch_cancelled;
+ /*
+ Is set to true if we need to calculate field->max_length for
+ metadata fields when doing mysql_stmt_store_result.
+ */
+ bool update_max_length;
+ struct MYSQL_STMT_EXT *extension;
+} MYSQL_STMT;
+
+enum enum_stmt_attr_type {
+ /*
+ When doing mysql_stmt_store_result calculate max_length attribute
+ of statement metadata. This is to be consistent with the old API,
+ where this was done automatically.
+ In the new API we do that only by request because it slows down
+ mysql_stmt_store_result sufficiently.
+ */
+ STMT_ATTR_UPDATE_MAX_LENGTH,
+ /*
+ unsigned long with combination of cursor flags (read only, for update,
+ etc)
+ */
+ STMT_ATTR_CURSOR_TYPE,
+ /*
+ Amount of rows to retrieve from server per one fetch if using cursors.
+ Accepts unsigned long attribute in the range 1 - ulong_max
+ */
+ STMT_ATTR_PREFETCH_ROWS
+};
+
+MYSQL_STMT *STDCALL mysql_stmt_init(MYSQL *mysql);
+int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query,
+ unsigned long length);
+int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt);
+int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt);
+int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind_arg,
+ unsigned int column, unsigned long offset);
+int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt);
+unsigned long STDCALL mysql_stmt_param_count(MYSQL_STMT *stmt);
+bool STDCALL mysql_stmt_attr_set(MYSQL_STMT *stmt,
+ enum enum_stmt_attr_type attr_type,
+ const void *attr);
+bool STDCALL mysql_stmt_attr_get(MYSQL_STMT *stmt,
+ enum enum_stmt_attr_type attr_type,
+ void *attr);
+bool STDCALL mysql_stmt_bind_param(MYSQL_STMT *stmt, MYSQL_BIND *bnd);
+bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bnd);
+bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt);
+bool STDCALL mysql_stmt_reset(MYSQL_STMT *stmt);
+bool STDCALL mysql_stmt_free_result(MYSQL_STMT *stmt);
+bool STDCALL mysql_stmt_send_long_data(MYSQL_STMT *stmt,
+ unsigned int param_number,
+ const char *data, unsigned long length);
+MYSQL_RES *STDCALL mysql_stmt_result_metadata(MYSQL_STMT *stmt);
+MYSQL_RES *STDCALL mysql_stmt_param_metadata(MYSQL_STMT *stmt);
+unsigned int STDCALL mysql_stmt_errno(MYSQL_STMT *stmt);
+const char *STDCALL mysql_stmt_error(MYSQL_STMT *stmt);
+const char *STDCALL mysql_stmt_sqlstate(MYSQL_STMT *stmt);
+MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_seek(MYSQL_STMT *stmt,
+ MYSQL_ROW_OFFSET offset);
+MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_tell(MYSQL_STMT *stmt);
+void STDCALL mysql_stmt_data_seek(MYSQL_STMT *stmt, my_ulonglong offset);
+my_ulonglong STDCALL mysql_stmt_num_rows(MYSQL_STMT *stmt);
+my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt);
+my_ulonglong STDCALL mysql_stmt_insert_id(MYSQL_STMT *stmt);
+unsigned int STDCALL mysql_stmt_field_count(MYSQL_STMT *stmt);
+
+bool STDCALL mysql_commit(MYSQL *mysql);
+bool STDCALL mysql_rollback(MYSQL *mysql);
+bool STDCALL mysql_autocommit(MYSQL *mysql, bool auto_mode);
+bool STDCALL mysql_more_results(MYSQL *mysql);
+int STDCALL mysql_next_result(MYSQL *mysql);
+int STDCALL mysql_stmt_next_result(MYSQL_STMT *stmt);
+void STDCALL mysql_close(MYSQL *sock);
+
+/* Public key reset */
+void STDCALL mysql_reset_server_public_key(void);
+
+/* status return codes */
+#define MYSQL_NO_DATA 100
+#define MYSQL_DATA_TRUNCATED 101
+
+#define mysql_reload(mysql) mysql_refresh((mysql), REFRESH_GRANT)
+
+#define HAVE_MYSQL_REAL_CONNECT
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _mysql_h */
diff --git a/contrib/libs/libmysql_r/include/mysql/client_authentication.h b/contrib/libs/libmysql_r/include/mysql/client_authentication.h
new file mode 100644
index 0000000000..c841b97533
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/client_authentication.h
@@ -0,0 +1,43 @@
+/* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+#ifndef CLIENT_AUTHENTICATION_H
+#define CLIENT_AUTHENTICATION_H
+
+/**
+ @file include/mysql/client_authentication.h
+*/
+
+#include "mysql.h"
+#include "mysql/client_plugin.h"
+
+int sha256_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql);
+int sha256_password_init(char *, size_t, int, va_list);
+int sha256_password_deinit(void);
+int caching_sha2_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql);
+int caching_sha2_password_init(char *, size_t, int, va_list);
+int caching_sha2_password_deinit(void);
+net_async_status caching_sha2_password_auth_client_nonblocking(
+ MYSQL_PLUGIN_VIO *vio, MYSQL *mysql, int *res);
+net_async_status sha256_password_auth_client_nonblocking(MYSQL_PLUGIN_VIO *vio,
+ MYSQL *mysql,
+ int *res);
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/client_plugin.h b/contrib/libs/libmysql_r/include/mysql/client_plugin.h
new file mode 100644
index 0000000000..96e481b33d
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/client_plugin.h
@@ -0,0 +1,213 @@
+#ifndef MYSQL_CLIENT_PLUGIN_INCLUDED
+/* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ Without limiting anything contained in the foregoing, this file,
+ which is part of C Driver for MySQL (Connector/C), is also subject to the
+ Universal FOSS Exception, version 1.0, a copy of which can be found at
+ http://oss.oracle.com/licenses/universal-foss-exception.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/mysql/client_plugin.h
+ MySQL Client Plugin API.
+ This file defines the API for plugins that work on the client side
+*/
+#define MYSQL_CLIENT_PLUGIN_INCLUDED
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdarg.h>
+#include <stdlib.h>
+#endif
+
+/*
+ On Windows, exports from DLL need to be declared.
+ Also, plugin needs to be declared as extern "C" because MSVC
+ unlike other compilers, uses C++ mangling for variables not only
+ for functions.
+*/
+
+#undef MYSQL_PLUGIN_EXPORT
+
+#if defined(_MSC_VER)
+#if defined(MYSQL_DYNAMIC_PLUGIN)
+#ifdef __cplusplus
+#define MYSQL_PLUGIN_EXPORT extern "C" __declspec(dllexport)
+#else
+#define MYSQL_PLUGIN_EXPORT __declspec(dllexport)
+#endif
+#else /* MYSQL_DYNAMIC_PLUGIN */
+#ifdef __cplusplus
+#define MYSQL_PLUGIN_EXPORT extern "C"
+#else
+#define MYSQL_PLUGIN_EXPORT
+#endif
+#endif /*MYSQL_DYNAMIC_PLUGIN */
+#else /*_MSC_VER */
+#define MYSQL_PLUGIN_EXPORT
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* known plugin types */
+#define MYSQL_CLIENT_reserved1 0
+#define MYSQL_CLIENT_reserved2 1
+#define MYSQL_CLIENT_AUTHENTICATION_PLUGIN 2
+#define MYSQL_CLIENT_TRACE_PLUGIN 3
+
+#define MYSQL_CLIENT_AUTHENTICATION_PLUGIN_INTERFACE_VERSION 0x0101
+#define MYSQL_CLIENT_TRACE_PLUGIN_INTERFACE_VERSION 0x0100
+
+#define MYSQL_CLIENT_MAX_PLUGINS 4
+
+#define mysql_declare_client_plugin(X) \
+ MYSQL_PLUGIN_EXPORT st_mysql_client_plugin_##X \
+ _mysql_client_plugin_declaration_ = { \
+ MYSQL_CLIENT_##X##_PLUGIN, \
+ MYSQL_CLIENT_##X##_PLUGIN_INTERFACE_VERSION,
+#define mysql_end_client_plugin }
+
+/* generic plugin header structure */
+#define MYSQL_CLIENT_PLUGIN_HEADER \
+ int type; \
+ unsigned int interface_version; \
+ const char *name; \
+ const char *author; \
+ const char *desc; \
+ unsigned int version[3]; \
+ const char *license; \
+ void *mysql_api; \
+ int (*init)(char *, size_t, int, va_list); \
+ int (*deinit)(void); \
+ int (*options)(const char *option, const void *);
+
+struct st_mysql_client_plugin {
+ MYSQL_CLIENT_PLUGIN_HEADER
+};
+
+struct MYSQL;
+
+/******** authentication plugin specific declarations *********/
+#include "plugin_auth_common.h"
+
+struct auth_plugin_t {
+ MYSQL_CLIENT_PLUGIN_HEADER
+ int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, struct MYSQL *mysql);
+ enum net_async_status (*authenticate_user_nonblocking)(MYSQL_PLUGIN_VIO *vio,
+ struct MYSQL *mysql,
+ int *result);
+};
+
+// Needed for the mysql_declare_client_plugin() macro. Do not use elsewhere.
+typedef struct auth_plugin_t st_mysql_client_plugin_AUTHENTICATION;
+
+/******** using plugins ************/
+
+/**
+ loads a plugin and initializes it
+
+ @param mysql MYSQL structure.
+ @param name a name of the plugin to load
+ @param type type of plugin that should be loaded, -1 to disable type check
+ @param argc number of arguments to pass to the plugin initialization
+ function
+ @param ... arguments for the plugin initialization function
+
+ @retval
+ a pointer to the loaded plugin, or NULL in case of a failure
+*/
+struct st_mysql_client_plugin *mysql_load_plugin(struct MYSQL *mysql,
+ const char *name, int type,
+ int argc, ...);
+
+/**
+ loads a plugin and initializes it, taking va_list as an argument
+
+ This is the same as mysql_load_plugin, but take va_list instead of
+ a list of arguments.
+
+ @param mysql MYSQL structure.
+ @param name a name of the plugin to load
+ @param type type of plugin that should be loaded, -1 to disable type check
+ @param argc number of arguments to pass to the plugin initialization
+ function
+ @param args arguments for the plugin initialization function
+
+ @retval
+ a pointer to the loaded plugin, or NULL in case of a failure
+*/
+struct st_mysql_client_plugin *mysql_load_plugin_v(struct MYSQL *mysql,
+ const char *name, int type,
+ int argc, va_list args);
+
+/**
+ finds an already loaded plugin by name, or loads it, if necessary
+
+ @param mysql MYSQL structure.
+ @param name a name of the plugin to load
+ @param type type of plugin that should be loaded
+
+ @retval
+ a pointer to the plugin, or NULL in case of a failure
+*/
+struct st_mysql_client_plugin *mysql_client_find_plugin(struct MYSQL *mysql,
+ const char *name,
+ int type);
+
+/**
+ adds a plugin structure to the list of loaded plugins
+
+ This is useful if an application has the necessary functionality
+ (for example, a special load data handler) statically linked into
+ the application binary. It can use this function to register the plugin
+ directly, avoiding the need to factor it out into a shared object.
+
+ @param mysql MYSQL structure. It is only used for error reporting
+ @param plugin an st_mysql_client_plugin structure to register
+
+ @retval
+ a pointer to the plugin, or NULL in case of a failure
+*/
+struct st_mysql_client_plugin *mysql_client_register_plugin(
+ struct MYSQL *mysql, struct st_mysql_client_plugin *plugin);
+
+/**
+ set plugin options
+
+ Can be used to set extra options and affect behavior for a plugin.
+ This function may be called multiple times to set several options
+
+ @param plugin an st_mysql_client_plugin structure
+ @param option a string which specifies the option to set
+ @param value value for the option.
+
+ @retval 0 on success, 1 in case of failure
+**/
+int mysql_plugin_options(struct st_mysql_client_plugin *plugin,
+ const char *option, const void *value);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/com_data.h b/contrib/libs/libmysql_r/include/mysql/com_data.h
new file mode 100644
index 0000000000..d69f320994
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/com_data.h
@@ -0,0 +1,121 @@
+/* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+#ifndef PLUGIN_PROTOCOL_INCLUDED
+#define PLUGIN_PROTOCOL_INCLUDED
+
+#ifndef MYSQL_ABI_CHECK
+#include "field_types.h" /* enum_field_types */
+#include "mysql_com.h" /* mysql_enum_shutdown_level */
+#endif
+
+/**
+ @file include/mysql/com_data.h
+ Definition of COM_DATA to be used with the Command service as data input
+ structure.
+*/
+
+struct COM_INIT_DB_DATA {
+ const char *db_name;
+ unsigned long length;
+};
+
+struct COM_REFRESH_DATA {
+ unsigned char options;
+};
+
+struct COM_KILL_DATA {
+ unsigned long id;
+};
+
+struct COM_SET_OPTION_DATA {
+ unsigned int opt_command;
+};
+
+struct PS_PARAM {
+ unsigned char null_bit;
+ enum enum_field_types type;
+ unsigned char unsigned_type;
+ const unsigned char *value;
+ unsigned long length;
+};
+
+struct COM_STMT_EXECUTE_DATA {
+ unsigned long stmt_id;
+ unsigned long open_cursor;
+ PS_PARAM *parameters;
+ unsigned long parameter_count;
+ unsigned char has_new_types;
+};
+
+struct COM_STMT_FETCH_DATA {
+ unsigned long stmt_id;
+ unsigned long num_rows;
+};
+
+struct COM_STMT_SEND_LONG_DATA_DATA {
+ unsigned long stmt_id;
+ unsigned int param_number;
+ unsigned char *longdata;
+ unsigned long length;
+};
+
+struct COM_STMT_PREPARE_DATA {
+ const char *query;
+ unsigned int length;
+};
+
+struct COM_STMT_CLOSE_DATA {
+ unsigned int stmt_id;
+};
+
+struct COM_STMT_RESET_DATA {
+ unsigned int stmt_id;
+};
+
+struct COM_QUERY_DATA {
+ const char *query;
+ unsigned int length;
+};
+
+struct COM_FIELD_LIST_DATA {
+ unsigned char *table_name;
+ unsigned int table_name_length;
+ const unsigned char *query;
+ unsigned int query_length;
+};
+
+union COM_DATA {
+ COM_INIT_DB_DATA com_init_db;
+ COM_REFRESH_DATA com_refresh;
+ COM_KILL_DATA com_kill;
+ COM_SET_OPTION_DATA com_set_option;
+ COM_STMT_EXECUTE_DATA com_stmt_execute;
+ COM_STMT_FETCH_DATA com_stmt_fetch;
+ COM_STMT_SEND_LONG_DATA_DATA com_stmt_send_long_data;
+ COM_STMT_PREPARE_DATA com_stmt_prepare;
+ COM_STMT_CLOSE_DATA com_stmt_close;
+ COM_STMT_RESET_DATA com_stmt_reset;
+ COM_QUERY_DATA com_query;
+ COM_FIELD_LIST_DATA com_field_list;
+};
+
+#endif /* PLUGIN_PROTOCOL_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/component_implementation.h b/contrib/libs/libmysql_r/include/mysql/components/component_implementation.h
new file mode 100644
index 0000000000..199eb07c0f
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/component_implementation.h
@@ -0,0 +1,329 @@
+/* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License, version 2.0,
+as published by the Free Software Foundation.
+
+This program is also distributed with certain software (including
+but not limited to OpenSSL) that is licensed under separate terms,
+as designated in a particular file or component or in included license
+documentation. The authors of MySQL hereby grant you an additional
+permission to link the program and your derivative works with the
+separately licensed software that they have included with MySQL.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License, version 2.0, for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef COMPONENT_IMPLEMENTATION_H
+#define COMPONENT_IMPLEMENTATION_H
+
+#include <mysql/components/services/dynamic_loader.h>
+#include <mysql/components/services/registry.h>
+#include <cstddef> // NULL
+#include "service_implementation.h"
+
+/**
+ @page PAGE_COMPONENTS_COMPONENT A Component
+
+ A component is a code container that contains one or more Service
+ Implementations. Components can be internal (part of the MySQL Server binary)
+ and external (hosted in a OS binary file different from the one of the MySQL
+ Server).
+
+ Each component will have:
+ - Name
+ - List of service implementations it provides.
+ - List of services or service implementations it needs.
+ - Initialization function that's called when a container is loaded. Takes a
+ reference to the currently active service registry implementation.
+ - De-initialization function that's called when a container unload is
+ requested.
+
+ Opposite to old plugin infrastructure, Components don't need linkage against
+ mysqld executable, neither on Linux nor Windows. In fact, in Components we
+ strongly discourage from linking against mysqld executable at all, as it
+ presents significant threat to them being independent and using only
+ Components infrastructure to communicate with other parts of software.
+
+ @subpage PAGE_COMPONENTS_IMPLEMENTATION
+
+ @page PAGE_COMPONENTS_IMPLEMENTATION MySQL Component - creating implementation
+ The Component for the Dynamic Loader needs to be a dynamic library (for
+ example .so or .dll) with specified entry-point method. The only exception is
+ the MySQL server, for which, for now, it will be statically linked. All these
+ implementation details are hidden away by macros defined in header files.
+ All macros to define Services are specified in service.h, for defining Service
+ Implementations in service_implementation.h and for specifying Components in
+ component_implementation.h.
+
+ @section EXAMPLE The Component example
+ Example Components are located in components/example directory. These
+ Components are used also for unit and MTR test, which assures these Components
+ are fully functional and they quality is maintained. The example Services are
+ defined in example_services.h, while implemented in three example Components
+ defined in files example_component1.cc, example_component2.cc,
+ and example_component3.cc. These files are specifically prepared to be used as
+ examples as they provide simplicity and an extensive documentation. The
+ following tutorial bases on these Components and will try to show a process to
+ create similar.
+
+ @subsection EXAMPLE_SERVICES Services defined in the example
+ Example contains definition of 3 Services which will be used to show a general
+ idea of services, basic implementations and simple example of one of concepts
+ possible with the Component Infrastructure. These example Services are defined
+ in example_services.h and are s_mysql_greetings,
+ s_mysql_greetings_localization and s_mysql_example_math.
+
+ @section TROUBLESHOOTING Common problems
+
+ -# If you have problem during linking on GCC with similar message:
+
+ ../../../components/mysql_server/component_mysql_server.a(server_component.cc.o):%server_component.cc:imp_...:
+ error: undefined reference to '..._impl::...'
+
+ In such case you should add a new `%init()` method (it can be dummy/empty)
+ to your source file that contains service methods implementations and a call
+ to that method somewhere in mysqld.cc. This will help GCC not to optimize
+ the required object file out of linkage. Take `mysql_string_services_init()`
+ as an example. This applies only to service implementations added to the
+ server component.
+
+ @section TUTORIAL Step by step tutorial for creating new Component
+ The creation of component is a mean to get some functionality exported for the
+ Components infrastructure. It can be divided into several steps:
+ -# %List all high level functionalities Component is planned to have
+ implemented. This will assure we know exactly what we need to benefit from
+ next steps. In the example, we would like to have a "Hello, World!" string
+ provider and simple math functions.
+ -# Look for existing Services, that are designed specifically to provide some
+ part of the new functionalities to reuse them, or other that are in any
+ degree similar in functionality, design or use cases to use as an example.
+ The Component infrastructure is highly oriented on reuse of Services and
+ will benefit with every reuse case, as it will decrease total size of
+ Services. In the example the existing base of Services is really small,
+ with the core Components infrastructure Services available only leading to
+ no reuse possible.
+ -# Design list of functions needed to provide all functionalities. Try to make
+ they follow existing patterns and ideas, possibly having some identical to
+ existing ones.
+ -# Try to separate groups of functions that specify some complete part of
+ functionality into separate small Services to improve re-usability. Also,
+ try to separate groups that seem to have more potential to be extended or
+ modified in future, because changing existing Services is forbidden, in
+ such a case this will lead to a lot of functions in Services that will be
+ duplicates and will introduce more boilerplate code to implement them.
+ Remove all functions that can be found in fully reused existing Services.
+ -# Create definitions of Services, ideally one Service per file, or a group of
+ really closely connected Services. In most cases you want to make these
+ definitions public, in case of MySQL that means placing them in
+ include/mysql/components/services/ directory to include them in mysql-dev
+ package. See example_services.h, which in contrary is not made public and
+ resides in example component source directory.
+ -# Create declarations of all handles, the Opaque pointers for all opaque
+ objects that are meant to be returned to the Services users. See usages of
+ DEFINE_SERVICE_HANDLE in registry.h.
+ -# Create basic structure of new Component. Use BEGIN_COMPONENT_PROVIDES,
+ BEGIN_COMPONENT_REQUIRES, BEGIN_COMPONENT_METADATA, DECLARE_COMPONENT and
+ DECLARE_LIBRARY_COMPONENTS. Fill in all information necessary to describe
+ the new Component extensively. The example_component1.cc and
+ example_component2.cc shows how structure should look like, and in
+ example_component3.cc there is an example with additional Service
+ references, for which placeholder definitions are kept in header file of the
+ new Component, see example_component3.h. Note the placeholder for the
+ Registry Service, which is available by default in every component.
+ -# Create implementations of the desired Service interfaces. Implement handles
+ used, as for example my_h_service_iterator_imp and
+ my_h_service_metadata_iterator_imp in registry.cc. Create separate
+ source and header files for each Service or closely connected group of
+ Services. Remember to include the header file for Service Implementation in
+ the Service Implementation source file to have no linkage problems.
+ The Service Implementations in english_greeting_service_imp.cc and
+ simple_example_math_imp.cc are implementations used in example_component1,
+ polish_greeting_service_imp.cc and example_math_wrapping_imp.cc are
+ implementations for example_component2 and example_component3 respectively.
+ -# Make sure component is loaded/initialized before using its services.
+ Atomic variable is_intialized represents the state of the component.
+ Please check the details about the variable from validate_password_imp.cc
+ file.
+ .
+
+ @file include/mysql/components/component_implementation.h
+ Specifies macros to define Components.
+*/
+
+/**
+ Declares a component. For specified name following macros must be executed
+ earlier: BEGIN_COMPONENT_PROVIDES, BEGIN_COMPONENT_REQUIRES and
+ BEGIN_COMPONENT_METADATA.
+ It fills mysql_component_t structure with all of the component data. The
+ info object will be named mysql_component_{source_name}.
+ After this macro it is required to specify comma-separated pointers to
+ initialize and deinitialize methods for components to be used during loading
+ and unloading of component.
+
+ @param source_name The source name used in other macros.
+ @param name Name string with human readable name.
+*/
+#define DECLARE_COMPONENT(source_name, name) \
+ mysql_component_t mysql_component_##source_name = { \
+ name, __##source_name##_provides, __##source_name##_requires, \
+ __##source_name##_metadata,
+
+/**
+ A macro to end the last declaration of a Component.
+*/
+#define END_DECLARE_COMPONENT() }
+
+/**
+ Creates a service implementation list that are provided by specified
+ component. Only a series of PROVIDES_SERVICE and PROVIDES_CUSTOM_SERVICE
+ macros are expected to be used after this macro and before the
+ END_COMPONENT_PROVIDES counterpart.
+
+ @param name Component name.
+*/
+#define BEGIN_COMPONENT_PROVIDES(name) \
+ static struct mysql_service_ref_t __##name##_provides[] = {
+/**
+ Declare a Service Implementation provided by a Component. It assumes standard
+ Service Implementation name to be referenced.
+ @sa SERVICE_IMPLEMENTATION
+
+ @param component Component name.
+ @param service A Service name for which the Service Implementation will be
+ added.
+*/
+#define PROVIDES_SERVICE(component, service) \
+ { \
+#service "." #component, \
+ (void *)&SERVICE_IMPLEMENTATION(component, service) \
+ }
+
+/**
+ A macro to end the last declaration started with the BEGIN_COMPONENT_PROVIDES.
+*/
+#define END_COMPONENT_PROVIDES() \
+ { NULL, NULL } \
+ }
+
+/**
+ A macro to specify requirements of the component. Creates a placeholder for
+ the Registry service and structure with a list for requirements and
+ pointers to their placeholders, adding the Registry service as first element.
+
+ @param name Name of component.
+*/
+#define BEGIN_COMPONENT_REQUIRES(name) \
+ REQUIRES_SERVICE_PLACEHOLDER(registry); \
+ static struct mysql_service_placeholder_ref_t __##name##_requires[] = { \
+ REQUIRES_SERVICE(registry),
+
+/**
+ Creates a definition for placeholder, in which the specified required service
+ will be provided upon component load. The placeholder will be named
+ mysql_service_{service name}. Use the "extern" keyword before macro invocation
+ to define a reference to the one real placeholder defined in component source.
+
+ @param service A referenced Service name.
+*/
+#define REQUIRES_SERVICE_PLACEHOLDER(service) \
+ SERVICE_TYPE(service) * mysql_service_##service
+
+/**
+ Adds a Service requirement with a pointer to placeholder to the list of
+ components.
+
+ @param service A referenced Service name.
+*/
+#define REQUIRES_SERVICE(service) \
+ { \
+#service, \
+ static_cast < void **> \
+ (static_cast <void *>(const_cast <mysql_service_##service##_t **>( \
+ &mysql_service_##service))) \
+ }
+
+/**
+ A macro to end the last declaration started with the BEGIN_COMPONENT_REQUIRES.
+*/
+#define END_COMPONENT_REQUIRES() \
+ { NULL, NULL } \
+ }
+
+/**
+ A macro to specify metadata of the component. Creates a list of metadata.
+ Only a series of METADATA macros are expected to be used after this macro and
+ before the END_COMPONENT_METADATA counterpart.
+
+ @param name Name of component.
+*/
+#define BEGIN_COMPONENT_METADATA(name) \
+ static struct mysql_metadata_ref_t __##name##_metadata[] = {
+/**
+ Adds a Service requirement with a pointer to placeholder to the list of
+ components.
+
+ @param key A string name of the metadata to add.
+ @param value A string value of the metadata to add.
+*/
+#define METADATA(key, value) \
+ { key, value }
+
+/**
+ A macro to end the last declaration started with the BEGIN_COMPONENT_METADATA.
+*/
+#define END_COMPONENT_METADATA() \
+ { NULL, NULL } \
+ }
+
+/* On Windows, exports from DLL need to be declared.
+ Also, plug-in needs to be declared as extern "C" because MSVC
+ unlike other compilers, uses C++ mangling for variables not only
+ for functions. */
+#if defined(_MSC_VER)
+#ifdef __cplusplus
+#define DLL_EXPORT extern "C" __declspec(dllexport)
+#else
+#define DLL_EXPORT __declspec(dllexport)
+#endif
+#else /*_MSC_VER */
+#ifdef __cplusplus
+#define DLL_EXPORT extern "C"
+#else
+#define DLL_EXPORT
+#endif
+#endif
+
+/**
+ Creates a list of component implementations included in this dynamic library.
+ It can be used only once in whole library. It defines an entry point method
+ for library to be used with the Dynamic Loader. A list of pointers to
+ Component structures is required after this macro up to the usage of
+ the END_DECLARE_LIBRARY_COMPONENTS macro. Current implementation of the
+ Dynamic Loader supports only one Component being specified in the library.
+*/
+#define DECLARE_LIBRARY_COMPONENTS \
+ mysql_component_t *library_components_list = {
+/**
+ A macro to end the last declaration started with the
+ DECLARE_LIBRARY_COMPONENTS.
+*/
+#define END_DECLARE_LIBRARY_COMPONENTS \
+ } \
+ ; \
+ DLL_EXPORT mysql_component_t *list_components() { \
+ return library_components_list; \
+ }
+
+/**
+ Defines a reference to the specified Component data info structure.
+*/
+#define COMPONENT_REF(name) mysql_component_##name
+
+#endif /* COMPONENT_IMPLEMENTATION_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/my_service.h b/contrib/libs/libmysql_r/include/mysql/components/my_service.h
new file mode 100644
index 0000000000..581af27f10
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/my_service.h
@@ -0,0 +1,113 @@
+/* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License, version 2.0,
+as published by the Free Software Foundation.
+
+This program is also distributed with certain software (including
+but not limited to OpenSSL) that is licensed under separate terms,
+as designated in a particular file or component or in included license
+documentation. The authors of MySQL hereby grant you an additional
+permission to link the program and your derivative works with the
+separately licensed software that they have included with MySQL.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License, version 2.0, for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MY_SERVICE_H
+#define MY_SERVICE_H
+
+#include <mysql/components/service.h>
+#include <mysql/components/services/registry.h>
+
+/**
+ Wraps my_h_service struct conforming ABI into RAII C++ object with ability to
+ cast to desired service type.
+*/
+template <typename TService>
+class my_service {
+ public:
+ /**
+ Acquires service by name.
+
+ @param name Name of service, with or without component name, to acquire.
+ @param registry Handle to registry service to use. The registry service
+ must be valid (i.e. not released) up to the moment when this instance
+ dies.
+ */
+ my_service(const char *name, SERVICE_TYPE(registry) * registry)
+ : m_registry(registry) {
+ if (registry->acquire(name, &m_service)) {
+ /* NULLed service handle means no valid service managed. */
+ m_service = {};
+ }
+ }
+ /**
+ Acquires service by name.
+
+ @param name Name of service, with or without component name, to acquire.
+ @param related_service Handle to service to acquire related to.
+ @param registry Handle to registry service to use.
+ */
+ my_service(const char *name, my_h_service related_service,
+ SERVICE_TYPE(registry) * registry)
+ : m_registry(registry) {
+ if (registry->acquire_related(name, related_service, &m_service)) {
+ /* NULLed service handle means no valid service managed. */
+ m_service = nullptr;
+ }
+ }
+ /**
+ Wraps service implementation already acquired.
+
+ @param service Service handle to manage.
+ @param registry Handle to registry service to use.
+ */
+ my_service(my_h_service service, SERVICE_TYPE(registry) * registry)
+ : m_service(service), m_registry(registry) {}
+
+ my_service(const my_service<TService> &other) = delete;
+
+ my_service(my_service<TService> &&other)
+ : m_service(other.m_service), m_registry(other.m_registry) {
+ other.m_service = nullptr;
+ }
+
+ ~my_service() {
+ if (this->is_valid()) {
+ m_registry->release(m_service);
+ }
+ }
+
+ operator TService *() const {
+ return reinterpret_cast<TService *>(m_service);
+ }
+
+ operator my_h_service() const { return m_service; }
+ /**
+ Returns managed service typed as desired service type to execute
+ operations specified after -> on it.
+ */
+ TService *operator->() const { return static_cast<TService *>(*this); }
+ /**
+ @retval false Object manages valid service.
+ @retval true Object does not manage any service.
+ */
+ operator bool() const { return !is_valid(); }
+ bool is_valid() const {
+ /* NULLed service handle means no valid service managed. */
+ return static_cast<const my_h_service_imp *>(this->m_service) != nullptr;
+ }
+
+ private:
+ my_h_service m_service;
+ SERVICE_TYPE(registry) * m_registry;
+};
+
+#endif /* MY_SERVICE_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/service.h b/contrib/libs/libmysql_r/include/mysql/components/service.h
new file mode 100644
index 0000000000..13dcb813a4
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/service.h
@@ -0,0 +1,130 @@
+/* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License, version 2.0,
+as published by the Free Software Foundation.
+
+This program is also distributed with certain software (including
+but not limited to OpenSSL) that is licensed under separate terms,
+as designated in a particular file or component or in included license
+documentation. The authors of MySQL hereby grant you an additional
+permission to link the program and your derivative works with the
+separately licensed software that they have included with MySQL.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License, version 2.0, for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SERVICE_H
+#define SERVICE_H
+
+/**
+ Specific type for the service status return values.
+
+ 0 is false, non-zero is true. Corresponds to C++ bool.
+
+ @sa DEFINE_BOOL_METHOD, DECLARE_BOOL_METHOD
+*/
+typedef int mysql_service_status_t;
+
+/**
+ @page PAGE_COMPONENTS_SERVICE A Service and a Service Implementation
+
+ The Service is basic concept of the Components subsystem. A Service is a
+ named, well-defined stateless interface to one functionality, expressed as a
+ list of pointers to a specific methods. The service name will consist of ASCII
+ symbols excluding the dot ('.') symbol. Each Service will be accompanied with
+ a (part of a) header file that defines the Service allowing other Components
+ to consume it. Each Service should work only on basic C types and structures
+ of these types to prevent problems with not fully-defined C++ objects ABI. The
+ Service is a default way to operate inside the Components subsystem as a mean
+ to show that one is interested only on functionality interface, not its exact
+ implementation. The Services are not versioned - any change to interface must
+ require Service being copied to one with different name before applying
+ changes. The Services by itself do not carry any state, all methods are
+ stateless. This does not prevent one from having some state-carrying objects
+ created and returned as handles to them. Such concept is shown for example in
+ create(), get() and release() methods of the registry_query Service. This
+ concept relies on implementation of generator of the Opaque pointers with
+ d-pointer described here: https://en.wikipedia.org/wiki/Opaque_pointer .
+
+ For any specific Service a Service Implementation is defined as a structure
+ of the Service type filled with pointers to methods of specified
+ implementation. The name of the Service Implementation is a name of the
+ Service and the implementation related name separated with a dot. In most
+ cases the implementation related name should be the Component name in which it
+ is being defined. Each Service can have several Service Implementations.
+
+ @file include/mysql/components/service.h
+*/
+
+/**
+ Generates the standard Service type name. It does not have const specifier,
+ it should be used only when really necessary.
+*/
+#define SERVICE_TYPE_NO_CONST(name) mysql_service_##name##_t
+
+/**
+ Generates the standard Service type name.
+*/
+#define SERVICE_TYPE(name) const SERVICE_TYPE_NO_CONST(name)
+
+/**
+ Declares a new Service. It creates a structure for pointers to Service
+ methods. A list of methods defined using DECLARE_METHOD and
+ DECLARE_BOOL_METHOD macros must follow this macro, with a closing
+ END_SERVICE_DEFINITION macro usage.
+
+ @param name Service name, must be a valid C name.
+*/
+#define BEGIN_SERVICE_DEFINITION(name) typedef struct s_mysql_##name {
+/**
+ A macro to end the last Service definition started with the
+ BEGIN_SERVICE_DEFINITION macro.
+*/
+#define END_SERVICE_DEFINITION(name) \
+ } \
+ SERVICE_TYPE_NO_CONST(name);
+/**
+ Declares a method as a part of the Service definition. To be used within the
+ SERVICE_DEFINITION macro.
+
+ @param retval Type of the return value for the method declaration. Should be a
+ simple type or structure, not a C++ object with undefined ABI.
+ @param name Name of the method, must be a valid C name.
+ @param args The list of arguments of the method taken in parentheses.
+*/
+#define DECLARE_METHOD(retval, name, args) retval(*name) args
+
+/**
+ Declares a method that returns bool as a part of the Service definition. To be
+ used within the SERVICE_DEFINITION macro.
+
+ @param name Name of the method, must be a valid C name.
+ @param args The list of arguments of the method taken in parentheses.
+*/
+#define DECLARE_BOOL_METHOD(name, args) \
+ DECLARE_METHOD(mysql_service_status_t, name, args)
+
+/**
+ Defines an object type that is meant for carrying handles to the
+ implementation-specific objects used in the Service interface, but without
+ their structure exposed, keeping it as an abstraction. This follows a Opaque
+ Pointer design pattern, see more: https://en.wikipedia.org/wiki/Opaque_pointer
+ If you would like to have a C++ RAII class to manage the resource with
+ additional methods to call raw service calls, please create your class
+ {handle_name} instead of following macro. Please make sure it does not use any
+ virtual methods to keep binary compatibility, and try use only one member, the
+ d-pointer to hide all implementation details and keep headers unmodified from
+ the point of publishing it.
+
+ @param name Handle name, must be a valid C name.
+*/
+#define DEFINE_SERVICE_HANDLE(name) typedef struct name##_imp *name
+
+#endif /* SERVICE_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/service_implementation.h b/contrib/libs/libmysql_r/include/mysql/components/service_implementation.h
new file mode 100644
index 0000000000..74043efd2f
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/service_implementation.h
@@ -0,0 +1,90 @@
+/* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License, version 2.0,
+as published by the Free Software Foundation.
+
+This program is also distributed with certain software (including
+but not limited to OpenSSL) that is licensed under separate terms,
+as designated in a particular file or component or in included license
+documentation. The authors of MySQL hereby grant you an additional
+permission to link the program and your derivative works with the
+separately licensed software that they have included with MySQL.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License, version 2.0, for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SERVICE_IMPLEMENTATION_H
+#define SERVICE_IMPLEMENTATION_H
+
+#include "service.h"
+
+/**
+ @file include/mysql/components/service_implementation.h
+ Specifies macros to define Service Implementations.
+*/
+
+/**
+ Reference to the name of the service implementation variable
+
+ @ref BEGIN_SERVICE_IMPLEMENTATION defines a local variable of
+ the structure type for the service (see @ref SERVICE_TYPE).
+ The variable is then used by the @ref PROVIDES_SERVICE macro to
+ construct the list of service provided by the component.
+ This macro allows one to use @ref BEGIN_SERVICE_IMPLEMENTATION ,
+ @ref DEFINE_METHOD and @ref END_SERVICE_IMPLEMENTATION macros to build
+ a service defintion structure and variable to be used outside of the
+ component definition context.
+
+ @param component Name of the implementation of the service.
+ Usually a component name.
+ @param service Name of the service to create the implementation for.
+
+*/
+#define SERVICE_IMPLEMENTATION(component, service) imp_##component##_##service
+
+/**
+ Declares a Service Implementation. It builds standard implementation
+ info structure. Only a series of pointers to methods the Service
+ Implementation implements as respective Service methods are expected to be
+ used after this macro and before the END_SERVICE_IMPLEMENTATION counterpart.
+
+ @param component Name of the Component to create implementation in.
+ @param service Name of the Service to create implementation for.
+*/
+#define BEGIN_SERVICE_IMPLEMENTATION(component, service) \
+ SERVICE_TYPE(service) SERVICE_IMPLEMENTATION(component, service) = {
+/**
+ A macro to end the last declaration of a Service Implementation.
+*/
+#define END_SERVICE_IMPLEMENTATION() }
+
+/**
+ A macro to ensure method implementation has required properties, that is it
+ does not throw exceptions and is static. This macro should be used with
+ exactly the same arguments as DECLARE_METHOD.
+
+ @param retval Type of return value. It cannot contain comma characters, but
+ as only simple structures are possible, this shouldn't be a problem.
+ @param name Method name.
+ @param args a list of arguments in parenthesis.
+*/
+#define DEFINE_METHOD(retval, name, args) retval name args noexcept
+
+/**
+ A short macro to define method that returns bool, which is the most common
+ case.
+
+ @param name Method name.
+ @param args a list of arguments in parenthesis.
+*/
+#define DEFINE_BOOL_METHOD(name, args) \
+ DEFINE_METHOD(mysql_service_status_t, name, args)
+
+#endif /* SERVICE_IMPLEMENTATION_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/dynamic_loader.h b/contrib/libs/libmysql_r/include/mysql/components/services/dynamic_loader.h
new file mode 100644
index 0000000000..c4fad4e3b0
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/dynamic_loader.h
@@ -0,0 +1,300 @@
+/* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License, version 2.0,
+as published by the Free Software Foundation.
+
+This program is also distributed with certain software (including
+but not limited to OpenSSL) that is licensed under separate terms,
+as designated in a particular file or component or in included license
+documentation. The authors of MySQL hereby grant you an additional
+permission to link the program and your derivative works with the
+separately licensed software that they have included with MySQL.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License, version 2.0, for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_DYNAMIC_LOADER_H
+#define MYSQL_DYNAMIC_LOADER_H
+
+#include <mysql/components/service.h>
+
+/**
+ A handle type for a iterator to a Component.
+*/
+DEFINE_SERVICE_HANDLE(my_h_component_iterator);
+/**
+ A handle type for a iterator to metadata of some Component.
+*/
+DEFINE_SERVICE_HANDLE(my_h_component_metadata_iterator);
+
+/**
+ Service for managing the list of loaded Components.
+*/
+BEGIN_SERVICE_DEFINITION(dynamic_loader)
+/**
+ Loads specified group of components by URN, initializes them and
+ registers all Service Implementations present in these components.
+ Assures all dependencies will be met after loading specified components.
+ The dependencies may be circular, in such case it's necessary to specify
+ all components on cycle to load in one batch. From URNs specified the
+ scheme part of URN (part before "://") is extracted and used to acquire
+ Service Implementation of scheme component loader Service for specified
+ scheme.
+
+ @param urns List of URNs of components to load.
+ @param component_count Number of components on list to load.
+ @return Status of performed operation
+ @retval false success
+ @retval true failure
+*/
+DECLARE_BOOL_METHOD(load, (const char *urns[], int component_count));
+/**
+ Unloads specified group of components by URN, deinitializes them and
+ unregisters all Service Implementations present in these components.
+ Assumes, thous does not check it, all dependencies of not unloaded
+ components will still be met after unloading specified components.
+ The dependencies may be circular, in such case it's necessary to specify
+ all components on cycle to unload in one batch. From URNs specified the
+ scheme part of URN (part before "://") is extracted and used to acquire
+ Service Implementation of scheme component loader Service for specified
+ scheme.
+
+ @param urns List of URNs of components to unload.
+ @param component_count Number of components on list to unload.
+ @return Status of performed operation
+ @retval false success
+ @retval true failure
+*/
+DECLARE_BOOL_METHOD(unload, (const char *urns[], int component_count));
+END_SERVICE_DEFINITION(dynamic_loader)
+
+/**
+ Service for listing all Components by iterator.
+*/
+BEGIN_SERVICE_DEFINITION(dynamic_loader_query)
+/**
+ Creates iterator that iterates through all loaded components.
+ If successful it leaves read lock on dynamic loader until iterator is
+ released.
+
+ @param [out] out_iterator Pointer to component iterator handle.
+ @return Status of performed operation
+ @retval false success
+ @retval true failure
+*/
+DECLARE_BOOL_METHOD(create, (my_h_component_iterator * out_iterator));
+/**
+ Gets name and URN of Service pointed to by iterator.
+
+ @param iterator Component iterator handle.
+ @param [out] out_name Pointer to string with component name to set result
+ pointer to.
+ @param [out] out_urn Pointer to string with URN from which the component was
+ loaded from, to set result pointer to.
+ @return Status of performed operation
+ @retval false success
+ @retval true Failure, may be caused when called on iterator that went
+ through all values already.
+*/
+DECLARE_BOOL_METHOD(get, (my_h_component_iterator iter, const char **out_name,
+ const char **out_urn));
+/**
+ Advances specified iterator to next element. Will succeed but return true if
+ it reaches one-past-last element.
+
+ @param iterator Component iterator handle.
+ @return Status of performed operation and validity of iterator after
+ operation.
+ @retval false success
+ @retval true Failure or called on iterator that was on last element.
+*/
+DECLARE_BOOL_METHOD(next, (my_h_component_iterator iter));
+/**
+ Checks if specified iterator is valid, i.e. have not reached one-past-last
+ element.
+
+ @param iterator Component iterator handle.
+ @return Validity of iterator
+ @retval false Valid
+ @retval true Invalid or reached one-past-last element.
+*/
+DECLARE_BOOL_METHOD(is_valid, (my_h_component_iterator iter));
+/**
+ Releases component iterator. Releases read lock on dynamic loader.
+
+ @param iterator Component iterator handle.
+ @return Status of performed operation
+ @retval false success
+ @retval true failure
+*/
+DECLARE_METHOD(void, release, (my_h_component_iterator iter));
+END_SERVICE_DEFINITION(dynamic_loader_query)
+
+/**
+ Service for listing all metadata for a Component specified by the iterator.
+*/
+BEGIN_SERVICE_DEFINITION(dynamic_loader_metadata_enumerate)
+/**
+ Creates iterator that iterates through all metadata for object pointed by
+ the specified iterator. If successful it leaves read lock on the registry
+ until the iterator is released.
+
+ @param iterator A iterator that points to object to get the metadata
+ iterator for.
+ @param [out] out_iterator Pointer to metadata iterator handle.
+ @return Status of performed operation
+ @retval false success
+ @retval true failure
+*/
+DECLARE_BOOL_METHOD(create, (my_h_component_iterator iterator,
+ my_h_component_metadata_iterator *out_iterator));
+/**
+ Gets the key and value of the metadata pointed to by the specified iterator.
+
+ @param iterator Metadata iterator handle.
+ @param [out] out_name A pointer to the string with the key to set the result
+ pointer to.
+ @param [out] out_value A pointer to the string with the metadata value to
+ set the result pointer to.
+ @return Status of performed operation
+ @retval false success
+ @retval true Failure, may be caused when called on the iterator that went
+ through all values already.
+*/
+DECLARE_BOOL_METHOD(get, (my_h_component_metadata_iterator iterator,
+ const char **name, const char **value));
+/**
+ Advances specified iterator to next element. Will fail if it reaches
+ one-past-last element.
+
+ @param iterator Metadata iterator handle.
+ @return Status of performed operation
+ @retval false success
+ @retval true Failure, may be caused when called on iterator that was on the
+ last element.
+*/
+DECLARE_BOOL_METHOD(next, (my_h_component_metadata_iterator iterator));
+/**
+ Checks if specified iterator is valid, i.e. have not reached one-past-last
+ element.
+
+ @param iterator Metadata iterator handle.
+ @return Validity of iterator
+ @retval false Valid
+ @retval true Invalid or reached one-past-last element.
+*/
+DECLARE_BOOL_METHOD(is_valid, (my_h_component_metadata_iterator iterator));
+/**
+ Releases the specified iterator. Releases read lock on the registry.
+
+ @param iterator Metadata iterator handle.
+ @return Status of performed operation
+ @retval false success
+ @retval true failure
+*/
+DECLARE_METHOD(void, release, (my_h_component_metadata_iterator iterator));
+END_SERVICE_DEFINITION(dynamic_loader_metadata_enumerate)
+
+/**
+ Service to query specified metadata key directly for the specified Component
+ by iterator to it.
+*/
+BEGIN_SERVICE_DEFINITION(dynamic_loader_metadata_query)
+/**
+ Gets the key and value of the metadata pointed to by the specified object
+ iterator.
+
+ @param iterator A iterator that points to object to get the metadata
+ iterator for.
+ @param name A pointer to the string with the key to set the result
+ pointer to.
+ @param [out] out_value A pointer to the string with the metadata value to
+ set the result pointer to.
+ @return Status of performed operation
+ @retval false success
+ @retval true Failure, may be caused when called on the iterator that went
+ through all values already.
+*/
+DECLARE_BOOL_METHOD(get_value, (my_h_component_iterator iterator,
+ const char *name, const char **value));
+END_SERVICE_DEFINITION(dynamic_loader_metadata_query)
+
+/**
+ Carries information on specific Service Implementation.
+*/
+struct mysql_service_ref_t {
+ const char *name;
+ void *implementation;
+};
+
+/**
+ Carries information on the specific Service requirement for some Component and
+ a pointer to member where to store the acquired Service Implementation to
+ satisfy this requirement.
+*/
+struct mysql_service_placeholder_ref_t {
+ const char *name;
+ void **implementation;
+};
+
+/**
+ Specifies a key and value pair of the single Component metadata.
+*/
+struct mysql_metadata_ref_t {
+ const char *key;
+ const char *value;
+};
+
+/**
+ Carries information on the specific Component, all Service Implementations it
+ provides, all its requirements and metadata.
+*/
+struct mysql_component_t {
+ const char *name;
+ struct mysql_service_ref_t *provides;
+ struct mysql_service_placeholder_ref_t *requires_;
+ struct mysql_metadata_ref_t *metadata;
+ mysql_service_status_t (*init)();
+ mysql_service_status_t (*deinit)();
+};
+
+/**
+ Service for providing Components from a specified scheme of URN.
+
+ All scheme loading Services are the same although they have separate names
+ (aliased to the main type) to allow a single component implement several
+ scheme loaders, to not break the recommendation to keep implementation names
+ the same as the component name, and to be able to create wrappers and other
+ solutions that require to have multiple implementations of a single type.
+*/
+BEGIN_SERVICE_DEFINITION(dynamic_loader_scheme)
+/**
+ Loads all Components that are located under the URN specified.
+
+ @param urn URN to location of the component to load from.
+ @param [out] out_data Pointer to pointer to MySQL component data structures
+ to set result components data retrieved from specified file.
+ @return Status of performed operation
+ @retval false success
+ @retval true failure
+*/
+DECLARE_BOOL_METHOD(load, (const char *urn, mysql_component_t **out_data));
+/**
+ Unloads all Components that were previously loaded.
+
+ @param urn URN to location to unload all components from.
+ @return Status of performed operation
+ @retval false success
+ @retval true failure
+*/
+DECLARE_BOOL_METHOD(unload, (const char *urn));
+END_SERVICE_DEFINITION(dynamic_loader_scheme)
+
+#endif /* MYSQL_DYNAMIC_LOADER_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/log_builtins.h b/contrib/libs/libmysql_r/include/mysql/components/services/log_builtins.h
new file mode 100644
index 0000000000..2bdf5dd97d
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/log_builtins.h
@@ -0,0 +1,1448 @@
+/* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ This defines built-in functions for use by logging services.
+ These helpers are organized into a number of APIs grouping
+ related functionality.
+
+ For documentation of the individual functions, see log_builtins.cc
+*/
+
+#ifndef LOG_BUILTINS_H
+#define LOG_BUILTINS_H
+
+#include <mysql/components/component_implementation.h>
+#include <mysql/components/my_service.h>
+#include <mysql/components/service_implementation.h>
+#include <mysql/components/services/log_shared.h>
+#if defined(MYSQL_DYNAMIC_PLUGIN)
+#include <mysql/service_plugin_registry.h>
+#endif
+#include <stdarg.h>
+#include <stdio.h>
+
+#include <my_compiler.h>
+#if defined(MYSQL_SERVER) && !defined(MYSQL_DYNAMIC_PLUGIN)
+#error #include "sql/log.h"
+#endif
+
+/**
+ Primitives for services to interact with the structured logger:
+ functions pertaining to log_line and log_item data
+*/
+BEGIN_SERVICE_DEFINITION(log_builtins)
+/**
+ See whether a type is wellknown.
+
+ @param t log item type to examine
+
+ @retval LOG_ITEM_TYPE_NOT_FOUND: key not found
+ @retval >0: index in array of wellknowns
+*/
+DECLARE_METHOD(int, wellknown_by_type, (log_item_type t));
+
+/**
+ See whether a string is a wellknown field name.
+
+ @param key potential key starts here
+ @param length length of the string to examine
+
+ @retval LOG_ITEM_TYPE_RESERVED: reserved, but not "wellknown" key
+ @retval LOG_ITEM_TYPE_NOT_FOUND: key not found
+ @retval >0: index in array of wellknowns
+*/
+DECLARE_METHOD(int, wellknown_by_name, (const char *key, size_t length));
+
+/**
+ Accessor: from a record describing a wellknown key, get its type
+
+ @param idx index in array of wellknowns, see log_item_wellknown_by_...()
+
+ @retval the log item type for the wellknown key
+*/
+DECLARE_METHOD(log_item_type, wellknown_get_type, (uint idx));
+
+/**
+ Accessor: from a record describing a wellknown key, get its name
+
+ @param idx index in array of wellknowns, see log_item_wellknown_by_...()
+
+ @retval name (NTBS)
+*/
+DECLARE_METHOD(const char *, wellknown_get_name, (uint idx));
+
+/**
+ Sanity check an item.
+ Certain log sinks have very low requirements with regard to the data
+ they receive; they write keys as strings, and then data according to
+ the item's class (string, integer, or float), formatted to the sink's
+ standards (e.g. JSON, XML, ...).
+ Code that has higher requirements can use this check to see whether
+ the given item is of a known type (whether generic or wellknown),
+ whether the given type and class agree, and whether in case of a
+ well-known type, the given key is correct for that type.
+ If your code generates items that don't pass this check, you should
+ probably go meditate on it.
+
+ @param li the log_item to check
+
+ @retval LOG_ITEM_OK no problems
+ @retval LOG_ITEM_TYPE_NOT_FOUND unknown item type
+ @retval LOG_ITEM_CLASS_MISMATCH item_class derived from type isn't
+ what's set on the item
+ @retval LOG_ITEM_KEY_MISMATCH class not generic, so key should
+ match wellknown
+ @retval LOG_ITEM_STRING_NULL class is string, pointer is nullptr
+ @retval LOG_ITEM_KEY_NULL no key set (this is legal e.g. on aux
+ items of filter rules, but should not
+ occur in a log_line, i.e., log_sinks are
+ within their rights to discard such items)
+*/
+DECLARE_METHOD(int, item_inconsistent, (log_item * li));
+
+// helpers: predicates to find out about types and classes
+
+/**
+ Predicate used to determine whether a type is generic
+ (generic string, generic float, generic integer) rather
+ than a well-known type.
+
+ @param t log item type to examine
+
+ @retval true if generic type
+ @retval false if wellknown type
+*/
+DECLARE_METHOD(bool, item_generic_type, (log_item_type t));
+
+/**
+ Predicate used to determine whether a class is a string
+ class (C-string or Lex-string).
+
+ @param c log item class to examine
+
+ @retval true if of a string class
+ @retval false if not of a string class
+*/
+DECLARE_METHOD(bool, item_string_class, (log_item_class c));
+
+/**
+ Predicate used to determine whether a class is a numeric
+ class (integer or float).
+
+ @param c log item class to examine
+
+ @retval true if of a numeric class
+ @retval false if not of a numeric class
+*/
+DECLARE_METHOD(bool, item_numeric_class, (log_item_class c));
+
+/**
+ Set an integer value on a log_item.
+ Fails gracefully if no log_item_data is supplied, so it can safely
+ wrap log_line_item_set[_with_key]().
+
+ @param lid log_item_data struct to set the value on
+ @param i integer to set
+
+ @retval true lid was nullptr (possibly: OOM, could not set up log_item)
+ @retval false all's well
+*/
+DECLARE_METHOD(bool, item_set_int, (log_item_data * lid, longlong i));
+/**
+ Set a floating point value on a log_item.
+ Fails gracefully if no log_item_data is supplied, so it can safely
+ wrap log_line_item_set[_with_key]().
+
+ @param lid log_item_data struct to set the value on
+ @param f float to set
+
+ @retval true lid was nullptr (possibly: OOM, could not set up log_item)
+ @retval false all's well
+*/
+DECLARE_METHOD(bool, item_set_float, (log_item_data * lid, double f));
+
+/**
+ Set a string value on a log_item.
+ Fails gracefully if no log_item_data is supplied, so it can safely
+ wrap log_line_item_set[_with_key]().
+
+ @param lid log_item_data struct to set the value on
+ @param s pointer to string
+ @param s_len length of string
+
+ @retval true lid was nullptr (possibly: OOM, could not set up log_item)
+ @retval false all's well
+*/
+DECLARE_METHOD(bool, item_set_lexstring,
+ (log_item_data * lid, const char *s, size_t s_len));
+
+/**
+ Set a string value on a log_item.
+ Fails gracefully if no log_item_data is supplied, so it can safely
+ wrap log_line_item_set[_with_key]().
+
+ @param lid log_item_data struct to set the value on
+ @param s pointer to NTBS
+
+ @retval true lid was nullptr (possibly: OOM, could not set up log_item)
+ @retval false all's well
+*/
+DECLARE_METHOD(bool, item_set_cstring, (log_item_data * lid, const char *s));
+
+/**
+ Create new log item with key name "key", and allocation flags of
+ "alloc" (see enum_log_item_free).
+ Will return a pointer to the item's log_item_data struct for
+ convenience.
+ This is mostly interesting for filters and other services that create
+ items that are not part of a log_line; sources etc. that intend to
+ create an item for a log_line (the more common case) should usually
+ use the below line_item_set_with_key() which creates an item (like
+ this function does), but also correctly inserts it into a log_line.
+
+ @param li the log_item to work on
+ @param t the item-type
+ @param key the key to set on the item.
+ ignored for non-generic types (may pass nullptr for those)
+ see alloc
+ @param alloc LOG_ITEM_FREE_KEY if key was allocated by caller
+ LOG_ITEM_FREE_NONE if key was not allocated
+ Allocated keys will automatically free()d when the
+ log_item is.
+ The log_item's alloc flags will be set to the
+ submitted value; specifically, any pre-existing
+ value will be clobbered. It is therefore WRONG
+ a) to use this on a log_item that already has a key;
+ it should only be used on freshly init'd log_items;
+ b) to use this on a log_item that already has a
+ value (specifically, an allocated one); the correct
+ order is to init a log_item, then set up type and
+ key, and finally to set the value. If said value is
+ an allocated string, the log_item's alloc should be
+ bitwise or'd with LOG_ITEM_FREE_VALUE.
+
+ @retval a pointer to the log_item's log_data, for easy chaining:
+ log_item_set_with_key(...)->data_integer= 1;
+*/
+DECLARE_METHOD(log_item_data *, item_set_with_key,
+ (log_item * li, log_item_type t, const char *key, uint32 alloc));
+
+/**
+ As log_item_set_with_key(), except that the key is automatically
+ derived from the wellknown log_item_type t.
+
+ Create new log item with type "t".
+ Will return a pointer to the item's log_item_data struct for
+ convenience.
+ This is mostly interesting for filters and other services that create
+ items that are not part of a log_line; sources etc. that intend to
+ create an item for a log_line (the more common case) should usually
+ use the below line_item_set_with_key() which creates an item (like
+ this function does), but also correctly inserts it into a log_line.
+
+ The allocation of this item will be LOG_ITEM_FREE_NONE;
+ specifically, any pre-existing value will be clobbered.
+ It is therefore WRONG
+ a) to use this on a log_item that already has a key;
+ it should only be used on freshly init'd log_items;
+ b) to use this on a log_item that already has a
+ value (specifically, an allocated one); the correct
+ order is to init a log_item, then set up type and
+ key, and finally to set the value. If said value is
+ an allocated string, the log_item's alloc should be
+ bitwise or'd with LOG_ITEM_FREE_VALUE.
+
+ @param li the log_item to work on
+ @param t the item-type
+
+ @retval a pointer to the log_item's log_data, for easy chaining:
+ log_item_set_with_key(...)->data_integer= 1;
+*/
+DECLARE_METHOD(log_item_data *, item_set, (log_item * li, log_item_type t));
+
+/**
+ Create new log item in log line "ll", with key name "key", and
+ allocation flags of "alloc" (see enum_log_item_free).
+ On success, the number of registered items on the log line is increased,
+ the item's type is added to the log_line's "seen" property,
+ and a pointer to the item's log_item_data struct is returned for
+ convenience.
+
+ @param ll the log_line to work on
+ @param t the item-type
+ @param key the key to set on the item.
+ ignored for non-generic types (may pass nullptr for those)
+ see alloc
+ @param alloc LOG_ITEM_FREE_KEY if key was allocated by caller
+ LOG_ITEM_FREE_NONE if key was not allocated
+ Allocated keys will automatically free()d when the
+ log_item is.
+ The log_item's alloc flags will be set to the
+ submitted value; specifically, any pre-existing
+ value will be clobbered. It is therefore WRONG
+ a) to use this on a log_item that already has a key;
+ it should only be used on freshly init'd log_items;
+ b) to use this on a log_item that already has a
+ value (specifically, an allocated one); the correct
+ order is to init a log_item, then set up type and
+ key, and finally to set the value. If said value is
+ an allocated string, the log_item's alloc should be
+ bitwise or'd with LOG_ITEM_FREE_VALUE.
+
+ @retval a pointer to the log_item's log_data, for easy chaining:
+ log_line_item_set_with_key(...)->data_integer= 1;
+*/
+DECLARE_METHOD(log_item_data *, line_item_set_with_key,
+ (log_line * ll, log_item_type t, const char *key, uint32 alloc));
+
+/**
+ Create a new log item of well-known type "t" in log line "ll".
+ On success, the number of registered items on the log line is increased,
+ the item's type is added to the log_line's "seen" property,
+ and a pointer to the item's log_item_data struct is returned for
+ convenience.
+
+ The allocation of this item will be LOG_ITEM_FREE_NONE;
+ specifically, any pre-existing value will be clobbered.
+ It is therefore WRONG
+ a) to use this on a log_item that already has a key;
+ it should only be used on freshly init'd log_items;
+ b) to use this on a log_item that already has a
+ value (specifically, an allocated one); the correct
+ order is to init a log_item, then set up type and
+ key, and finally to set the value. If said value is
+ an allocated string, the log_item's alloc should be
+ bitwise or'd with LOG_ITEM_FREE_VALUE.
+
+ @param ll the log_line to work on
+ @param t the item-type
+
+ @retval a pointer to the log_item's log_data, for easy chaining:
+ log_line_item_set_with_key(...)->data_integer= 1;
+*/
+DECLARE_METHOD(log_item_data *, line_item_set,
+ (log_line * ll, log_item_type t));
+
+/**
+ Dynamically allocate and initialize a log_line.
+
+ @retval nullptr could not set up buffer (too small?)
+ @retval other address of the newly initialized log_line
+*/
+DECLARE_METHOD(log_line *, line_init, ());
+
+/**
+ Release a log_line allocated with line_init()
+
+ @param ll a log_line previously allocated with line_init()
+*/
+DECLARE_METHOD(void, line_exit, (log_line * ll));
+
+/**
+ How many items are currently set on the given log_line?
+
+ @param ll the log-line to examine
+
+ @retval the number of items set
+*/
+DECLARE_METHOD(int, line_item_count, (log_line * ll));
+
+/**
+ Test whether a given type is presumed present on the log line.
+
+ @param ll the log_line to examine
+ @param m the log_type to test for
+
+ @retval 0 not present
+ @retval !=0 present
+*/
+DECLARE_METHOD(log_item_type_mask, line_item_types_seen,
+ (log_line * ll, log_item_type_mask m));
+
+/**
+ Get an iterator for the items in a log_line.
+ For now, only one iterator may exist per log_line.
+
+ @param ll the log_line to examine
+
+ @retval a log_iterm_iter, or nullptr on failure
+*/
+DECLARE_METHOD(log_item_iter *, line_item_iter_acquire, (log_line * ll));
+
+/**
+ Release an iterator for the items in a log_line.
+
+ @param it the iterator to release
+*/
+DECLARE_METHOD(void, line_item_iter_release, (log_item_iter * it));
+/**
+ Use the log_line iterator to get the first item from the set.
+
+ @param it the iterator to use
+
+ @retval pointer to the first log_item in the collection, or nullptr
+*/
+DECLARE_METHOD(log_item *, line_item_iter_first, (log_item_iter * it));
+
+/**
+ Use the log_line iterator to get the next item from the set.
+
+ @param it the iterator to use
+
+ @retval pointer to the next log_item in the collection, or nullptr
+*/
+DECLARE_METHOD(log_item *, line_item_iter_next, (log_item_iter * it));
+
+/**
+ Use the log_line iterator to get the current item from the set.
+
+ @param it the iterator to use
+
+ @retval pointer to the current log_item in the collection, or nullptr
+*/
+DECLARE_METHOD(log_item *, line_item_iter_current, (log_item_iter * it));
+
+/**
+ Complete, filter, and write submitted log items.
+
+ This expects a log_line collection of log-related key/value pairs,
+ e.g. from log_message().
+
+ Where missing, timestamp, priority, thread-ID (if any) and so forth
+ are added.
+
+ Log item source services, log item filters, and log item sinks are
+ then called; then all applicable resources are freed.
+
+ This interface is intended to facilitate the building of submission
+ interfaces other than the variadic message() one below. See the
+ example fluent C++ LogEvent() wrapper for an example of how to leverage
+ it.
+
+ @param ll key/value pairs describing info to log
+
+ @retval int number of fields in created log line
+*/
+DECLARE_METHOD(int, line_submit, (log_line * ll));
+
+/**
+ Submit a log-message for log "log_type".
+ Variadic convenience function for logging.
+
+ This fills in the array that is used by the filter and log-writer
+ services. Where missing, timestamp, priority, and thread-ID (if any)
+ are added. Log item source services, log item filters, and log item
+ writers are called.
+
+
+ The variadic list accepts a list of "assignments" of the form
+ - log_item_type, value, for well-known types, and
+ - log_item_type, key, value, for ad-hoc types (LOG_ITEM_GEN_*)
+
+ As its last item, the list should have
+ - an element of type LOG_ITEM_LOG_MESSAGE, containing a printf-style
+ format string, followed by all variables necessary to satisfy the
+ substitutions in that string
+
+ OR
+
+ - an element of type LOG_ITEM_LOG_LOOKUP, containing a MySQL error code,
+ which will be looked up in the list or regular error messages, followed
+ by all variables necessary to satisfy the substitutions in that string
+
+ OR
+
+ - an element of type LOG_ITEM_LOG_VERBATIM, containing a string that will
+ be used directly, with no % substitutions
+
+ see log_vmessage() for more information.
+*/
+DECLARE_METHOD(int, message, (int log_type, ...));
+
+/**
+ Escape \0 bytes, add \0 terminator. For log-writers and other sinks
+ that terminate in an API using C-strings.
+
+
+ @param li list_item to process
+
+ @retval -1 out of memory
+ @retval 0 success
+*/
+DECLARE_METHOD(int, sanitize, (log_item * li));
+
+/**
+ Return MySQL error message for a given error code.
+
+ @param mysql_errcode the error code the message for which to look up
+
+ @retval the message (a printf-style format string)
+*/
+DECLARE_METHOD(const char *, errmsg_by_errcode, (int mysql_errcode));
+
+/**
+ Return MySQL error code for a given error symbol.
+
+ @param sym the symbol to look up
+
+ @retval -1 failure
+ @retval >=0 the MySQL error code
+*/
+DECLARE_METHOD(longlong, errcode_by_errsymbol, (const char *sym));
+
+/**
+ Convenience function: Derive a log label ("error", "warning",
+ "information") from a severity.
+
+ @param prio the severity/prio in question
+
+ @return a label corresponding to that priority.
+ @retval "System" for prio of SYSTEM_LEVEL
+ @retval "Error" for prio of ERROR_LEVEL
+ @retval "Warning" for prio of WARNING_LEVEL
+ @retval "Note" for prio of INFORMATION_LEVEL
+*/
+DECLARE_METHOD(const char *, label_from_prio, (int prio));
+
+/**
+ open an error log file
+
+ @param file if beginning with '.':
+ @@global.log_error, except with this extension
+ otherwise:
+ use this as file name in the same location as
+ @@global.log_error
+
+ Value not contain folder separators!
+
+ @param[out] my_errstream an error log handle, or nullptr on failure
+
+ @retval 0 success
+ @retval !0 failure
+*/
+DECLARE_METHOD(int, open_errstream, (const char *file, void **my_errstream));
+
+/**
+ write to an error log file previously opened with open_errstream()
+
+ @param my_errstream a handle describing the log file
+ @param buffer pointer to the string to write
+ @param length length of the string to write
+
+ @retval 0 success
+ @retval !0 failure
+*/
+DECLARE_METHOD(int, write_errstream,
+ (void *my_errstream, const char *buffer, size_t length));
+
+/**
+ are we writing to a dedicated errstream, or are we sharing it?
+
+ @param my_errstream a handle describing the log file
+
+ @retval 0 not dedicated (multiplexed, stderr, ...)
+ @retval 1 dedicated
+*/
+DECLARE_METHOD(int, dedicated_errstream, (void *my_errstream));
+
+/**
+ close an error log file previously opened with open_errstream()
+
+ @param my_stream a handle describing the log file
+
+ @retval 0 success
+ @retval !0 failure
+*/
+DECLARE_METHOD(int, close_errstream, (void **my_errstream));
+
+END_SERVICE_DEFINITION(log_builtins)
+
+/**
+ String primitives for logging services.
+*/
+BEGIN_SERVICE_DEFINITION(log_builtins_string)
+// alloc (len+1) bytes
+DECLARE_METHOD(void *, malloc, (size_t len));
+// alloc (len+1) bytes, then copy len bytes from fm, and \0 terminate
+// like my_strndup(), and unlike strndup(), \0 in input won't end copying
+DECLARE_METHOD(char *, strndup, (const char *fm, size_t len));
+// free allocated memory
+DECLARE_METHOD(void, free, (void *ptr));
+
+// length of nul terminated byte string
+DECLARE_METHOD(size_t, length, (const char *s));
+// find char in string, from the left
+DECLARE_METHOD(char *, find_first, (const char *s, int c));
+// find char in string, from the right
+DECLARE_METHOD(char *, find_last, (const char *s, int c));
+
+// compare two NUL-terminated byte-strings
+DECLARE_METHOD(int, compare,
+ (const char *a, const char *b, size_t len,
+ bool case_insensitive));
+
+/**
+ Wrapper for std::snprintf()
+ Replace all % in format string with variables from list.
+ Do not use in new code; use std::snprintf() instead.
+
+ @param to buffer to write the result to
+ @param n size of that buffer
+ @param fmt format string
+ @param ap va_list with valuables for all substitutions in format string
+
+ @retval return value of snprintf
+*/
+DECLARE_METHOD(size_t, substitutev,
+ (char *to, size_t n, const char *fmt, va_list ap))
+MY_ATTRIBUTE((format(printf, 3, 0)));
+
+// replace all % in format string with variables from list (std::snprintf())
+DECLARE_METHOD(size_t, substitute, (char *to, size_t n, const char *fmt, ...))
+MY_ATTRIBUTE((format(printf, 3, 4)));
+
+END_SERVICE_DEFINITION(log_builtins_string)
+
+/**
+ Temporary primitives for logging services.
+*/
+BEGIN_SERVICE_DEFINITION(log_builtins_tmp)
+// Are we shutting down yet? Windows EventLog needs to know.
+DECLARE_METHOD(size_t, notify_client,
+ (void *thd, uint severity, uint code, char *to, size_t n,
+ const char *format, ...))
+MY_ATTRIBUTE((format(printf, 6, 7)));
+END_SERVICE_DEFINITION(log_builtins_tmp)
+
+/**
+ Syslog/Eventlog functions for logging services.
+*/
+BEGIN_SERVICE_DEFINITION(log_builtins_syseventlog)
+DECLARE_METHOD(int, open, (const char *name, int option, int facility));
+DECLARE_METHOD(int, write, (enum loglevel level, const char *msg));
+DECLARE_METHOD(int, close, (void));
+END_SERVICE_DEFINITION(log_builtins_syseventlog)
+
+#ifdef __cplusplus
+
+#if !defined(LOG_H)
+
+extern SERVICE_TYPE(log_builtins) * log_bi;
+extern SERVICE_TYPE(log_builtins_string) * log_bs;
+
+#define log_line_init log_bi->line_init
+#define log_line_exit log_bi->line_exit
+#define log_line_item_set_with_key log_bi->line_item_set_with_key
+#define log_line_item_set log_bi->line_item_set
+#define log_line_item_types_seen log_bi->line_item_types_seen
+#define log_line_submit log_bi->line_submit
+#define log_set_int log_bi->item_set_int
+#define log_set_float log_bi->item_set_float
+#define log_set_lexstring log_bi->item_set_lexstring
+#define log_set_cstring log_bi->item_set_cstring
+#define log_malloc log_bs->malloc
+#define log_free log_bs->free
+#define log_msg log_bs->substitutev
+#define error_msg_by_errcode log_bi->errmsg_by_errcode
+#define error_code_by_errsymbol log_bi->errcode_by_errsymbol
+#else
+
+#error #include "sql/derror.h"
+
+#define log_malloc(s) my_malloc(0, (s), MYF(0))
+#define log_free my_free
+#define log_msg vsnprintf
+#define error_msg_by_errcode error_message_for_error_log
+#define error_code_by_errsymbol mysql_symbol_to_errno
+#define log_set_int log_item_set_int
+#define log_set_float log_item_set_float
+#define log_set_lexstring log_item_set_lexstring
+#define log_set_cstring log_item_set_cstring
+
+/**
+ Very long-running functions during server start-up can use this
+ function to check whether the time-out for buffered logging has
+ been reached. If so and we have urgent information, all buffered
+ log events will be flushed to the log using built-in default-logger
+ for the time being. The information will be kept until start-up
+ completes in case it later turns out the user configured a loadable
+ logger, in which case we'll also flush the buffered information to
+ that logger later once the logger becomes available.
+
+ This function should only be used during start-up; once external
+ components are loaded by the component framework, this function
+ should no longer be called (as log events are no longer buffered,
+ but logged immediately).
+*/
+void log_sink_buffer_check_timeout(void);
+#endif // LOG_H
+
+#ifndef DISABLE_ERROR_LOGGING
+
+#if defined(LOG_COMPONENT_TAG)
+
+#define LogErr(severity, ecode, ...) \
+ LogEvent() \
+ .prio(severity) \
+ .errcode(ecode) \
+ .subsys(LOG_SUBSYSTEM_TAG) \
+ .component(LOG_COMPONENT_TAG) \
+ .source_line(__LINE__) \
+ .source_file(MY_BASENAME) \
+ .function(__FUNCTION__) \
+ .lookup(ecode, ##__VA_ARGS__)
+
+#define LogPluginErr(severity, ecode, ...) \
+ LogEvent() \
+ .prio(severity) \
+ .errcode(ecode) \
+ .subsys(LOG_SUBSYSTEM_TAG) \
+ .component("plugin:" LOG_COMPONENT_TAG) \
+ .source_line(__LINE__) \
+ .source_file(MY_BASENAME) \
+ .function(__FUNCTION__) \
+ .lookup_quoted(ecode, "Plugin " LOG_COMPONENT_TAG " reported", \
+ ##__VA_ARGS__)
+
+#define LogPluginErrV(severity, ecode, vl) \
+ LogEvent() \
+ .prio(severity) \
+ .errcode(ecode) \
+ .subsys(LOG_SUBSYSTEM_TAG) \
+ .component("plugin:" LOG_COMPONENT_TAG) \
+ .source_line(__LINE__) \
+ .source_file(MY_BASENAME) \
+ .function(__FUNCTION__) \
+ .lookup_quotedv(ecode, "Plugin " LOG_COMPONENT_TAG " reported", vl)
+
+#define LogPluginErrMsg(severity, ecode, ...) \
+ LogEvent() \
+ .prio(severity) \
+ .errcode(ecode) \
+ .subsys(LOG_SUBSYSTEM_TAG) \
+ .component("plugin:" LOG_COMPONENT_TAG) \
+ .source_line(__LINE__) \
+ .source_file(MY_BASENAME) \
+ .function(__FUNCTION__) \
+ .message_quoted("Plugin " LOG_COMPONENT_TAG " reported", ##__VA_ARGS__)
+
+#else
+
+#define LogErr(severity, ecode, ...) \
+ LogEvent() \
+ .prio(severity) \
+ .errcode(ecode) \
+ .subsys(LOG_SUBSYSTEM_TAG) \
+ .source_line(__LINE__) \
+ .source_file(MY_BASENAME) \
+ .function(__FUNCTION__) \
+ .lookup(ecode, ##__VA_ARGS__)
+
+#endif
+
+#else
+
+inline void dummy_log_message(longlong severity MY_ATTRIBUTE((unused)),
+ longlong ecode MY_ATTRIBUTE((unused)), ...) {
+ return;
+}
+
+#define LogErr(severity, ecode, ...) \
+ dummy_log_message(severity, ecode, ##__VA_ARGS__)
+
+#define LogPluginErr(severity, ecode, ...) \
+ dummy_log_message(severity, ecode, ##__VA_ARGS__)
+#define LogPluginErrV(severity, ecode, ...) \
+ dummy_log_message(severity, ecode, ##__VA_ARGS__)
+#define LogPluginErrMsg(severity, ecode, ...) \
+ dummy_log_message(severity, ecode, ##__VA_ARGS__)
+
+#endif // DISABLE_ERROR_LOGGING
+
+/**
+ Modular logger: fluid API. Server-internal. Lets you use safe and
+ expressive syntax, like so:
+
+ LogEvent(LOG_TYPE_ERROR).prio(INFORMATION_LEVEL).message("Meow! %d", 4711);
+*/
+
+class LogEvent {
+ private:
+ log_line *ll;
+ char *msg;
+ const char *msg_tag;
+
+ /**
+ Set MySQL error-code if none has been set yet.
+
+ @param errcode the error code (not operating system errno!)
+
+ @retval true an error occurred, value not set (OOM?)
+ @retval false value was set without incident, or did not need to be set
+ */
+ bool set_errcode(longlong errcode) {
+ if (ll == nullptr) return true;
+
+ if (!log_line_item_types_seen(ll, LOG_ITEM_SQL_ERRCODE) &&
+ !log_line_item_types_seen(ll, LOG_ITEM_SQL_ERRSYMBOL)) {
+ return log_set_int(log_line_item_set(ll, LOG_ITEM_SQL_ERRCODE), errcode);
+ }
+ return false; // already set, that's OK then
+ }
+
+ /**
+ Set the error message.
+
+ @param fmt format string. % substitution will be performed.
+ @param ap va_list of the arguments for % substitution.
+ */
+ void set_message(const char *fmt, va_list ap)
+ MY_ATTRIBUTE((format(printf, 2, 0)));
+
+ /**
+ Set the error message (by MySQL error code).
+ The actual message will be looked up using this errcode.
+ As the message is a printf-style format string, % substitution
+ will be performed.
+
+ @param errcode MySQL error code to fetch the message string for
+ @param ap va_list of the arguments for % substitution.
+ */
+ void set_message_by_errcode(longlong errcode, va_list ap);
+
+ public:
+ /**
+ Destructor automatically sends the event on.
+ It is auto-free()d after processing.
+ */
+ ~LogEvent() {
+ if (ll != nullptr) {
+ log_line_submit(this->ll);
+ log_line_exit(ll);
+ log_free(msg);
+ }
+ }
+
+ /**
+ "Full customization" constructor. Use one of the LogErr() macro
+ where possible; it's there to help you remember the minimum set
+ of particles and their data-types. Be prepared for stern looks
+ from your reviewers if you use this constructor except for external
+ (loadable) services that have no error messages registered with the
+ server, and therefore need to submit them free-form.
+ */
+ LogEvent() {
+ if ((ll = log_line_init()) != nullptr) {
+ if ((msg = (char *)log_malloc(LOG_BUFF_MAX)) == nullptr) {
+ log_line_exit(ll);
+ ll = nullptr;
+ }
+ } else
+ msg = nullptr;
+ msg_tag = nullptr;
+ }
+
+ /**
+
+ Set log type.
+
+ @param val the log type (LOG_TYPE_ERROR)
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &type(enum_log_type val) {
+ log_set_int(log_line_item_set(this->ll, LOG_ITEM_LOG_TYPE), val);
+ return *this;
+ }
+
+ /**
+ Append a numeric error code
+
+ @param val the MySQL error code (not operating system errno!).
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &errcode(longlong val) {
+ log_set_int(log_line_item_set(this->ll, LOG_ITEM_SQL_ERRCODE), val);
+ return *this;
+ }
+
+ /**
+ Append a (string) error symbol
+
+ @param val error symbol. NTBS.
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &errsymbol(const char *val) {
+ log_set_cstring(log_line_item_set(this->ll, LOG_ITEM_SQL_ERRSYMBOL), val);
+ return *this;
+ }
+
+ /**
+ Append a (string) SQL state
+
+ @param val the SQLstate. NTBS.
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &sqlstate(const char *val) {
+ log_set_cstring(log_line_item_set(this->ll, LOG_ITEM_SQL_STATE), val);
+ return *this;
+ }
+
+ /**
+ Append a numeric (operating system, as opposed to MySQL) error number.
+
+ @param val the operating system errno.
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &os_errno(longlong val) {
+ log_set_int(log_line_item_set(this->ll, LOG_ITEM_SYS_ERRNO), val);
+ return *this;
+ }
+
+ /**
+ Append a textual (operating system, as opposed to MySQL) error message,
+ vulgo, strerror()
+
+ @param val the error message returned by the operating system. NTBS.
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &os_errmsg(const char *val) {
+ log_set_cstring(log_line_item_set(this->ll, LOG_ITEM_SYS_STRERROR), val);
+ return *this;
+ }
+
+ /**
+ Which source file was the problem detected in?
+
+ @param val the source file's name. NTBS.
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &source_file(const char *val) {
+ log_set_cstring(log_line_item_set(this->ll, LOG_ITEM_SRC_FILE), val);
+ return *this;
+ }
+
+ /**
+ Which line in the source file was the problem detected on?
+
+ @param val the line number.
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &source_line(longlong val) {
+ log_set_int(log_line_item_set(this->ll, LOG_ITEM_SRC_LINE), val);
+ return *this;
+ }
+
+ /**
+ Which function in the source was the problem detected in?
+
+ @param val the function's name. NTBS.
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &function(const char *val) {
+ log_set_cstring(log_line_item_set(this->ll, LOG_ITEM_SRC_FUNC), val);
+ return *this;
+ }
+
+ /**
+ Which subsystem in the source was the problem detected in?
+ ("Repl"/"InnoDB"/"Server")
+
+ @param val the subsystem. NTBS.
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &subsys(const char *val) {
+ if (val != nullptr)
+ log_set_cstring(log_line_item_set(this->ll, LOG_ITEM_SRV_SUBSYS), val);
+ return *this;
+ }
+
+ /**
+ Which component in the source was the problem detected in?
+ This should be the same string that is given to the
+ component/service framework.
+
+ @param val the component. NTBS.
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &component(const char *val) {
+ if (val != nullptr)
+ log_set_cstring(log_line_item_set(this->ll, LOG_ITEM_SRV_COMPONENT), val);
+ return *this;
+ }
+
+ /**
+ What user were we working for at the time of the issue?
+
+ @param val the user part (of "user@host"). LEX_CSTRING.
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &user(LEX_CSTRING val) {
+ log_set_lexstring(log_line_item_set(this->ll, LOG_ITEM_MSC_USER), val.str,
+ val.length);
+ return *this;
+ }
+
+ /**
+ What user were we working for at the time of the issue?
+
+ @param val the user part (of "user@host"). NTBS.
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &user(const char *val) {
+ log_set_cstring(log_line_item_set(this->ll, LOG_ITEM_MSC_USER), val);
+ return *this;
+ }
+
+ /**
+ Whose session did the issue appear in?
+
+ @param val the host part (of "user@host"). LEX_CSTRING.
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &host(LEX_CSTRING val) {
+ log_set_lexstring(log_line_item_set(this->ll, LOG_ITEM_MSC_HOST), val.str,
+ val.length);
+ return *this;
+ }
+
+ /**
+ Whose session did the issue appear in?
+
+ @param val the host part (of "user@host"). NTBS.
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &host(const char *val) {
+ log_set_cstring(log_line_item_set(this->ll, LOG_ITEM_MSC_HOST), val);
+ return *this;
+ }
+
+ /**
+ What thread / "connection ID" was the issue detected in?
+
+ @param val the thread_ID of the session the issue appeared in
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &thread_id(longlong val) {
+ log_set_int(log_line_item_set(this->ll, LOG_ITEM_SRV_THREAD), val);
+ return *this;
+ }
+
+ /**
+ What query apparently caused the issue?
+
+ @param val the query_ID of the offending query
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &query_id(longlong val) {
+ log_set_int(log_line_item_set(this->ll, LOG_ITEM_SQL_QUERY_ID), val);
+ return *this;
+ }
+
+ /**
+ What table were we working on?
+
+ @param val the table's name/alias. NTBS.
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &table_name(const char *val) {
+ log_set_cstring(log_line_item_set(this->ll, LOG_ITEM_SQL_TABLE_NAME), val);
+ return *this;
+ }
+
+ /**
+ Set error message priority.
+ Assign one of ERROR_LEVEL, WARNING_LEVEL, INFORMATION_LEVEL.
+ log-writers and other sinks should use this value (rather
+ than that of LOG_ITEM_LOG_EPRIO):
+
+ - file writers should use the value to determine
+ what label to write (perhaps by submitting it to label_from_prio())
+
+ - sinks that submit the event data to a sub-system outside of
+ the MySQL server (such as syslog, EventLog, systemd journal, etc.)
+ should translate this value into a priority/log level understood
+ by that target subsystem.
+
+ @param val The priority for this LogEvent.
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &prio(longlong val) {
+ log_set_int(log_line_item_set(this->ll, LOG_ITEM_LOG_PRIO), val);
+ return *this;
+ }
+
+ /**
+ Set a label (usually "warning"/"error"/"information").
+ Will be derived from prio if not set explicitly.
+ Some log services may ignore custom labels.
+
+ @param val the (custom) label to set
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &label(const char *val) {
+ log_set_cstring(log_line_item_set(this->ll, LOG_ITEM_LOG_LABEL), val);
+ return *this;
+ }
+
+ /**
+ Add a message to the event, verbatim (i.e. with no % substitutions).
+ This is an analog of message("%s", message); it can be used when
+ message may contain user input or a message from another subsystem
+ that could contain % that must not be interpreted as an invitation
+ to do % substitutions.
+
+ If you use this in a context other than an external service that
+ has no messages registered with the server, your reviewers will
+ say unkind things about you. Use registered messages and their
+ error codes wherever possible!
+
+ @param msg_arg the message. % substitution will not happen.
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &verbatim(const char *msg_arg) {
+ log_set_cstring(log_line_item_set(this->ll, LOG_ITEM_LOG_MESSAGE), msg_arg);
+ return *this;
+ }
+
+ /**
+ Fill in a format string by substituting the % with the given
+ arguments, then add the result as the event's message.
+ This should be used very sparingly; use registered messages
+ and their error codes wherever possible!
+
+ @param fmt message (treated as a printf-style format-string,
+ so % substitution will happen)
+ @param ap valist to satisfy any % in the message
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &messagev(const char *fmt, va_list ap)
+ MY_ATTRIBUTE((format(printf, 2, 0))) {
+ set_message(fmt, ap);
+ return *this;
+ }
+
+ /**
+ Fill in a format string by substituting the % with the given
+ arguments, then add the result as the event's message.
+
+ If you use this in a context other than an external service that
+ has no messages registered with the server, your reviewers will
+ say unkind things about you. Use registered messages and their
+ error codes wherever possible!
+
+ @param fmt message (treated as a printf-style format-string,
+ so % substitution will happen)
+ @param ... varargs to satisfy any % in the message
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &message(const char *fmt, ...) MY_ATTRIBUTE((format(printf, 2, 3)));
+
+ /**
+ Fill in a format string by substituting the % with the given
+ arguments and tag, then add the result as the event's message.
+
+ @param tag Tag to prefix to message.
+ @param fmt message (treated as a printf-style format-string,
+ so % substitution will happen)
+ @param ... varargs to satisfy any % in the message
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &message_quoted(const char *tag, const char *fmt, ...)
+ MY_ATTRIBUTE((format(printf, 3, 4))) {
+ msg_tag = tag;
+
+ va_list args;
+ va_start(args, fmt);
+ set_message(fmt, args);
+ va_end(args);
+
+ return *this;
+ }
+
+ /**
+ Find an error message by its MySQL error code.
+ Substitute the % in that message with the given
+ arguments, then add the result as the event's message.
+
+ @param errcode MySQL error code for the message in question,
+ e.g. ER_STARTUP
+ @param ... varargs to satisfy any % in the message
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &lookup(longlong errcode, ...) {
+ va_list args;
+ va_start(args, errcode);
+ set_message_by_errcode(errcode, args);
+ va_end(args);
+
+ return *this;
+ }
+
+ /**
+ Find an error message by its MySQL error code. Substitute the % in that
+ message with the given arguments list, then add the result as the event's
+ message.
+
+ @param errcode MySQL error code for the message in question,
+ e.g. ER_STARTUP
+ @param args varargs to satisfy any % in the message
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &lookupv(longlong errcode, va_list args) {
+ set_message_by_errcode(errcode, args);
+
+ return *this;
+ }
+
+ LogEvent &lookup_quoted(longlong errcode, const char *tag, ...) {
+ msg_tag = tag;
+
+ va_list args;
+ va_start(args, tag);
+ set_message_by_errcode(errcode, args);
+ va_end(args);
+
+ return *this;
+ }
+
+ LogEvent &lookup_quotedv(longlong errcode, const char *tag, va_list vl) {
+ msg_tag = tag;
+ set_message_by_errcode(errcode, vl);
+
+ return *this;
+ }
+
+ /**
+ Add a ad hoc integer value with the given key.
+
+ @param key user-defined key (i.e. not wellknown). NTBS.
+ @param val value.
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &int_value(const char *key, longlong val) {
+ log_set_int(log_line_item_set_with_key(this->ll, LOG_ITEM_GEN_INTEGER, key,
+ LOG_ITEM_FREE_NONE),
+ val);
+ return *this;
+ }
+
+ /**
+ Add a ad hoc (not "well-known") float value with the given key.
+
+ @param key user-defined key (i.e. not wellknown). NTBS.
+ @param val value.
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &float_value(const char *key, double val) {
+ log_set_float(log_line_item_set_with_key(this->ll, LOG_ITEM_GEN_FLOAT, key,
+ LOG_ITEM_FREE_NONE),
+ val);
+ return *this;
+ }
+
+ /**
+ Add a ad hoc string value with the given key.
+
+ @param key user-defined key (i.e. not wellknown). NTBS.
+ @param val value.
+ @param len length in bytes of the value.
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &string_value(const char *key, const char *val, size_t len) {
+ log_set_lexstring(
+ log_line_item_set_with_key(this->ll, LOG_ITEM_GEN_LEX_STRING, key,
+ LOG_ITEM_FREE_NONE),
+ val, len);
+ return *this;
+ }
+
+ /**
+ Add a ad hoc string value with the given key.
+
+ @param key user-defined key (i.e. not wellknown). NTBS.
+ @param val value. NTBS.
+
+ @retval the LogEvent, for easy fluent-style chaining.
+ */
+ LogEvent &string_value(const char *key, const char *val) {
+ log_set_cstring(
+ log_line_item_set_with_key(this->ll, LOG_ITEM_GEN_LEX_STRING, key,
+ LOG_ITEM_FREE_NONE),
+ val);
+ return *this;
+ }
+};
+
+inline void LogEvent::set_message_by_errcode(longlong errcode, va_list ap) {
+ const char *fmt = error_msg_by_errcode((int)errcode);
+
+ if ((fmt == nullptr) || (*fmt == '\0')) fmt = "invalid error code";
+
+ set_errcode(errcode);
+ set_message(fmt, ap);
+}
+
+inline void LogEvent::set_message(const char *fmt, va_list ap) {
+ if ((ll != nullptr) && (msg != nullptr)) {
+ char buf[LOG_BUFF_MAX];
+ if (msg_tag != nullptr) {
+ snprintf(buf, LOG_BUFF_MAX - 1, "%s: \'%s\'", msg_tag, fmt);
+ fmt = buf;
+ }
+ size_t len = log_msg(msg, LOG_BUFF_MAX - 1, fmt, ap);
+ log_set_lexstring(log_line_item_set(this->ll, LOG_ITEM_LOG_MESSAGE), msg,
+ len);
+ }
+}
+
+inline LogEvent &LogEvent::message(const char *fmt, ...) {
+ va_list args;
+ va_start(args, fmt);
+ set_message(fmt, args);
+ va_end(args);
+
+ return *this;
+}
+
+// Methods initialize and de-initialize logging service for plugins.
+#if defined(MYSQL_DYNAMIC_PLUGIN)
+
+/**
+ Method to de-initialize logging service in plugin.
+
+ param[in,out] reg_srv Plugin registry service.
+ param[in,out] log_bi Error logging service.
+ param[in,out] log_bs String service for error logging.
+*/
+inline void deinit_logging_service_for_plugin(
+ SERVICE_TYPE(registry) * *reg_srv, SERVICE_TYPE(log_builtins) * *log_bi,
+ SERVICE_TYPE(log_builtins_string) * *log_bs) {
+ using log_builtins_t = SERVICE_TYPE_NO_CONST(log_builtins);
+ using log_builtins_string_t = SERVICE_TYPE_NO_CONST(log_builtins_string);
+ if (*log_bi)
+ (*reg_srv)->release(
+ reinterpret_cast<my_h_service>(const_cast<log_builtins_t *>(*log_bi)));
+ if (*log_bs)
+ (*reg_srv)->release(reinterpret_cast<my_h_service>(
+ const_cast<log_builtins_string_t *>(*log_bs)));
+ mysql_plugin_registry_release(*reg_srv);
+ *log_bi = nullptr;
+ *log_bs = nullptr;
+ *reg_srv = nullptr;
+}
+
+/**
+ Method to de-initialize logging service in plugin.
+
+ param[in,out] reg_srv Plugin registry service.
+ param[in,out] log_bi Error logging service.
+ param[in,out] log_bs String service for error logging.
+
+ @retval false Success.
+ @retval true Failed.
+*/
+inline bool init_logging_service_for_plugin(
+ SERVICE_TYPE(registry) * *reg_srv, SERVICE_TYPE(log_builtins) * *log_bi,
+ SERVICE_TYPE(log_builtins_string) * *log_bs) {
+ my_h_service log_srv = nullptr;
+ my_h_service log_str_srv = nullptr;
+ *reg_srv = mysql_plugin_registry_acquire();
+ if (!(*reg_srv)->acquire("log_builtins.mysql_server", &log_srv) &&
+ !(*reg_srv)->acquire("log_builtins_string.mysql_server", &log_str_srv)) {
+ (*log_bi) = reinterpret_cast<SERVICE_TYPE(log_builtins) *>(log_srv);
+ (*log_bs) =
+ reinterpret_cast<SERVICE_TYPE(log_builtins_string) *>(log_str_srv);
+ } else {
+ deinit_logging_service_for_plugin(reg_srv, log_bi, log_bs);
+ return true;
+ }
+ return false;
+}
+
+#elif defined(EXTRA_CODE_FOR_UNIT_TESTING)
+
+/**
+ Method is used by unit tests.
+
+ param[in,out] reg_srv Plugin registry service.
+ param[in,out] log_bi Error logging service.
+ param[in,out] log_bs String service for error logging.
+
+ @retval false Success.
+ @retval true Failed.
+*/
+inline bool init_logging_service_for_plugin(
+ SERVICE_TYPE(registry) * *reg_srv MY_ATTRIBUTE((unused)),
+ SERVICE_TYPE(log_builtins) * *log_bi MY_ATTRIBUTE((unused)),
+ SERVICE_TYPE(log_builtins_string) * *log_bs MY_ATTRIBUTE((unused)))
+
+{
+ return false;
+}
+
+/**
+ Method is used by unit tests.
+
+ param[in,out] reg_srv Plugin registry service.
+ param[in,out] log_bi Error logging service.
+ param[in,out] log_bs String service for error logging.
+*/
+inline void deinit_logging_service_for_plugin(
+ SERVICE_TYPE(registry) * *reg_srv MY_ATTRIBUTE((unused)),
+ SERVICE_TYPE(log_builtins) * *log_bi MY_ATTRIBUTE((unused)),
+ SERVICE_TYPE(log_builtins_string) * *log_bs MY_ATTRIBUTE((unused))) {}
+
+#endif // MYSQL_DYNAMIC_PLUGIN
+
+#endif // __cplusplus
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/log_shared.h b/contrib/libs/libmysql_r/include/mysql/components/services/log_shared.h
new file mode 100644
index 0000000000..b5a18cf9ef
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/log_shared.h
@@ -0,0 +1,234 @@
+/* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef LOG_SHARED_H
+#define LOG_SHARED_H
+
+#include <mysql/mysql_lex_string.h>
+
+#include "my_basename.h"
+#include "my_inttypes.h"
+#include "my_loglevel.h"
+
+/** fallback: includer may not have set this to something sensible. */
+#ifndef LOG_SUBSYSTEM_TAG
+#define LOG_SUBSYSTEM_TAG NULL
+#endif
+
+/**
+ The logging sub-system internally uses the log_line structure to pass
+ data around. This header primarily the specifics and symbols of that
+ structure.
+
+ Within the server, those interfaces may be used, but it is usually
+ preferable to use the fluent C++ convenience class LogErr() instead
+ where possible (and the variadic convenience function log_message()
+ where it is not). (see sql/log.h).
+
+ (The legacy calls sql_print_(error|warning|information) have now
+ been defined to use log_message().)
+
+ Finally, this header defines log types (error log etc.) as well
+ as log item types (timestamp, message, ...) used by the logging
+ components; these are shared between the variadic convenience
+ functions (log_message(), sql_print_*()) as well as the lower
+ level services using the log_line structure.
+*/
+
+/*
+ By historical convention in the lex context,
+ CSTRING means "constant lex string (char * + size_t)",
+ not "C-style string" (char *, \0 terminated)!
+*/
+typedef struct MYSQL_LEX_CSTRING LEX_CSTRING;
+
+/**
+ log_type -- which log to send data to
+ check vs enum_log_table_type and LOG_FILE/LOG_TABLE/LOG_NONE
+*/
+enum enum_log_type {
+ LOG_TYPE_UNDEF = 0,
+ LOG_TYPE_ERROR = 1,
+ LOG_TYPE_GENERAL = 2,
+ LOG_TYPE_SLOW = 4,
+ LOG_TYPE_AUDIT = 8,
+ LOG_TYPE_MISC = 16
+};
+
+/**
+ item_type -- what to log
+
+
+ Used by variadic convenience interface
+ log_message(), legacy sql_print_*(), legacy my_plugin_log_message().
+ Also available via the log_builtins service as message().
+
+ (Wherever possible, use the fluent C++ wrapper LogErr() (see
+ log_builtins.h) instead, though.)
+
+ LOG_ITEM_GEN_CSTRING lets the caller submit a \0 terminated,
+ C-style string for convenience; it will be converted to
+ lex style (char *, size_t) on submission.
+
+ LOG_ITEM_END should not be used in the variadic interface
+ as submitting a log line without an actual message is discouraged.
+ Instead LOG_ITEM_LOG_MESSAGE or LOG_ITEM_LOG_LOOKUP should be used
+ as the last LOG_ITEM_* key-value pairs:
+
+ - LOG_ITEM_LOG_MESSAGE can be used to submit an ad hoc message
+ directly while debugging.
+
+ - LOG_ITEM_LOG_LOOKUP asks for the given error number to be
+ replaced by the associated error message (i.e. the error message
+ for the error number will be looked up, and the LOOKUP item will
+ be replaced by a MESSAGE one).
+
+ In variadic submission, both ad hoc and well-known error messages
+ are considered printf()-style format strings, and should be followed
+ by any arguments/variables required by that format string.
+
+ In some situations, the variadic interface will automatically
+ generate some items ("If you cannot afford a timestamp, one will
+ be provided for you."). If an item of the required type already
+ exists, the submission interface should not generate another.
+
+ Old-style plug-ins using my_plugin_log_message() will automatically
+ be tagged with a default LOG_ITEM_MSC_COMPONENT of their plug-in name.
+
+
+
+ Non-variadic interface
+
+ In non-variadic submission (i.e. all functions accepting a log_line),
+ LOG_ITEM_LOG_LOOKUP and LOG_ITEM_GEN_CSTRING are not valid item types,
+ while LOG_ITEM_LOG_MESSAGE must already be a string literal (i.e. any
+ substitutions must already have taken place).
+*/
+typedef enum enum_log_item_type {
+ LOG_ITEM_END = 0, /**< end of list, see above */
+ LOG_ITEM_LOG_TYPE = 1 << 0, /**< error log, etc. */
+ LOG_ITEM_SQL_ERRCODE = 1 << 1, /**< mysql error code (numeric) */
+ LOG_ITEM_SQL_ERRSYMBOL = 1 << 2, /**< mysql error code (symbolic) */
+ LOG_ITEM_SQL_STATE = 1 << 3, /**< SQL state */
+ LOG_ITEM_SYS_ERRNO = 1 << 4, /**< OS errno */
+ LOG_ITEM_SYS_STRERROR = 1 << 5, /**< OS strerror() */
+ LOG_ITEM_SRC_FILE = 1 << 6, /**< log called from file ... */
+ LOG_ITEM_SRC_LINE = 1 << 7, /**< log called from line ... */
+ LOG_ITEM_SRC_FUNC = 1 << 8, /**< log called from function ... */
+ LOG_ITEM_SRV_SUBSYS = 1 << 9, /**< log called from subsystem ... */
+ LOG_ITEM_SRV_COMPONENT = 1 << 10, /**< log called from component ... */
+ LOG_ITEM_MSC_USER = 1 << 11, /**< offending thread owned by ... */
+ LOG_ITEM_MSC_HOST = 1 << 12, /**< responsible user on host ... */
+ LOG_ITEM_SRV_THREAD = 1 << 13, /**< connection ID */
+ LOG_ITEM_SQL_QUERY_ID = 1 << 14, /**< query ID */
+ LOG_ITEM_SQL_TABLE_NAME = 1 << 15, /**< table name */
+ LOG_ITEM_LOG_PRIO = 1 << 16, /**< log priority (error, warn, ...) */
+ LOG_ITEM_LOG_LABEL = 1 << 17, /**< label, unless auto-derived */
+ LOG_ITEM_LOG_VERBATIM = 1 << 18, /**< the message, no % substitutions */
+ LOG_ITEM_LOG_MESSAGE = 1 << 19, /**< the message, format string */
+ LOG_ITEM_LOG_LOOKUP = 1 << 20, /**< insert message by error-code */
+ LOG_ITEM_LOG_TIMESTAMP = 1 << 21, /**< ISO8601 timestamp */
+ LOG_ITEM_LOG_BUFFERED = 1 << 22, /**< integer timestamp if/when buffered */
+ LOG_ITEM_LOG_SUPPRESSED = 1 << 23, /**< "and ... more" throttled */
+ LOG_ITEM_GEN_FLOAT = 1 << 24, /**< float not otherwise specified */
+ LOG_ITEM_GEN_INTEGER = 1 << 25, /**< integer not otherwise specified */
+ LOG_ITEM_GEN_LEX_STRING = 1 << 26, /**< lex string not otherwise specified */
+ LOG_ITEM_GEN_CSTRING = 1 << 27 /**< C-string not otherwise specified */
+} log_item_type;
+
+/* some suggested keys for generic items */
+
+/** DIAGNOSTICS: for da->message_text() */
+#define LOG_TAG_DIAG "DIAGNOSTICS"
+
+/** AUX: supplementary data not fitting any of the wellknown keys */
+#define LOG_TAG_AUX "AUX"
+
+/* data type */
+typedef enum enum_log_item_class {
+ LOG_UNTYPED = 0, /**< undefined */
+ LOG_CSTRING = 1, /**< string (char * + \0; variadic API only) */
+ LOG_INTEGER = 2, /**< integer (long long) */
+ LOG_FLOAT = 3, /**< float (double) */
+ LOG_LEX_STRING = 4 /**< string (char *, size_t) */
+} log_item_class;
+
+/* do we need to release any parts of the item after use? */
+enum enum_log_item_free {
+ LOG_ITEM_FREE_NONE = 0,
+ LOG_ITEM_FREE_KEY = 1,
+ LOG_ITEM_FREE_VALUE = 2
+};
+
+/* union: payload */
+typedef union _log_item_data {
+ longlong data_integer;
+ double data_float;
+ LEX_CSTRING data_string;
+} log_item_data;
+
+/* item key: for now, a C-string */
+typedef const char *log_item_key;
+
+/* log item: key/value */
+typedef struct _log_item {
+ log_item_type type;
+ log_item_class item_class;
+ log_item_key key;
+ log_item_data data;
+ uint32 alloc;
+} log_item;
+
+/* service helpers */
+typedef enum enum_log_item_error {
+ LOG_ITEM_OK = 0,
+ LOG_ITEM_TYPE_NOT_FOUND = -1,
+ LOG_ITEM_TYPE_RESERVED = -2,
+ LOG_ITEM_CLASS_MISMATCH = -3,
+ LOG_ITEM_KEY_MISMATCH = -4,
+ LOG_ITEM_STRING_NULL = -5,
+ LOG_ITEM_KEY_NULL = -6
+} log_item_error;
+
+/** a bit mask of log_types. standardizing the width to 64 bit. */
+typedef uint64 log_item_type_mask;
+
+/** log line: a collection of log items */
+typedef struct _log_line log_line;
+
+/** log iter: an iterator over the collection of log items in a log line */
+typedef struct _log_item_iter log_item_iter;
+
+/** advisory. components must not rely on others using the same value. */
+#define LOG_BUFF_MAX 8192
+
+/** 26 for regular timestamp, plus 7 (".123456") when using micro-seconds */
+static const int iso8601_size = 33;
+
+/**
+ index of first server error message: messages with this index or
+ higher are intended for the error log; messages below this index
+ are intended for the client
+*/
+#define ER_SERVER_RANGE_START 10000
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/my_io_bits.h b/contrib/libs/libmysql_r/include/mysql/components/services/my_io_bits.h
new file mode 100644
index 0000000000..10d862aaa8
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/my_io_bits.h
@@ -0,0 +1,62 @@
+/* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef COMPONENTS_SERVICES_MY_IO_BITS_H
+#define COMPONENTS_SERVICES_MY_IO_BITS_H
+
+/**
+ @file mysql/components/services/my_io_bits.h
+ Types to make file and socket I/O compatible.
+*/
+
+#ifdef _WIN32
+/* Include common headers.*/
+#include <io.h> /* access(), chmod() */
+#ifdef WIN32_LEAN_AND_MEAN
+#include <winsock2.h>
+#include <ws2tcpip.h> /* SOCKET */
+#endif
+#endif
+
+#ifndef MYSQL_ABI_CHECK
+#if !defined(_WIN32)
+#include <sys/socket.h>
+#include <unistd.h>
+#endif
+#include <errno.h>
+#include <limits.h>
+#include <sys/types.h> // Needed for mode_t, so IWYU pragma: keep.
+#endif
+
+typedef int File; /* File descriptor */
+#ifdef _WIN32
+typedef int MY_MODE;
+typedef int mode_t;
+typedef int socket_len_t;
+typedef SOCKET my_socket;
+#else
+typedef mode_t MY_MODE;
+typedef socklen_t socket_len_t;
+typedef int my_socket; /* File descriptor for sockets */
+#endif /* _WIN32 */
+
+#endif /* COMPONENTS_SERVICES_MY_IO_BITS_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/my_thread_bits.h b/contrib/libs/libmysql_r/include/mysql/components/services/my_thread_bits.h
new file mode 100644
index 0000000000..992f9a39a1
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/my_thread_bits.h
@@ -0,0 +1,58 @@
+/* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef COMPONENTS_SERVICES_MY_THREAD_BITS_H
+#define COMPONENTS_SERVICES_MY_THREAD_BITS_H
+
+/**
+ @file mysql/components/services/my_thread_bits.h
+ Types to make different thread packages compatible.
+*/
+
+#ifndef MYSQL_ABI_CHECK
+#if defined(_WIN32)
+#include <windows.h>
+#else
+#include <pthread.h> // IWYU pragma: export
+#include <sched.h> // IWYU pragma: export
+#endif
+#endif /* MYSQL_ABI_CHECK */
+
+#ifdef _WIN32
+typedef DWORD my_thread_t;
+typedef struct thread_attr {
+ DWORD dwStackSize;
+ int detachstate;
+} my_thread_attr_t;
+#else
+typedef pthread_t my_thread_t;
+typedef pthread_attr_t my_thread_attr_t;
+#endif
+
+struct my_thread_handle {
+ my_thread_t thread{0};
+#ifdef _WIN32
+ HANDLE handle{INVALID_HANDLE_VALUE};
+#endif
+};
+
+#endif /* COMPONENTS_SERVICES_MY_THREAD_BITS_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/mysql_cond_bits.h b/contrib/libs/libmysql_r/include/mysql/components/services/mysql_cond_bits.h
new file mode 100644
index 0000000000..3c9e2dcc9b
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/mysql_cond_bits.h
@@ -0,0 +1,62 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef COMPONENTS_SERVICES_MYSQL_COND_BITS_H
+#define COMPONENTS_SERVICES_MYSQL_COND_BITS_H
+
+/**
+ @file
+ Instrumentation helpers for conditions.
+*/
+
+#include "mysql/components/services/thr_cond_bits.h"
+
+/**
+ @defgroup psi_api_cond Cond Instrumentation (API)
+ @ingroup psi_api
+ @{
+*/
+
+/**
+ An instrumented cond structure.
+ @c mysql_cond_t is a drop-in replacement for @c native_cond_t.
+ @sa mysql_cond_init
+ @sa mysql_cond_wait
+ @sa mysql_cond_timedwait
+ @sa mysql_cond_signal
+ @sa mysql_cond_broadcast
+ @sa mysql_cond_destroy
+*/
+struct mysql_cond_t {
+ /** The real condition */
+ native_cond_t m_cond;
+ /**
+ The instrumentation hook.
+ Note that this hook is not conditionally defined,
+ for binary compatibility of the @c mysql_cond_t interface.
+ */
+ struct PSI_cond *m_psi;
+};
+
+/** @} (end of group psi_api_cond) */
+
+#endif /* COMPONENTS_SERVICES_MYSQL_COND_BITS_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/mysql_mutex_bits.h b/contrib/libs/libmysql_r/include/mysql/components/services/mysql_mutex_bits.h
new file mode 100644
index 0000000000..bca8420d1f
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/mysql_mutex_bits.h
@@ -0,0 +1,62 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef COMPONENTS_SERVICES_MYSQL_MUTEX_BITS_H
+#define COMPONENTS_SERVICES_MYSQL_MUTEX_BITS_H
+
+/**
+ @file
+ ABI for instrumented mutexes.
+*/
+
+#include <mysql/components/services/thr_mutex_bits.h>
+
+/**
+ @defgroup psi_api_mutex Mutex Instrumentation (API)
+ @ingroup psi_api
+ @{
+*/
+
+/**
+ An instrumented mutex structure.
+ @c mysql_mutex_t is a drop-in replacement for @c my_mutex_t.
+ @sa mysql_mutex_assert_owner
+ @sa mysql_mutex_assert_not_owner
+ @sa mysql_mutex_init
+ @sa mysql_mutex_lock
+ @sa mysql_mutex_unlock
+ @sa mysql_mutex_destroy
+*/
+struct mysql_mutex_t {
+ /** The real mutex. */
+ my_mutex_t m_mutex;
+ /**
+ The instrumentation hook.
+ Note that this hook is not conditionally defined,
+ for binary compatibility of the @c mysql_mutex_t interface.
+ */
+ struct PSI_mutex *m_psi{nullptr};
+};
+
+/** @} (end of group psi_api_mutex) */
+
+#endif /* COMPONENTS_SERVICES_MYSQL_MUTEX_BITS_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/mysql_rwlock_bits.h b/contrib/libs/libmysql_r/include/mysql/components/services/mysql_rwlock_bits.h
new file mode 100644
index 0000000000..80ea267206
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/mysql_rwlock_bits.h
@@ -0,0 +1,84 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef COMPONENTS_SERVICES_MYSQL_RWLOCK_BITS_H
+#define COMPONENTS_SERVICES_MYSQL_RWLOCK_BITS_H
+
+/**
+ @file
+ Instrumentation helpers for rwlock.
+*/
+
+#include "mysql/components/services/thr_rwlock_bits.h"
+
+/**
+ @defgroup psi_api_rwlock Rwlock Instrumentation (API)
+ @ingroup psi_api
+ @{
+*/
+
+/**
+ An instrumented rwlock structure.
+ @c mysql_rwlock_t is a drop-in replacement for @c pthread_rwlock_t.
+ @sa mysql_rwlock_init
+ @sa mysql_rwlock_rdlock
+ @sa mysql_rwlock_tryrdlock
+ @sa mysql_rwlock_wrlock
+ @sa mysql_rwlock_trywrlock
+ @sa mysql_rwlock_unlock
+ @sa mysql_rwlock_destroy
+*/
+struct mysql_rwlock_t {
+ /** The real rwlock */
+ native_rw_lock_t m_rwlock;
+ /**
+ The instrumentation hook.
+ Note that this hook is not conditionally defined,
+ for binary compatibility of the @c mysql_rwlock_t interface.
+ */
+ struct PSI_rwlock *m_psi;
+};
+
+/**
+ An instrumented prlock structure.
+ A prlock is a read write lock that 'prefers readers' (pr).
+ @c mysql_prlock_t is a drop-in replacement for @c rw_pr_lock_t.
+ @sa mysql_prlock_init
+ @sa mysql_prlock_rdlock
+ @sa mysql_prlock_wrlock
+ @sa mysql_prlock_unlock
+ @sa mysql_prlock_destroy
+*/
+struct mysql_prlock_t {
+ /** The real prlock */
+ rw_pr_lock_t m_prlock;
+ /**
+ The instrumentation hook.
+ Note that this hook is not conditionally defined,
+ for binary compatibility of the @c mysql_rwlock_t interface.
+ */
+ struct PSI_rwlock *m_psi;
+};
+
+/** @} (end of group psi_api_rwlock) */
+
+#endif /* COMPONENTS_SERVICES_MYSQL_RWLOCK_BITS_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/mysql_socket_bits.h b/contrib/libs/libmysql_r/include/mysql/components/services/mysql_socket_bits.h
new file mode 100644
index 0000000000..2e3f4477e9
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/mysql_socket_bits.h
@@ -0,0 +1,63 @@
+#ifndef COMPONENTS_SERVICES_MYSQL_SOCKET_BITS_H
+#define COMPONENTS_SERVICES_MYSQL_SOCKET_BITS_H
+
+/* Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "my_io.h"
+#include "mysql/components/services/my_io_bits.h"
+
+/**
+ An instrumented socket.
+ @c MYSQL_SOCKET is a replacement for @c my_socket.
+*/
+struct MYSQL_SOCKET {
+ /** The real socket descriptor. */
+ my_socket fd;
+
+ /**
+ The instrumentation hook.
+ Note that this hook is not conditionally defined,
+ for binary compatibility of the @c MYSQL_SOCKET interface.
+ */
+ struct PSI_socket *m_psi;
+};
+
+/**
+ @def MYSQL_INVALID_SOCKET
+ MYSQL_SOCKET initial value.
+*/
+// MYSQL_SOCKET MYSQL_INVALID_SOCKET= {INVALID_SOCKET, NULL};
+#define MYSQL_INVALID_SOCKET mysql_socket_invalid()
+
+/**
+ MYSQL_SOCKET helper. Initialize instrumented socket.
+ @sa mysql_socket_getfd
+ @sa mysql_socket_setfd
+*/
+static inline MYSQL_SOCKET mysql_socket_invalid() {
+ MYSQL_SOCKET mysql_socket = {INVALID_SOCKET, NULL};
+ return mysql_socket;
+}
+
+#endif // COMPONENTS_SERVICES_MYSQL_SOCKET_BITS_H
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/page_track_service.h b/contrib/libs/libmysql_r/include/mysql/components/services/page_track_service.h
new file mode 100644
index 0000000000..9e71b777f9
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/page_track_service.h
@@ -0,0 +1,184 @@
+/* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @brief
+
+ This defines the API used to call functions to the page tracking service.
+ When implementing such a service, refer to mysql_page_track.h instead!
+
+*/
+
+#ifndef MYSQL_PAGE_TRACK_SERVICE_H
+#define MYSQL_PAGE_TRACK_SERVICE_H
+
+#include <mysql/components/service.h>
+#include <functional>
+
+#ifdef __cplusplus
+class THD;
+#define MYSQL_THD THD *
+#else
+#define MYSQL_THD void *
+#endif
+
+/**
+ SE for the page tracking. Currently supports only in InnoDB.
+*/
+typedef enum { PAGE_TRACK_SE_INNODB = 1 } Page_Track_SE;
+
+/**
+ Page tracking callback function.
+
+ @param[in] thd Current thread context
+ @param[in] buffer buffer filled with 8 byte page ids; the format is
+ specific to SE. For InnoDB it is space_id (4 bytes) followed by page number
+ (4 bytes)
+ @param[in] buf_len length of buffer in bytes
+ @param[in] num_pages number of valid page IDs in buffer
+ @param[in,out] user_ctx user context passed to page tracking function
+
+ @return Operation status.
+*/
+typedef int (*Page_Track_Callback)(MYSQL_THD thd, const unsigned char *buffer,
+ size_t buf_len, int num_pages,
+ void *user_ctx);
+
+BEGIN_SERVICE_DEFINITION(mysql_page_track)
+
+/**
+ Service API to start page tracking
+
+ @param[in] opaque_thd Current thread context.
+ @param[in] se_type SE for which to enable tracking
+ @param[out] start_id SE specific sequence number [LSN for InnoDB]
+ indicating when the tracking was started
+
+ @return Operation status.
+ @retval 0 Success
+ @retval other ER_* mysql error. Get error details from THD.
+*/
+
+DECLARE_METHOD(int, start,
+ (MYSQL_THD opaque_thd, Page_Track_SE se_type,
+ uint64_t *start_id));
+
+/**
+ Service API to stop page tracking
+
+ @param[in] opaque_thd Current thread context.
+ @param[in] se_type SE for which to enable tracking
+ @param[out] stop_id SE specific sequence number [LSN for InnoDB]
+ indicating when the tracking was stopped
+
+ @return Operation status.
+ @retval 0 Success
+ @retval other ER_* mysql error. Get error details from THD.
+*/
+
+DECLARE_METHOD(int, stop,
+ (MYSQL_THD opaque_thd, Page_Track_SE se_type,
+ uint64_t *stop_id));
+
+/**
+ Service API to purge page tracking data.
+
+ @param[in] opaque_thd Current thread context.
+ @param[in] se_type SE for which to enable tracking
+ @param[in,out] purge_id SE specific sequence number [LSN for InnoDB]
+ initially indicating till where the data needs to be purged and finally
+ updated to until where it was actually purged
+
+ @return Operation status.
+ @retval 0 Success
+ @retval other ER_* mysql error. Get error details from THD.
+*/
+DECLARE_METHOD(int, purge,
+ (MYSQL_THD opaque_thd, Page_Track_SE se_type,
+ uint64_t *purge_id));
+
+/**
+ Service API to get tracked pages
+
+ @param[in] opaque_thd Current thread context.
+ @param[in] se_type SE for which to enable tracking
+ @param[in,out] start_id SE specific sequence number [LSN for InnoDB] from
+ where the pages tracked would be returned.
+ @note The range might get expanded and the actual start_id used for the
+ querying will be updated.
+ @param[in,out] stop_id SE specific sequence number [LSN for InnoDB]
+ until where the pages tracked would be returned.
+ @note The range might get expanded and the actual stop_id used for the
+ querying will be updated.
+ @param[out] buffer allocated buffer to copy page IDs
+ @param[in] buffer_len length of buffer in bytes
+ @param[in] cbk_func callback function return page IDs
+ @param[in] cbk_ctx caller's context for callback
+
+ @return Operation status.
+ @retval 0 Success
+ @retval other ER_* mysql error. Get error details from THD.
+*/
+
+DECLARE_METHOD(int, get_page_ids,
+ (MYSQL_THD opaque_thd, Page_Track_SE se_type, uint64_t *start_id,
+ uint64_t *stop_id, unsigned char *buffer, size_t buffer_len,
+ Page_Track_Callback cbk_func, void *cbk_ctx));
+
+/**
+ Service API to get approximate number of pages tracked in the given range.
+
+ @param[in] opaque_thd Current thread context.
+ @param[in] se_type SE for which to enable tracking
+ @param[in,out] start_id SE specific sequence number [LSN for InnoDB] from
+ where the pages tracked would be returned.
+ @note the range might get expanded and the actual start_id used for the
+ querying will be updated.
+ @param[in,out] stop_id SE specific sequence number [LSN for InnoDB]
+ until where the pages tracked would be returned.
+ @note the range might get expanded and the actual stop_id used for the
+ querying will be updated.
+ @param[out] num_pages number of pages tracked
+
+ @return Operation status.
+ @retval 0 Success
+ @retval other ER_* mysql error. Get error details from THD.
+*/
+DECLARE_METHOD(int, get_num_page_ids,
+ (MYSQL_THD opaque_thd, Page_Track_SE se_type, uint64_t *start_id,
+ uint64_t *stop_id, uint64_t *num_pages));
+
+/**
+ API to check if the page tracking is active or not and to return start id if
+ it's active.
+
+ @param[in] opaque_thd Current thread context.
+ @param[in] se_type SE for which to enable tracking
+ @param[out] initial_start_id SE specific sequence number [LSN for
+ InnoDB] which denotes the start id at which page tracking was started if it's
+ active
+ @param[out] last_start_id SE specific sequence number [LSN for
+ InnoDB] which denotes the start id the last time the start request was issued
+ @return if page tracking is active or not
+ @retval true if page tracking is active
+ @retval false if page tracking is not active
+*/
+DECLARE_METHOD(int, get_status,
+ (MYSQL_THD opaque_thd, Page_Track_SE se_type,
+ uint64_t *initial_start_id, uint64_t *last_start_id));
+
+END_SERVICE_DEFINITION(mysql_page_track)
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/psi_cond_bits.h b/contrib/libs/libmysql_r/include/mysql/components/services/psi_cond_bits.h
new file mode 100644
index 0000000000..68082c2f03
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/psi_cond_bits.h
@@ -0,0 +1,197 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef COMPONENTS_SERVICES_PSI_COND_BITS_H
+#define COMPONENTS_SERVICES_PSI_COND_BITS_H
+
+/**
+ @file
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_cond Cond Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+/**
+ Instrumented cond key.
+ To instrument a condition, a condition key must be obtained
+ using @c register_cond.
+ Using a zero key always disable the instrumentation.
+*/
+typedef unsigned int PSI_cond_key;
+
+/**
+ @def PSI_COND_VERSION_1
+ Performance Schema Cond Interface number for version 1.
+ This version is supported.
+*/
+#define PSI_COND_VERSION_1 1
+
+/**
+ @def PSI_CURRENT_COND_VERSION
+ Performance Schema Cond Interface number for the most recent version.
+ The most current version is @c PSI_COND_VERSION_1
+*/
+#define PSI_CURRENT_COND_VERSION 1
+
+/**
+ Interface for an instrumented condition.
+ This is an opaque structure.
+*/
+struct PSI_cond;
+typedef struct PSI_cond PSI_cond;
+
+/**
+ Interface for an instrumented condition operation.
+ This is an opaque structure.
+*/
+struct PSI_cond_locker;
+typedef struct PSI_cond_locker PSI_cond_locker;
+
+/** Operation performed on an instrumented condition. */
+enum PSI_cond_operation {
+ /** Wait. */
+ PSI_COND_WAIT = 0,
+ /** Wait, with timeout. */
+ PSI_COND_TIMEDWAIT = 1
+};
+typedef enum PSI_cond_operation PSI_cond_operation;
+
+/**
+ Condition information.
+ @since PSI_COND_VERSION_1
+ This structure is used to register an instrumented cond.
+*/
+struct PSI_cond_info_v1 {
+ /**
+ Pointer to the key assigned to the registered cond.
+ */
+ PSI_cond_key *m_key;
+ /**
+ The name of the cond to register.
+ */
+ const char *m_name;
+ /**
+ The flags of the cond to register.
+ @sa PSI_FLAG_SINGLETON
+ */
+ unsigned int m_flags;
+ /** Volatility index. */
+ int m_volatility;
+ /** Documentation. */
+ const char *m_documentation;
+};
+typedef struct PSI_cond_info_v1 PSI_cond_info_v1;
+
+/**
+ State data storage for @c start_cond_wait_v1_t.
+ This structure provide temporary storage to a condition locker.
+ The content of this structure is considered opaque,
+ the fields are only hints of what an implementation
+ of the psi interface can use.
+ This memory is provided by the instrumented code for performance reasons.
+ @sa start_cond_wait_v1_t
+*/
+struct PSI_cond_locker_state_v1 {
+ /** Internal state. */
+ unsigned int m_flags;
+ /** Current operation. */
+ enum PSI_cond_operation m_operation;
+ /** Current condition. */
+ struct PSI_cond *m_cond;
+ /** Current mutex. */
+ struct PSI_mutex *m_mutex;
+ /** Current thread. */
+ struct PSI_thread *m_thread;
+ /** Timer start. */
+ unsigned long long m_timer_start;
+ /** Timer function. */
+ unsigned long long (*m_timer)(void);
+ /** Internal data. */
+ void *m_wait;
+};
+typedef struct PSI_cond_locker_state_v1 PSI_cond_locker_state_v1;
+
+/**
+ Cond registration API.
+ @param category a category name (typically a plugin name)
+ @param info an array of cond info to register
+ @param count the size of the info array
+*/
+typedef void (*register_cond_v1_t)(const char *category,
+ struct PSI_cond_info_v1 *info, int count);
+
+/**
+ Cond instrumentation initialisation API.
+ @param key the registered key
+ @param identity the address of the cond itself
+ @return an instrumented cond
+*/
+typedef struct PSI_cond *(*init_cond_v1_t)(PSI_cond_key key,
+ const void *identity);
+
+/**
+ Cond instrumentation destruction API.
+ @param cond the rcond to destroy
+*/
+typedef void (*destroy_cond_v1_t)(struct PSI_cond *cond);
+
+/**
+ Record a condition instrumentation signal event.
+ @param cond the cond instrumentation
+*/
+typedef void (*signal_cond_v1_t)(struct PSI_cond *cond);
+
+/**
+ Record a condition instrumentation broadcast event.
+ @param cond the cond instrumentation
+*/
+typedef void (*broadcast_cond_v1_t)(struct PSI_cond *cond);
+
+/**
+ Record a condition instrumentation wait start event.
+ @param state data storage for the locker
+ @param cond the instrumented cond to lock
+ @param op the operation to perform
+ @param src_file the source file name
+ @param src_line the source line number
+ @return a cond locker, or NULL
+*/
+typedef struct PSI_cond_locker *(*start_cond_wait_v1_t)(
+ struct PSI_cond_locker_state_v1 *state, struct PSI_cond *cond,
+ struct PSI_mutex *mutex, enum PSI_cond_operation op, const char *src_file,
+ unsigned int src_line);
+
+/**
+ Record a condition instrumentation wait end event.
+ @param locker a thread locker for the running thread
+ @param rc the wait operation return code
+*/
+typedef void (*end_cond_wait_v1_t)(struct PSI_cond_locker *locker, int rc);
+
+typedef struct PSI_cond_info_v1 PSI_cond_info;
+typedef struct PSI_cond_locker_state_v1 PSI_cond_locker_state;
+
+/** @} (end of group psi_abi_cond) */
+
+#endif /* COMPONENTS_SERVICES_PSI_COND_BITS_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/psi_error_bits.h b/contrib/libs/libmysql_r/include/mysql/components/services/psi_error_bits.h
new file mode 100644
index 0000000000..89d7e18a8a
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/psi_error_bits.h
@@ -0,0 +1,51 @@
+/* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef COMPONENTS_SERVICES_PSI_ERROR_BITS_H
+#define COMPONENTS_SERVICES_PSI_ERROR_BITS_H
+
+/**
+ @file
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_error Error Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+enum PSI_error_operation {
+ PSI_ERROR_OPERATION_RAISED = 0,
+ PSI_ERROR_OPERATION_HANDLED
+};
+typedef enum PSI_error_operation PSI_error_operation;
+
+/**
+ Log the error seen in Performance Schema buffers.
+ @param error_num MySQL error number
+ @param error_operation operation on error (PSI_ERROR_OPERATION_*)
+*/
+typedef void (*log_error_v1_t)(unsigned int error_num,
+ PSI_error_operation error_operation);
+
+/** @} (end of group psi_abi_error) */
+
+#endif /* COMPONENTS_SERVICES_PSI_ERROR_BITS_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/psi_file_bits.h b/contrib/libs/libmysql_r/include/mysql/components/services/psi_file_bits.h
new file mode 100644
index 0000000000..da89b9bb6e
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/psi_file_bits.h
@@ -0,0 +1,318 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef COMPONENTS_SERVICES_PSI_FILE_BITS_H
+#define COMPONENTS_SERVICES_PSI_FILE_BITS_H
+
+#ifndef MYSQL_ABI_CHECK
+#include <stddef.h> /* size_t */
+#endif
+
+#include <mysql/components/services/my_io_bits.h> /* File */
+
+/**
+ @file
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_file File Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+/**
+ Instrumented file key.
+ To instrument a file, a file key must be obtained using @c register_file.
+ Using a zero key always disable the instrumentation.
+*/
+typedef unsigned int PSI_file_key;
+
+/**
+ Interface for an instrumented file handle.
+ This is an opaque structure.
+*/
+struct PSI_file;
+typedef struct PSI_file PSI_file;
+
+/**
+ Interface for an instrumented file operation.
+ This is an opaque structure.
+*/
+struct PSI_file_locker;
+typedef struct PSI_file_locker PSI_file_locker;
+
+/** Operation performed on an instrumented file. */
+enum PSI_file_operation {
+ /** File creation, as in @c create(). */
+ PSI_FILE_CREATE = 0,
+ /** Temporary file creation, as in @c create_temp_file(). */
+ PSI_FILE_CREATE_TMP = 1,
+ /** File open, as in @c open(). */
+ PSI_FILE_OPEN = 2,
+ /** File open, as in @c fopen(). */
+ PSI_FILE_STREAM_OPEN = 3,
+ /** File close, as in @c close(). */
+ PSI_FILE_CLOSE = 4,
+ /** File close, as in @c fclose(). */
+ PSI_FILE_STREAM_CLOSE = 5,
+ /**
+ Generic file read, such as @c fgets(), @c fgetc(), @c fread(), @c read(),
+ @c pread().
+ */
+ PSI_FILE_READ = 6,
+ /**
+ Generic file write, such as @c fputs(), @c fputc(), @c fprintf(),
+ @c vfprintf(), @c fwrite(), @c write(), @c pwrite().
+ */
+ PSI_FILE_WRITE = 7,
+ /** Generic file seek, such as @c fseek() or @c seek(). */
+ PSI_FILE_SEEK = 8,
+ /** Generic file tell, such as @c ftell() or @c tell(). */
+ PSI_FILE_TELL = 9,
+ /** File flush, as in @c fflush(). */
+ PSI_FILE_FLUSH = 10,
+ /** File stat, as in @c stat(). */
+ PSI_FILE_STAT = 11,
+ /** File stat, as in @c fstat(). */
+ PSI_FILE_FSTAT = 12,
+ /** File chsize, as in @c my_chsize(). */
+ PSI_FILE_CHSIZE = 13,
+ /** File delete, such as @c my_delete() or @c my_delete_with_symlink(). */
+ PSI_FILE_DELETE = 14,
+ /** File rename, such as @c my_rename() or @c my_rename_with_symlink(). */
+ PSI_FILE_RENAME = 15,
+ /** File sync, as in @c fsync() or @c my_sync(). */
+ PSI_FILE_SYNC = 16
+};
+typedef enum PSI_file_operation PSI_file_operation;
+
+/**
+ File instrument information.
+ @since PSI_FILE_VERSION_1
+ This structure is used to register an instrumented file.
+*/
+struct PSI_file_info_v1 {
+ /**
+ Pointer to the key assigned to the registered file.
+ */
+ PSI_file_key *m_key;
+ /**
+ The name of the file instrument to register.
+ */
+ const char *m_name;
+ /**
+ The flags of the file instrument to register.
+ @sa PSI_FLAG_SINGLETON
+ */
+ unsigned int m_flags;
+ /** Volatility index. */
+ int m_volatility;
+ /** Documentation. */
+ const char *m_documentation;
+};
+typedef struct PSI_file_info_v1 PSI_file_info_v1;
+
+/**
+ State data storage for @c get_thread_file_name_locker_v1_t.
+ This structure provide temporary storage to a file locker.
+ The content of this structure is considered opaque,
+ the fields are only hints of what an implementation
+ of the psi interface can use.
+ This memory is provided by the instrumented code for performance reasons.
+ @sa get_thread_file_name_locker_v1_t
+ @sa get_thread_file_stream_locker_v1_t
+ @sa get_thread_file_descriptor_locker_v1_t
+*/
+struct PSI_file_locker_state_v1 {
+ /** Internal state. */
+ unsigned int m_flags;
+ /** Current operation. */
+ enum PSI_file_operation m_operation;
+ /** Current file. */
+ struct PSI_file *m_file;
+ /** Current file name. */
+ const char *m_name;
+ /** Current file class. */
+ void *m_class;
+ /** Current thread. */
+ struct PSI_thread *m_thread;
+ /** Operation number of bytes. */
+ size_t m_number_of_bytes;
+ /** Timer start. */
+ unsigned long long m_timer_start;
+ /** Timer function. */
+ unsigned long long (*m_timer)(void);
+ /** Internal data. */
+ void *m_wait;
+};
+typedef struct PSI_file_locker_state_v1 PSI_file_locker_state_v1;
+
+/**
+ File registration API.
+ @param category a category name (typically a plugin name)
+ @param info an array of file info to register
+ @param count the size of the info array
+*/
+typedef void (*register_file_v1_t)(const char *category,
+ struct PSI_file_info_v1 *info, int count);
+
+/**
+ Create a file instrumentation for a created file.
+ This method does not create the file itself, but is used to notify the
+ instrumentation interface that a file was just created.
+ @param key the file instrumentation key for this file
+ @param name the file name
+ @param file the file handle
+*/
+typedef void (*create_file_v1_t)(PSI_file_key key, const char *name, File file);
+
+/**
+ Get a file instrumentation locker, for opening or creating a file.
+ @param state data storage for the locker
+ @param key the file instrumentation key
+ @param op the operation to perform
+ @param name the file name
+ @param identity a pointer representative of this file.
+ @return a file locker, or NULL
+*/
+typedef struct PSI_file_locker *(*get_thread_file_name_locker_v1_t)(
+ struct PSI_file_locker_state_v1 *state, PSI_file_key key,
+ enum PSI_file_operation op, const char *name, const void *identity);
+
+/**
+ Get a file stream instrumentation locker.
+ @param state data storage for the locker
+ @param file the file stream to access
+ @param op the operation to perform
+ @return a file locker, or NULL
+*/
+typedef struct PSI_file_locker *(*get_thread_file_stream_locker_v1_t)(
+ struct PSI_file_locker_state_v1 *state, struct PSI_file *file,
+ enum PSI_file_operation op);
+
+/**
+ Get a file instrumentation locker.
+ @param state data storage for the locker
+ @param file the file descriptor to access
+ @param op the operation to perform
+ @return a file locker, or NULL
+*/
+typedef struct PSI_file_locker *(*get_thread_file_descriptor_locker_v1_t)(
+ struct PSI_file_locker_state_v1 *state, File file,
+ enum PSI_file_operation op);
+
+/**
+ Start a file instrumentation open operation.
+ @param locker the file locker
+ @param src_file the source file name
+ @param src_line the source line number
+*/
+typedef void (*start_file_open_wait_v1_t)(struct PSI_file_locker *locker,
+ const char *src_file,
+ unsigned int src_line);
+
+/**
+ End a file instrumentation open operation, for file streams.
+ @param locker the file locker.
+ @param result the opened file (NULL indicates failure, non NULL success).
+ @return an instrumented file handle
+*/
+typedef struct PSI_file *(*end_file_open_wait_v1_t)(
+ struct PSI_file_locker *locker, void *result);
+
+/**
+ End a file instrumentation open operation, for non stream files.
+ @param locker the file locker.
+ @param file the file number assigned by open() or create() for this file.
+*/
+typedef void (*end_file_open_wait_and_bind_to_descriptor_v1_t)(
+ struct PSI_file_locker *locker, File file);
+
+/**
+ End a file instrumentation open operation, for non stream temporary files.
+ @param locker the file locker.
+ @param file the file number assigned by open() or create() for this file.
+ @param filename the file name generated during temporary file creation.
+*/
+typedef void (*end_temp_file_open_wait_and_bind_to_descriptor_v1_t)(
+ struct PSI_file_locker *locker, File file, const char *filename);
+
+/**
+ Record a file instrumentation start event.
+ @param locker a file locker for the running thread
+ @param count the number of bytes requested, or 0 if not applicable
+ @param src_file the source file name
+ @param src_line the source line number
+*/
+typedef void (*start_file_wait_v1_t)(struct PSI_file_locker *locker,
+ size_t count, const char *src_file,
+ unsigned int src_line);
+
+/**
+ Record a file instrumentation end event.
+ Note that for file close operations, the instrumented file handle
+ associated with the file (which was provided to obtain a locker)
+ is invalid after this call.
+ @param locker a file locker for the running thread
+ @param count the number of bytes actually used in the operation,
+ or 0 if not applicable, or -1 if the operation failed
+ @sa get_thread_file_name_locker
+ @sa get_thread_file_stream_locker
+ @sa get_thread_file_descriptor_locker
+*/
+typedef void (*end_file_wait_v1_t)(struct PSI_file_locker *locker,
+ size_t count);
+
+/**
+ Start a file instrumentation close operation.
+ @param locker the file locker
+ @param src_file the source file name
+ @param src_line the source line number
+*/
+typedef void (*start_file_close_wait_v1_t)(struct PSI_file_locker *locker,
+ const char *src_file,
+ unsigned int src_line);
+
+/**
+ End a file instrumentation close operation.
+ @param locker the file locker.
+ @param rc the close operation return code (0 for success).
+*/
+typedef void (*end_file_close_wait_v1_t)(struct PSI_file_locker *locker,
+ int rc);
+
+/**
+ Rename a file instrumentation close operation.
+ @param locker the file locker.
+ @param old_name name of the file to be renamed.
+ @param new_name name of the file after rename.
+ @param rc the rename operation return code (0 for success).
+*/
+typedef void (*end_file_rename_wait_v1_t)(struct PSI_file_locker *locker,
+ const char *old_name,
+ const char *new_name, int rc);
+
+typedef struct PSI_file_info_v1 PSI_file_info;
+typedef struct PSI_file_locker_state_v1 PSI_file_locker_state;
+
+/** @} (end of group psi_abi_file) */
+
+#endif /* COMPONENTS_SERVICES_PSI_FILE_BITS_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/psi_idle_bits.h b/contrib/libs/libmysql_r/include/mysql/components/services/psi_idle_bits.h
new file mode 100644
index 0000000000..bf2074145a
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/psi_idle_bits.h
@@ -0,0 +1,86 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef COMPONENTS_SERVICES_PSI_IDLE_BITS_H
+#define COMPONENTS_SERVICES_PSI_IDLE_BITS_H
+
+/**
+ @file
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_idle Idle Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+/**
+ Interface for an instrumented idle operation.
+ This is an opaque structure.
+*/
+struct PSI_idle_locker;
+typedef struct PSI_idle_locker PSI_idle_locker;
+
+/**
+ State data storage for @c start_idle_wait_v1_t.
+ This structure provide temporary storage to an idle locker.
+ The content of this structure is considered opaque,
+ the fields are only hints of what an implementation
+ of the psi interface can use.
+ This memory is provided by the instrumented code for performance reasons.
+ @sa start_idle_wait_v1_t.
+*/
+struct PSI_idle_locker_state_v1 {
+ /** Internal state. */
+ unsigned int m_flags;
+ /** Current thread. */
+ struct PSI_thread *m_thread;
+ /** Timer start. */
+ unsigned long long m_timer_start;
+ /** Timer function. */
+ unsigned long long (*m_timer)(void);
+ /** Internal data. */
+ void *m_wait;
+};
+typedef struct PSI_idle_locker_state_v1 PSI_idle_locker_state_v1;
+
+/**
+ Record an idle instrumentation wait start event.
+ @param state data storage for the locker
+ @param src_file the source file name
+ @param src_line the source line number
+ @return an idle locker, or NULL
+*/
+typedef struct PSI_idle_locker *(*start_idle_wait_v1_t)(
+ struct PSI_idle_locker_state_v1 *state, const char *src_file,
+ unsigned int src_line);
+
+/**
+ Record an idle instrumentation wait end event.
+ @param locker a thread locker for the running thread
+*/
+typedef void (*end_idle_wait_v1_t)(struct PSI_idle_locker *locker);
+
+typedef struct PSI_idle_locker_state_v1 PSI_idle_locker_state;
+
+/** @} (end of group psi_abi_idle) */
+
+#endif /* COMPONENTS_SERVICES_PSI_IDLE_BITS_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/psi_mdl_bits.h b/contrib/libs/libmysql_r/include/mysql/components/services/psi_mdl_bits.h
new file mode 100644
index 0000000000..01f95ebadf
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/psi_mdl_bits.h
@@ -0,0 +1,106 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef COMPONENTS_SERVICES_PSI_MDL_BITS_H
+#define COMPONENTS_SERVICES_PSI_MDL_BITS_H
+
+/**
+ @file
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_mdl Metadata Lock Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+struct MDL_key;
+
+/** @sa enum_mdl_type. */
+typedef int opaque_mdl_type;
+
+/** @sa enum_mdl_duration. */
+typedef int opaque_mdl_duration;
+
+/** @sa MDL_wait::enum_wait_status. */
+typedef int opaque_mdl_status;
+
+/**
+ Interface for an instrumented metadata lock.
+ This is an opaque structure.
+*/
+struct PSI_metadata_lock;
+typedef struct PSI_metadata_lock PSI_metadata_lock;
+
+/**
+ Interface for an instrumented MDL operation.
+ This is an opaque structure.
+*/
+struct PSI_metadata_locker;
+typedef struct PSI_metadata_locker PSI_metadata_locker;
+
+/**
+ State data storage for @c start_metadata_wait_v1_t.
+ This structure provide temporary storage to a metadata locker.
+ The content of this structure is considered opaque,
+ the fields are only hints of what an implementation
+ of the psi interface can use.
+ This memory is provided by the instrumented code for performance reasons.
+ @sa start_metadata_wait_v1_t
+*/
+struct PSI_metadata_locker_state_v1 {
+ /** Internal state. */
+ unsigned int m_flags;
+ /** Current metadata lock. */
+ struct PSI_metadata_lock *m_metadata_lock;
+ /** Current thread. */
+ struct PSI_thread *m_thread;
+ /** Timer start. */
+ unsigned long long m_timer_start;
+ /** Timer function. */
+ unsigned long long (*m_timer)(void);
+ /** Internal data. */
+ void *m_wait;
+};
+typedef struct PSI_metadata_locker_state_v1 PSI_metadata_locker_state_v1;
+
+typedef PSI_metadata_lock *(*create_metadata_lock_v1_t)(
+ void *identity, const struct MDL_key *key, opaque_mdl_type mdl_type,
+ opaque_mdl_duration mdl_duration, opaque_mdl_status mdl_status,
+ const char *src_file, unsigned int src_line);
+
+typedef void (*set_metadata_lock_status_v1_t)(PSI_metadata_lock *lock,
+ opaque_mdl_status mdl_status);
+
+typedef void (*destroy_metadata_lock_v1_t)(PSI_metadata_lock *lock);
+
+typedef struct PSI_metadata_locker *(*start_metadata_wait_v1_t)(
+ struct PSI_metadata_locker_state_v1 *state, struct PSI_metadata_lock *mdl,
+ const char *src_file, unsigned int src_line);
+
+typedef void (*end_metadata_wait_v1_t)(struct PSI_metadata_locker *locker,
+ int rc);
+
+typedef struct PSI_metadata_locker_state_v1 PSI_metadata_locker_state;
+
+/** @} (end of group psi_abi_mdl) */
+
+#endif /* COMPONENTS_SERVICES_PSI_MDL_BITS_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/psi_memory_bits.h b/contrib/libs/libmysql_r/include/mysql/components/services/psi_memory_bits.h
new file mode 100644
index 0000000000..a7b7f268ed
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/psi_memory_bits.h
@@ -0,0 +1,127 @@
+/* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef COMPONENTS_SERVICES_PSI_MEMORY_BITS_H
+#define COMPONENTS_SERVICES_PSI_MEMORY_BITS_H
+
+#ifndef MYSQL_ABI_CHECK
+#include <stddef.h> /* size_t */
+#endif
+
+/**
+ @file
+ Performance schema instrumentation interface.
+*/
+
+/**
+ @defgroup psi_abi_memory Memory Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+/**
+ Instrumented memory key.
+ To instrument memory, a memory key must be obtained using @c register_memory.
+ Using a zero key always disable the instrumentation.
+*/
+typedef unsigned int PSI_memory_key;
+
+struct PSI_thread;
+
+/**
+ Memory instrument information.
+ @since PSI_MEMORY_VERSION_1
+ This structure is used to register instrumented memory.
+*/
+struct PSI_memory_info_v1 {
+ /** Pointer to the key assigned to the registered memory. */
+ PSI_memory_key *m_key;
+ /** The name of the memory instrument to register. */
+ const char *m_name;
+ /**
+ The flags of the memory instrument to register.
+ @sa PSI_FLAG_ONLY_GLOBAL_STAT
+ */
+ unsigned int m_flags;
+ /** Volatility index. */
+ int m_volatility;
+ /** Documentation. */
+ const char *m_documentation;
+};
+typedef struct PSI_memory_info_v1 PSI_memory_info_v1;
+
+/**
+ Memory registration API.
+ @param category a category name (typically a plugin name)
+ @param info an array of memory info to register
+ @param count the size of the info array
+*/
+typedef void (*register_memory_v1_t)(const char *category,
+ struct PSI_memory_info_v1 *info,
+ int count);
+
+/**
+ Instrument memory allocation.
+ @param key the memory instrument key
+ @param size the size of memory allocated
+ @param[out] owner the memory owner
+ @return the effective memory instrument key
+*/
+typedef PSI_memory_key (*memory_alloc_v1_t)(PSI_memory_key key, size_t size,
+ struct PSI_thread **owner);
+
+/**
+ Instrument memory re allocation.
+ @param key the memory instrument key
+ @param old_size the size of memory previously allocated
+ @param new_size the size of memory re allocated
+ @param[in, out] owner the memory owner
+ @return the effective memory instrument key
+*/
+typedef PSI_memory_key (*memory_realloc_v1_t)(PSI_memory_key key,
+ size_t old_size, size_t new_size,
+ struct PSI_thread **owner);
+
+/**
+ Instrument memory claim.
+ @param key the memory instrument key
+ @param size the size of memory allocated
+ @param[in, out] owner the memory owner
+ @return the effective memory instrument key
+*/
+typedef PSI_memory_key (*memory_claim_v1_t)(PSI_memory_key key, size_t size,
+ struct PSI_thread **owner);
+
+/**
+ Instrument memory free.
+ @param key the memory instrument key
+ @param size the size of memory allocated
+ @param owner the memory owner
+*/
+typedef void (*memory_free_v1_t)(PSI_memory_key key, size_t size,
+ struct PSI_thread *owner);
+
+typedef struct PSI_memory_info_v1 PSI_memory_info;
+
+/** @} (end of group psi_abi_memory) */
+
+#endif /* COMPONENTS_SERVICES_PSI_MEMORY_BITS_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/psi_mutex_bits.h b/contrib/libs/libmysql_r/include/mysql/components/services/psi_mutex_bits.h
new file mode 100644
index 0000000000..7931746508
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/psi_mutex_bits.h
@@ -0,0 +1,196 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef COMPONENTS_SERVICES_PSI_MUTEX_BITS_H
+#define COMPONENTS_SERVICES_PSI_MUTEX_BITS_H
+
+/**
+ @file
+ Instrumentation helpers for mutexes.
+ This header file provides the necessary declarations
+ to use the mutex API with the performance schema instrumentation.
+ In some compilers (SunStudio), 'static inline' functions, when declared
+ but not used, are not optimized away (because they are unused) by default,
+ so that including a static inline function from a header file does
+ create unwanted dependencies, causing unresolved symbols at link time.
+ Other compilers, like gcc, optimize these dependencies by default.
+*/
+
+/**
+ @defgroup psi_abi_mutex Mutex Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+/**
+ Instrumented mutex key.
+ To instrument a mutex, a mutex key must be obtained using @c register_mutex.
+ Using a zero key always disable the instrumentation.
+*/
+typedef unsigned int PSI_mutex_key;
+
+/**
+ @def PSI_MUTEX_VERSION_1
+ Performance Schema Mutex Interface number for version 1.
+ This version is supported.
+*/
+#define PSI_MUTEX_VERSION_1 1
+
+/**
+ @def PSI_CURRENT_MUTEX_VERSION
+ Performance Schema Mutex Interface number for the most recent version.
+ The most current version is @c PSI_MUTEX_VERSION_1
+*/
+#define PSI_CURRENT_MUTEX_VERSION 1
+
+/**
+ Mutex information.
+ @since PSI_MUTEX_VERSION_1
+ This structure is used to register an instrumented mutex.
+*/
+struct PSI_mutex_info_v1 {
+ /**
+ Pointer to the key assigned to the registered mutex.
+ */
+ PSI_mutex_key *m_key;
+ /**
+ The name of the mutex to register.
+ */
+ const char *m_name;
+ /**
+ The flags of the mutex to register.
+ @sa PSI_FLAG_SINGLETON
+ */
+ unsigned int m_flags;
+ /** Volatility index. */
+ int m_volatility;
+ /** Documentation. */
+ const char *m_documentation;
+};
+
+/**
+ Interface for an instrumented mutex.
+ This is an opaque structure.
+*/
+struct PSI_mutex;
+typedef struct PSI_mutex PSI_mutex;
+
+/**
+ Interface for an instrumented mutex operation.
+ This is an opaque structure.
+*/
+struct PSI_mutex_locker;
+typedef struct PSI_mutex_locker PSI_mutex_locker;
+
+/** Operation performed on an instrumented mutex. */
+enum PSI_mutex_operation {
+ /** Lock. */
+ PSI_MUTEX_LOCK = 0,
+ /** Lock attempt. */
+ PSI_MUTEX_TRYLOCK = 1
+};
+typedef enum PSI_mutex_operation PSI_mutex_operation;
+
+/**
+ State data storage for @c start_mutex_wait_v1_t.
+ This structure provide temporary storage to a mutex locker.
+ The content of this structure is considered opaque,
+ the fields are only hints of what an implementation
+ of the psi interface can use.
+ This memory is provided by the instrumented code for performance reasons.
+ @sa start_mutex_wait_v1_t
+*/
+struct PSI_mutex_locker_state_v1 {
+ /** Internal state. */
+ unsigned int m_flags;
+ /** Current operation. */
+ enum PSI_mutex_operation m_operation;
+ /** Current mutex. */
+ struct PSI_mutex *m_mutex;
+ /** Current thread. */
+ struct PSI_thread *m_thread;
+ /** Timer start. */
+ unsigned long long m_timer_start;
+ /** Timer function. */
+ unsigned long long (*m_timer)(void);
+ /** Internal data. */
+ void *m_wait;
+};
+typedef struct PSI_mutex_locker_state_v1 PSI_mutex_locker_state_v1;
+
+/**
+ Mutex registration API.
+ @param category a category name (typically a plugin name)
+ @param info an array of mutex info to register
+ @param count the size of the info array
+*/
+typedef void (*register_mutex_v1_t)(const char *category,
+ struct PSI_mutex_info_v1 *info, int count);
+
+/**
+ Mutex instrumentation initialization API.
+ @param key the registered mutex key
+ @param identity the address of the mutex itself
+ @return an instrumented mutex
+*/
+typedef struct PSI_mutex *(*init_mutex_v1_t)(PSI_mutex_key key,
+ const void *identity);
+
+/**
+ Mutex instrumentation destruction API.
+ @param mutex the mutex to destroy
+*/
+typedef void (*destroy_mutex_v1_t)(struct PSI_mutex *mutex);
+
+/**
+ Record a mutex instrumentation unlock event.
+ @param mutex the mutex instrumentation
+*/
+typedef void (*unlock_mutex_v1_t)(struct PSI_mutex *mutex);
+
+/**
+ Record a mutex instrumentation wait start event.
+ @param state data storage for the locker
+ @param mutex the instrumented mutex to lock
+ @param op the operation to perform
+ @param src_file the source file name
+ @param src_line the source line number
+ @return a mutex locker, or NULL
+*/
+typedef struct PSI_mutex_locker *(*start_mutex_wait_v1_t)(
+ struct PSI_mutex_locker_state_v1 *state, struct PSI_mutex *mutex,
+ enum PSI_mutex_operation op, const char *src_file, unsigned int src_line);
+
+/**
+ Record a mutex instrumentation wait end event.
+ @param locker a thread locker for the running thread
+ @param rc the wait operation return code
+*/
+typedef void (*end_mutex_wait_v1_t)(struct PSI_mutex_locker *locker, int rc);
+
+typedef struct PSI_mutex_info_v1 PSI_mutex_info_v1;
+typedef PSI_mutex_info_v1 PSI_mutex_info;
+typedef struct PSI_mutex_locker_state_v1 PSI_mutex_locker_state;
+
+/** @} (end of group psi_abi_mutex) */
+
+#endif /* COMPONENTS_SERVICES_PSI_MUTEX_BITS_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/psi_rwlock_bits.h b/contrib/libs/libmysql_r/include/mysql/components/services/psi_rwlock_bits.h
new file mode 100644
index 0000000000..31a1a61655
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/psi_rwlock_bits.h
@@ -0,0 +1,295 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef COMPONENTS_SERVICES_PSI_RWLOCK_BITS_H
+#define COMPONENTS_SERVICES_PSI_RWLOCK_BITS_H
+
+/**
+ @file
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_rwlock Rwlock Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+/**
+ Instrumented rwlock key.
+ To instrument a rwlock, a rwlock key must be obtained
+ using @c register_rwlock.
+ Using a zero key always disable the instrumentation.
+*/
+typedef unsigned int PSI_rwlock_key;
+
+/**
+ @def PSI_RWLOCK_VERSION_1
+ Performance Schema Rwlock Interface number for version 1.
+ This version is obsolete.
+*/
+#define PSI_RWLOCK_VERSION_1 1
+
+/**
+ @def PSI_RWLOCK_VERSION_2
+ Performance Schema Rwlock Interface number for version 2.
+ This version is supported.
+*/
+#define PSI_RWLOCK_VERSION_2 2
+
+/**
+ @def PSI_CURRENT_RWLOCK_VERSION
+ Performance Schema Rwlock Interface number for the most recent version.
+ The most current version is @c PSI_RWLOCK_VERSION_2
+*/
+#define PSI_CURRENT_RWLOCK_VERSION 2
+
+/**
+ Interface for an instrumented rwlock.
+ This is an opaque structure.
+*/
+struct PSI_rwlock;
+typedef struct PSI_rwlock PSI_rwlock;
+
+/**
+ Interface for an instrumented rwlock operation.
+ This is an opaque structure.
+*/
+struct PSI_rwlock_locker;
+typedef struct PSI_rwlock_locker PSI_rwlock_locker;
+
+#if 0
+/*
+ Keeping the original version 1 definition in the source,
+ in case we ever need to provide support for version 1.
+*/
+
+/**
+ Operation performed on an instrumented rwlock.
+ For basic READ / WRITE lock,
+ operations are "READ" or "WRITE".
+ For SX-locks, operations are "SHARED", "SHARED-EXCLUSIVE" or "EXCLUSIVE".
+*/
+enum PSI_rwlock_operation {
+ /** Read lock. */
+ PSI_RWLOCK_READLOCK = 0,
+ /** Write lock. */
+ PSI_RWLOCK_WRITELOCK = 1,
+ /** Read lock attempt. */
+ PSI_RWLOCK_TRYREADLOCK = 2,
+ /** Write lock attempt. */
+ PSI_RWLOCK_TRYWRITELOCK = 3,
+
+ /** Shared lock. */
+ PSI_RWLOCK_SHAREDLOCK = 4,
+ /** Shared Exclusive lock. */
+ PSI_RWLOCK_SHAREDEXCLUSIVELOCK = 5,
+ /** Exclusive lock. */
+ PSI_RWLOCK_EXCLUSIVELOCK = 6,
+ /** Shared lock attempt. */
+ PSI_RWLOCK_TRYSHAREDLOCK = 7,
+ /** Shared Exclusive lock attempt. */
+ PSI_RWLOCK_TRYSHAREDEXCLUSIVELOCK = 8,
+ /** Exclusive lock attempt. */
+ PSI_RWLOCK_TRYEXCLUSIVELOCK = 9
+};
+#endif
+
+/**
+ Operation performed on an instrumented rwlock.
+ For basic READ / WRITE lock,
+ operations are "READ" or "WRITE".
+ For SX-locks, operations are "SHARED", "SHARED-EXCLUSIVE" or "EXCLUSIVE".
+*/
+enum PSI_rwlock_operation {
+ /** Read lock. */
+ PSI_RWLOCK_READLOCK = 0,
+ /** Write lock. */
+ PSI_RWLOCK_WRITELOCK = 1,
+ /** Read lock attempt. */
+ PSI_RWLOCK_TRYREADLOCK = 2,
+ /** Write lock attempt. */
+ PSI_RWLOCK_TRYWRITELOCK = 3,
+ /** Unlock (Read or Write). */
+ PSI_RWLOCK_UNLOCK = 4,
+
+ /** Shared lock. */
+ PSI_RWLOCK_SHAREDLOCK = 5,
+ /** Shared Exclusive lock. */
+ PSI_RWLOCK_SHAREDEXCLUSIVELOCK = 6,
+ /** Exclusive lock. */
+ PSI_RWLOCK_EXCLUSIVELOCK = 7,
+ /** Shared lock attempt. */
+ PSI_RWLOCK_TRYSHAREDLOCK = 8,
+ /** Shared Exclusive lock attempt. */
+ PSI_RWLOCK_TRYSHAREDEXCLUSIVELOCK = 9,
+ /** Exclusive lock attempt. */
+ PSI_RWLOCK_TRYEXCLUSIVELOCK = 10,
+ /** Unlock a shared lock. */
+ PSI_RWLOCK_SHAREDUNLOCK = 11,
+ /** Unlock a shared exclusive lock. */
+ PSI_RWLOCK_SHAREDEXCLUSIVEUNLOCK = 12,
+ /** Unlock an exclusive lock. */
+ PSI_RWLOCK_EXCLUSIVEUNLOCK = 13
+};
+typedef enum PSI_rwlock_operation PSI_rwlock_operation;
+
+/**
+ Rwlock information.
+ @since PSI_RWLOCK_VERSION_1
+ This structure is used to register an instrumented rwlock.
+*/
+struct PSI_rwlock_info_v1 {
+ /**
+ Pointer to the key assigned to the registered rwlock.
+ */
+ PSI_rwlock_key *m_key;
+ /**
+ The name of the rwlock to register.
+ */
+ const char *m_name;
+ /**
+ The flags of the rwlock to register.
+ @sa PSI_FLAG_SINGLETON
+ */
+ unsigned int m_flags;
+ /** Volatility index. */
+ int m_volatility;
+ /** Documentation. */
+ const char *m_documentation;
+};
+typedef struct PSI_rwlock_info_v1 PSI_rwlock_info_v1;
+
+/**
+ State data storage for @c start_rwlock_rdwait_v1_t, @c
+ start_rwlock_wrwait_v1_t.
+ This structure provide temporary storage to a rwlock locker.
+ The content of this structure is considered opaque,
+ the fields are only hints of what an implementation
+ of the psi interface can use.
+ This memory is provided by the instrumented code for performance reasons.
+ @sa start_rwlock_rdwait_v1_t
+ @sa start_rwlock_wrwait_v1_t
+*/
+struct PSI_rwlock_locker_state_v1 {
+ /** Internal state. */
+ unsigned int m_flags;
+ /** Current operation. */
+ enum PSI_rwlock_operation m_operation;
+ /** Current rwlock. */
+ struct PSI_rwlock *m_rwlock;
+ /** Current thread. */
+ struct PSI_thread *m_thread;
+ /** Timer start. */
+ unsigned long long m_timer_start;
+ /** Timer function. */
+ unsigned long long (*m_timer)(void);
+ /** Internal data. */
+ void *m_wait;
+};
+typedef struct PSI_rwlock_locker_state_v1 PSI_rwlock_locker_state_v1;
+
+/**
+ Rwlock registration API.
+ @param category a category name (typically a plugin name)
+ @param info an array of rwlock info to register
+ @param count the size of the info array
+*/
+typedef void (*register_rwlock_v1_t)(const char *category,
+ struct PSI_rwlock_info_v1 *info,
+ int count);
+
+/**
+ Rwlock instrumentation initialization API.
+ @param key the registered rwlock key
+ @param identity the address of the rwlock itself
+ @return an instrumented rwlock
+*/
+typedef struct PSI_rwlock *(*init_rwlock_v1_t)(PSI_rwlock_key key,
+ const void *identity);
+
+/**
+ Rwlock instrumentation destruction API.
+ @param rwlock the rwlock to destroy
+*/
+typedef void (*destroy_rwlock_v1_t)(struct PSI_rwlock *rwlock);
+
+/**
+ Record a rwlock instrumentation read wait start event.
+ @param state data storage for the locker
+ @param rwlock the instrumented rwlock to lock
+ @param op the operation to perform
+ @param src_file the source file name
+ @param src_line the source line number
+ @return a rwlock locker, or NULL
+*/
+typedef struct PSI_rwlock_locker *(*start_rwlock_rdwait_v1_t)(
+ struct PSI_rwlock_locker_state_v1 *state, struct PSI_rwlock *rwlock,
+ enum PSI_rwlock_operation op, const char *src_file, unsigned int src_line);
+
+/**
+ Record a rwlock instrumentation read wait end event.
+ @param locker a thread locker for the running thread
+ @param rc the wait operation return code
+*/
+typedef void (*end_rwlock_rdwait_v1_t)(struct PSI_rwlock_locker *locker,
+ int rc);
+
+/**
+ Record a rwlock instrumentation write wait start event.
+ @param state data storage for the locker
+ @param rwlock the instrumented rwlock to lock
+ @param op the operation to perform
+ @param src_file the source file name
+ @param src_line the source line number
+ @return a rwlock locker, or NULL
+*/
+typedef struct PSI_rwlock_locker *(*start_rwlock_wrwait_v1_t)(
+ struct PSI_rwlock_locker_state_v1 *state, struct PSI_rwlock *rwlock,
+ enum PSI_rwlock_operation op, const char *src_file, unsigned int src_line);
+
+/**
+ Record a rwlock instrumentation write wait end event.
+ @param locker a thread locker for the running thread
+ @param rc the wait operation return code
+*/
+typedef void (*end_rwlock_wrwait_v1_t)(struct PSI_rwlock_locker *locker,
+ int rc);
+
+/**
+ Record a rwlock instrumentation unlock event.
+ @param rwlock the rwlock instrumentation
+*/
+typedef void (*unlock_rwlock_v1_t)(struct PSI_rwlock *rwlock);
+
+/**
+ Record a rwlock instrumentation unlock event.
+ @param rwlock the rwlock instrumentation
+ @param op the unlock operation performed
+*/
+typedef void (*unlock_rwlock_v2_t)(struct PSI_rwlock *rwlock,
+ enum PSI_rwlock_operation op);
+
+typedef struct PSI_rwlock_info_v1 PSI_rwlock_info;
+typedef struct PSI_rwlock_locker_state_v1 PSI_rwlock_locker_state;
+
+/** @} (end of group psi_abi_rwlock) */
+
+#endif /* COMPONENTS_SERVICES_PSI_RWLOCK_BITS_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/psi_socket_bits.h b/contrib/libs/libmysql_r/include/mysql/components/services/psi_socket_bits.h
new file mode 100644
index 0000000000..27c9ac220f
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/psi_socket_bits.h
@@ -0,0 +1,268 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef COMPONENTS_SERVICES_PSI_SOCKET_BITS_H
+#define COMPONENTS_SERVICES_PSI_SOCKET_BITS_H
+
+#ifndef MYSQL_ABI_CHECK
+#include <stddef.h> /* size_t */
+#endif
+
+#include <mysql/components/services/my_io_bits.h> /* socklen_t */
+
+/**
+ @file
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_socket Socket Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+/**
+ Instrumented socket key.
+ To instrument a socket, a socket key must be obtained using @c
+ register_socket.
+ Using a zero key always disable the instrumentation.
+*/
+typedef unsigned int PSI_socket_key;
+
+/**
+ @def PSI_SOCKET_VERSION_1
+ Performance Schema Socket Interface number for version 1.
+ This version is supported.
+*/
+#define PSI_SOCKET_VERSION_1 1
+
+/**
+ @def PSI_CURRENT_SOCKET_VERSION
+ Performance Schema Socket Interface number for the most recent version.
+ The most current version is @c PSI_SOCKET_VERSION_1
+*/
+#define PSI_CURRENT_SOCKET_VERSION 1
+
+/**
+ Interface for an instrumented socket descriptor.
+ This is an opaque structure.
+*/
+struct PSI_socket;
+typedef struct PSI_socket PSI_socket;
+
+/**
+ Interface for an instrumented socket operation.
+ This is an opaque structure.
+*/
+struct PSI_socket_locker;
+typedef struct PSI_socket_locker PSI_socket_locker;
+
+/** State of an instrumented socket. */
+enum PSI_socket_state {
+ /** Idle, waiting for the next command. */
+ PSI_SOCKET_STATE_IDLE = 1,
+ /** Active, executing a command. */
+ PSI_SOCKET_STATE_ACTIVE = 2
+};
+typedef enum PSI_socket_state PSI_socket_state;
+
+/** Operation performed on an instrumented socket. */
+enum PSI_socket_operation {
+ /** Socket creation, as in @c socket() or @c socketpair(). */
+ PSI_SOCKET_CREATE = 0,
+ /** Socket connection, as in @c connect(), @c listen() and @c accept(). */
+ PSI_SOCKET_CONNECT = 1,
+ /** Socket bind, as in @c bind(), @c getsockname() and @c getpeername(). */
+ PSI_SOCKET_BIND = 2,
+ /** Socket close, as in @c shutdown(). */
+ PSI_SOCKET_CLOSE = 3,
+ /** Socket send, @c send(). */
+ PSI_SOCKET_SEND = 4,
+ /** Socket receive, @c recv(). */
+ PSI_SOCKET_RECV = 5,
+ /** Socket send, @c sendto(). */
+ PSI_SOCKET_SENDTO = 6,
+ /** Socket receive, @c recvfrom). */
+ PSI_SOCKET_RECVFROM = 7,
+ /** Socket send, @c sendmsg(). */
+ PSI_SOCKET_SENDMSG = 8,
+ /** Socket receive, @c recvmsg(). */
+ PSI_SOCKET_RECVMSG = 9,
+ /** Socket seek, such as @c fseek() or @c seek(). */
+ PSI_SOCKET_SEEK = 10,
+ /** Socket options, as in @c getsockopt() and @c setsockopt(). */
+ PSI_SOCKET_OPT = 11,
+ /** Socket status, as in @c sockatmark() and @c isfdtype(). */
+ PSI_SOCKET_STAT = 12,
+ /** Socket shutdown, as in @c shutdown(). */
+ PSI_SOCKET_SHUTDOWN = 13,
+ /** Socket select, as in @c select() and @c poll(). */
+ PSI_SOCKET_SELECT = 14
+};
+typedef enum PSI_socket_operation PSI_socket_operation;
+
+/**
+ Socket instrument information.
+ @since PSI_SOCKET_VERSION_1
+ This structure is used to register an instrumented socket.
+*/
+struct PSI_socket_info_v1 {
+ /**
+ Pointer to the key assigned to the registered socket.
+ */
+ PSI_socket_key *m_key;
+ /**
+ The name of the socket instrument to register.
+ */
+ const char *m_name;
+ /**
+ The flags of the socket instrument to register.
+ @sa PSI_FLAG_SINGLETON
+ */
+ unsigned int m_flags;
+ /** Volatility index. */
+ int m_volatility;
+ /** Documentation. */
+ const char *m_documentation;
+};
+typedef struct PSI_socket_info_v1 PSI_socket_info_v1;
+
+/**
+ State data storage for @c start_socket_wait_v1_t.
+ This structure provide temporary storage to a socket locker.
+ The content of this structure is considered opaque,
+ the fields are only hints of what an implementation
+ of the psi interface can use.
+ This memory is provided by the instrumented code for performance reasons.
+ @sa start_socket_wait_v1_t
+*/
+struct PSI_socket_locker_state_v1 {
+ /** Internal state. */
+ unsigned int m_flags;
+ /** Current socket. */
+ struct PSI_socket *m_socket;
+ /** Current thread. */
+ struct PSI_thread *m_thread;
+ /** Operation number of bytes. */
+ size_t m_number_of_bytes;
+ /** Timer start. */
+ unsigned long long m_timer_start;
+ /** Timer function. */
+ unsigned long long (*m_timer)(void);
+ /** Current operation. */
+ enum PSI_socket_operation m_operation;
+ /** Source file. */
+ const char *m_src_file;
+ /** Source line number. */
+ int m_src_line;
+ /** Internal data. */
+ void *m_wait;
+};
+typedef struct PSI_socket_locker_state_v1 PSI_socket_locker_state_v1;
+
+/**
+ Socket registration API.
+ @param category a category name (typically a plugin name)
+ @param info an array of socket info to register
+ @param count the size of the info array
+*/
+typedef void (*register_socket_v1_t)(const char *category,
+ struct PSI_socket_info_v1 *info,
+ int count);
+
+/**
+ Socket instrumentation initialisation API.
+ @param key the registered socket key
+ @param fd socket file descriptor
+ @param addr the socket ip address
+ @param addr_len length of socket ip address
+ @return an instrumented socket
+*/
+typedef struct PSI_socket *(*init_socket_v1_t)(PSI_socket_key key,
+ const my_socket *fd,
+ const struct sockaddr *addr,
+ socklen_t addr_len);
+
+/**
+ socket instrumentation destruction API.
+ @param socket the socket to destroy
+*/
+typedef void (*destroy_socket_v1_t)(struct PSI_socket *socket);
+
+/**
+ Record a socket instrumentation start event.
+ @param state data storage for the locker
+ @param socket the instrumented socket
+ @param op socket operation to be performed
+ @param count the number of bytes requested, or 0 if not applicable
+ @param src_file the source file name
+ @param src_line the source line number
+ @return a socket locker, or NULL
+*/
+typedef struct PSI_socket_locker *(*start_socket_wait_v1_t)(
+ struct PSI_socket_locker_state_v1 *state, struct PSI_socket *socket,
+ enum PSI_socket_operation op, size_t count, const char *src_file,
+ unsigned int src_line);
+
+/**
+ Record a socket instrumentation end event.
+ Note that for socket close operations, the instrumented socket handle
+ associated with the socket (which was provided to obtain a locker)
+ is invalid after this call.
+ @param locker a socket locker for the running thread
+ @param count the number of bytes actually used in the operation,
+ or 0 if not applicable, or -1 if the operation failed
+ @sa get_thread_socket_locker
+*/
+typedef void (*end_socket_wait_v1_t)(struct PSI_socket_locker *locker,
+ size_t count);
+
+/**
+ Set the socket state for an instrumented socket.
+ @param socket the instrumented socket
+ @param state socket state
+*/
+typedef void (*set_socket_state_v1_t)(struct PSI_socket *socket,
+ enum PSI_socket_state state);
+
+/**
+ Set the socket info for an instrumented socket.
+ @param socket the instrumented socket
+ @param fd the socket descriptor
+ @param addr the socket ip address
+ @param addr_len length of socket ip address
+*/
+typedef void (*set_socket_info_v1_t)(struct PSI_socket *socket,
+ const my_socket *fd,
+ const struct sockaddr *addr,
+ socklen_t addr_len);
+
+/**
+ Bind a socket to the thread that owns it.
+ @param socket instrumented socket
+*/
+typedef void (*set_socket_thread_owner_v1_t)(struct PSI_socket *socket);
+
+typedef struct PSI_socket_info_v1 PSI_socket_info;
+typedef struct PSI_socket_locker_state_v1 PSI_socket_locker_state;
+
+/** @} (end of group psi_abi_socket) */
+
+#endif /* COMPONENTS_SERVICES_PSI_SOCKET_BITS_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/psi_stage_bits.h b/contrib/libs/libmysql_r/include/mysql/components/services/psi_stage_bits.h
new file mode 100644
index 0000000000..5f1768e429
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/psi_stage_bits.h
@@ -0,0 +1,120 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef COMPONENTS_SERVICES_PSI_STAGE_BITS_H
+#define COMPONENTS_SERVICES_PSI_STAGE_BITS_H
+
+/**
+ @file
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_stage Stage Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+/**
+ Instrumented stage key.
+ To instrument a stage, a stage key must be obtained using @c register_stage.
+ Using a zero key always disable the instrumentation.
+*/
+typedef unsigned int PSI_stage_key;
+
+/**
+ @def PSI_STAGE_VERSION_1
+ Performance Schema Stage Interface number for version 1.
+ This version is supported.
+*/
+#define PSI_STAGE_VERSION_1 1
+
+/**
+ @def PSI_CURRENT_STAGE_VERSION
+ Performance Schema Stage Interface number for the most recent version.
+ The most current version is @c PSI_STAGE_VERSION_1
+*/
+#define PSI_CURRENT_STAGE_VERSION 1
+
+/**
+ Interface for an instrumented stage progress.
+ This is a public structure, for efficiency.
+*/
+struct PSI_stage_progress_v1 {
+ unsigned long long m_work_completed;
+ unsigned long long m_work_estimated;
+};
+typedef struct PSI_stage_progress_v1 PSI_stage_progress_v1;
+
+/**
+ Stage instrument information.
+ @since PSI_STAGE_VERSION_1
+ This structure is used to register an instrumented stage.
+*/
+struct PSI_stage_info_v1 {
+ /** The registered stage key. */
+ PSI_stage_key m_key{0};
+ /** The name of the stage instrument to register. */
+ const char *m_name{nullptr};
+ /**
+ The flags of the stage instrument to register.
+ @sa PSI_FLAG_PROGRESS
+ */
+ unsigned int m_flags{0};
+ /** Documentation. */
+ const char *m_documentation{nullptr};
+};
+typedef struct PSI_stage_info_v1 PSI_stage_info_v1;
+
+/**
+ Stage registration API.
+ @param category a category name
+ @param info an array of stage info to register
+ @param count the size of the info array
+*/
+typedef void (*register_stage_v1_t)(const char *category,
+ struct PSI_stage_info_v1 **info, int count);
+
+/**
+ Start a new stage, and implicitly end the previous stage.
+ @param key the key of the new stage
+ @param src_file the source file name
+ @param src_line the source line number
+ @return the new stage progress
+*/
+typedef PSI_stage_progress_v1 *(*start_stage_v1_t)(PSI_stage_key key,
+ const char *src_file,
+ int src_line);
+
+/**
+ Get the current stage progress.
+ @return the stage progress
+*/
+typedef PSI_stage_progress_v1 *(*get_current_stage_progress_v1_t)(void);
+
+/** End the current stage. */
+typedef void (*end_stage_v1_t)(void);
+
+typedef struct PSI_stage_info_v1 PSI_stage_info;
+typedef struct PSI_stage_progress_v1 PSI_stage_progress;
+
+/** @} (end of group psi_abi_stage) */
+
+#endif /* COMPONENTS_SERVICES_PSI_STAGE_BITS_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/psi_statement_bits.h b/contrib/libs/libmysql_r/include/mysql/components/services/psi_statement_bits.h
new file mode 100644
index 0000000000..d3f53e6fe6
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/psi_statement_bits.h
@@ -0,0 +1,508 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef COMPONENTS_SERVICES_PSI_STATEMENT_BITS_H
+#define COMPONENTS_SERVICES_PSI_STATEMENT_BITS_H
+
+#ifndef MYSQL_ABI_CHECK
+#include <stddef.h> /* size_t */
+#endif
+
+/**
+ @file
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_statement Statement Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+/**
+ Instrumented statement key.
+ To instrument a statement, a statement key must be obtained using @c
+ register_statement.
+ Using a zero key always disable the instrumentation.
+*/
+typedef unsigned int PSI_statement_key;
+
+/**
+ @def PSI_STATEMENT_VERSION_1
+ Performance Schema Statement Interface number for version 1.
+ This version is deprecated.
+*/
+#define PSI_STATEMENT_VERSION_1 1
+
+/**
+ @def PSI_STATEMENT_VERSION_2
+ Performance Schema Statement Interface number for version 2.
+ This version is supported.
+*/
+#define PSI_STATEMENT_VERSION_2 2
+
+/**
+ @def PSI_CURRENT_STATEMENT_VERSION
+ Performance Schema Statement Interface number for the most recent version.
+ The most current version is @c PSI_STATEMENT_VERSION_2
+*/
+#define PSI_CURRENT_STATEMENT_VERSION 2
+
+/**
+ Interface for an instrumented statement.
+ This is an opaque structure.
+*/
+struct PSI_statement_locker;
+typedef struct PSI_statement_locker PSI_statement_locker;
+
+/**
+ Interface for an instrumented prepared statement.
+ This is an opaque structure.
+*/
+struct PSI_prepared_stmt;
+typedef struct PSI_prepared_stmt PSI_prepared_stmt;
+
+/**
+ Interface for an instrumented statement digest operation.
+ This is an opaque structure.
+*/
+struct PSI_digest_locker;
+typedef struct PSI_digest_locker PSI_digest_locker;
+
+/**
+ Interface for an instrumented stored procedure share.
+ This is an opaque structure.
+*/
+struct PSI_sp_share;
+typedef struct PSI_sp_share PSI_sp_share;
+
+/**
+ Interface for an instrumented stored program.
+ This is an opaque structure.
+*/
+struct PSI_sp_locker;
+typedef struct PSI_sp_locker PSI_sp_locker;
+
+/**
+ Statement instrument information.
+ @since PSI_STATEMENT_VERSION_1
+ This structure is used to register an instrumented statement.
+*/
+struct PSI_statement_info_v1 {
+ /** The registered statement key. */
+ PSI_statement_key m_key;
+ /** The name of the statement instrument to register. */
+ const char *m_name;
+ /**
+ The flags of the statement instrument to register.
+ @sa PSI_FLAG_MUTABLE
+ */
+ unsigned int m_flags;
+ /** Documentation. */
+ const char *m_documentation;
+};
+typedef struct PSI_statement_info_v1 PSI_statement_info_v1;
+
+/* Duplicate of NAME_LEN, to avoid dependency on mysql_com.h */
+#define PSI_SCHEMA_NAME_LEN (64 * 3)
+
+/**
+ State data storage for @c get_thread_statement_locker_v1_t,
+ @c get_thread_statement_locker_v1_t.
+ This structure provide temporary storage to a statement locker.
+ The content of this structure is considered opaque,
+ the fields are only hints of what an implementation
+ of the psi interface can use.
+ This memory is provided by the instrumented code for performance reasons.
+ @sa get_thread_statement_locker_v1_t
+*/
+struct PSI_statement_locker_state_v1 {
+ /** Discarded flag. */
+ bool m_discarded;
+ /** In prepare flag. */
+ bool m_in_prepare;
+ /** Metric, no index used flag. */
+ unsigned char m_no_index_used;
+ /** Metric, no good index used flag. */
+ unsigned char m_no_good_index_used;
+ /** Internal state. */
+ unsigned int m_flags;
+ /** Instrumentation class. */
+ void *m_class;
+ /** Current thread. */
+ struct PSI_thread *m_thread;
+ /** Timer start. */
+ unsigned long long m_timer_start;
+ /** Timer function. */
+ unsigned long long (*m_timer)(void);
+ /** Internal data. */
+ void *m_statement;
+ /** Locked time. */
+ unsigned long long m_lock_time;
+ /** Rows sent. */
+ unsigned long long m_rows_sent;
+ /** Rows examined. */
+ unsigned long long m_rows_examined;
+ /** Metric, temporary tables created on disk. */
+ unsigned long m_created_tmp_disk_tables;
+ /** Metric, temporary tables created. */
+ unsigned long m_created_tmp_tables;
+ /** Metric, number of select full join. */
+ unsigned long m_select_full_join;
+ /** Metric, number of select full range join. */
+ unsigned long m_select_full_range_join;
+ /** Metric, number of select range. */
+ unsigned long m_select_range;
+ /** Metric, number of select range check. */
+ unsigned long m_select_range_check;
+ /** Metric, number of select scan. */
+ unsigned long m_select_scan;
+ /** Metric, number of sort merge passes. */
+ unsigned long m_sort_merge_passes;
+ /** Metric, number of sort merge. */
+ unsigned long m_sort_range;
+ /** Metric, number of sort rows. */
+ unsigned long m_sort_rows;
+ /** Metric, number of sort scans. */
+ unsigned long m_sort_scan;
+ /** Statement digest. */
+ const struct sql_digest_storage *m_digest;
+ /** Current schema name. */
+ char m_schema_name[PSI_SCHEMA_NAME_LEN];
+ /** Length in bytes of @c m_schema_name. */
+ unsigned int m_schema_name_length;
+ /** Statement character set number. */
+ unsigned int m_cs_number;
+ /** Statement query sample. */
+ const char *m_query_sample;
+ /** Length in bytes of @c m_query_sample. */
+ unsigned int m_query_sample_length;
+ /** True if @c m_query_sample was truncated. */
+ bool m_query_sample_truncated;
+
+ PSI_sp_share *m_parent_sp_share;
+ PSI_prepared_stmt *m_parent_prepared_stmt;
+};
+typedef struct PSI_statement_locker_state_v1 PSI_statement_locker_state_v1;
+
+struct PSI_sp_locker_state_v1 {
+ /** Internal state. */
+ unsigned int m_flags;
+ /** Current thread. */
+ struct PSI_thread *m_thread;
+ /** Timer start. */
+ unsigned long long m_timer_start;
+ /** Timer function. */
+ unsigned long long (*m_timer)(void);
+ /** Stored Procedure share. */
+ PSI_sp_share *m_sp_share;
+};
+typedef struct PSI_sp_locker_state_v1 PSI_sp_locker_state_v1;
+
+/**
+ Statement registration API.
+ @param category a category name
+ @param info an array of statement info to register
+ @param count the size of the info array
+*/
+typedef void (*register_statement_v1_t)(const char *category,
+ struct PSI_statement_info_v1 *info,
+ int count);
+
+/**
+ Get a statement instrumentation locker.
+ @param state data storage for the locker
+ @param key the statement instrumentation key
+ @param charset client character set
+ @return a statement locker, or NULL
+*/
+typedef struct PSI_statement_locker *(*get_thread_statement_locker_v1_t)(
+ struct PSI_statement_locker_state_v1 *state, PSI_statement_key key,
+ const void *charset, PSI_sp_share *sp_share);
+
+/**
+ Refine a statement locker to a more specific key.
+ Note that only events declared mutable can be refined.
+ @param locker the statement locker for the current event
+ @param key the new key for the event
+ @sa PSI_FLAG_MUTABLE
+*/
+typedef struct PSI_statement_locker *(*refine_statement_v1_t)(
+ struct PSI_statement_locker *locker, PSI_statement_key key);
+
+/**
+ Start a new statement event.
+ @param locker the statement locker for this event
+ @param db the active database name for this statement
+ @param db_length the active database name length for this statement
+ @param src_file source file name
+ @param src_line source line number
+*/
+typedef void (*start_statement_v1_t)(struct PSI_statement_locker *locker,
+ const char *db, unsigned int db_length,
+ const char *src_file,
+ unsigned int src_line);
+
+/**
+ Set the statement text for a statement event.
+ Note that the statement text pointer must remain valid until end statement
+ is called.
+ @param locker the current statement locker
+ @param text the statement text
+ @param text_len the statement text length
+*/
+typedef void (*set_statement_text_v1_t)(struct PSI_statement_locker *locker,
+ const char *text,
+ unsigned int text_len);
+
+/**
+ Set a statement query id.
+ Introduced in MySQL 8.0.14
+ @param locker the statement locker
+ @param query_id the query id
+*/
+typedef void (*set_statement_query_id_t)(struct PSI_statement_locker *locker,
+ unsigned long long query_id);
+
+/**
+ Set a statement event lock time.
+ @param locker the statement locker
+ @param lock_time the locked time, in microseconds
+*/
+typedef void (*set_statement_lock_time_t)(struct PSI_statement_locker *locker,
+ unsigned long long lock_time);
+
+/**
+ Set a statement event rows sent metric.
+ @param locker the statement locker
+ @param count the number of rows sent
+*/
+typedef void (*set_statement_rows_sent_t)(struct PSI_statement_locker *locker,
+ unsigned long long count);
+
+/**
+ Set a statement event rows examined metric.
+ @param locker the statement locker
+ @param count the number of rows examined
+*/
+typedef void (*set_statement_rows_examined_t)(
+ struct PSI_statement_locker *locker, unsigned long long count);
+
+/**
+ Increment a statement event "created tmp disk tables" metric.
+ @param locker the statement locker
+ @param count the metric increment value
+*/
+typedef void (*inc_statement_created_tmp_disk_tables_t)(
+ struct PSI_statement_locker *locker, unsigned long count);
+
+/**
+ Increment a statement event "created tmp tables" metric.
+ @param locker the statement locker
+ @param count the metric increment value
+*/
+typedef void (*inc_statement_created_tmp_tables_t)(
+ struct PSI_statement_locker *locker, unsigned long count);
+
+/**
+ Increment a statement event "select full join" metric.
+ @param locker the statement locker
+ @param count the metric increment value
+*/
+typedef void (*inc_statement_select_full_join_t)(
+ struct PSI_statement_locker *locker, unsigned long count);
+
+/**
+ Increment a statement event "select full range join" metric.
+ @param locker the statement locker
+ @param count the metric increment value
+*/
+typedef void (*inc_statement_select_full_range_join_t)(
+ struct PSI_statement_locker *locker, unsigned long count);
+
+/**
+ Increment a statement event "select range join" metric.
+ @param locker the statement locker
+ @param count the metric increment value
+*/
+typedef void (*inc_statement_select_range_t)(
+ struct PSI_statement_locker *locker, unsigned long count);
+
+/**
+ Increment a statement event "select range check" metric.
+ @param locker the statement locker
+ @param count the metric increment value
+*/
+typedef void (*inc_statement_select_range_check_t)(
+ struct PSI_statement_locker *locker, unsigned long count);
+
+/**
+ Increment a statement event "select scan" metric.
+ @param locker the statement locker
+ @param count the metric increment value
+*/
+typedef void (*inc_statement_select_scan_t)(struct PSI_statement_locker *locker,
+ unsigned long count);
+
+/**
+ Increment a statement event "sort merge passes" metric.
+ @param locker the statement locker
+ @param count the metric increment value
+*/
+typedef void (*inc_statement_sort_merge_passes_t)(
+ struct PSI_statement_locker *locker, unsigned long count);
+
+/**
+ Increment a statement event "sort range" metric.
+ @param locker the statement locker
+ @param count the metric increment value
+*/
+typedef void (*inc_statement_sort_range_t)(struct PSI_statement_locker *locker,
+ unsigned long count);
+
+/**
+ Increment a statement event "sort rows" metric.
+ @param locker the statement locker
+ @param count the metric increment value
+*/
+typedef void (*inc_statement_sort_rows_t)(struct PSI_statement_locker *locker,
+ unsigned long count);
+
+/**
+ Increment a statement event "sort scan" metric.
+ @param locker the statement locker
+ @param count the metric increment value
+*/
+typedef void (*inc_statement_sort_scan_t)(struct PSI_statement_locker *locker,
+ unsigned long count);
+
+/**
+ Set a statement event "no index used" metric.
+ @param locker the statement locker
+*/
+typedef void (*set_statement_no_index_used_t)(
+ struct PSI_statement_locker *locker);
+
+/**
+ Set a statement event "no good index used" metric.
+ @param locker the statement locker
+*/
+typedef void (*set_statement_no_good_index_used_t)(
+ struct PSI_statement_locker *locker);
+
+/**
+ End a statement event.
+ @param locker the statement locker
+ @param stmt_da the statement diagnostics area.
+ @sa Diagnostics_area
+*/
+typedef void (*end_statement_v1_t)(struct PSI_statement_locker *locker,
+ void *stmt_da);
+
+/**
+ Get a prepare statement.
+ @param locker a statement locker for the running thread.
+*/
+typedef PSI_prepared_stmt *(*create_prepared_stmt_v1_t)(
+ void *identity, unsigned int stmt_id, PSI_statement_locker *locker,
+ const char *stmt_name, size_t stmt_name_length, const char *name,
+ size_t length);
+
+/**
+ destroy a prepare statement.
+ @param prepared_stmt prepared statement.
+*/
+typedef void (*destroy_prepared_stmt_v1_t)(PSI_prepared_stmt *prepared_stmt);
+
+/**
+ repreare a prepare statement.
+ @param prepared_stmt prepared statement.
+*/
+typedef void (*reprepare_prepared_stmt_v1_t)(PSI_prepared_stmt *prepared_stmt);
+
+/**
+ Record a prepare statement instrumentation execute event.
+ @param locker a statement locker for the running thread.
+ @param prepared_stmt prepared statement.
+*/
+typedef void (*execute_prepared_stmt_v1_t)(PSI_statement_locker *locker,
+ PSI_prepared_stmt *prepared_stmt);
+
+/**
+ Set the statement text for a prepared statment event.
+ @param prepared_stmt prepared statement.
+ @param text the prepared statement text
+ @param text_len the prepared statement text length
+*/
+typedef void (*set_prepared_stmt_text_v1_t)(PSI_prepared_stmt *prepared_stmt,
+ const char *text,
+ unsigned int text_len);
+/**
+ Get a digest locker for the current statement.
+ @param locker a statement locker for the running thread
+*/
+typedef struct PSI_digest_locker *(*digest_start_v1_t)(
+ struct PSI_statement_locker *locker);
+
+/**
+ Add a computed digest to the current digest instrumentation.
+ @param locker a digest locker for the current statement
+ @param digest the computed digest
+*/
+typedef void (*digest_end_v1_t)(struct PSI_digest_locker *locker,
+ const struct sql_digest_storage *digest);
+
+/**
+ Acquire a sp share instrumentation.
+ @param object_type type of stored program
+ @param schema_name schema name of stored program
+ @param schema_name_length length of schema_name
+ @param object_name object name of stored program
+ @param object_name_length length of object_name
+ @return a stored program share instrumentation, or NULL
+*/
+typedef struct PSI_sp_share *(*get_sp_share_v1_t)(
+ unsigned int object_type, const char *schema_name,
+ unsigned int schema_name_length, const char *object_name,
+ unsigned int object_name_length);
+
+/**
+ Release a stored program share.
+ @param share the stored program share to release
+*/
+typedef void (*release_sp_share_v1_t)(struct PSI_sp_share *share);
+
+typedef PSI_sp_locker *(*start_sp_v1_t)(struct PSI_sp_locker_state_v1 *state,
+ struct PSI_sp_share *sp_share);
+
+typedef void (*end_sp_v1_t)(struct PSI_sp_locker *locker);
+
+typedef void (*drop_sp_v1_t)(unsigned int object_type, const char *schema_name,
+ unsigned int schema_name_length,
+ const char *object_name,
+ unsigned int object_name_length);
+
+typedef struct PSI_statement_info_v1 PSI_statement_info;
+typedef struct PSI_statement_locker_state_v1 PSI_statement_locker_state;
+typedef struct PSI_sp_locker_state_v1 PSI_sp_locker_state;
+
+/** @} (end of group psi_abi_statement) */
+
+#endif /* COMPONENTS_SERVICES_PSI_STATEMENT_BITS_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/psi_system_bits.h b/contrib/libs/libmysql_r/include/mysql/components/services/psi_system_bits.h
new file mode 100644
index 0000000000..680910e0f2
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/psi_system_bits.h
@@ -0,0 +1,42 @@
+/* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef COMPONENTS_SERVICES_PSI_SYSTEM_BITS_H
+#define COMPONENTS_SERVICES_PSI_SYSTEM_BITS_H
+
+/**
+ @file
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_system System Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+/**
+ System event - plugin unload event
+*/
+typedef void (*unload_plugin_v1_t)(const char *plugin_name);
+
+/** @} (end of group psi_abi_system) */
+
+#endif /* COMPONENTS_SERVICES_PSI_SYSTEM_BITS_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/psi_table_bits.h b/contrib/libs/libmysql_r/include/mysql/components/services/psi_table_bits.h
new file mode 100644
index 0000000000..f9e09fe07d
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/psi_table_bits.h
@@ -0,0 +1,228 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef COMPONENTS_SERVICES_PSI_TABLE_BITS_H
+#define COMPONENTS_SERVICES_PSI_TABLE_BITS_H
+
+/**
+ @file
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_table Table Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+struct TABLE_SHARE;
+
+/**
+ Interface for an instrumented table operation.
+ This is an opaque structure.
+*/
+struct PSI_table_locker;
+typedef struct PSI_table_locker PSI_table_locker;
+
+/** IO operation performed on an instrumented table. */
+enum PSI_table_io_operation {
+ /** Row fetch. */
+ PSI_TABLE_FETCH_ROW = 0,
+ /** Row write. */
+ PSI_TABLE_WRITE_ROW = 1,
+ /** Row update. */
+ PSI_TABLE_UPDATE_ROW = 2,
+ /** Row delete. */
+ PSI_TABLE_DELETE_ROW = 3
+};
+typedef enum PSI_table_io_operation PSI_table_io_operation;
+
+/**
+ State data storage for @c start_table_io_wait_v1_t,
+ @c start_table_lock_wait_v1_t.
+ This structure provide temporary storage to a table locker.
+ The content of this structure is considered opaque,
+ the fields are only hints of what an implementation
+ of the psi interface can use.
+ This memory is provided by the instrumented code for performance reasons.
+ @sa start_table_io_wait_v1_t
+ @sa start_table_lock_wait_v1_t
+*/
+struct PSI_table_locker_state {
+ /** Internal state. */
+ unsigned int m_flags;
+ /** Current io operation. */
+ enum PSI_table_io_operation m_io_operation;
+ /** Current table handle. */
+ struct PSI_table *m_table;
+ /** Current table share. */
+ struct PSI_table_share *m_table_share;
+ /** Current thread. */
+ struct PSI_thread *m_thread;
+ /** Timer start. */
+ unsigned long long m_timer_start;
+ /** Timer function. */
+ unsigned long long (*m_timer)(void);
+ /** Internal data. */
+ void *m_wait;
+ /**
+ Implementation specific.
+ For table io, the table io index.
+ For table lock, the lock type.
+ */
+ unsigned int m_index;
+};
+typedef struct PSI_table_locker_state PSI_table_locker_state;
+
+/**
+ Interface for an instrumented table share.
+ This is an opaque structure.
+*/
+struct PSI_table_share;
+typedef struct PSI_table_share PSI_table_share;
+
+/**
+ Interface for an instrumented table handle.
+ This is an opaque structure.
+*/
+struct PSI_table;
+typedef struct PSI_table PSI_table;
+
+/** Lock operation performed on an instrumented table. */
+enum PSI_table_lock_operation {
+ /** Table lock, in the server layer. */
+ PSI_TABLE_LOCK = 0,
+ /** Table lock, in the storage engine layer. */
+ PSI_TABLE_EXTERNAL_LOCK = 1
+};
+typedef enum PSI_table_lock_operation PSI_table_lock_operation;
+
+/**
+ Acquire a table share instrumentation.
+ @param temporary True for temporary tables
+ @param share The SQL layer table share
+ @return a table share instrumentation, or NULL
+*/
+typedef struct PSI_table_share *(*get_table_share_v1_t)(
+ bool temporary, struct TABLE_SHARE *share);
+
+/**
+ Release a table share.
+ @param share the table share to release
+*/
+typedef void (*release_table_share_v1_t)(struct PSI_table_share *share);
+
+/**
+ Drop a table share.
+ @param temporary True for temporary tables
+ @param schema_name the table schema name
+ @param schema_name_length the table schema name length
+ @param table_name the table name
+ @param table_name_length the table name length
+*/
+typedef void (*drop_table_share_v1_t)(bool temporary, const char *schema_name,
+ int schema_name_length,
+ const char *table_name,
+ int table_name_length);
+
+/**
+ Open an instrumentation table handle.
+ @param share the table to open
+ @param identity table handle identity
+ @return a table handle, or NULL
+*/
+typedef struct PSI_table *(*open_table_v1_t)(struct PSI_table_share *share,
+ const void *identity);
+
+/**
+ Unbind a table handle from the current thread.
+ This operation happens when an opened table is added to the open table cache.
+ @param table the table to unbind
+*/
+typedef void (*unbind_table_v1_t)(struct PSI_table *table);
+
+/**
+ Rebind a table handle to the current thread.
+ This operation happens when a table from the open table cache
+ is reused for a thread.
+ @param table the table to unbind
+*/
+typedef PSI_table *(*rebind_table_v1_t)(PSI_table_share *share,
+ const void *identity, PSI_table *table);
+
+/**
+ Close an instrumentation table handle.
+ Note that the table handle is invalid after this call.
+ @param table the table handle to close
+*/
+typedef void (*close_table_v1_t)(struct TABLE_SHARE *server_share,
+ struct PSI_table *table);
+
+/**
+ Record a table instrumentation io wait start event.
+ @param state data storage for the locker
+ @param table the instrumented table
+ @param op the operation to perform
+ @param index the operation index
+ @param src_file the source file name
+ @param src_line the source line number
+*/
+typedef struct PSI_table_locker *(*start_table_io_wait_v1_t)(
+ struct PSI_table_locker_state *state, struct PSI_table *table,
+ enum PSI_table_io_operation op, unsigned int index, const char *src_file,
+ unsigned int src_line);
+
+/**
+ Record a table instrumentation io wait end event.
+ @param locker a table locker for the running thread
+ @param numrows the number of rows involved in io
+*/
+typedef void (*end_table_io_wait_v1_t)(struct PSI_table_locker *locker,
+ unsigned long long numrows);
+
+/**
+ Record a table instrumentation lock wait start event.
+ @param state data storage for the locker
+ @param table the instrumented table
+ @param op the operation to perform
+ @param flags the operation flags
+ @param src_file the source file name
+ @param src_line the source line number
+*/
+typedef struct PSI_table_locker *(*start_table_lock_wait_v1_t)(
+ struct PSI_table_locker_state *state, struct PSI_table *table,
+ enum PSI_table_lock_operation op, unsigned long flags, const char *src_file,
+ unsigned int src_line);
+
+/**
+ Record a table instrumentation lock wait end event.
+ @param locker a table locker for the running thread
+*/
+typedef void (*end_table_lock_wait_v1_t)(struct PSI_table_locker *locker);
+
+/**
+ Record a table unlock event.
+ @param table instrumentation for the table being unlocked
+*/
+typedef void (*unlock_table_v1_t)(struct PSI_table *table);
+
+/** @} (end of group psi_abi_table) */
+
+#endif /* COMPONENTS_SERVICES_PSI_TABLE_BITS_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/psi_thread_bits.h b/contrib/libs/libmysql_r/include/mysql/components/services/psi_thread_bits.h
new file mode 100644
index 0000000000..21b5b4da04
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/psi_thread_bits.h
@@ -0,0 +1,468 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef COMPONENTS_SERVICES_PSI_THREAD_BITS_H
+#define COMPONENTS_SERVICES_PSI_THREAD_BITS_H
+
+#ifndef MYSQL_ABI_CHECK
+#include <stddef.h> /* size_t */
+#endif
+
+#include <mysql/components/services/my_io_bits.h> /* sockaddr_storage */
+#include <mysql/components/services/my_thread_bits.h> /* my_thread_handle */
+
+/**
+ @file
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_thread Thread Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+/**
+ Instrumented thread key.
+ To instrument a thread, a thread key must be obtained
+ using @c register_thread.
+ Using a zero key always disable the instrumentation.
+*/
+typedef unsigned int PSI_thread_key;
+
+#ifdef __cplusplus
+class THD;
+#else
+/*
+ Phony declaration when compiling C code.
+ This is ok, because the C code will never have a THD anyway.
+*/
+struct opaque_THD {
+ int dummy;
+};
+typedef struct opaque_THD THD;
+#endif
+
+/** @sa enum_vio_type. */
+typedef int opaque_vio_type;
+
+/**
+ Interface for an instrumented thread.
+ This is an opaque structure.
+*/
+struct PSI_thread;
+typedef struct PSI_thread PSI_thread;
+
+/**
+ Thread instrument information.
+ @since PSI_THREAD_VERSION_1
+ This structure is used to register an instrumented thread.
+*/
+struct PSI_thread_info_v1 {
+ /**
+ Pointer to the key assigned to the registered thread.
+ */
+ PSI_thread_key *m_key;
+ /**
+ The name of the thread instrument to register.
+ */
+ const char *m_name;
+ /**
+ The flags of the thread to register.
+ @sa PSI_FLAG_SINGLETON
+ @sa PSI_FLAG_USER
+ */
+ unsigned int m_flags;
+ /** Volatility index. */
+ int m_volatility;
+ /** Documentation. */
+ const char *m_documentation;
+};
+typedef struct PSI_thread_info_v1 PSI_thread_info_v1;
+
+/**
+ Thread registration API.
+ @param category a category name (typically a plugin name)
+ @param info an array of thread info to register
+ @param count the size of the info array
+*/
+typedef void (*register_thread_v1_t)(const char *category,
+ struct PSI_thread_info_v1 *info,
+ int count);
+
+/**
+ Spawn a thread.
+ This method creates a new thread, with instrumentation.
+ @param key the instrumentation key for this thread
+ @param thread the resulting thread
+ @param attr the thread attributes
+ @param start_routine the thread start routine
+ @param arg the thread start routine argument
+*/
+typedef int (*spawn_thread_v1_t)(PSI_thread_key key, my_thread_handle *thread,
+ const my_thread_attr_t *attr,
+ void *(*start_routine)(void *), void *arg);
+
+/**
+ Create instrumentation for a thread.
+ @param key the registered key
+ @param identity an address typical of the thread
+ @param thread_id PROCESSLIST_ID of the thread
+ @return an instrumented thread
+*/
+typedef struct PSI_thread *(*new_thread_v1_t)(PSI_thread_key key,
+ const void *identity,
+ unsigned long long thread_id);
+
+/**
+ Assign a THD to an instrumented thread.
+ @param thread the instrumented thread
+ @param thd the sql layer THD to assign
+*/
+typedef void (*set_thread_THD_v1_t)(struct PSI_thread *thread, THD *thd);
+
+/**
+ Assign an id to an instrumented thread.
+ @param thread the instrumented thread
+ @param id the PROCESSLIST_ID to assign
+*/
+typedef void (*set_thread_id_v1_t)(struct PSI_thread *thread,
+ unsigned long long id);
+/**
+ Read the THREAD_ID of the current thread.
+ @return the id of the instrumented thread
+*/
+typedef unsigned long long (*get_current_thread_internal_id_v2_t)();
+
+/**
+ Read the THREAD_ID of an instrumented thread.
+ @param thread the instrumented thread
+ @return the id of the instrumented thread
+*/
+typedef unsigned long long (*get_thread_internal_id_v2_t)(
+ struct PSI_thread *thread);
+
+/**
+ Get the instrumentation for the thread of given PROCESSLIST_ID.
+ @param processlist_id the thread id
+ @return the instrumented thread
+*/
+typedef struct PSI_thread *(*get_thread_by_id_v2_t)(
+ unsigned long long processlist_id);
+
+/**
+ Assign the current operating system thread id to an instrumented thread.
+ The operating system task id is obtained from @c gettid()
+ @param thread the instrumented thread
+*/
+typedef void (*set_thread_os_id_v1_t)(struct PSI_thread *thread);
+
+/**
+ Get the instrumentation for the running thread.
+ For this function to return a result,
+ the thread instrumentation must have been attached to the
+ running thread using @c set_thread()
+ @return the instrumentation for the running thread
+*/
+typedef struct PSI_thread *(*get_thread_v1_t)(void);
+
+/**
+ Assign a user name to the instrumented thread.
+ @param user the user name
+ @param user_len the user name length
+*/
+typedef void (*set_thread_user_v1_t)(const char *user, int user_len);
+
+/**
+ Assign a user name and host name to the instrumented thread.
+ @param user the user name
+ @param user_len the user name length
+ @param host the host name
+ @param host_len the host name length
+*/
+typedef void (*set_thread_account_v1_t)(const char *user, int user_len,
+ const char *host, int host_len);
+
+/**
+ Assign a current database to the instrumented thread.
+ @param db the database name
+ @param db_len the database name length
+*/
+typedef void (*set_thread_db_v1_t)(const char *db, int db_len);
+
+/**
+ Assign a current command to the instrumented thread.
+ @param command the current command
+*/
+typedef void (*set_thread_command_v1_t)(int command);
+
+/**
+ Assign a connection type to the instrumented thread.
+ @param conn_type the connection type
+*/
+typedef void (*set_connection_type_v1_t)(opaque_vio_type conn_type);
+
+/**
+ Assign a start time to the instrumented thread.
+ @param start_time the thread start time
+*/
+typedef void (*set_thread_start_time_v1_t)(time_t start_time);
+
+/**
+ Assign a state to the instrumented thread.
+ @param state the thread state
+*/
+typedef void (*set_thread_state_v1_t)(const char *state);
+
+/**
+ Assign a process info to the instrumented thread.
+ @param info the process into string
+ @param info_len the process into string length
+*/
+typedef void (*set_thread_info_v1_t)(const char *info, unsigned int info_len);
+
+/**
+ Assign a resource group name to the current thread.
+
+ @param group_name resource group name string
+ @param group_name_len resource group name string length
+ @param user_data user-defined data
+ return 0 if successful, 1 otherwise
+*/
+typedef int (*set_thread_resource_group_v1_t)(const char *group_name,
+ int group_name_len,
+ void *user_data);
+
+/**
+ Assign a resource group name to an instrumented thread, identified either by
+ the thread instrumentation or Performance Schema thread id.
+
+ @param thread pointer to the thread instrumentation. Ignored if NULL.
+ @param thread_id thread id of the target thread. Only used if thread is NULL.
+ @param group_name resource group name string
+ @param group_name_len resource group name string length
+ @param user_data user-defined data
+ return 0 if successful, 1 otherwise
+*/
+typedef int (*set_thread_resource_group_by_id_v1_t)(
+ PSI_thread *thread, unsigned long long thread_id, const char *group_name,
+ int group_name_len, void *user_data);
+
+/**
+ Attach a thread instrumentation to the running thread.
+ In case of thread pools, this method should be called when
+ a worker thread picks a work item and runs it.
+ Also, this method should be called if the instrumented code does not
+ keep the pointer returned by @c new_thread() and relies on @c get_thread()
+ instead.
+ @param thread the thread instrumentation
+*/
+typedef void (*set_thread_v1_t)(struct PSI_thread *thread);
+
+/** Aggregate the thread status variables. */
+typedef void (*aggregate_thread_status_v2_t)(struct PSI_thread *thread);
+
+/** Delete the current thread instrumentation. */
+typedef void (*delete_current_thread_v1_t)(void);
+
+/** Delete a thread instrumentation. */
+typedef void (*delete_thread_v1_t)(struct PSI_thread *thread);
+
+/**
+ Stores an array of connection attributes
+ @param buffer char array of length encoded connection attributes
+ in network format
+ @param length length of the data in buffer
+ @param from_cs charset in which @c buffer is encoded
+ @return state
+ @retval non_0 attributes truncated
+ @retval 0 stored the attribute
+*/
+typedef int (*set_thread_connect_attrs_v1_t)(const char *buffer,
+ unsigned int length,
+ const void *from_cs);
+
+/**
+ Get the current thread current event.
+ @param [out] thread_internal_id The thread internal id
+ @param [out] event_id The per thread event id.
+*/
+typedef void (*get_current_thread_event_id_v2_t)(
+ unsigned long long *thread_internal_id, unsigned long long *event_id);
+
+/**
+ Get the thread current event.
+ @deprecated
+ @param [out] thread_internal_id The thread internal id
+ @param [out] event_id The per thread event id.
+*/
+typedef void (*get_thread_event_id_v1_t)(unsigned long long *thread_internal_id,
+ unsigned long long *event_id);
+
+/**
+ Get the thread current event.
+ @param thread the instrumented thread
+ @param [out] thread_internal_id The thread internal id
+ @param [out] event_id The per thread event id.
+*/
+typedef void (*get_thread_event_id_v2_t)(struct PSI_thread *psi,
+ unsigned long long *thread_internal_id,
+ unsigned long long *event_id);
+
+/* Duplicate definitions to avoid dependency on mysql_com.h */
+#define PSI_USERNAME_LENGTH (32 * 3)
+#define PSI_NAME_LEN (64 * 3)
+#define PSI_HOSTNAME_LENGTH (255)
+
+/**
+ Performance Schema thread type: user/foreground or system/background.
+ @sa get_thread_system_attrs
+*/
+struct PSI_thread_attrs_v3 {
+ /* PFS internal thread id, unique. */
+ unsigned long long m_thread_internal_id;
+
+ /* SHOW PROCESSLIST thread id, not unique. */
+ unsigned long m_processlist_id;
+
+ /* Operating system thread id, if any. */
+ unsigned long long m_thread_os_id;
+
+ /* User-defined data. */
+ void *m_user_data;
+
+ /* User name. */
+ char m_username[PSI_USERNAME_LENGTH];
+
+ /* User name length. */
+ size_t m_username_length;
+
+ /* Host name. */
+ char m_hostname[PSI_HOSTNAME_LENGTH];
+
+ /* Host name length. */
+ size_t m_hostname_length;
+
+ /* Resource group name. */
+ char m_groupname[PSI_NAME_LEN];
+
+ /* Resource group name length. */
+ size_t m_groupname_length;
+
+ /** Raw socket address */
+ struct sockaddr_storage m_sock_addr;
+
+ /** Length of address */
+ socklen_t m_sock_addr_length;
+
+ /* True if system/background thread, false if user/foreground thread. */
+ bool m_system_thread;
+};
+
+typedef struct PSI_thread_attrs_v3 PSI_thread_attrs;
+
+/**
+ Callback for the pfs_notification service.
+ @param thread_attrs system attributes of the current thread.
+*/
+typedef void (*PSI_notification_cb_v3)(const PSI_thread_attrs_v3 *thread_attrs);
+
+/**
+ Registration structure for the pfs_notification service.
+ @sa register_notification_v3_t
+*/
+struct PSI_notification_v3 {
+ PSI_notification_cb_v3 thread_create;
+ PSI_notification_cb_v3 thread_destroy;
+ PSI_notification_cb_v3 session_connect;
+ PSI_notification_cb_v3 session_disconnect;
+ PSI_notification_cb_v3 session_change_user;
+};
+
+typedef struct PSI_notification_v3 PSI_notification;
+
+/**
+ Get system attributes for the current thread.
+
+ @param thread_attrs pointer to pfs_thread_attr struct
+ @return 0 if successful, 1 otherwise
+*/
+typedef int (*get_thread_system_attrs_v3_t)(PSI_thread_attrs_v3 *thread_attrs);
+
+/**
+ Get system attributes for an instrumented thread, identified either by the
+ thread instrumentation or Performance Schema thread id.
+
+ @param thread pointer to the thread instrumentation. Ignored if NULL.
+ @param thread_id thread id of the target thread. Only used if thread is NULL.
+ @param thread_attrs pointer to pfs_thread_attr struct
+ @return 0 if successful, 1 otherwise
+*/
+typedef int (*get_thread_system_attrs_by_id_v3_t)(
+ PSI_thread *thread, unsigned long long thread_id,
+ PSI_thread_attrs_v3 *thread_attrs);
+
+/**
+ Register callback functions for the Notification service.
+ For best performance, set with_ref_count = false.
+
+ @param callbacks structure of user-defined callback functions
+ @param with_ref_count true if callbacks can be unregistered
+ @sa unregister_notification
+ @return registration handle on success, 0 if failure
+*/
+typedef int (*register_notification_v3_t)(const PSI_notification_v3 *callbacks,
+ bool with_ref_count);
+
+/**
+ Unregister callback functions for the Notification service.
+
+ @param handle registration handle returned by register_notification()
+ @sa register_notification
+ @return 0 if successful, non-zero otherwise
+*/
+typedef int (*unregister_notification_v1_t)(int handle);
+
+/**
+ Invoke the callback function registered for a session connect event.
+
+ @param thread the thread instrumentation
+*/
+typedef void (*notify_session_connect_v1_t)(PSI_thread *thread);
+
+/**
+ Invoke the callback function registered for a session disconnect event.
+
+ @param thread the thread instrumentation
+*/
+typedef void (*notify_session_disconnect_v1_t)(PSI_thread *thread);
+
+/**
+ Invoke the callback function registered for a changer user event.
+
+ @param thread the thread instrumentation
+*/
+typedef void (*notify_session_change_user_v1_t)(PSI_thread *thread);
+
+typedef struct PSI_thread_info_v1 PSI_thread_info;
+
+/** @} (end of group psi_abi_thread) */
+
+#endif /* COMPONENTS_SERVICES_PSI_THREAD_BITS_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/psi_transaction_bits.h b/contrib/libs/libmysql_r/include/mysql/components/services/psi_transaction_bits.h
new file mode 100644
index 0000000000..283faf8f44
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/psi_transaction_bits.h
@@ -0,0 +1,176 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef COMPONENTS_SERVICES_PSI_TRANSACTION_BITS_H
+#define COMPONENTS_SERVICES_PSI_TRANSACTION_BITS_H
+
+/**
+ @file
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_transaction Transaction Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+/**
+ Interface for an instrumented transaction.
+ This is an opaque structure.
+*/
+struct PSI_transaction_locker;
+typedef struct PSI_transaction_locker PSI_transaction_locker;
+
+/**
+ State data storage for @c get_thread_transaction_locker_v1_t,
+ @c get_thread_transaction_locker_v1_t.
+ This structure provide temporary storage to a transaction locker.
+ The content of this structure is considered opaque,
+ the fields are only hints of what an implementation
+ of the psi interface can use.
+ This memory is provided by the instrumented code for performance reasons.
+ @sa get_thread_transaction_locker_v1_t
+*/
+struct PSI_transaction_locker_state_v1 {
+ /** Internal state. */
+ unsigned int m_flags;
+ /** Instrumentation class. */
+ void *m_class;
+ /** Current thread. */
+ struct PSI_thread *m_thread;
+ /** Timer start. */
+ unsigned long long m_timer_start;
+ /** Timer function. */
+ unsigned long long (*m_timer)(void);
+ /** Internal data. */
+ void *m_transaction;
+ /** True if read-only transaction, false if read-write. */
+ bool m_read_only;
+ /** True if transaction is autocommit. */
+ bool m_autocommit;
+ /** Number of statements. */
+ unsigned long m_statement_count;
+ /** Total number of savepoints. */
+ unsigned long m_savepoint_count;
+ /** Number of rollback_to_savepoint. */
+ unsigned long m_rollback_to_savepoint_count;
+ /** Number of release_savepoint. */
+ unsigned long m_release_savepoint_count;
+};
+typedef struct PSI_transaction_locker_state_v1 PSI_transaction_locker_state_v1;
+
+/**
+ Get a transaction instrumentation locker.
+ @param state data storage for the locker
+ @param xid the xid for this transaction
+ @param trxid the InnoDB transaction id
+ @param isolation_level isolation level for this transaction
+ @param read_only true if transaction access mode is read-only
+ @param autocommit true if transaction is autocommit
+ @return a transaction locker, or NULL
+*/
+typedef struct PSI_transaction_locker *(*get_thread_transaction_locker_v1_t)(
+ struct PSI_transaction_locker_state_v1 *state, const void *xid,
+ const unsigned long long *trxid, int isolation_level, bool read_only,
+ bool autocommit);
+
+/**
+ Start a new transaction event.
+ @param locker the transaction locker for this event
+ @param src_file source file name
+ @param src_line source line number
+*/
+typedef void (*start_transaction_v1_t)(struct PSI_transaction_locker *locker,
+ const char *src_file,
+ unsigned int src_line);
+
+/**
+ Set the transaction xid.
+ @param locker the transaction locker for this event
+ @param xid the id of the XA transaction
+ @param xa_state the state of the XA transaction
+*/
+typedef void (*set_transaction_xid_v1_t)(struct PSI_transaction_locker *locker,
+ const void *xid, int xa_state);
+
+/**
+ Set the state of the XA transaction.
+ @param locker the transaction locker for this event
+ @param xa_state the new state of the xa transaction
+*/
+typedef void (*set_transaction_xa_state_v1_t)(
+ struct PSI_transaction_locker *locker, int xa_state);
+
+/**
+ Set the transaction gtid.
+ @param locker the transaction locker for this event
+ @param sid the source id for the transaction, mapped from sidno
+ @param gtid_spec the gtid specifier for the transaction
+*/
+typedef void (*set_transaction_gtid_v1_t)(struct PSI_transaction_locker *locker,
+ const void *sid,
+ const void *gtid_spec);
+
+/**
+ Set the transaction trx_id.
+ @param locker the transaction locker for this event
+ @param trxid the storage engine transaction ID
+*/
+typedef void (*set_transaction_trxid_v1_t)(
+ struct PSI_transaction_locker *locker, const unsigned long long *trxid);
+
+/**
+ Increment a transaction event savepoint count.
+ @param locker the transaction locker
+ @param count the increment value
+*/
+typedef void (*inc_transaction_savepoints_v1_t)(
+ struct PSI_transaction_locker *locker, unsigned long count);
+
+/**
+ Increment a transaction event rollback to savepoint count.
+ @param locker the transaction locker
+ @param count the increment value
+*/
+typedef void (*inc_transaction_rollback_to_savepoint_v1_t)(
+ struct PSI_transaction_locker *locker, unsigned long count);
+
+/**
+ Increment a transaction event release savepoint count.
+ @param locker the transaction locker
+ @param count the increment value
+*/
+typedef void (*inc_transaction_release_savepoint_v1_t)(
+ struct PSI_transaction_locker *locker, unsigned long count);
+
+/**
+ Commit or rollback the transaction.
+ @param locker the transaction locker for this event
+ @param commit true if transaction was committed, false if rolled back
+*/
+typedef void (*end_transaction_v1_t)(struct PSI_transaction_locker *locker,
+ bool commit);
+
+typedef struct PSI_transaction_locker_state_v1 PSI_transaction_locker_state;
+
+/** @} (end of group psi_abi_transaction) */
+
+#endif /* COMPONENTS_SERVICES_PSI_TRANSACTION_BITS_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/registry.h b/contrib/libs/libmysql_r/include/mysql/components/services/registry.h
new file mode 100644
index 0000000000..fc86666273
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/registry.h
@@ -0,0 +1,296 @@
+/* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License, version 2.0,
+as published by the Free Software Foundation.
+
+This program is also distributed with certain software (including
+but not limited to OpenSSL) that is licensed under separate terms,
+as designated in a particular file or component or in included license
+documentation. The authors of MySQL hereby grant you an additional
+permission to link the program and your derivative works with the
+separately licensed software that they have included with MySQL.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License, version 2.0, for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_REGISTRY_H
+#define MYSQL_REGISTRY_H
+
+#include <mysql/components/service.h>
+#include <stdint.h>
+
+/**
+ A handle type for acquired Service.
+*/
+DEFINE_SERVICE_HANDLE(my_h_service);
+
+/**
+ A handle type for a iterator to a Service Implementation.
+*/
+DEFINE_SERVICE_HANDLE(my_h_service_iterator);
+/**
+ A handle type for a iterator to metadata of some Service Implementation.
+*/
+DEFINE_SERVICE_HANDLE(my_h_service_metadata_iterator);
+
+/**
+ Service for acquiring and releasing references to all registered Service
+ Implementations.
+*/
+BEGIN_SERVICE_DEFINITION(registry)
+/**
+ Finds and acquires a Service by name. A name of the Service or the Service
+ Implementation can be specified. In case of the Service name, the default
+ Service Implementation for Service specified will be returned.
+
+ @param service_name Name of Service or Service Implementation to acquire.
+ @param [out] out_service Pointer to Service handle to set acquired Service.
+ @return Status of performed operation
+ @retval false success
+ @retval true failure
+*/
+DECLARE_BOOL_METHOD(acquire,
+ (const char *service_name, my_h_service *out_service));
+/**
+ Finds a Service by name. If there is a Service Implementation with the same
+ Component part of name as the input Service then the found Service is
+ returned. Otherwise the default Service Implementation for specified
+ Service is returned.
+
+ @param service_name Name of Service or Service Implementation to acquire.
+ @param service Service handle already acquired Service Implementation.
+ @param [out] out_service Pointer to Service Implementation handle to set
+ acquired Service Implementation.
+ @return Status of performed operation
+ @retval false success
+ @retval true failure
+*/
+DECLARE_BOOL_METHOD(acquire_related,
+ (const char *service_name, my_h_service service,
+ my_h_service *out_service));
+/**
+ Releases the Service Implementation previously acquired. After the call to
+ this method the usage of the Service Implementation handle will lead to
+ unpredicted results.
+
+ @param service Service Implementation handle of already acquired Service.
+ @return Status of performed operation
+ @retval false success
+ @retval true failure
+*/
+DECLARE_BOOL_METHOD(release, (my_h_service service));
+END_SERVICE_DEFINITION(registry)
+
+/**
+ Service for managing list of registered Service Implementations.
+*/
+BEGIN_SERVICE_DEFINITION(registry_registration)
+/**
+ Registers a new Service Implementation. If it is the first Service
+ Implementation for the specified Service then it is made a default one.
+
+ @param service_implementation_name Name of the Service Implementation to
+ register.
+ @param ptr Pointer to the Service Implementation structure.
+ @return Status of performed operation
+ @retval false success
+ @retval true failure
+*/
+DECLARE_BOOL_METHOD(register_service, (const char *service_implementation_name,
+ my_h_service ptr));
+/**
+ Removes previously registered Service Implementation from registry. If it is
+ the default one for specified Service then any one still registered is made
+ default. If there is no other, the default entry is removed from the
+ Registry too.
+
+ @param service_implementation_name Name of the Service Implementation to
+ unregister.
+ @return Status of performed operation
+ @retval false success
+ @retval true Failure. May happen when Service is still being referenced.
+*/
+DECLARE_BOOL_METHOD(unregister, (const char *service_implementation_name));
+/**
+ Sets new default Service Implementation for corresponding Service name.
+
+ @param service_implementation_name Name of the Service Implementation to
+ set as default one.
+ @return Status of performed operation
+ @retval false success
+ @retval true failure
+*/
+DECLARE_BOOL_METHOD(set_default, (const char *service_implementation_name));
+END_SERVICE_DEFINITION(registry_registration)
+
+/**
+ Service for listing all Service Implementations by iterator.
+*/
+BEGIN_SERVICE_DEFINITION(registry_query)
+/**
+ Creates iterator that iterates through all registered Service
+ Implementations. If successful it leaves read lock on the Registry until
+ iterator is released. The starting point of iteration may be specified
+ to be on one particular Service Implementation. The iterator will move
+ through all Service Implementations and additionally through all default
+ Service Implementation additionally, i.e. the default Service Implementation
+ will be returned twice. If no name is specified for search, iterator will be
+ positioned on the first Service Implementation.
+
+ @param service_name_pattern Name of Service or Service Implementation to
+ start iteration from. May be empty string or NULL pointer, in which case
+ iteration starts from the first Service Implementation.
+ @param [out] out_iterator Pointer to the Service Implementation iterator
+ handle.
+ @return Status of performed operation
+ @retval false success
+ @retval true failure
+*/
+DECLARE_BOOL_METHOD(create, (const char *service_name_pattern,
+ my_h_service_iterator *out_iterator));
+/**
+ Gets name of Service pointed to by iterator. The pointer returned will last
+ at least up to the moment of call to the release() method on the iterator.
+
+ @param iterator Service Implementation iterator handle.
+ @param [out] out_name Pointer to string with name to set result pointer to.
+ @return Status of performed operation
+ @retval false success
+ @retval true Failure, may be caused when called on iterator that went
+ through all values already.
+*/
+DECLARE_BOOL_METHOD(get, (my_h_service_iterator iter, const char **out_name));
+/**
+ Advances specified iterator to next element. Will succeed but return true if
+ it reaches one-past-last element.
+
+ @param iterator Service Implementation iterator handle.
+ @return Status of performed operation and validity of iterator after
+ operation.
+ @retval false success
+ @retval true Failure or called on iterator that was on last element.
+*/
+DECLARE_BOOL_METHOD(next, (my_h_service_iterator iter));
+/**
+ Checks if specified iterator is valid, i.e. have not reached one-past-last
+ element.
+
+ @param iterator Service Implementation iterator handle.
+ @return Validity of iterator
+ @retval false Valid
+ @retval true Invalid or reached one-past-last element.
+*/
+DECLARE_BOOL_METHOD(is_valid, (my_h_service_iterator iter));
+/**
+ Releases the Service Implementations iterator. Releases read lock on the
+ Registry.
+
+ @param iterator Service Implementation iterator handle.
+ @return Status of performed operation
+ @retval false success
+ @retval true failure
+*/
+DECLARE_METHOD(void, release, (my_h_service_iterator iter));
+END_SERVICE_DEFINITION(registry_query)
+
+/**
+ Service for listing all metadata for a Service Implementation specified by
+ the given iterator.
+*/
+BEGIN_SERVICE_DEFINITION(registry_metadata_enumerate)
+/**
+ Creates a iterator that iterates through all metadata for the object pointed
+ by the specified iterator. If successful it leaves read lock on the registry
+ until the iterator is released.
+
+ @param iterator A iterator that points to object to get the metadata
+ iterator for.
+ @param [out] out_iterator Pointer to metadata iterator handle.
+ @return Status of performed operation
+ @retval false success
+ @retval true failure
+*/
+DECLARE_BOOL_METHOD(create, (my_h_service_iterator iterator,
+ my_h_service_metadata_iterator *out_iterator));
+/**
+ Gets the key and value of the metadata pointed to by the specified iterator.
+ The pointers returned will last at least up to the moment of call to the
+ release() method on the iterator.
+
+ @param iterator Metadata iterator handle.
+ @param [out] out_name A pointer to the string with the key to set the result
+ pointer to.
+ @param [out] out_value A pointer to the string with the metadata value to
+ set the result pointer to.
+ @return Status of performed operation
+ @retval false success
+ @retval true Failure, may be caused when called on the iterator that went
+ through all values already.
+*/
+DECLARE_BOOL_METHOD(get, (my_h_service_metadata_iterator iterator,
+ const char **name, const char **value));
+/**
+ Advances specified iterator to next element. Will fail if it reaches
+ one-past-last element.
+
+ @param iterator Metadata iterator handle.
+ @return Status of performed operation
+ @retval false success
+ @retval true Failure, may be caused when called on iterator that was on last
+ element.
+*/
+DECLARE_BOOL_METHOD(next, (my_h_service_metadata_iterator iterator));
+/**
+ Checks if specified iterator is valid, i.e. have not reached one-past-last
+ element.
+
+ @param iterator Metadata iterator handle.
+ @return Validity of iterator
+ @retval false Valid
+ @retval true Invalid or reached one-past-last element.
+*/
+DECLARE_BOOL_METHOD(is_valid, (my_h_service_metadata_iterator iterator));
+/**
+ Releases the specified iterator. Releases read lock on the registry.
+
+ @param iterator Metadata iterator handle.
+ @return Status of performed operation
+ @retval false success
+ @retval true failure
+*/
+DECLARE_METHOD(void, release, (my_h_service_metadata_iterator iterator));
+END_SERVICE_DEFINITION(registry_metadata_enumerate)
+
+/**
+ Service to query specified metadata key directly for the specified Service
+ Implementation by iterator to it.
+*/
+BEGIN_SERVICE_DEFINITION(registry_metadata_query)
+/**
+ Gets the key and value of the metadata pointed to by the specified object
+ iterator. The pointer returned will last at least up to the moment of call
+ to the release() method on the iterator.
+
+ @param iterator A iterator that points to object to get the metadata
+ iterator for.
+ @param name A pointer to the string with the key to set the result
+ pointer to.
+ @param [out] out_value A pointer to the string with the metadata value to
+ set the result pointer to.
+ @return Status of performed operation
+ @retval false success
+ @retval true Failure, may be caused when called on the iterator that went
+ through all values already.
+*/
+DECLARE_BOOL_METHOD(get_value, (my_h_service_iterator iterator,
+ const char *name, const char **value));
+END_SERVICE_DEFINITION(registry_metadata_query)
+
+#endif /* MYSQL_REGISTRY_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/system_variable_source_type.h b/contrib/libs/libmysql_r/include/mysql/components/services/system_variable_source_type.h
new file mode 100644
index 0000000000..449bcdd126
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/system_variable_source_type.h
@@ -0,0 +1,45 @@
+/*
+ Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef SYSTEM_VARIABLE_SOURCE_TYPE_H
+#define SYSTEM_VARIABLE_SOURCE_TYPE_H
+/**
+ This enum values define how system variables are set. For example if a
+ variable is set by global option file /etc/my.cnf then source will be
+ set to GLOBAL, or if a variable is set from command line then source
+ will hold value as COMMAND_LINE.
+*/
+enum enum_variable_source {
+ COMPILED = 1,
+ GLOBAL,
+ SERVER,
+ EXPLICIT,
+ EXTRA,
+ MYSQL_USER,
+ LOGIN,
+ COMMAND_LINE,
+ PERSISTED,
+ DYNAMIC
+};
+
+#endif /* SYSTEM_VARIABLE_SOURCE_TYPE_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/thr_cond_bits.h b/contrib/libs/libmysql_r/include/mysql/components/services/thr_cond_bits.h
new file mode 100644
index 0000000000..f77f40236f
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/thr_cond_bits.h
@@ -0,0 +1,48 @@
+/* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef COMPONENTS_SERVICES_THR_COND_BITS_H
+#define COMPONENTS_SERVICES_THR_COND_BITS_H
+
+/**
+ @file
+ MySQL condition variable implementation.
+
+ native_cond_t
+ Windows - ConditionVariable
+ Other OSes - pthread
+*/
+
+#include <stddef.h>
+#include <sys/types.h>
+#ifdef _WIN32
+#include <time.h>
+#include "my_systime.h"
+#endif
+
+#ifdef _WIN32
+typedef CONDITION_VARIABLE native_cond_t;
+#else
+typedef pthread_cond_t native_cond_t;
+#endif
+
+#endif /* COMPONENTS_SERVICES_THR_COND_BITS_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/thr_mutex_bits.h b/contrib/libs/libmysql_r/include/mysql/components/services/thr_mutex_bits.h
new file mode 100644
index 0000000000..84add7f443
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/thr_mutex_bits.h
@@ -0,0 +1,68 @@
+/* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef COMPONENTS_SERVICES_THR_MUTEX_BITS_H
+#define COMPONENTS_SERVICES_THR_MUTEX_BITS_H
+
+#if defined(_WIN32)
+#include <windows.h>
+#else
+#include <pthread.h> // IWYU pragma: export
+#include <sched.h> // IWYU pragma: export
+#endif
+
+/**
+ @file
+ ABI for thd_mutex
+
+ There are three "layers":
+ 1) native_mutex_*()
+ Functions that map directly down to OS primitives.
+ Windows - CriticalSection
+ Other OSes - pthread
+ 2) my_mutex_*()
+ Functions that implement SAFE_MUTEX (default for debug),
+ Otherwise native_mutex_*() is used.
+ 3) mysql_mutex_*()
+ Functions that include Performance Schema instrumentation.
+ See include/mysql/psi/mysql_thread.h
+*/
+
+#ifdef _WIN32
+typedef CRITICAL_SECTION native_mutex_t;
+typedef int native_mutexattr_t;
+#else
+typedef pthread_mutex_t native_mutex_t;
+typedef pthread_mutexattr_t native_mutexattr_t;
+#endif
+
+struct safe_mutex_t;
+
+struct my_mutex_t {
+ union u {
+ native_mutex_t m_native;
+ safe_mutex_t *m_safe_ptr;
+ } m_u;
+};
+typedef struct my_mutex_t my_mutex_t;
+
+#endif /* COMPONENTS_SERVICES_THR_MUTEX_BITS_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/components/services/thr_rwlock_bits.h b/contrib/libs/libmysql_r/include/mysql/components/services/thr_rwlock_bits.h
new file mode 100644
index 0000000000..8cd066d5bf
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/components/services/thr_rwlock_bits.h
@@ -0,0 +1,115 @@
+/* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef COMPONENTS_SERVICES_THR_RWLOCK_BITS_H
+#define COMPONENTS_SERVICES_THR_RWLOCK_BITS_H
+
+/**
+ @file
+ MySQL rwlock ABI.
+
+ There are two "layers":
+ 1) native_rw_*()
+ Functions that map directly down to OS primitives.
+ Windows - SRWLock
+ Other OSes - pthread
+ 2) mysql_rw*()
+ Functions that include Performance Schema instrumentation.
+ See include/mysql/psi/mysql_thread.h
+
+ This file also includes rw_pr_*(), which implements a special
+ version of rwlocks that prefer readers. The P_S version of these
+ are mysql_prlock_*() - see include/mysql/psi/mysql_thread.h
+*/
+
+#include <stddef.h>
+#include <sys/types.h>
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
+#include <mysql/components/services/my_thread_bits.h>
+#include <mysql/components/services/thr_cond_bits.h>
+#include <mysql/components/services/thr_mutex_bits.h>
+
+#ifdef _WIN32
+struct native_rw_lock_t {
+ SRWLOCK srwlock; /* native reader writer lock */
+ BOOL have_exclusive_srwlock; /* used for unlock */
+};
+#else
+typedef pthread_rwlock_t native_rw_lock_t;
+#endif
+
+/**
+ Portable implementation of special type of read-write locks.
+
+ These locks have two properties which are unusual for rwlocks:
+ 1) They "prefer readers" in the sense that they do not allow
+ situations in which rwlock is rd-locked and there is a
+ pending rd-lock which is blocked (e.g. due to pending
+ request for wr-lock).
+ This is a stronger guarantee than one which is provided for
+ PTHREAD_RWLOCK_PREFER_READER_NP rwlocks in Linux.
+ MDL subsystem deadlock detector relies on this property for
+ its correctness.
+ 2) They are optimized for uncontended wr-lock/unlock case.
+ This is scenario in which they are most oftenly used
+ within MDL subsystem. Optimizing for it gives significant
+ performance improvements in some of tests involving many
+ connections.
+
+ Another important requirement imposed on this type of rwlock
+ by the MDL subsystem is that it should be OK to destroy rwlock
+ object which is in unlocked state even though some threads might
+ have not yet fully left unlock operation for it (of course there
+ is an external guarantee that no thread will try to lock rwlock
+ which is destroyed).
+ Putting it another way the unlock operation should not access
+ rwlock data after changing its state to unlocked.
+
+ TODO/FIXME: We should consider alleviating this requirement as
+ it blocks us from doing certain performance optimizations.
+*/
+
+struct rw_pr_lock_t {
+ /**
+ Lock which protects the structure.
+ Also held for the duration of wr-lock.
+ */
+ native_mutex_t lock;
+ /**
+ Condition variable which is used to wake-up
+ writers waiting for readers to go away.
+ */
+ native_cond_t no_active_readers;
+ /** Number of active readers. */
+ unsigned int active_readers;
+ /** Number of writers waiting for readers to go away. */
+ unsigned int writers_waiting_readers;
+ /** Indicates whether there is an active writer. */
+ bool active_writer;
+ /** Thread holding wr-lock (for debug purposes only). */
+ my_thread_t writer_thread;
+};
+
+#endif /* COMPONENTS_SERVICES_THR_RWLOCK_BITS_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/mysql_lex_string.h b/contrib/libs/libmysql_r/include/mysql/mysql_lex_string.h
new file mode 100644
index 0000000000..0a95655159
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/mysql_lex_string.h
@@ -0,0 +1,44 @@
+/* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_LEX_STRING_INCLUDED
+#define MYSQL_LEX_STRING_INCLUDED
+
+/**
+ @file include/mysql/mysql_lex_string.h
+*/
+
+#ifndef MYSQL_ABI_CHECK
+#include <stddef.h>
+#endif
+
+struct MYSQL_LEX_STRING {
+ char *str;
+ size_t length;
+};
+
+struct MYSQL_LEX_CSTRING {
+ const char *str;
+ size_t length;
+};
+
+#endif // MYSQL_LEX_STRING_INCLUDED
diff --git a/contrib/libs/libmysql_r/include/mysql/plugin.h b/contrib/libs/libmysql_r/include/mysql/plugin.h
new file mode 100644
index 0000000000..fee7aa7565
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/plugin.h
@@ -0,0 +1,901 @@
+/* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef _my_plugin_h
+#define _my_plugin_h
+
+/**
+ @file include/mysql/plugin.h
+*/
+
+#ifndef MYSQL_ABI_CHECK
+#include <stddef.h>
+
+#include "mysql_version.h" /* MYSQL_VERSION_ID */
+#ifdef __cplusplus
+#include "sql/sql_plugin.h" // plugin_thdvar_safe_update
+#endif
+#endif
+
+#include "status_var.h"
+
+/*
+ On Windows, exports from DLL need to be declared.
+ Also, plugin needs to be declared as extern "C" because MSVC
+ unlike other compilers, uses C++ mangling for variables not only
+ for functions.
+*/
+#if defined(_MSC_VER)
+#if defined(MYSQL_DYNAMIC_PLUGIN)
+#ifdef __cplusplus
+#define MYSQL_PLUGIN_EXPORT extern "C" __declspec(dllexport)
+#else
+#define MYSQL_PLUGIN_EXPORT __declspec(dllexport)
+#endif
+#else /* MYSQL_DYNAMIC_PLUGIN */
+#ifdef __cplusplus
+#define MYSQL_PLUGIN_EXPORT extern "C"
+#else
+#define MYSQL_PLUGIN_EXPORT
+#endif
+#endif /*MYSQL_DYNAMIC_PLUGIN */
+#else /*_MSC_VER */
+#define MYSQL_PLUGIN_EXPORT
+#endif
+
+#ifdef __cplusplus
+class THD;
+class Item;
+#define MYSQL_THD THD *
+#else
+#define MYSQL_THD void *
+#endif
+
+typedef void *MYSQL_PLUGIN;
+
+#ifndef MYSQL_ABI_CHECK
+#include <mysql/services.h>
+#endif
+
+#define MYSQL_XIDDATASIZE 128
+/**
+ MYSQL_XID is binary compatible with the XID structure as
+ in the X/Open CAE Specification, Distributed Transaction Processing:
+ The XA Specification, X/Open Company Ltd., 1991.
+ http://www.opengroup.org/bookstore/catalog/c193.htm
+
+ @see XID in sql/handler.h
+*/
+struct MYSQL_XID {
+ long formatID;
+ long gtrid_length;
+ long bqual_length;
+ char data[MYSQL_XIDDATASIZE]; /* Not \0-terminated */
+};
+
+/*************************************************************************
+ Plugin API. Common for all plugin types.
+*/
+
+#define MYSQL_PLUGIN_INTERFACE_VERSION 0x010A
+
+/*
+ The allowable types of plugins
+*/
+#define MYSQL_UDF_PLUGIN 0 /* User-defined function */
+#define MYSQL_STORAGE_ENGINE_PLUGIN 1 /* Storage Engine */
+#define MYSQL_FTPARSER_PLUGIN 2 /* Full-text parser plugin */
+#define MYSQL_DAEMON_PLUGIN 3 /* The daemon/raw plugin type */
+#define MYSQL_INFORMATION_SCHEMA_PLUGIN 4 /* The I_S plugin type */
+#define MYSQL_AUDIT_PLUGIN 5 /* The Audit plugin type */
+#define MYSQL_REPLICATION_PLUGIN 6 /* The replication plugin type */
+#define MYSQL_AUTHENTICATION_PLUGIN 7 /* The authentication plugin type */
+#define MYSQL_VALIDATE_PASSWORD_PLUGIN 8 /* validate password plugin type */
+#define MYSQL_GROUP_REPLICATION_PLUGIN 9 /* The Group Replication plugin */
+#define MYSQL_KEYRING_PLUGIN 10 /* The Keyring plugin type */
+#define MYSQL_CLONE_PLUGIN 11 /* The Clone plugin type */
+#define MYSQL_MAX_PLUGIN_TYPE_NUM 12 /* The number of plugin types */
+
+/* We use the following strings to define licenses for plugins */
+#define PLUGIN_LICENSE_PROPRIETARY 0
+#define PLUGIN_LICENSE_GPL 1
+#define PLUGIN_LICENSE_BSD 2
+
+#define PLUGIN_LICENSE_PROPRIETARY_STRING "PROPRIETARY"
+#define PLUGIN_LICENSE_GPL_STRING "GPL"
+#define PLUGIN_LICENSE_BSD_STRING "BSD"
+
+/*
+ Macros for beginning and ending plugin declarations. Between
+ mysql_declare_plugin and mysql_declare_plugin_end there should
+ be a st_mysql_plugin struct for each plugin to be declared.
+*/
+
+#ifndef MYSQL_DYNAMIC_PLUGIN
+#define __MYSQL_DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \
+ MYSQL_PLUGIN_EXPORT int VERSION = MYSQL_PLUGIN_INTERFACE_VERSION; \
+ MYSQL_PLUGIN_EXPORT int PSIZE = sizeof(struct st_mysql_plugin); \
+ MYSQL_PLUGIN_EXPORT struct st_mysql_plugin DECLS[] = {
+#else
+#define __MYSQL_DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \
+ MYSQL_PLUGIN_EXPORT int _mysql_plugin_interface_version_ = \
+ MYSQL_PLUGIN_INTERFACE_VERSION; \
+ MYSQL_PLUGIN_EXPORT int _mysql_sizeof_struct_st_plugin_ = \
+ sizeof(struct st_mysql_plugin); \
+ MYSQL_PLUGIN_EXPORT struct st_mysql_plugin _mysql_plugin_declarations_[] = {
+#endif
+
+#define mysql_declare_plugin(NAME) \
+ __MYSQL_DECLARE_PLUGIN(NAME, builtin_##NAME##_plugin_interface_version, \
+ builtin_##NAME##_sizeof_struct_st_plugin, \
+ builtin_##NAME##_plugin)
+
+#define mysql_declare_plugin_end \
+ , { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } \
+ }
+
+/*
+ Constants for plugin flags.
+ */
+
+#define PLUGIN_OPT_NO_INSTALL 1UL /* Not dynamically loadable */
+#define PLUGIN_OPT_NO_UNINSTALL 2UL /* Not dynamically unloadable */
+#define PLUGIN_OPT_ALLOW_EARLY 4UL /* allow --early-plugin-load */
+
+/*
+ declarations for server variables and command line options
+*/
+
+#define PLUGIN_VAR_BOOL 0x0001
+#define PLUGIN_VAR_INT 0x0002
+#define PLUGIN_VAR_LONG 0x0003
+#define PLUGIN_VAR_LONGLONG 0x0004
+#define PLUGIN_VAR_STR 0x0005
+#define PLUGIN_VAR_ENUM 0x0006
+#define PLUGIN_VAR_SET 0x0007
+#define PLUGIN_VAR_DOUBLE 0x0008
+#define PLUGIN_VAR_UNSIGNED 0x0080
+#define PLUGIN_VAR_THDLOCAL 0x0100 /* Variable is per-connection */
+#define PLUGIN_VAR_READONLY 0x0200 /* Server variable is read only */
+#define PLUGIN_VAR_NOSYSVAR 0x0400 /* Configurable only by cmd-line */
+#define PLUGIN_VAR_NOCMDOPT 0x0800 /* Not a command line option */
+#define PLUGIN_VAR_NOCMDARG 0x1000 /* No argument for cmd line */
+#define PLUGIN_VAR_RQCMDARG 0x0000 /* Argument required for cmd line */
+#define PLUGIN_VAR_OPCMDARG 0x2000 /* Argument optional for cmd line */
+#define PLUGIN_VAR_NODEFAULT 0x4000 /* SET DEFAULT is prohibited */
+#define PLUGIN_VAR_MEMALLOC 0x8000 /* String needs memory allocated */
+#define PLUGIN_VAR_NOPERSIST \
+ 0x10000 /* SET PERSIST_ONLY is prohibited \
+ for read only variables */
+
+/**
+ There can be some variables which needs to be set before plugin is loaded but
+ not after plugin is loaded. ex: GR specific variables. Below flag must be set
+ for these kind of variables.
+*/
+#define PLUGIN_VAR_PERSIST_AS_READ_ONLY 0x20000
+#define PLUGIN_VAR_INVISIBLE 0x40000 /* Variable should not be shown */
+
+struct SYS_VAR;
+struct st_mysql_value;
+
+/*
+ SYNOPSIS
+ (*mysql_var_check_func)()
+ thd thread handle
+ var dynamic variable being altered
+ save pointer to temporary storage
+ value user provided value
+ RETURN
+ 0 user provided value is OK and the update func may be called.
+ any other value indicates error.
+
+ This function should parse the user provided value and store in the
+ provided temporary storage any data as required by the update func.
+ There is sufficient space in the temporary storage to store a double.
+ Note that the update func may not be called if any other error occurs
+ so any memory allocated should be thread-local so that it may be freed
+ automatically at the end of the statement.
+*/
+
+typedef int (*mysql_var_check_func)(MYSQL_THD thd, SYS_VAR *var, void *save,
+ struct st_mysql_value *value);
+
+/*
+ SYNOPSIS
+ (*mysql_var_update_func)()
+ thd thread handle
+ var dynamic variable being altered
+ var_ptr pointer to dynamic variable
+ save pointer to temporary storage
+ RETURN
+ NONE
+
+ This function should use the validated value stored in the temporary store
+ and persist it in the provided pointer to the dynamic variable.
+ For example, strings may require memory to be allocated.
+*/
+typedef void (*mysql_var_update_func)(MYSQL_THD thd, SYS_VAR *var,
+ void *var_ptr, const void *save);
+
+/* the following declarations are for internal use only */
+
+#define PLUGIN_VAR_MASK \
+ (PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR | PLUGIN_VAR_NOCMDOPT | \
+ PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_RQCMDARG | \
+ PLUGIN_VAR_MEMALLOC | PLUGIN_VAR_NODEFAULT | PLUGIN_VAR_NOPERSIST | \
+ PLUGIN_VAR_PERSIST_AS_READ_ONLY | PLUGIN_VAR_INVISIBLE)
+
+#define MYSQL_PLUGIN_VAR_HEADER \
+ int flags; \
+ const char *name; \
+ const char *comment; \
+ mysql_var_check_func check; \
+ mysql_var_update_func update
+
+#define MYSQL_SYSVAR_NAME(name) mysql_sysvar_##name
+#define MYSQL_SYSVAR(name) ((SYS_VAR *)&(MYSQL_SYSVAR_NAME(name)))
+
+/*
+ for global variables, the value pointer is the first
+ element after the header, the default value is the second.
+ for thread variables, the value offset is the first
+ element after the header, the default value is the second.
+*/
+
+#define DECLARE_MYSQL_SYSVAR_BASIC(name, type) \
+ struct { \
+ MYSQL_PLUGIN_VAR_HEADER; \
+ type *value; \
+ const type def_val; \
+ } MYSQL_SYSVAR_NAME(name)
+
+#define DECLARE_MYSQL_SYSVAR_SIMPLE(name, type) \
+ struct { \
+ MYSQL_PLUGIN_VAR_HEADER; \
+ type *value; \
+ type def_val; \
+ type min_val; \
+ type max_val; \
+ type blk_sz; \
+ } MYSQL_SYSVAR_NAME(name)
+
+#define DECLARE_MYSQL_SYSVAR_TYPELIB(name, type) \
+ struct { \
+ MYSQL_PLUGIN_VAR_HEADER; \
+ type *value; \
+ type def_val; \
+ TYPELIB *typelib; \
+ } MYSQL_SYSVAR_NAME(name)
+
+#define DECLARE_THDVAR_FUNC(type) type *(*resolve)(MYSQL_THD thd, int offset)
+
+#define DECLARE_MYSQL_THDVAR_BASIC(name, type) \
+ struct { \
+ MYSQL_PLUGIN_VAR_HEADER; \
+ int offset; \
+ const type def_val; \
+ DECLARE_THDVAR_FUNC(type); \
+ } MYSQL_SYSVAR_NAME(name)
+
+#define DECLARE_MYSQL_THDVAR_SIMPLE(name, type) \
+ struct { \
+ MYSQL_PLUGIN_VAR_HEADER; \
+ int offset; \
+ type def_val; \
+ type min_val; \
+ type max_val; \
+ type blk_sz; \
+ DECLARE_THDVAR_FUNC(type); \
+ } MYSQL_SYSVAR_NAME(name)
+
+#define DECLARE_MYSQL_THDVAR_TYPELIB(name, type) \
+ struct { \
+ MYSQL_PLUGIN_VAR_HEADER; \
+ int offset; \
+ type def_val; \
+ DECLARE_THDVAR_FUNC(type); \
+ TYPELIB *typelib; \
+ } MYSQL_SYSVAR_NAME(name)
+
+/*
+ the following declarations are for use by plugin implementors
+*/
+
+#define MYSQL_SYSVAR_BOOL(name, varname, opt, comment, check, update, def) \
+ DECLARE_MYSQL_SYSVAR_BASIC(name, bool) = { \
+ PLUGIN_VAR_BOOL | ((opt)&PLUGIN_VAR_MASK), \
+ #name, \
+ comment, \
+ check, \
+ update, \
+ &varname, \
+ def}
+
+#define MYSQL_SYSVAR_STR(name, varname, opt, comment, check, update, def) \
+ DECLARE_MYSQL_SYSVAR_BASIC(name, char *) = { \
+ PLUGIN_VAR_STR | ((opt)&PLUGIN_VAR_MASK), \
+ #name, \
+ comment, \
+ check, \
+ update, \
+ &varname, \
+ def}
+
+#define MYSQL_SYSVAR_INT(name, varname, opt, comment, check, update, def, min, \
+ max, blk) \
+ DECLARE_MYSQL_SYSVAR_SIMPLE(name, int) = { \
+ PLUGIN_VAR_INT | ((opt)&PLUGIN_VAR_MASK), \
+ #name, \
+ comment, \
+ check, \
+ update, \
+ &varname, \
+ def, \
+ min, \
+ max, \
+ blk}
+
+#define MYSQL_SYSVAR_UINT(name, varname, opt, comment, check, update, def, \
+ min, max, blk) \
+ DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned int) = { \
+ PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED | ((opt)&PLUGIN_VAR_MASK), \
+ #name, \
+ comment, \
+ check, \
+ update, \
+ &varname, \
+ def, \
+ min, \
+ max, \
+ blk}
+
+#define MYSQL_SYSVAR_LONG(name, varname, opt, comment, check, update, def, \
+ min, max, blk) \
+ DECLARE_MYSQL_SYSVAR_SIMPLE(name, long) = { \
+ PLUGIN_VAR_LONG | ((opt)&PLUGIN_VAR_MASK), \
+ #name, \
+ comment, \
+ check, \
+ update, \
+ &varname, \
+ def, \
+ min, \
+ max, \
+ blk}
+
+#define MYSQL_SYSVAR_ULONG(name, varname, opt, comment, check, update, def, \
+ min, max, blk) \
+ DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long) = { \
+ PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | ((opt)&PLUGIN_VAR_MASK), \
+ #name, \
+ comment, \
+ check, \
+ update, \
+ &varname, \
+ def, \
+ min, \
+ max, \
+ blk}
+
+#define MYSQL_SYSVAR_LONGLONG(name, varname, opt, comment, check, update, def, \
+ min, max, blk) \
+ DECLARE_MYSQL_SYSVAR_SIMPLE(name, long long) = { \
+ PLUGIN_VAR_LONGLONG | ((opt)&PLUGIN_VAR_MASK), \
+ #name, \
+ comment, \
+ check, \
+ update, \
+ &varname, \
+ def, \
+ min, \
+ max, \
+ blk}
+
+#define MYSQL_SYSVAR_ULONGLONG(name, varname, opt, comment, check, update, \
+ def, min, max, blk) \
+ DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long long) = { \
+ PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt)&PLUGIN_VAR_MASK), \
+ #name, \
+ comment, \
+ check, \
+ update, \
+ &varname, \
+ def, \
+ min, \
+ max, \
+ blk}
+
+#define MYSQL_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, \
+ typelib) \
+ DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long) = { \
+ PLUGIN_VAR_ENUM | ((opt)&PLUGIN_VAR_MASK), \
+ #name, \
+ comment, \
+ check, \
+ update, \
+ &varname, \
+ def, \
+ typelib}
+
+#define MYSQL_SYSVAR_SET(name, varname, opt, comment, check, update, def, \
+ typelib) \
+ DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long long) = { \
+ PLUGIN_VAR_SET | ((opt)&PLUGIN_VAR_MASK), \
+ #name, \
+ comment, \
+ check, \
+ update, \
+ &varname, \
+ def, \
+ typelib}
+
+#define MYSQL_SYSVAR_DOUBLE(name, varname, opt, comment, check, update, def, \
+ min, max, blk) \
+ DECLARE_MYSQL_SYSVAR_SIMPLE(name, double) = { \
+ PLUGIN_VAR_DOUBLE | ((opt)&PLUGIN_VAR_MASK), \
+ #name, \
+ comment, \
+ check, \
+ update, \
+ &varname, \
+ def, \
+ min, \
+ max, \
+ blk}
+
+#define MYSQL_THDVAR_BOOL(name, opt, comment, check, update, def) \
+ DECLARE_MYSQL_THDVAR_BASIC(name, bool) = { \
+ PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL | ((opt)&PLUGIN_VAR_MASK), \
+ #name, \
+ comment, \
+ check, \
+ update, \
+ -1, \
+ def, \
+ NULL}
+
+#define MYSQL_THDVAR_STR(name, opt, comment, check, update, def) \
+ DECLARE_MYSQL_THDVAR_BASIC(name, char *) = { \
+ PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL | ((opt)&PLUGIN_VAR_MASK), \
+ #name, \
+ comment, \
+ check, \
+ update, \
+ -1, \
+ def, \
+ NULL}
+
+#define MYSQL_THDVAR_INT(name, opt, comment, check, update, def, min, max, \
+ blk) \
+ DECLARE_MYSQL_THDVAR_SIMPLE(name, int) = { \
+ PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | ((opt)&PLUGIN_VAR_MASK), \
+ #name, \
+ comment, \
+ check, \
+ update, \
+ -1, \
+ def, \
+ min, \
+ max, \
+ blk, \
+ NULL}
+
+#define MYSQL_THDVAR_UINT(name, opt, comment, check, update, def, min, max, \
+ blk) \
+ DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned int) = { \
+ PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | \
+ ((opt)&PLUGIN_VAR_MASK), \
+ #name, \
+ comment, \
+ check, \
+ update, \
+ -1, \
+ def, \
+ min, \
+ max, \
+ blk, \
+ NULL}
+
+#define MYSQL_THDVAR_LONG(name, opt, comment, check, update, def, min, max, \
+ blk) \
+ DECLARE_MYSQL_THDVAR_SIMPLE(name, long) = { \
+ PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | ((opt)&PLUGIN_VAR_MASK), \
+ #name, \
+ comment, \
+ check, \
+ update, \
+ -1, \
+ def, \
+ min, \
+ max, \
+ blk, \
+ NULL}
+
+#define MYSQL_THDVAR_ULONG(name, opt, comment, check, update, def, min, max, \
+ blk) \
+ DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned long) = { \
+ PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | \
+ ((opt)&PLUGIN_VAR_MASK), \
+ #name, \
+ comment, \
+ check, \
+ update, \
+ -1, \
+ def, \
+ min, \
+ max, \
+ blk, \
+ NULL}
+
+#define MYSQL_THDVAR_LONGLONG(name, opt, comment, check, update, def, min, \
+ max, blk) \
+ DECLARE_MYSQL_THDVAR_SIMPLE(name, long long) = { \
+ PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | ((opt)&PLUGIN_VAR_MASK), \
+ #name, \
+ comment, \
+ check, \
+ update, \
+ -1, \
+ def, \
+ min, \
+ max, \
+ blk, \
+ NULL}
+
+#define MYSQL_THDVAR_ULONGLONG(name, opt, comment, check, update, def, min, \
+ max, blk) \
+ DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned long long) = { \
+ PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | \
+ ((opt)&PLUGIN_VAR_MASK), \
+ #name, \
+ comment, \
+ check, \
+ update, \
+ -1, \
+ def, \
+ min, \
+ max, \
+ blk, \
+ NULL}
+
+#define MYSQL_THDVAR_ENUM(name, opt, comment, check, update, def, typelib) \
+ DECLARE_MYSQL_THDVAR_TYPELIB(name, unsigned long) = { \
+ PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL | ((opt)&PLUGIN_VAR_MASK), \
+ #name, \
+ comment, \
+ check, \
+ update, \
+ -1, \
+ def, \
+ NULL, \
+ typelib}
+
+#define MYSQL_THDVAR_SET(name, opt, comment, check, update, def, typelib) \
+ DECLARE_MYSQL_THDVAR_TYPELIB(name, unsigned long long) = { \
+ PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL | ((opt)&PLUGIN_VAR_MASK), \
+ #name, \
+ comment, \
+ check, \
+ update, \
+ -1, \
+ def, \
+ NULL, \
+ typelib}
+
+#define MYSQL_THDVAR_DOUBLE(name, opt, comment, check, update, def, min, max, \
+ blk) \
+ DECLARE_MYSQL_THDVAR_SIMPLE(name, double) = { \
+ PLUGIN_VAR_DOUBLE | PLUGIN_VAR_THDLOCAL | ((opt)&PLUGIN_VAR_MASK), \
+ #name, \
+ comment, \
+ check, \
+ update, \
+ -1, \
+ def, \
+ min, \
+ max, \
+ blk, \
+ NULL}
+
+/* accessor macros */
+
+#define SYSVAR(name) (*(MYSQL_SYSVAR_NAME(name).value))
+
+/* when thd == null, result points to global value */
+#define THDVAR(thd, name) \
+ (*(MYSQL_SYSVAR_NAME(name).resolve(thd, MYSQL_SYSVAR_NAME(name).offset)))
+
+#define THDVAR_SET(thd, name, value) \
+ plugin_thdvar_safe_update(thd, MYSQL_SYSVAR(name), \
+ (char **)&THDVAR(thd, name), (const char *)value);
+
+/*
+ Plugin description structure.
+*/
+
+struct st_mysql_plugin {
+ int type; /* the plugin type (a MYSQL_XXX_PLUGIN value) */
+ void *info; /* pointer to type-specific plugin descriptor */
+ const char *name; /* plugin name */
+ const char *author; /* plugin author (for I_S.PLUGINS) */
+ const char *descr; /* general descriptive text (for I_S.PLUGINS) */
+ int license; /* the plugin license (PLUGIN_LICENSE_XXX) */
+ /** Function to invoke when plugin is loaded. */
+ int (*init)(MYSQL_PLUGIN);
+ /** Function to invoke when plugin is uninstalled. */
+ int (*check_uninstall)(MYSQL_PLUGIN);
+ /** Function to invoke when plugin is unloaded. */
+ int (*deinit)(MYSQL_PLUGIN);
+ unsigned int version; /* plugin version (for I_S.PLUGINS) */
+ SHOW_VAR *status_vars;
+ SYS_VAR **system_vars;
+ void *__reserved1; /* reserved for dependency checking */
+ unsigned long flags; /* flags for plugin */
+};
+
+/*************************************************************************
+ API for Full-text parser plugin. (MYSQL_FTPARSER_PLUGIN)
+*/
+#define MYSQL_FTPARSER_INTERFACE_VERSION 0x0101
+
+/*************************************************************************
+ API for Query Rewrite plugin. (MYSQL_QUERY_REWRITE_PLUGIN)
+*/
+
+#define MYSQL_REWRITE_PRE_PARSE_INTERFACE_VERSION 0x0010
+#define MYSQL_REWRITE_POST_PARSE_INTERFACE_VERSION 0x0010
+
+/*************************************************************************
+ API for Storage Engine plugin. (MYSQL_DAEMON_PLUGIN)
+*/
+
+/* handlertons of different MySQL releases are incompatible */
+#define MYSQL_DAEMON_INTERFACE_VERSION (MYSQL_VERSION_ID << 8)
+
+/*
+ Here we define only the descriptor structure, that is referred from
+ st_mysql_plugin.
+*/
+
+struct st_mysql_daemon {
+ int interface_version;
+};
+
+/*************************************************************************
+ API for I_S plugin. (MYSQL_INFORMATION_SCHEMA_PLUGIN)
+*/
+
+/* handlertons of different MySQL releases are incompatible */
+#define MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION (MYSQL_VERSION_ID << 8)
+
+/*
+ Here we define only the descriptor structure, that is referred from
+ st_mysql_plugin.
+*/
+
+struct st_mysql_information_schema {
+ int interface_version;
+};
+
+/*************************************************************************
+ API for Storage Engine plugin. (MYSQL_STORAGE_ENGINE_PLUGIN)
+*/
+
+/* handlertons of different MySQL releases are incompatible */
+#define MYSQL_HANDLERTON_INTERFACE_VERSION (MYSQL_VERSION_ID << 8)
+
+/*
+ The real API is in the sql/handler.h
+ Here we define only the descriptor structure, that is referred from
+ st_mysql_plugin.
+*/
+
+struct st_mysql_storage_engine {
+ int interface_version;
+};
+
+struct handlerton;
+
+/*
+ API for Replication plugin. (MYSQL_REPLICATION_PLUGIN)
+*/
+#define MYSQL_REPLICATION_INTERFACE_VERSION 0x0400
+
+/**
+ Replication plugin descriptor
+*/
+struct Mysql_replication {
+ int interface_version;
+};
+
+/*************************************************************************
+ st_mysql_value struct for reading values from mysqld.
+ Used by server variables framework to parse user-provided values.
+ Will be used for arguments when implementing UDFs.
+
+ Note that val_str() returns a string in temporary memory
+ that will be freed at the end of statement. Copy the string
+ if you need it to persist.
+*/
+
+#define MYSQL_VALUE_TYPE_STRING 0
+#define MYSQL_VALUE_TYPE_REAL 1
+#define MYSQL_VALUE_TYPE_INT 2
+
+struct st_mysql_value {
+ int (*value_type)(struct st_mysql_value *);
+ const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length);
+ int (*val_real)(struct st_mysql_value *, double *realbuf);
+ int (*val_int)(struct st_mysql_value *, long long *intbuf);
+ int (*is_unsigned)(struct st_mysql_value *);
+};
+
+/*************************************************************************
+ Miscellaneous functions for plugin implementors
+*/
+
+#define thd_proc_info(thd, msg) \
+ set_thd_proc_info(thd, msg, __func__, __FILE__, __LINE__)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int thd_in_lock_tables(const MYSQL_THD thd);
+int thd_tablespace_op(const MYSQL_THD thd);
+long long thd_test_options(const MYSQL_THD thd, long long test_options);
+int thd_sql_command(const MYSQL_THD thd);
+const char *set_thd_proc_info(MYSQL_THD thd, const char *info,
+ const char *calling_func,
+ const char *calling_file,
+ const unsigned int calling_line);
+void **thd_ha_data(const MYSQL_THD thd, const struct handlerton *hton);
+void thd_storage_lock_wait(MYSQL_THD thd, long long value);
+int thd_tx_isolation(const MYSQL_THD thd);
+int thd_tx_is_read_only(const MYSQL_THD thd);
+MYSQL_THD thd_tx_arbitrate(MYSQL_THD requestor, MYSQL_THD holder);
+int thd_tx_priority(const MYSQL_THD thd);
+int thd_tx_is_dd_trx(const MYSQL_THD thd);
+char *thd_security_context(MYSQL_THD thd, char *buffer, size_t length,
+ size_t max_query_len);
+/* Increments the row counter, see THD::row_count */
+void thd_inc_row_count(MYSQL_THD thd);
+int thd_allow_batch(MYSQL_THD thd);
+
+/**
+ Mark transaction to rollback and mark error as fatal to a
+ sub-statement if in sub statement mode.
+
+ @param thd user thread connection handle
+ @param all if all != 0, rollback the main transaction
+*/
+
+void thd_mark_transaction_to_rollback(MYSQL_THD thd, int all);
+
+/**
+ Create a temporary file.
+
+ @details
+ The temporary file is created in a location specified by the mysql
+ server configuration (--tmpdir option). The caller does not need to
+ delete the file, it will be deleted automatically.
+
+ @param prefix prefix for temporary file name
+ @retval -1 error
+ @retval >= 0 a file handle that can be passed to dup or my_close
+*/
+int mysql_tmpfile(const char *prefix);
+
+/**
+ Check the killed state of a connection
+
+ @details
+ In MySQL support for the KILL statement is cooperative. The KILL
+ statement only sets a "killed" flag. This function returns the value
+ of that flag. A thread should check it often, especially inside
+ time-consuming loops, and gracefully abort the operation if it is
+ non-zero.
+
+ @param v_thd user thread connection handle
+ @retval 0 the connection is active
+ @retval 1 the connection has been killed
+*/
+int thd_killed(const void *v_thd);
+
+/**
+ Set the killed status of the current statement.
+
+ @param thd user thread connection handle
+*/
+void thd_set_kill_status(const MYSQL_THD thd);
+
+/**
+ Get binary log position for latest written entry.
+
+ @note The file variable will be set to a buffer holding the name of
+ the file name currently, but this can change if a rotation
+ occur. Copy the string if you want to retain it.
+
+ @param thd Use thread connection handle
+ @param file_var Pointer to variable that will hold the file name.
+ @param pos_var Pointer to variable that will hold the file position.
+ */
+void thd_binlog_pos(const MYSQL_THD thd, const char **file_var,
+ unsigned long long *pos_var);
+
+/**
+ Return the thread id of a user thread
+
+ @param thd user thread connection handle
+ @return thread id
+*/
+unsigned long thd_get_thread_id(const MYSQL_THD thd);
+
+/**
+ Get the XID for this connection's transaction
+
+ @param thd user thread connection handle
+ @param xid location where identifier is stored
+*/
+void thd_get_xid(const MYSQL_THD thd, MYSQL_XID *xid);
+
+/**
+ Provide a handler data getter to simplify coding
+*/
+void *thd_get_ha_data(const MYSQL_THD thd, const struct handlerton *hton);
+
+/**
+ Provide a handler data setter to simplify coding
+
+ @details
+ Set ha_data pointer (storage engine per-connection information).
+
+ To avoid unclean deactivation (uninstall) of storage engine plugin
+ in the middle of transaction, additional storage engine plugin
+ lock is acquired.
+
+ If ha_data is not null and storage engine plugin was not locked
+ by thd_set_ha_data() in this connection before, storage engine
+ plugin gets locked.
+
+ If ha_data is null and storage engine plugin was locked by
+ thd_set_ha_data() in this connection before, storage engine
+ plugin lock gets released.
+
+ If handlerton::close_connection() didn't reset ha_data, server does
+ it immediately after calling handlerton::close_connection().
+*/
+void thd_set_ha_data(MYSQL_THD thd, const struct handlerton *hton,
+ const void *ha_data);
+
+/**
+ Interface to remove the per thread openssl error queue.
+ This function is a no-op when openssl is not used.
+*/
+
+void remove_ssl_err_thread_state();
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _my_plugin_h */
diff --git a/contrib/libs/libmysql_r/include/mysql/plugin_auth_common.h b/contrib/libs/libmysql_r/include/mysql/plugin_auth_common.h
new file mode 100644
index 0000000000..84470056cf
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/plugin_auth_common.h
@@ -0,0 +1,182 @@
+#ifndef MYSQL_PLUGIN_AUTH_COMMON_INCLUDED
+/* Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ Without limiting anything contained in the foregoing, this file,
+ which is part of C Driver for MySQL (Connector/C), is also subject to the
+ Universal FOSS Exception, version 1.0, a copy of which can be found at
+ http://oss.oracle.com/licenses/universal-foss-exception.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/mysql/plugin_auth_common.h
+
+ This file defines constants and data structures that are the same for
+ both client- and server-side authentication plugins.
+*/
+#define MYSQL_PLUGIN_AUTH_COMMON_INCLUDED
+
+/** the max allowed length for a user name */
+#define MYSQL_USERNAME_LENGTH 96
+
+/**
+ return values of the plugin authenticate_user() method.
+*/
+
+/**
+ Authentication failed, plugin internal error.
+ An error occurred in the authentication plugin itself.
+ These errors are reported in table performance_schema.host_cache,
+ column COUNT_AUTH_PLUGIN_ERRORS.
+*/
+#define CR_AUTH_PLUGIN_ERROR 3
+/**
+ Authentication failed, client server handshake.
+ An error occurred during the client server handshake.
+ These errors are reported in table performance_schema.host_cache,
+ column COUNT_HANDSHAKE_ERRORS.
+*/
+#define CR_AUTH_HANDSHAKE 2
+/**
+ Authentication failed, user credentials.
+ For example, wrong passwords.
+ These errors are reported in table performance_schema.host_cache,
+ column COUNT_AUTHENTICATION_ERRORS.
+*/
+#define CR_AUTH_USER_CREDENTIALS 1
+/**
+ Authentication failed. Additionally, all other CR_xxx values
+ (libmysql error code) can be used too.
+
+ The client plugin may set the error code and the error message directly
+ in the MYSQL structure and return CR_ERROR. If a CR_xxx specific error
+ code was returned, an error message in the MYSQL structure will be
+ overwritten. If CR_ERROR is returned without setting the error in MYSQL,
+ CR_UNKNOWN_ERROR will be user.
+*/
+#define CR_ERROR 0
+/**
+ Authentication (client part) was successful. It does not mean that the
+ authentication as a whole was successful, usually it only means
+ that the client was able to send the user name and the password to the
+ server. If CR_OK is returned, the libmysql reads the next packet expecting
+ it to be one of OK, ERROR, or CHANGE_PLUGIN packets.
+*/
+#define CR_OK -1
+/**
+ Authentication was successful.
+ It means that the client has done its part successfully and also that
+ a plugin has read the last packet (one of OK, ERROR, CHANGE_PLUGIN).
+ In this case, libmysql will not read a packet from the server,
+ but it will use the data at mysql->net.read_pos.
+
+ A plugin may return this value if the number of roundtrips in the
+ authentication protocol is not known in advance, and the client plugin
+ needs to read one packet more to determine if the authentication is finished
+ or not.
+*/
+#define CR_OK_HANDSHAKE_COMPLETE -2
+
+/**
+Flag to be passed back to server from authentication plugins via
+authenticated_as when proxy mapping should be done by the server.
+*/
+#define PROXY_FLAG 0
+
+/*
+ We need HANDLE definition if on Windows. Define WIN32_LEAN_AND_MEAN (if
+ not already done) to minimize amount of imported declarations.
+*/
+#ifdef _WIN32
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#endif
+
+struct MYSQL_PLUGIN_VIO_INFO {
+ enum {
+ MYSQL_VIO_INVALID,
+ MYSQL_VIO_TCP,
+ MYSQL_VIO_SOCKET,
+ MYSQL_VIO_PIPE,
+ MYSQL_VIO_MEMORY
+ } protocol;
+ int socket; /**< it's set, if the protocol is SOCKET or TCP */
+#ifdef _WIN32
+ HANDLE handle; /**< it's set, if the protocol is PIPE or MEMORY */
+#endif
+};
+
+/* state of an asynchronous operation */
+enum net_async_status {
+ NET_ASYNC_COMPLETE = 0,
+ NET_ASYNC_NOT_READY,
+ NET_ASYNC_ERROR,
+ NET_ASYNC_COMPLETE_NO_MORE_RESULTS
+};
+
+/**
+ Provides plugin access to communication channel
+*/
+typedef struct MYSQL_PLUGIN_VIO {
+ /**
+ Plugin provides a pointer reference and this function sets it to the
+ contents of any incoming packet. Returns the packet length, or -1 if
+ the plugin should terminate.
+ */
+ int (*read_packet)(struct MYSQL_PLUGIN_VIO *vio, unsigned char **buf);
+
+ /**
+ Plugin provides a buffer with data and the length and this
+ function sends it as a packet. Returns 0 on success, 1 on failure.
+ */
+ int (*write_packet)(struct MYSQL_PLUGIN_VIO *vio, const unsigned char *packet,
+ int packet_len);
+
+ /**
+ Fills in a MYSQL_PLUGIN_VIO_INFO structure, providing the information
+ about the connection.
+ */
+ void (*info)(struct MYSQL_PLUGIN_VIO *vio,
+ struct MYSQL_PLUGIN_VIO_INFO *info);
+
+ /**
+ Non blocking version of read_packet. This function points buf to starting
+ position of incoming packet. When this function returns NET_ASYNC_NOT_READY
+ plugin should call this function again until all incoming packets are read.
+ If return code is NET_ASYNC_COMPLETE, plugin can do further processing of
+ read packets.
+ */
+ enum net_async_status (*read_packet_nonblocking)(struct MYSQL_PLUGIN_VIO *vio,
+ unsigned char **buf,
+ int *result);
+ /**
+ Non blocking version of write_packet. Sends data available in pkt of length
+ pkt_len to server in asynchrnous way.
+ */
+ enum net_async_status (*write_packet_nonblocking)(
+ struct MYSQL_PLUGIN_VIO *vio, const unsigned char *pkt, int pkt_len,
+ int *result);
+
+} MYSQL_PLUGIN_VIO;
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/plugin_trace.h b/contrib/libs/libmysql_r/include/mysql/plugin_trace.h
new file mode 100644
index 0000000000..b9fb15ab2b
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/plugin_trace.h
@@ -0,0 +1,322 @@
+/* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef PLUGIN_TRACE_INCLUDED
+#define PLUGIN_TRACE_INCLUDED
+/**
+ @file include/mysql/plugin_trace.h
+
+ Declarations for client-side plugins of type MYSQL_CLIENT_TRACE_PLUGIN.
+
+ See libmysql/mysql_trace.c for a brief description of the client-side
+ protocol tracing infrastructure.
+*/
+
+#include <mysql/client_plugin.h>
+
+/*
+ Lists of protocol stages and trace events
+ =========================================
+
+ These lists are defined with PROTOCOL_STAGE_LIST() and TRACE_EVENT_LIST(),
+ respectively. Macros accept a disposition name as an argument.
+
+ For example, to process list of protocol stages using disposition "foo",
+ define protocol_stage_foo(Stage) macro and then put
+
+ PROTOCOL_STAGE_LIST(foo)
+
+ in your code. This will expand to sequence of protocol_stage_foo(X)
+ macros where X ranges over the list of protocol stages, and these macros
+ should generate the actual code. See below how this technique is used
+ to generate protocol_stage and trace_events enums.
+*/
+
+/**
+ Protocol stages
+ ---------------
+
+ A client following the MySQL protocol goes through several stages of it. Each
+ stage determines what packets can be expected from the server or can be send
+ by the client.
+
+ Upon receiving each trace event, trace plugin will be notified of the current
+ protocol stage so that it can correctly interpret the event.
+
+ These are the possible protocol stages and the transitions between them.
+
+ .. digraph:: protocol_stages
+
+ CONNECTING -> WAIT_FOR_INIT_PACKET;
+ CONNECTING -> DISCONNECTED [ label = "failed connection" ];
+
+ WAIT_FOR_INIT_PACKET -> AUTHENTICATE;
+ WAIT_FOR_INIT_PACKET -> SSL_NEGOTIATION -> AUTHENTICATE;
+
+ AUTHENTICATE -> READY_FOR_COMMAND [ label = "accepted" ];
+ AUTHENTICATE -> DISCONNECTED [ label = "rejected" ];
+
+ READY_FOR_COMMAND -> DISCONNECTED [ label = "COM_QUIT" ];
+ READY_FOR_COMMAND -> AUTHENTICATE [ label="after change user" ];
+ READY_FOR_COMMAND -> WAIT_FOR_PACKET
+ [ label="wait for a single packet after, e.g., COM_STATISTICS" ];
+ READY_FOR_COMMAND -> WAIT_FOR_RESULT;
+ READY_FOR_COMMAND -> WAIT_FOR_PS_DESCRIPTION
+ [ label="after prepare command" ];
+
+ WAIT_FOR_PACKET -> READY_FOR_COMAND;
+
+ WAIT_FOR_RESULT -> READY_FOR_COMMAND [ label="simple reply" ];
+ WAIT_FOR_RESULT -> WAIT_FOR_FIELD_DEF;
+ WAIT_FOR_RESULT -> FILE_REQUEST;
+
+ WAIT_FOR_FIELD_DEF -> WAIT_FOR_ROW [ label="in a resultset" ];
+ WAIT_FOR_FIELD_DEF -> READY_FOR_COMMAND
+ [ label="after describe table or prepare command" ];
+
+ WAIT_FOR_ROW -> READY_FOR_COMMAND;
+ WAIT_FOR_ROW -> WAIT_FOR_RESULT [ label="multi-resultset" ];
+
+ WAIT_FOR_PS_DESCRIPTION -> WAIT_FOR_PARAM_DEF;
+ WAIT_FOR_PS_DESCRIPTION -> READY_FOR_COMMAND
+ [ label="no params and result" ];
+ WAIT_FOR_PS_DESCRIPTION -> WAIT_FOR_FIELD_DEF [ label="no params" ];
+
+ WAIT_FOR_PARAM_DEF -> WAIT_FOR_FIELD_DEF;
+ WAIT_FOR_PARAM_DEF -> READY_FOR_COMMAND [ label="no result" ];
+
+ FILE_REQUEST -> WAIT_FOR_RESULT [label="when whole file sent"];
+*/
+
+#define PROTOCOL_STAGE_LIST(X) \
+ protocol_stage_##X(CONNECTING) protocol_stage_##X(WAIT_FOR_INIT_PACKET) \
+ protocol_stage_##X(AUTHENTICATE) protocol_stage_##X(SSL_NEGOTIATION) \
+ protocol_stage_##X(READY_FOR_COMMAND) \
+ protocol_stage_##X(WAIT_FOR_PACKET) \
+ protocol_stage_##X(WAIT_FOR_RESULT) \
+ protocol_stage_##X(WAIT_FOR_FIELD_DEF) \
+ protocol_stage_##X(WAIT_FOR_ROW) \
+ protocol_stage_##X(FILE_REQUEST) \
+ protocol_stage_##X(WAIT_FOR_PS_DESCRIPTION) \
+ protocol_stage_##X(WAIT_FOR_PARAM_DEF) \
+ protocol_stage_##X(DISCONNECTED)
+
+/**
+ Trace events
+ ------------
+
+ The following events are generated during the various stages of the
+ client-server conversation.
+
+ ---------------------- -----------------------------------------------------
+ Connection events
+ ---------------------- -----------------------------------------------------
+ CONNECTING Client is connecting to the server.
+ CONNECTED Physical connection has been established.
+ DISCONNECTED Connection with server was broken.
+ ---------------------- -----------------------------------------------------
+ SSL events
+ ---------------------- -----------------------------------------------------
+ SEND_SSL_REQUEST Client is sending SSL connection request.
+ SSL_CONNECT Client is initiating SSL handshake.
+ SSL_CONNECTED SSL connection has been established.
+ ---------------------- -----------------------------------------------------
+ Authentication events
+ ---------------------- -----------------------------------------------------
+ CHALLENGE_RECEIVED Client received authentication challenge.
+ AUTH_PLUGIN Client selects an authentication plugin to be used
+ in the following authentication exchange.
+ SEND_AUTH_RESPONSE Client sends response to the authentication
+ challenge.
+ SEND_AUTH_DATA Client sends extra authentication data packet.
+ AUTHENTICATED Server has accepted connection.
+ ---------------------- -----------------------------------------------------
+ Command phase events
+ ---------------------- -----------------------------------------------------
+ SEND_COMMAND Client is sending a command to the server.
+ SEND_FILE Client is sending local file contents to the server.
+ ---------------------- -----------------------------------------------------
+ General events
+ ---------------------- -----------------------------------------------------
+ READ_PACKET Client starts waiting for a packet from server.
+ PACKET_RECEIVED A packet from server has been received.
+ PACKET_SENT After successful sending of a packet to the server.
+ ERROR Client detected an error.
+ ---------------------- -----------------------------------------------------
+*/
+
+#define TRACE_EVENT_LIST(X) \
+ trace_event_##X(ERROR) trace_event_##X(CONNECTING) trace_event_##X( \
+ CONNECTED) trace_event_##X(DISCONNECTED) \
+ trace_event_##X(SEND_SSL_REQUEST) trace_event_##X(SSL_CONNECT) \
+ trace_event_##X(SSL_CONNECTED) trace_event_##X(INIT_PACKET_RECEIVED) \
+ trace_event_##X(AUTH_PLUGIN) trace_event_##X(SEND_AUTH_RESPONSE) \
+ trace_event_##X(SEND_AUTH_DATA) \
+ trace_event_##X(AUTHENTICATED) \
+ trace_event_##X(SEND_COMMAND) \
+ trace_event_##X(SEND_FILE) \
+ trace_event_##X(READ_PACKET) \
+ trace_event_##X(PACKET_RECEIVED) \
+ trace_event_##X(PACKET_SENT)
+
+/**
+ Some trace events have additional arguments. These are stored in
+ st_trace_event_args structure. Various events store their arguments in the
+ structure as follows. Unused members are set to 0/NULL.
+
+ AUTH_PLUGIN
+ ------------- ----------------------------------
+ plugin_name the name of the plugin
+ ------------- ----------------------------------
+
+ SEND_COMMAND
+ ------------- ----------------------------------
+ cmd the command code
+ hdr pointer to command packet header
+ hdr_len length of the header
+ pkt pointer to command arguments
+ pkt_len length of arguments
+ ------------- ----------------------------------
+
+ Other SEND_* and *_RECEIVED events
+ ------------- ----------------------------------
+ pkt the data sent or received
+ pkt_len length of the data
+ ------------- ----------------------------------
+
+ PACKET_SENT
+ ------------- ----------------------------------
+ pkt_len number of bytes sent
+ ------------- ----------------------------------
+*/
+
+struct st_trace_event_args {
+ const char *plugin_name;
+ int cmd;
+ const unsigned char *hdr;
+ size_t hdr_len;
+ const unsigned char *pkt;
+ size_t pkt_len;
+};
+
+/* Definitions of protocol_stage and trace_event enums. */
+
+#define protocol_stage_enum(X) PROTOCOL_STAGE_##X,
+
+enum protocol_stage { PROTOCOL_STAGE_LIST(enum) PROTOCOL_STAGE_LAST };
+
+#define trace_event_enum(X) TRACE_EVENT_##X,
+
+enum trace_event { TRACE_EVENT_LIST(enum) TRACE_EVENT_LAST };
+
+/*
+ Trace plugin methods
+ ====================
+*/
+
+struct st_mysql_client_plugin_TRACE;
+struct MYSQL;
+
+/**
+ Trace plugin tracing_start() method.
+
+ Called when tracing with this plugin starts on a connection. A trace
+ plugin might want to maintain per-connection information. It can
+ return a pointer to memory area holding such information. It will be
+ stored in a connection handle and passed to other plugin methods.
+
+ @param self pointer to the plugin instance
+ @param connection_handle Session
+ @param stage protocol stage in which tracing has started - currently
+ it is always CONNECTING stage.
+
+ @return A pointer to plugin-specific, per-connection data if any.
+*/
+
+typedef void *(tracing_start_callback)(
+ struct st_mysql_client_plugin_TRACE *self, MYSQL *connection_handle,
+ enum protocol_stage stage);
+
+/**
+ Trace plugin tracing_stop() method.
+
+ Called when tracing of the connection has ended. If a plugin
+ allocated any per-connection resources, it should de-allocate them
+ here.
+
+ @param self pointer to the plugin instance
+ @param connection_handle Session
+ @param plugin_data pointer to plugin's per-connection data.
+*/
+
+typedef void(tracing_stop_callback)(struct st_mysql_client_plugin_TRACE *self,
+ MYSQL *connection_handle,
+ void *plugin_data);
+
+/**
+ Trace plugin trace_event() method.
+
+ Called when a trace event occurs. Plugin can decide to stop tracing
+ this connection by returning non-zero value.
+
+ @param self pointer to the plugin instance
+ @param plugin_data pointer to plugin's per-connection data
+ @param connection_handle Session
+ @param stage current protocol stage
+ @param event the trace event
+ @param args trace event arguments
+
+ @return Non-zero if tracing of the connection should end here.
+*/
+
+typedef int(trace_event_handler)(struct st_mysql_client_plugin_TRACE *self,
+ void *plugin_data, MYSQL *connection_handle,
+ enum protocol_stage stage,
+ enum trace_event event,
+ struct st_trace_event_args args);
+
+struct st_mysql_client_plugin_TRACE {
+ MYSQL_CLIENT_PLUGIN_HEADER
+ tracing_start_callback *tracing_start;
+ tracing_stop_callback *tracing_stop;
+ trace_event_handler *trace_event;
+};
+
+/**
+ The global trace_plugin pointer. If it is not NULL, it points at a
+ loaded trace plugin which should be used to trace all connections made
+ to the server.
+*/
+extern struct st_mysql_client_plugin_TRACE *trace_plugin;
+
+#ifndef DBUG_OFF
+
+/*
+ Functions for getting names of trace events and protocol
+ stages for debugging purposes.
+*/
+const char *protocol_stage_name(enum protocol_stage stage);
+const char *trace_event_name(enum trace_event ev);
+
+#endif
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/mysql_cond.h b/contrib/libs/libmysql_r/include/mysql/psi/mysql_cond.h
new file mode 100644
index 0000000000..44e7904303
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/mysql_cond.h
@@ -0,0 +1,274 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_COND_H
+#define MYSQL_COND_H
+
+/**
+ @file include/mysql/psi/mysql_cond.h
+ Instrumentation helpers for conditions.
+*/
+
+#include "mysql/components/services/mysql_cond_bits.h"
+#include "mysql/psi/mysql_mutex.h"
+#include "mysql/psi/psi_cond.h"
+#include "thr_cond.h"
+#ifdef MYSQL_SERVER
+#ifndef MYSQL_DYNAMIC_PLUGIN
+#error #include "pfs_cond_provider.h"
+#endif
+#endif
+
+#ifndef PSI_COND_CALL
+#define PSI_COND_CALL(M) psi_cond_service->M
+#endif
+
+/**
+ @defgroup psi_api_cond Cond Instrumentation (API)
+ @ingroup psi_api
+ @{
+*/
+
+#ifndef DISABLE_MYSQL_THREAD_H
+
+/**
+ @def mysql_cond_register(P1, P2, P3)
+ Cond registration.
+*/
+#define mysql_cond_register(P1, P2, P3) inline_mysql_cond_register(P1, P2, P3)
+
+/**
+ @def mysql_cond_init(K, C)
+ Instrumented cond_init.
+ @c mysql_cond_init is a replacement for @c pthread_cond_init.
+ Note that pthread_condattr_t is not supported in MySQL.
+ @param C The cond to initialize
+ @param K The PSI_cond_key for this instrumented cond
+
+*/
+
+#define mysql_cond_init(K, C) mysql_cond_init_with_src(K, C, __FILE__, __LINE__)
+
+#define mysql_cond_init_with_src(K, C, F, L) inline_mysql_cond_init(K, C, F, L)
+
+/**
+ @def mysql_cond_destroy(C)
+ Instrumented cond_destroy.
+ @c mysql_cond_destroy is a drop-in replacement for @c pthread_cond_destroy.
+*/
+#define mysql_cond_destroy(C) mysql_cond_destroy_with_src(C, __FILE__, __LINE__)
+
+#define mysql_cond_destroy_with_src(C, F, L) inline_mysql_cond_destroy(C, F, L)
+
+/**
+ @def mysql_cond_wait(C)
+ Instrumented cond_wait.
+ @c mysql_cond_wait is a drop-in replacement for @c native_cond_wait.
+*/
+#define mysql_cond_wait(C, M) mysql_cond_wait_with_src(C, M, __FILE__, __LINE__)
+
+#define mysql_cond_wait_with_src(C, M, F, L) inline_mysql_cond_wait(C, M, F, L)
+
+/**
+ @def mysql_cond_timedwait(C, M, W)
+ Instrumented cond_timedwait.
+ @c mysql_cond_timedwait is a drop-in replacement
+ for @c native_cond_timedwait.
+*/
+
+#define mysql_cond_timedwait(C, M, W) \
+ mysql_cond_timedwait_with_src(C, M, W, __FILE__, __LINE__)
+
+#define mysql_cond_timedwait_with_src(C, M, W, F, L) \
+ inline_mysql_cond_timedwait(C, M, W, F, L)
+
+/**
+ @def mysql_cond_signal(C)
+ Instrumented cond_signal.
+ @c mysql_cond_signal is a drop-in replacement for @c pthread_cond_signal.
+*/
+
+#define mysql_cond_signal(C) mysql_cond_signal_with_src(C, __FILE__, __LINE__)
+
+#define mysql_cond_signal_with_src(C, F, L) inline_mysql_cond_signal(C, F, L)
+
+/**
+ @def mysql_cond_broadcast(C)
+ Instrumented cond_broadcast.
+ @c mysql_cond_broadcast is a drop-in replacement
+ for @c pthread_cond_broadcast.
+*/
+#define mysql_cond_broadcast(C) \
+ mysql_cond_broadcast_with_src(C, __FILE__, __LINE__)
+
+#define mysql_cond_broadcast_with_src(C, F, L) \
+ inline_mysql_cond_broadcast(C, F, L)
+
+static inline void inline_mysql_cond_register(
+ const char *category MY_ATTRIBUTE((unused)),
+ PSI_cond_info *info MY_ATTRIBUTE((unused)),
+ int count MY_ATTRIBUTE((unused))) {
+#ifdef HAVE_PSI_COND_INTERFACE
+ PSI_COND_CALL(register_cond)(category, info, count);
+#endif
+}
+
+static inline int inline_mysql_cond_init(
+ PSI_cond_key key MY_ATTRIBUTE((unused)), mysql_cond_t *that,
+ const char *src_file MY_ATTRIBUTE((unused)),
+ int src_line MY_ATTRIBUTE((unused))) {
+#ifdef HAVE_PSI_COND_INTERFACE
+ that->m_psi = PSI_COND_CALL(init_cond)(key, &that->m_cond);
+#else
+ that->m_psi = NULL;
+#endif
+ return native_cond_init(&that->m_cond);
+}
+
+static inline int inline_mysql_cond_destroy(
+ mysql_cond_t *that, const char *src_file MY_ATTRIBUTE((unused)),
+ int src_line MY_ATTRIBUTE((unused))) {
+#ifdef HAVE_PSI_COND_INTERFACE
+ if (that->m_psi != NULL) {
+ PSI_COND_CALL(destroy_cond)(that->m_psi);
+ that->m_psi = NULL;
+ }
+#endif
+ return native_cond_destroy(&that->m_cond);
+}
+
+static inline int inline_mysql_cond_wait(
+ mysql_cond_t *that, mysql_mutex_t *mutex,
+ const char *src_file MY_ATTRIBUTE((unused)),
+ int src_line MY_ATTRIBUTE((unused))) {
+ int result;
+
+#ifdef HAVE_PSI_COND_INTERFACE
+ if (that->m_psi != NULL) {
+ /* Instrumentation start */
+ PSI_cond_locker *locker;
+ PSI_cond_locker_state state;
+ locker = PSI_COND_CALL(start_cond_wait)(&state, that->m_psi, mutex->m_psi,
+ PSI_COND_WAIT, src_file, src_line);
+
+ /* Instrumented code */
+ result = my_cond_wait(&that->m_cond, &mutex->m_mutex
+#ifdef SAFE_MUTEX
+ ,
+ src_file, src_line
+#endif
+ );
+
+ /* Instrumentation end */
+ if (locker != NULL) {
+ PSI_COND_CALL(end_cond_wait)(locker, result);
+ }
+
+ return result;
+ }
+#endif
+
+ /* Non instrumented code */
+ result = my_cond_wait(&that->m_cond, &mutex->m_mutex
+#ifdef SAFE_MUTEX
+ ,
+ src_file, src_line
+#endif
+ );
+
+ return result;
+}
+
+static inline int inline_mysql_cond_timedwait(
+ mysql_cond_t *that, mysql_mutex_t *mutex, const struct timespec *abstime,
+ const char *src_file MY_ATTRIBUTE((unused)),
+ int src_line MY_ATTRIBUTE((unused))) {
+ int result;
+
+#ifdef HAVE_PSI_COND_INTERFACE
+ if (that->m_psi != NULL) {
+ /* Instrumentation start */
+ PSI_cond_locker *locker;
+ PSI_cond_locker_state state;
+ locker =
+ PSI_COND_CALL(start_cond_wait)(&state, that->m_psi, mutex->m_psi,
+ PSI_COND_TIMEDWAIT, src_file, src_line);
+
+ /* Instrumented code */
+ result = my_cond_timedwait(&that->m_cond, &mutex->m_mutex, abstime
+#ifdef SAFE_MUTEX
+ ,
+ src_file, src_line
+#endif
+ );
+
+ /* Instrumentation end */
+ if (locker != NULL) {
+ PSI_COND_CALL(end_cond_wait)(locker, result);
+ }
+
+ return result;
+ }
+#endif
+
+ /* Non instrumented code */
+ result = my_cond_timedwait(&that->m_cond, &mutex->m_mutex, abstime
+#ifdef SAFE_MUTEX
+ ,
+ src_file, src_line
+#endif
+ );
+
+ return result;
+}
+
+static inline int inline_mysql_cond_signal(
+ mysql_cond_t *that, const char *src_file MY_ATTRIBUTE((unused)),
+ int src_line MY_ATTRIBUTE((unused))) {
+ int result;
+#ifdef HAVE_PSI_COND_INTERFACE
+ if (that->m_psi != NULL) {
+ PSI_COND_CALL(signal_cond)(that->m_psi);
+ }
+#endif
+ result = native_cond_signal(&that->m_cond);
+ return result;
+}
+
+static inline int inline_mysql_cond_broadcast(
+ mysql_cond_t *that, const char *src_file MY_ATTRIBUTE((unused)),
+ int src_line MY_ATTRIBUTE((unused))) {
+ int result;
+#ifdef HAVE_PSI_COND_INTERFACE
+ if (that->m_psi != NULL) {
+ PSI_COND_CALL(broadcast_cond)(that->m_psi);
+ }
+#endif
+ result = native_cond_broadcast(&that->m_cond);
+ return result;
+}
+
+#endif /* DISABLE_MYSQL_THREAD_H */
+
+/** @} (end of group psi_api_cond) */
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/mysql_file.h b/contrib/libs/libmysql_r/include/mysql/psi/mysql_file.h
new file mode 100644
index 0000000000..8eed4f7355
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/mysql_file.h
@@ -0,0 +1,1325 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/mysql/psi/mysql_file.h
+ Instrumentation helpers for mysys file io.
+ This header file provides the necessary declarations
+ to use the mysys file API with the performance schema instrumentation.
+ In some compilers (SunStudio), 'static inline' functions, when declared
+ but not used, are not optimized away (because they are unused) by default,
+ so that including a static inline function from a header file does
+ create unwanted dependencies, causing unresolved symbols at link time.
+ Other compilers, like gcc, optimize these dependencies by default.
+
+ Since the instrumented APIs declared here are wrapper on top
+ of mysys file io APIs, including mysql/psi/mysql_file.h assumes that
+ the dependency on my_sys already exists.
+*/
+
+#ifndef MYSQL_FILE_H
+#define MYSQL_FILE_H
+
+/* For strlen() */
+#include <string.h>
+
+#include "my_dbug.h"
+/* For MY_STAT */
+#include "my_dir.h"
+/* For my_chsize */
+#include "my_sys.h"
+#include "mysql/psi/psi_file.h"
+#include "mysql/service_mysql_alloc.h"
+#include "pfs_file_provider.h"
+
+#ifndef PSI_FILE_CALL
+#define PSI_FILE_CALL(M) psi_file_service->M
+#endif
+
+/**
+ @defgroup psi_api_file File Instrumentation (API)
+ @ingroup psi_api
+ @{
+*/
+
+/**
+ @def mysql_file_register(P1, P2, P3)
+ File registration.
+*/
+#define mysql_file_register(P1, P2, P3) inline_mysql_file_register(P1, P2, P3)
+
+/**
+ @def mysql_file_fgets(P1, P2, F)
+ Instrumented fgets.
+ @c mysql_file_fgets is a replacement for @c fgets.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_fgets(P1, P2, F) \
+ inline_mysql_file_fgets(__FILE__, __LINE__, P1, P2, F)
+#else
+#define mysql_file_fgets(P1, P2, F) inline_mysql_file_fgets(P1, P2, F)
+#endif
+
+/**
+ @def mysql_file_fgetc(F)
+ Instrumented fgetc.
+ @c mysql_file_fgetc is a replacement for @c fgetc.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_fgetc(F) inline_mysql_file_fgetc(__FILE__, __LINE__, F)
+#else
+#define mysql_file_fgetc(F) inline_mysql_file_fgetc(F)
+#endif
+
+/**
+ @def mysql_file_fputs(P1, F)
+ Instrumented fputs.
+ @c mysql_file_fputs is a replacement for @c fputs.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_fputs(P1, F) \
+ inline_mysql_file_fputs(__FILE__, __LINE__, P1, F)
+#else
+#define mysql_file_fputs(P1, F) inline_mysql_file_fputs(P1, F)
+#endif
+
+/**
+ @def mysql_file_fputc(P1, F)
+ Instrumented fputc.
+ @c mysql_file_fputc is a replacement for @c fputc.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_fputc(P1, F) \
+ inline_mysql_file_fputc(__FILE__, __LINE__, P1, F)
+#else
+#define mysql_file_fputc(P1, F) inline_mysql_file_fputc(P1, F)
+#endif
+
+/**
+ @def mysql_file_fprintf
+ Instrumented fprintf.
+ @c mysql_file_fprintf is a replacement for @c fprintf.
+*/
+#define mysql_file_fprintf inline_mysql_file_fprintf
+
+/**
+ @def mysql_file_vfprintf(F, P1, P2)
+ Instrumented vfprintf.
+ @c mysql_file_vfprintf is a replacement for @c vfprintf.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_vfprintf(F, P1, P2) \
+ inline_mysql_file_vfprintf(__FILE__, __LINE__, F, P1, P2)
+#else
+#define mysql_file_vfprintf(F, P1, P2) inline_mysql_file_vfprintf(F, P1, P2)
+#endif
+
+/**
+ @def mysql_file_fflush(F, P1, P2)
+ Instrumented fflush.
+ @c mysql_file_fflush is a replacement for @c fflush.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_fflush(F) inline_mysql_file_fflush(__FILE__, __LINE__, F)
+#else
+#define mysql_file_fflush(F) inline_mysql_file_fflush(F)
+#endif
+
+/**
+ @def mysql_file_feof(F)
+ Instrumented feof.
+ @c mysql_file_feof is a replacement for @c feof.
+*/
+#define mysql_file_feof(F) inline_mysql_file_feof(F)
+
+/**
+ @def mysql_file_fstat(FN, S)
+ Instrumented fstat.
+ @c mysql_file_fstat is a replacement for @c my_fstat.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_fstat(FN, S) \
+ inline_mysql_file_fstat(__FILE__, __LINE__, FN, S)
+#else
+#define mysql_file_fstat(FN, S) inline_mysql_file_fstat(FN, S)
+#endif
+
+/**
+ @def mysql_file_stat(K, FN, S, FL)
+ Instrumented stat.
+ @c mysql_file_stat is a replacement for @c my_stat.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_stat(K, FN, S, FL) \
+ inline_mysql_file_stat(K, __FILE__, __LINE__, FN, S, FL)
+#else
+#define mysql_file_stat(K, FN, S, FL) inline_mysql_file_stat(FN, S, FL)
+#endif
+
+/**
+ @def mysql_file_chsize(F, P1, P2, P3)
+ Instrumented chsize.
+ @c mysql_file_chsize is a replacement for @c my_chsize.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_chsize(F, P1, P2, P3) \
+ inline_mysql_file_chsize(__FILE__, __LINE__, F, P1, P2, P3)
+#else
+#define mysql_file_chsize(F, P1, P2, P3) inline_mysql_file_chsize(F, P1, P2, P3)
+#endif
+
+/**
+ @def mysql_file_fopen(K, N, F1, F2)
+ Instrumented fopen.
+ @c mysql_file_fopen is a replacement for @c my_fopen.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_fopen(K, N, F1, F2) \
+ inline_mysql_file_fopen(K, __FILE__, __LINE__, N, F1, F2)
+#else
+#define mysql_file_fopen(K, N, F1, F2) inline_mysql_file_fopen(N, F1, F2)
+#endif
+
+/**
+ @def mysql_file_fclose(FD, FL)
+ Instrumented fclose.
+ @c mysql_file_fclose is a replacement for @c my_fclose.
+ Without the instrumentation, this call will have the same behavior as the
+ undocumented and possibly platform specific my_fclose(NULL, ...) behavior.
+ With the instrumentation, mysql_fclose(NULL, ...) will safely return 0,
+ which is an extension compared to my_fclose and is therefore compliant.
+ mysql_fclose is on purpose *not* implementing
+ @code DBUG_ASSERT(file != NULL) @endcode,
+ since doing so could introduce regressions.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_fclose(FD, FL) \
+ inline_mysql_file_fclose(__FILE__, __LINE__, FD, FL)
+#else
+#define mysql_file_fclose(FD, FL) inline_mysql_file_fclose(FD, FL)
+#endif
+
+/**
+ @def mysql_file_fread(FD, P1, P2, P3)
+ Instrumented fread.
+ @c mysql_file_fread is a replacement for @c my_fread.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_fread(FD, P1, P2, P3) \
+ inline_mysql_file_fread(__FILE__, __LINE__, FD, P1, P2, P3)
+#else
+#define mysql_file_fread(FD, P1, P2, P3) inline_mysql_file_fread(FD, P1, P2, P3)
+#endif
+
+/**
+ @def mysql_file_fwrite(FD, P1, P2, P3)
+ Instrumented fwrite.
+ @c mysql_file_fwrite is a replacement for @c my_fwrite.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_fwrite(FD, P1, P2, P3) \
+ inline_mysql_file_fwrite(__FILE__, __LINE__, FD, P1, P2, P3)
+#else
+#define mysql_file_fwrite(FD, P1, P2, P3) \
+ inline_mysql_file_fwrite(FD, P1, P2, P3)
+#endif
+
+/**
+ @def mysql_file_fseek(FD, P, W)
+ Instrumented fseek.
+ @c mysql_file_fseek is a replacement for @c my_fseek.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_fseek(FD, P, W) \
+ inline_mysql_file_fseek(__FILE__, __LINE__, FD, P, W)
+#else
+#define mysql_file_fseek(FD, P, W) inline_mysql_file_fseek(FD, P, W)
+#endif
+
+/**
+ @def mysql_file_ftell(FD)
+ Instrumented ftell.
+ @c mysql_file_ftell is a replacement for @c my_ftell.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_ftell(FD) inline_mysql_file_ftell(__FILE__, __LINE__, FD)
+#else
+#define mysql_file_ftell(FD) inline_mysql_file_ftell(FD)
+#endif
+
+/**
+ @def mysql_file_create(K, N, F1, F2, F3)
+ Instrumented create.
+ @c mysql_file_create is a replacement for @c my_create.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_create(K, N, F1, F2, F3) \
+ inline_mysql_file_create(K, __FILE__, __LINE__, N, F1, F2, F3)
+#else
+#define mysql_file_create(K, N, F1, F2, F3) \
+ inline_mysql_file_create(N, F1, F2, F3)
+#endif
+
+/**
+ @def mysql_file_create_temp(K, T, D, P, M, U, F)
+ Instrumented create_temp_file.
+ @c mysql_file_create_temp is a replacement for @c create_temp_file.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_create_temp(K, T, D, P, M, U, F) \
+ inline_mysql_file_create_temp(K, __FILE__, __LINE__, T, D, P, M, U, F)
+#else
+#define mysql_file_create_temp(K, T, D, P, M, U, F) \
+ inline_mysql_file_create_temp(T, D, P, M, U, F)
+#endif
+
+/**
+ @def mysql_file_open(K, N, F1, F2)
+ Instrumented open.
+ @c mysql_file_open is a replacement for @c my_open.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_open(K, N, F1, F2) \
+ inline_mysql_file_open(K, __FILE__, __LINE__, N, F1, F2)
+#else
+#define mysql_file_open(K, N, F1, F2) inline_mysql_file_open(N, F1, F2)
+#endif
+
+/**
+ @def mysql_file_close(FD, F)
+ Instrumented close.
+ @c mysql_file_close is a replacement for @c my_close.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_close(FD, F) \
+ inline_mysql_file_close(__FILE__, __LINE__, FD, F)
+#else
+#define mysql_file_close(FD, F) inline_mysql_file_close(FD, F)
+#endif
+
+/**
+ @def mysql_file_read(FD, B, S, F)
+ Instrumented read.
+ @c mysql_read is a replacement for @c my_read.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_read(FD, B, S, F) \
+ inline_mysql_file_read(__FILE__, __LINE__, FD, B, S, F)
+#else
+#define mysql_file_read(FD, B, S, F) inline_mysql_file_read(FD, B, S, F)
+#endif
+
+/**
+ @def mysql_file_write(FD, B, S, F)
+ Instrumented write.
+ @c mysql_file_write is a replacement for @c my_write.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_write(FD, B, S, F) \
+ inline_mysql_file_write(__FILE__, __LINE__, FD, B, S, F)
+#else
+#define mysql_file_write(FD, B, S, F) inline_mysql_file_write(FD, B, S, F)
+#endif
+
+/**
+ @def mysql_file_pread(FD, B, S, O, F)
+ Instrumented pread.
+ @c mysql_pread is a replacement for @c my_pread.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_pread(FD, B, S, O, F) \
+ inline_mysql_file_pread(__FILE__, __LINE__, FD, B, S, O, F)
+#else
+#define mysql_file_pread(FD, B, S, O, F) inline_mysql_file_pread(FD, B, S, O, F)
+#endif
+
+/**
+ @def mysql_file_pwrite(FD, B, S, O, F)
+ Instrumented pwrite.
+ @c mysql_file_pwrite is a replacement for @c my_pwrite.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_pwrite(FD, B, S, O, F) \
+ inline_mysql_file_pwrite(__FILE__, __LINE__, FD, B, S, O, F)
+#else
+#define mysql_file_pwrite(FD, B, S, O, F) \
+ inline_mysql_file_pwrite(FD, B, S, O, F)
+#endif
+
+/**
+ @def mysql_file_seek(FD, P, W, F)
+ Instrumented seek.
+ @c mysql_file_seek is a replacement for @c my_seek.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_seek(FD, P, W, F) \
+ inline_mysql_file_seek(__FILE__, __LINE__, FD, P, W, F)
+#else
+#define mysql_file_seek(FD, P, W, F) inline_mysql_file_seek(FD, P, W, F)
+#endif
+
+/**
+ @def mysql_file_tell(FD, F)
+ Instrumented tell.
+ @c mysql_file_tell is a replacement for @c my_tell.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_tell(FD, F) inline_mysql_file_tell(__FILE__, __LINE__, FD, F)
+#else
+#define mysql_file_tell(FD, F) inline_mysql_file_tell(FD, F)
+#endif
+
+/**
+ @def mysql_file_delete(K, P1, P2)
+ Instrumented delete.
+ @c mysql_file_delete is a replacement for @c my_delete.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_delete(K, P1, P2) \
+ inline_mysql_file_delete(K, __FILE__, __LINE__, P1, P2)
+#else
+#define mysql_file_delete(K, P1, P2) inline_mysql_file_delete(P1, P2)
+#endif
+
+/**
+ @def mysql_file_rename(K, P1, P2, P3)
+ Instrumented rename.
+ @c mysql_file_rename is a replacement for @c my_rename.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_rename(K, P1, P2, P3) \
+ inline_mysql_file_rename(K, __FILE__, __LINE__, P1, P2, P3)
+#else
+#define mysql_file_rename(K, P1, P2, P3) inline_mysql_file_rename(P1, P2, P3)
+#endif
+
+/**
+ @def mysql_file_create_with_symlink(K, P1, P2, P3, P4, P5)
+ Instrumented create with symbolic link.
+ @c mysql_file_create_with_symlink is a replacement
+ for @c my_create_with_symlink.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_create_with_symlink(K, P1, P2, P3, P4, P5) \
+ inline_mysql_file_create_with_symlink(K, __FILE__, __LINE__, P1, P2, P3, P4, \
+ P5)
+#else
+#define mysql_file_create_with_symlink(K, P1, P2, P3, P4, P5) \
+ inline_mysql_file_create_with_symlink(P1, P2, P3, P4, P5)
+#endif
+
+/**
+ @def mysql_file_delete_with_symlink(K, P1, P2)
+ Instrumented delete with symbolic link.
+ @c mysql_file_delete_with_symlink is a replacement
+ for @c my_delete_with_symlink.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_delete_with_symlink(K, P1, P2) \
+ inline_mysql_file_delete_with_symlink(K, __FILE__, __LINE__, P1, P2)
+#else
+#define mysql_file_delete_with_symlink(K, P1, P2) \
+ inline_mysql_file_delete_with_symlink(P1, P2)
+#endif
+
+/**
+ @def mysql_file_rename_with_symlink(K, P1, P2, P3)
+ Instrumented rename with symbolic link.
+ @c mysql_file_rename_with_symlink is a replacement
+ for @c my_rename_with_symlink.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_rename_with_symlink(K, P1, P2, P3) \
+ inline_mysql_file_rename_with_symlink(K, __FILE__, __LINE__, P1, P2, P3)
+#else
+#define mysql_file_rename_with_symlink(K, P1, P2, P3) \
+ inline_mysql_file_rename_with_symlink(P1, P2, P3)
+#endif
+
+/**
+ @def mysql_file_sync(P1, P2)
+ Instrumented file sync.
+ @c mysql_file_sync is a replacement for @c my_sync.
+*/
+#ifdef HAVE_PSI_FILE_INTERFACE
+#define mysql_file_sync(P1, P2) \
+ inline_mysql_file_sync(__FILE__, __LINE__, P1, P2)
+#else
+#define mysql_file_sync(P1, P2) inline_mysql_file_sync(P1, P2)
+#endif
+
+/**
+ An instrumented FILE structure.
+ @c MYSQL_FILE is a drop-in replacement for @c FILE.
+ @sa mysql_file_open
+*/
+struct MYSQL_FILE {
+ /** The real file. */
+ FILE *m_file;
+ /**
+ The instrumentation hook.
+ Note that this hook is not conditionally defined,
+ for binary compatibility of the @c MYSQL_FILE interface.
+ */
+ struct PSI_file *m_psi;
+};
+
+static inline void inline_mysql_file_register(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ const char *category, PSI_file_info *info, int count
+#else
+ const char *category MY_ATTRIBUTE((unused)),
+ void *info MY_ATTRIBUTE((unused)), int count MY_ATTRIBUTE((unused))
+#endif
+) {
+#ifdef HAVE_PSI_FILE_INTERFACE
+ PSI_FILE_CALL(register_file)(category, info, count);
+#endif
+}
+
+static inline char *inline_mysql_file_fgets(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ char *str, int size, MYSQL_FILE *file) {
+ char *result;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ locker = PSI_FILE_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
+ PSI_FILE_READ);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t)size, src_file, src_line);
+ result = fgets(str, size, file->m_file);
+ PSI_FILE_CALL(end_file_wait)(locker, result ? strlen(result) : 0);
+ return result;
+ }
+#endif
+
+ result = fgets(str, size, file->m_file);
+ return result;
+}
+
+static inline int inline_mysql_file_fgetc(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_FILE *file) {
+ int result;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ locker = PSI_FILE_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
+ PSI_FILE_READ);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t)1, src_file, src_line);
+ result = fgetc(file->m_file);
+ PSI_FILE_CALL(end_file_wait)(locker, (size_t)1);
+ return result;
+ }
+#endif
+
+ result = fgetc(file->m_file);
+ return result;
+}
+
+static inline int inline_mysql_file_fputs(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ const char *str, MYSQL_FILE *file) {
+ int result;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ size_t bytes;
+ locker = PSI_FILE_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
+ PSI_FILE_WRITE);
+ if (likely(locker != NULL)) {
+ bytes = str ? strlen(str) : 0;
+ PSI_FILE_CALL(start_file_wait)(locker, bytes, src_file, src_line);
+ result = fputs(str, file->m_file);
+ PSI_FILE_CALL(end_file_wait)(locker, bytes);
+ return result;
+ }
+#endif
+
+ result = fputs(str, file->m_file);
+ return result;
+}
+
+static inline int inline_mysql_file_fputc(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ char c, MYSQL_FILE *file) {
+ int result;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ locker = PSI_FILE_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
+ PSI_FILE_WRITE);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t)1, src_file, src_line);
+ result = fputc(c, file->m_file);
+ PSI_FILE_CALL(end_file_wait)(locker, (size_t)1);
+ return result;
+ }
+#endif
+
+ result = fputc(c, file->m_file);
+ return result;
+}
+
+static inline int inline_mysql_file_fprintf(MYSQL_FILE *file,
+ const char *format, ...)
+ MY_ATTRIBUTE((format(printf, 2, 3)));
+
+static inline int inline_mysql_file_fprintf(MYSQL_FILE *file,
+ const char *format, ...) {
+ /*
+ TODO: figure out how to pass src_file and src_line from the caller.
+ */
+ int result;
+ va_list args;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ locker = PSI_FILE_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
+ PSI_FILE_WRITE);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t)0, __FILE__, __LINE__);
+ va_start(args, format);
+ result = vfprintf(file->m_file, format, args);
+ va_end(args);
+ PSI_FILE_CALL(end_file_wait)(locker, (size_t)result);
+ return result;
+ }
+#endif
+
+ va_start(args, format);
+ result = vfprintf(file->m_file, format, args);
+ va_end(args);
+ return result;
+}
+
+static inline int inline_mysql_file_vfprintf(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_FILE *file, const char *format, va_list args)
+#ifdef HAVE_PSI_FILE_INTERFACE
+ MY_ATTRIBUTE((format(printf, 4, 0)));
+#else
+ MY_ATTRIBUTE((format(printf, 2, 0)));
+#endif
+
+static inline int inline_mysql_file_vfprintf(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_FILE *file, const char *format, va_list args) {
+ int result;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ locker = PSI_FILE_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
+ PSI_FILE_WRITE);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t)0, src_file, src_line);
+ result = vfprintf(file->m_file, format, args);
+ PSI_FILE_CALL(end_file_wait)(locker, (size_t)result);
+ return result;
+ }
+#endif
+
+ result = vfprintf(file->m_file, format, args);
+ return result;
+}
+
+static inline int inline_mysql_file_fflush(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_FILE *file) {
+ int result;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ locker = PSI_FILE_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
+ PSI_FILE_FLUSH);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t)0, src_file, src_line);
+ result = fflush(file->m_file);
+ PSI_FILE_CALL(end_file_wait)(locker, (size_t)0);
+ return result;
+ }
+#endif
+
+ result = fflush(file->m_file);
+ return result;
+}
+
+static inline int inline_mysql_file_feof(MYSQL_FILE *file) {
+ /* Not instrumented, there is no wait involved */
+ return feof(file->m_file);
+}
+
+static inline int inline_mysql_file_fstat(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ int filenr, MY_STAT *stat_area) {
+ int result;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ locker = PSI_FILE_CALL(get_thread_file_descriptor_locker)(&state, filenr,
+ PSI_FILE_FSTAT);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t)0, src_file, src_line);
+ result = my_fstat(filenr, stat_area);
+ PSI_FILE_CALL(end_file_wait)(locker, (size_t)0);
+ return result;
+ }
+#endif
+
+ result = my_fstat(filenr, stat_area);
+ return result;
+}
+
+static inline MY_STAT *inline_mysql_file_stat(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ PSI_file_key key, const char *src_file, uint src_line,
+#endif
+ const char *path, MY_STAT *stat_area, myf flags) {
+ MY_STAT *result;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ locker = PSI_FILE_CALL(get_thread_file_name_locker)(
+ &state, key, PSI_FILE_STAT, path, &locker);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line);
+ result = my_stat(path, stat_area, flags);
+ PSI_FILE_CALL(end_file_open_wait)(locker, result);
+ return result;
+ }
+#endif
+
+ result = my_stat(path, stat_area, flags);
+ return result;
+}
+
+static inline int inline_mysql_file_chsize(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ File file, my_off_t newlength, int filler, myf flags) {
+ int result;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ locker = PSI_FILE_CALL(get_thread_file_descriptor_locker)(&state, file,
+ PSI_FILE_CHSIZE);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_wait)
+ (locker, (size_t)newlength, src_file, src_line);
+ result = my_chsize(file, newlength, filler, flags);
+ PSI_FILE_CALL(end_file_wait)(locker, (size_t)newlength);
+ return result;
+ }
+#endif
+
+ result = my_chsize(file, newlength, filler, flags);
+ return result;
+}
+
+static inline MYSQL_FILE *inline_mysql_file_fopen(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ PSI_file_key key, const char *src_file, uint src_line,
+#endif
+ const char *filename, int flags, myf myFlags) {
+ MYSQL_FILE *that;
+ that = (MYSQL_FILE *)my_malloc(PSI_NOT_INSTRUMENTED, sizeof(MYSQL_FILE),
+ MYF(MY_WME));
+ if (likely(that != NULL)) {
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ locker = PSI_FILE_CALL(get_thread_file_name_locker)(
+ &state, key, PSI_FILE_STREAM_OPEN, filename, that);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_open_wait)
+ (locker, src_file, src_line);
+ that->m_file = my_fopen(filename, flags, myFlags);
+ that->m_psi = PSI_FILE_CALL(end_file_open_wait)(locker, that->m_file);
+ if (unlikely(that->m_file == NULL)) {
+ my_free(that);
+ return NULL;
+ }
+ return that;
+ }
+#endif
+
+ that->m_psi = NULL;
+ that->m_file = my_fopen(filename, flags, myFlags);
+ if (unlikely(that->m_file == NULL)) {
+ my_free(that);
+ return NULL;
+ }
+ }
+ return that;
+}
+
+static inline int inline_mysql_file_fclose(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_FILE *file, myf flags) {
+ int result = 0;
+ if (likely(file != NULL)) {
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ locker = PSI_FILE_CALL(get_thread_file_stream_locker)(
+ &state, file->m_psi, PSI_FILE_STREAM_CLOSE);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line);
+ result = my_fclose(file->m_file, flags);
+ PSI_FILE_CALL(end_file_close_wait)(locker, result);
+ my_free(file);
+ return result;
+ }
+#endif
+
+ result = my_fclose(file->m_file, flags);
+ my_free(file);
+ }
+ return result;
+}
+
+static inline size_t inline_mysql_file_fread(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_FILE *file, uchar *buffer, size_t count, myf flags) {
+ size_t result;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ size_t bytes_read;
+ locker = PSI_FILE_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
+ PSI_FILE_READ);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
+ result = my_fread(file->m_file, buffer, count, flags);
+ if (flags & (MY_NABP | MY_FNABP)) {
+ bytes_read = (result == 0) ? count : 0;
+ } else {
+ bytes_read = (result != MY_FILE_ERROR) ? result : 0;
+ }
+ PSI_FILE_CALL(end_file_wait)(locker, bytes_read);
+ return result;
+ }
+#endif
+
+ result = my_fread(file->m_file, buffer, count, flags);
+ return result;
+}
+
+static inline size_t inline_mysql_file_fwrite(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_FILE *file, const uchar *buffer, size_t count, myf flags) {
+ size_t result;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ size_t bytes_written;
+ locker = PSI_FILE_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
+ PSI_FILE_WRITE);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
+ result = my_fwrite(file->m_file, buffer, count, flags);
+ if (flags & (MY_NABP | MY_FNABP)) {
+ bytes_written = (result == 0) ? count : 0;
+ } else {
+ bytes_written = (result != MY_FILE_ERROR) ? result : 0;
+ }
+ PSI_FILE_CALL(end_file_wait)(locker, bytes_written);
+ return result;
+ }
+#endif
+
+ result = my_fwrite(file->m_file, buffer, count, flags);
+ return result;
+}
+
+static inline my_off_t inline_mysql_file_fseek(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_FILE *file, my_off_t pos, int whence) {
+ my_off_t result;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ locker = PSI_FILE_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
+ PSI_FILE_SEEK);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t)0, src_file, src_line);
+ result = my_fseek(file->m_file, pos, whence);
+ PSI_FILE_CALL(end_file_wait)(locker, (size_t)0);
+ return result;
+ }
+#endif
+
+ result = my_fseek(file->m_file, pos, whence);
+ return result;
+}
+
+static inline my_off_t inline_mysql_file_ftell(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_FILE *file) {
+ my_off_t result;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ locker = PSI_FILE_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
+ PSI_FILE_TELL);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t)0, src_file, src_line);
+ result = my_ftell(file->m_file);
+ PSI_FILE_CALL(end_file_wait)(locker, (size_t)0);
+ return result;
+ }
+#endif
+
+ result = my_ftell(file->m_file);
+ return result;
+}
+
+static inline File inline_mysql_file_create(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ PSI_file_key key, const char *src_file, uint src_line,
+#endif
+ const char *filename, int create_flags, int access_flags, myf myFlags) {
+ File file;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ locker = PSI_FILE_CALL(get_thread_file_name_locker)(
+ &state, key, PSI_FILE_CREATE, filename, &locker);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line);
+ file = my_create(filename, create_flags, access_flags, myFlags);
+ PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file);
+ return file;
+ }
+#endif
+
+ file = my_create(filename, create_flags, access_flags, myFlags);
+ return file;
+}
+
+static inline File inline_mysql_file_create_temp(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ PSI_file_key key, const char *src_file, uint src_line,
+#endif
+ char *to, const char *dir, const char *pfx, int mode,
+ UnlinkOrKeepFile unlink_or_keep, myf myFlags) {
+ File file;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ locker = PSI_FILE_CALL(get_thread_file_name_locker)(
+ &state, key, PSI_FILE_CREATE, NULL, &locker);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line);
+ /* The file name is generated by create_temp_file(). */
+ file = create_temp_file(to, dir, pfx, mode, unlink_or_keep, myFlags);
+ PSI_FILE_CALL(end_temp_file_open_wait_and_bind_to_descriptor)
+ (locker, file, (const char *)to);
+ return file;
+ }
+#endif
+
+ file = create_temp_file(to, dir, pfx, mode, unlink_or_keep, myFlags);
+ return file;
+}
+
+static inline File inline_mysql_file_open(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ PSI_file_key key, const char *src_file, uint src_line,
+#endif
+ const char *filename, int flags, myf myFlags) {
+ File file;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ locker = PSI_FILE_CALL(get_thread_file_name_locker)(
+ &state, key, PSI_FILE_OPEN, filename, &locker);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line);
+ file = my_open(filename, flags, myFlags);
+ PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file);
+ return file;
+ }
+#endif
+
+ file = my_open(filename, flags, myFlags);
+ return file;
+}
+
+static inline int inline_mysql_file_close(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ File file, myf flags) {
+ int result;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ locker = PSI_FILE_CALL(get_thread_file_descriptor_locker)(&state, file,
+ PSI_FILE_CLOSE);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line);
+ result = my_close(file, flags);
+ PSI_FILE_CALL(end_file_close_wait)(locker, result);
+ return result;
+ }
+#endif
+
+ result = my_close(file, flags);
+ return result;
+}
+
+static inline size_t inline_mysql_file_read(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ File file, uchar *buffer, size_t count, myf flags) {
+ size_t result;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ size_t bytes_read;
+ locker = PSI_FILE_CALL(get_thread_file_descriptor_locker)(&state, file,
+ PSI_FILE_READ);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
+ result = my_read(file, buffer, count, flags);
+ if (flags & (MY_NABP | MY_FNABP)) {
+ bytes_read = (result == 0) ? count : 0;
+ } else {
+ bytes_read = (result != MY_FILE_ERROR) ? result : 0;
+ }
+ PSI_FILE_CALL(end_file_wait)(locker, bytes_read);
+ return result;
+ }
+#endif
+
+ result = my_read(file, buffer, count, flags);
+ return result;
+}
+
+static inline size_t inline_mysql_file_write(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ File file, const uchar *buffer, size_t count, myf flags) {
+ size_t result;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ size_t bytes_written;
+ locker = PSI_FILE_CALL(get_thread_file_descriptor_locker)(&state, file,
+ PSI_FILE_WRITE);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
+ result = my_write(file, buffer, count, flags);
+ if (flags & (MY_NABP | MY_FNABP)) {
+ bytes_written = (result == 0) ? count : 0;
+ } else {
+ bytes_written = (result != MY_FILE_ERROR) ? result : 0;
+ }
+ PSI_FILE_CALL(end_file_wait)(locker, bytes_written);
+ return result;
+ }
+#endif
+
+ result = my_write(file, buffer, count, flags);
+ return result;
+}
+
+static inline size_t inline_mysql_file_pread(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ File file, uchar *buffer, size_t count, my_off_t offset, myf flags) {
+ size_t result;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ size_t bytes_read;
+ locker = PSI_FILE_CALL(get_thread_file_descriptor_locker)(&state, file,
+ PSI_FILE_READ);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
+ result = my_pread(file, buffer, count, offset, flags);
+ if (flags & (MY_NABP | MY_FNABP)) {
+ bytes_read = (result == 0) ? count : 0;
+ } else {
+ bytes_read = (result != MY_FILE_ERROR) ? result : 0;
+ }
+ PSI_FILE_CALL(end_file_wait)(locker, bytes_read);
+ return result;
+ }
+#endif
+
+ result = my_pread(file, buffer, count, offset, flags);
+ return result;
+}
+
+static inline size_t inline_mysql_file_pwrite(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ File file, const uchar *buffer, size_t count, my_off_t offset, myf flags) {
+ size_t result;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ size_t bytes_written;
+ locker = PSI_FILE_CALL(get_thread_file_descriptor_locker)(&state, file,
+ PSI_FILE_WRITE);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
+ result = my_pwrite(file, buffer, count, offset, flags);
+ if (flags & (MY_NABP | MY_FNABP)) {
+ bytes_written = (result == 0) ? count : 0;
+ } else {
+ bytes_written = (result != MY_FILE_ERROR) ? result : 0;
+ }
+ PSI_FILE_CALL(end_file_wait)(locker, bytes_written);
+ return result;
+ }
+#endif
+
+ result = my_pwrite(file, buffer, count, offset, flags);
+ return result;
+}
+
+static inline my_off_t inline_mysql_file_seek(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ File file, my_off_t pos, int whence, myf flags) {
+ my_off_t result;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ locker = PSI_FILE_CALL(get_thread_file_descriptor_locker)(&state, file,
+ PSI_FILE_SEEK);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t)0, src_file, src_line);
+ result = my_seek(file, pos, whence, flags);
+ PSI_FILE_CALL(end_file_wait)(locker, (size_t)0);
+ return result;
+ }
+#endif
+
+ result = my_seek(file, pos, whence, flags);
+ return result;
+}
+
+static inline my_off_t inline_mysql_file_tell(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ File file, myf flags) {
+ my_off_t result;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ locker = PSI_FILE_CALL(get_thread_file_descriptor_locker)(&state, file,
+ PSI_FILE_TELL);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t)0, src_file, src_line);
+ result = my_tell(file, flags);
+ PSI_FILE_CALL(end_file_wait)(locker, (size_t)0);
+ return result;
+ }
+#endif
+
+ result = my_tell(file, flags);
+ return result;
+}
+
+static inline int inline_mysql_file_delete(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ PSI_file_key key, const char *src_file, uint src_line,
+#endif
+ const char *name, myf flags) {
+ int result;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ locker = PSI_FILE_CALL(get_thread_file_name_locker)(
+ &state, key, PSI_FILE_DELETE, name, &locker);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line);
+ result = my_delete(name, flags);
+ PSI_FILE_CALL(end_file_close_wait)(locker, result);
+ return result;
+ }
+#endif
+
+ result = my_delete(name, flags);
+ return result;
+}
+
+static inline int inline_mysql_file_rename(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ PSI_file_key key, const char *src_file, uint src_line,
+#endif
+ const char *from, const char *to, myf flags) {
+ int result;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ locker = PSI_FILE_CALL(get_thread_file_name_locker)(
+ &state, key, PSI_FILE_RENAME, from, &locker);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t)0, src_file, src_line);
+ result = my_rename(from, to, flags);
+ PSI_FILE_CALL(end_file_rename_wait)(locker, from, to, result);
+ return result;
+ }
+#endif
+
+ result = my_rename(from, to, flags);
+ return result;
+}
+
+static inline File inline_mysql_file_create_with_symlink(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ PSI_file_key key, const char *src_file, uint src_line,
+#endif
+ const char *linkname, const char *filename, int create_flags,
+ int access_flags, myf flags) {
+ File file;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ locker = PSI_FILE_CALL(get_thread_file_name_locker)(
+ &state, key, PSI_FILE_CREATE, filename, &locker);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line);
+ file = my_create_with_symlink(linkname, filename, create_flags,
+ access_flags, flags);
+ PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file);
+ return file;
+ }
+#endif
+
+ file = my_create_with_symlink(linkname, filename, create_flags, access_flags,
+ flags);
+ return file;
+}
+
+static inline int inline_mysql_file_delete_with_symlink(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ PSI_file_key key, const char *src_file, uint src_line,
+#endif
+ const char *name, myf flags) {
+ int result;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ locker = PSI_FILE_CALL(get_thread_file_name_locker)(
+ &state, key, PSI_FILE_DELETE, name, &locker);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line);
+ result = my_delete_with_symlink(name, flags);
+ PSI_FILE_CALL(end_file_close_wait)(locker, result);
+ return result;
+ }
+#endif
+
+ result = my_delete_with_symlink(name, flags);
+ return result;
+}
+
+static inline int inline_mysql_file_rename_with_symlink(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ PSI_file_key key, const char *src_file, uint src_line,
+#endif
+ const char *from, const char *to, myf flags) {
+ int result;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ locker = PSI_FILE_CALL(get_thread_file_name_locker)(
+ &state, key, PSI_FILE_RENAME, from, &locker);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t)0, src_file, src_line);
+ result = my_rename_with_symlink(from, to, flags);
+ PSI_FILE_CALL(end_file_rename_wait)(locker, from, to, result);
+ return result;
+ }
+#endif
+
+ result = my_rename_with_symlink(from, to, flags);
+ return result;
+}
+
+static inline int inline_mysql_file_sync(
+#ifdef HAVE_PSI_FILE_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ File fd, myf flags) {
+ int result = 0;
+#ifdef HAVE_PSI_FILE_INTERFACE
+ struct PSI_file_locker *locker;
+ PSI_file_locker_state state;
+ locker = PSI_FILE_CALL(get_thread_file_descriptor_locker)(&state, fd,
+ PSI_FILE_SYNC);
+ if (likely(locker != NULL)) {
+ PSI_FILE_CALL(start_file_wait)(locker, (size_t)0, src_file, src_line);
+ result = my_sync(fd, flags);
+ PSI_FILE_CALL(end_file_wait)(locker, (size_t)0);
+ return result;
+ }
+#endif
+
+ result = my_sync(fd, flags);
+ return result;
+}
+
+/** @} (end of group psi_api_file) */
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/mysql_memory.h b/contrib/libs/libmysql_r/include/mysql/psi/mysql_memory.h
new file mode 100644
index 0000000000..c0b6cecac2
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/mysql_memory.h
@@ -0,0 +1,66 @@
+/* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_MEMORY_H
+#define MYSQL_MEMORY_H
+
+/**
+ @file include/mysql/psi/mysql_memory.h
+ Instrumentation helpers for memory allocation.
+*/
+
+#include "my_compiler.h"
+#include "mysql/psi/psi_memory.h"
+
+#ifndef PSI_MEMORY_CALL
+#define PSI_MEMORY_CALL(M) psi_memory_service->M
+#endif
+
+/**
+ @defgroup psi_api_memory Memory Instrumentation (API)
+ @ingroup psi_api
+ @{
+*/
+
+/**
+ @def mysql_memory_register(P1, P2, P3)
+ Memory registration.
+*/
+#define mysql_memory_register(P1, P2, P3) \
+ inline_mysql_memory_register(P1, P2, P3)
+
+static inline void inline_mysql_memory_register(
+#ifdef HAVE_PSI_MEMORY_INTERFACE
+ const char *category, PSI_memory_info *info, int count)
+#else
+ const char *category MY_ATTRIBUTE((unused)),
+ void *info MY_ATTRIBUTE((unused)), int count MY_ATTRIBUTE((unused)))
+#endif
+{
+#ifdef HAVE_PSI_MEMORY_INTERFACE
+ PSI_MEMORY_CALL(register_memory)(category, info, count);
+#endif
+}
+
+/** @} (end of group psi_api_memory) */
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/mysql_mutex.h b/contrib/libs/libmysql_r/include/mysql/psi/mysql_mutex.h
new file mode 100644
index 0000000000..1dca8d4afe
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/mysql_mutex.h
@@ -0,0 +1,343 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_MUTEX_H
+#define MYSQL_MUTEX_H
+
+/**
+ @file include/mysql/psi/mysql_mutex.h
+ Instrumentation helpers for mutexes.
+ This header file provides the necessary declarations
+ to use the mutex API with the performance schema instrumentation.
+ In some compilers (SunStudio), 'static inline' functions, when declared
+ but not used, are not optimized away (because they are unused) by default,
+ so that including a static inline function from a header file does
+ create unwanted dependencies, causing unresolved symbols at link time.
+ Other compilers, like gcc, optimize these dependencies by default.
+*/
+/*
+ Note: there are several orthogonal dimensions here.
+
+ Dimension 1: Instrumentation
+ HAVE_PSI_MUTEX_INTERFACE is defined when the instrumentation is compiled in.
+ This may happen both in debug or production builds.
+
+ Dimension 2: Debug
+ SAFE_MUTEX is defined when debug is compiled in.
+ This may happen both with and without instrumentation.
+
+ Dimension 3: Platform
+ Mutexes are implemented with one of:
+ - the pthread library
+ - fast mutexes
+ - window apis
+ This is implemented by various macro definitions in my_thread.h
+
+ This causes complexity with '#ifdef'-ery that can't be avoided.
+*/
+
+#include "mysql/components/services/mysql_mutex_bits.h"
+#include "mysql/components/services/psi_mutex_bits.h"
+#include "mysql/psi/psi_mutex.h"
+#include "thr_mutex.h"
+
+#ifdef MYSQL_SERVER
+#ifndef MYSQL_DYNAMIC_PLUGIN
+#error #include "pfs_mutex_provider.h"
+#endif
+#endif
+
+#ifndef PSI_MUTEX_CALL
+#define PSI_MUTEX_CALL(M) psi_mutex_service->M
+#endif
+
+/**
+ @defgroup psi_api_mutex Mutex Instrumentation (API)
+ @ingroup psi_api
+ @{
+*/
+
+/*
+ Consider the following code:
+ static inline void foo() { bar(); }
+ when foo() is never called.
+
+ With gcc, foo() is a local static function, so the dependencies
+ are optimized away at compile time, and there is no dependency on bar().
+ With other compilers (HP, Sun Studio), the function foo() implementation
+ is compiled, and bar() needs to be present to link.
+
+ Due to the existing header dependencies in MySQL code, this header file
+ is sometime used when it is not needed, which in turn cause link failures
+ on some platforms.
+ The proper fix would be to cut these extra dependencies in the calling code.
+ DISABLE_MYSQL_THREAD_H is a work around to limit dependencies.
+ DISABLE_MYSQL_PRLOCK_H is similar, and is used to disable specifically
+ the prlock wrappers.
+*/
+#ifndef DISABLE_MYSQL_THREAD_H
+
+/**
+ @def mysql_mutex_assert_owner(M)
+ Wrapper, to use safe_mutex_assert_owner with instrumented mutexes.
+ @c mysql_mutex_assert_owner is a drop-in replacement
+ for @c safe_mutex_assert_owner.
+*/
+#ifdef SAFE_MUTEX
+#define mysql_mutex_assert_owner(M) \
+ safe_mutex_assert_owner((M)->m_mutex.m_u.m_safe_ptr);
+#else
+#define mysql_mutex_assert_owner(M) \
+ {}
+#endif
+
+/**
+ @def mysql_mutex_assert_not_owner(M)
+ Wrapper, to use safe_mutex_assert_not_owner with instrumented mutexes.
+ @c mysql_mutex_assert_not_owner is a drop-in replacement
+ for @c safe_mutex_assert_not_owner.
+*/
+#ifdef SAFE_MUTEX
+#define mysql_mutex_assert_not_owner(M) \
+ safe_mutex_assert_not_owner((M)->m_mutex.m_u.m_safe_ptr);
+#else
+#define mysql_mutex_assert_not_owner(M) \
+ {}
+#endif
+
+/**
+ @def mysql_mutex_register(P1, P2, P3)
+ Mutex registration.
+*/
+#define mysql_mutex_register(P1, P2, P3) inline_mysql_mutex_register(P1, P2, P3)
+
+/**
+ @def mysql_mutex_init(K, M, A)
+ Instrumented mutex_init.
+ @c mysql_mutex_init is a replacement for @c pthread_mutex_init.
+ @param K The PSI_mutex_key for this instrumented mutex
+ @param M The mutex to initialize
+ @param A Mutex attributes
+*/
+
+#define mysql_mutex_init(K, M, A) \
+ mysql_mutex_init_with_src(K, M, A, __FILE__, __LINE__)
+
+#define mysql_mutex_init_with_src(K, M, A, F, L) \
+ inline_mysql_mutex_init(K, M, A, F, L)
+
+/**
+ @def mysql_mutex_destroy(M)
+ Instrumented mutex_destroy.
+ @c mysql_mutex_destroy is a drop-in replacement
+ for @c pthread_mutex_destroy.
+*/
+#define mysql_mutex_destroy(M) \
+ mysql_mutex_destroy_with_src(M, __FILE__, __LINE__)
+
+#define mysql_mutex_destroy_with_src(M, F, L) \
+ inline_mysql_mutex_destroy(M, F, L)
+
+/**
+ @def mysql_mutex_lock(M)
+ Instrumented mutex_lock.
+ @c mysql_mutex_lock is a drop-in replacement for @c pthread_mutex_lock.
+ @param M The mutex to lock
+*/
+
+#define mysql_mutex_lock(M) mysql_mutex_lock_with_src(M, __FILE__, __LINE__)
+
+#define mysql_mutex_lock_with_src(M, F, L) inline_mysql_mutex_lock(M, F, L)
+
+/**
+ @def mysql_mutex_trylock(M)
+ Instrumented mutex_lock.
+ @c mysql_mutex_trylock is a drop-in replacement
+ for @c my_mutex_trylock.
+*/
+
+#define mysql_mutex_trylock(M) \
+ mysql_mutex_trylock_with_src(M, __FILE__, __LINE__)
+
+#define mysql_mutex_trylock_with_src(M, F, L) \
+ inline_mysql_mutex_trylock(M, F, L)
+
+/**
+ @def mysql_mutex_unlock(M)
+ Instrumented mutex_unlock.
+ @c mysql_mutex_unlock is a drop-in replacement for @c pthread_mutex_unlock.
+*/
+#define mysql_mutex_unlock(M) mysql_mutex_unlock_with_src(M, __FILE__, __LINE__)
+
+#define mysql_mutex_unlock_with_src(M, F, L) inline_mysql_mutex_unlock(M, F, L)
+
+static inline void inline_mysql_mutex_register(
+ const char *category MY_ATTRIBUTE((unused)),
+ PSI_mutex_info *info MY_ATTRIBUTE((unused)),
+ int count MY_ATTRIBUTE((unused))) {
+#ifdef HAVE_PSI_MUTEX_INTERFACE
+ PSI_MUTEX_CALL(register_mutex)(category, info, count);
+#endif
+}
+
+static inline int inline_mysql_mutex_init(
+ PSI_mutex_key key MY_ATTRIBUTE((unused)), mysql_mutex_t *that,
+ const native_mutexattr_t *attr, const char *src_file MY_ATTRIBUTE((unused)),
+ uint src_line MY_ATTRIBUTE((unused))) {
+#ifdef HAVE_PSI_MUTEX_INTERFACE
+ that->m_psi = PSI_MUTEX_CALL(init_mutex)(key, &that->m_mutex);
+#else
+ that->m_psi = NULL;
+#endif
+ return my_mutex_init(&that->m_mutex, attr
+#ifdef SAFE_MUTEX
+ ,
+ src_file, src_line
+#endif
+ );
+}
+
+static inline int inline_mysql_mutex_destroy(
+ mysql_mutex_t *that, const char *src_file MY_ATTRIBUTE((unused)),
+ uint src_line MY_ATTRIBUTE((unused))) {
+#ifdef HAVE_PSI_MUTEX_INTERFACE
+ if (that->m_psi != NULL) {
+ PSI_MUTEX_CALL(destroy_mutex)(that->m_psi);
+ that->m_psi = NULL;
+ }
+#endif
+ return my_mutex_destroy(&that->m_mutex
+#ifdef SAFE_MUTEX
+ ,
+ src_file, src_line
+#endif
+ );
+}
+
+static inline int inline_mysql_mutex_lock(
+ mysql_mutex_t *that, const char *src_file MY_ATTRIBUTE((unused)),
+ uint src_line MY_ATTRIBUTE((unused))) {
+ int result;
+
+#ifdef HAVE_PSI_MUTEX_INTERFACE
+ if (that->m_psi != NULL) {
+ /* Instrumentation start */
+ PSI_mutex_locker *locker;
+ PSI_mutex_locker_state state;
+ locker = PSI_MUTEX_CALL(start_mutex_wait)(
+ &state, that->m_psi, PSI_MUTEX_LOCK, src_file, src_line);
+
+ /* Instrumented code */
+ result = my_mutex_lock(&that->m_mutex
+#ifdef SAFE_MUTEX
+ ,
+ src_file, src_line
+#endif
+ );
+
+ /* Instrumentation end */
+ if (locker != NULL) {
+ PSI_MUTEX_CALL(end_mutex_wait)(locker, result);
+ }
+
+ return result;
+ }
+#endif
+
+ /* Non instrumented code */
+ result = my_mutex_lock(&that->m_mutex
+#ifdef SAFE_MUTEX
+ ,
+ src_file, src_line
+#endif
+ );
+
+ return result;
+}
+
+static inline int inline_mysql_mutex_trylock(
+ mysql_mutex_t *that, const char *src_file MY_ATTRIBUTE((unused)),
+ uint src_line MY_ATTRIBUTE((unused))) {
+ int result;
+
+#ifdef HAVE_PSI_MUTEX_INTERFACE
+ if (that->m_psi != NULL) {
+ /* Instrumentation start */
+ PSI_mutex_locker *locker;
+ PSI_mutex_locker_state state;
+ locker = PSI_MUTEX_CALL(start_mutex_wait)(
+ &state, that->m_psi, PSI_MUTEX_TRYLOCK, src_file, src_line);
+
+ /* Instrumented code */
+ result = my_mutex_trylock(&that->m_mutex
+#ifdef SAFE_MUTEX
+ ,
+ src_file, src_line
+#endif
+ );
+
+ /* Instrumentation end */
+ if (locker != NULL) {
+ PSI_MUTEX_CALL(end_mutex_wait)(locker, result);
+ }
+
+ return result;
+ }
+#endif
+
+ /* Non instrumented code */
+ result = my_mutex_trylock(&that->m_mutex
+#ifdef SAFE_MUTEX
+ ,
+ src_file, src_line
+#endif
+ );
+
+ return result;
+}
+
+static inline int inline_mysql_mutex_unlock(
+ mysql_mutex_t *that, const char *src_file MY_ATTRIBUTE((unused)),
+ uint src_line MY_ATTRIBUTE((unused))) {
+ int result;
+
+#ifdef HAVE_PSI_MUTEX_INTERFACE
+ if (that->m_psi != NULL) {
+ PSI_MUTEX_CALL(unlock_mutex)(that->m_psi);
+ }
+#endif
+
+ result = my_mutex_unlock(&that->m_mutex
+#ifdef SAFE_MUTEX
+ ,
+ src_file, src_line
+#endif
+ );
+
+ return result;
+}
+
+#endif /* DISABLE_MYSQL_THREAD_H */
+
+/** @} (end of group psi_api_mutex) */
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/mysql_rwlock.h b/contrib/libs/libmysql_r/include/mysql/psi/mysql_rwlock.h
new file mode 100644
index 0000000000..df3ab2a9f6
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/mysql_rwlock.h
@@ -0,0 +1,525 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_RWLOCK_H
+#define MYSQL_RWLOCK_H
+
+/**
+ @file include/mysql/psi/mysql_rwlock.h
+ Instrumentation helpers for rwlock.
+*/
+
+#include "mysql/components/services/mysql_rwlock_bits.h"
+#include "mysql/psi/psi_rwlock.h"
+#include "thr_rwlock.h"
+#ifdef MYSQL_SERVER
+#ifndef MYSQL_DYNAMIC_PLUGIN
+#error #include "pfs_rwlock_provider.h"
+#endif
+#endif
+
+#ifndef PSI_RWLOCK_CALL
+#define PSI_RWLOCK_CALL(M) psi_rwlock_service->M
+#endif
+
+/**
+ @defgroup psi_api_rwlock Rwlock Instrumentation (API)
+ @ingroup psi_api
+ @{
+*/
+
+/**
+ @def mysql_prlock_assert_write_owner(M)
+ Drop-in replacement
+ for @c rw_pr_lock_assert_write_owner.
+*/
+#ifdef SAFE_MUTEX
+#define mysql_prlock_assert_write_owner(M) \
+ rw_pr_lock_assert_write_owner(&(M)->m_prlock)
+#else
+#define mysql_prlock_assert_write_owner(M) \
+ {}
+#endif
+
+/**
+ @def mysql_prlock_assert_not_write_owner(M)
+ Drop-in replacement
+ for @c rw_pr_lock_assert_not_write_owner.
+*/
+#ifdef SAFE_MUTEX
+#define mysql_prlock_assert_not_write_owner(M) \
+ rw_pr_lock_assert_not_write_owner(&(M)->m_prlock)
+#else
+#define mysql_prlock_assert_not_write_owner(M) \
+ {}
+#endif
+
+#ifndef DISABLE_MYSQL_THREAD_H
+
+/**
+ @def mysql_rwlock_register(P1, P2, P3)
+ Rwlock registration.
+*/
+#define mysql_rwlock_register(P1, P2, P3) \
+ inline_mysql_rwlock_register(P1, P2, P3)
+
+/**
+ @def mysql_rwlock_init(K, T)
+ Instrumented rwlock_init.
+ @c mysql_rwlock_init is a replacement for @c pthread_rwlock_init.
+ Note that pthread_rwlockattr_t is not supported in MySQL.
+ @param K The PSI_rwlock_key for this instrumented rwlock
+ @param T The rwlock to initialize
+*/
+
+#define mysql_rwlock_init(K, T) \
+ mysql_rwlock_init_with_src(K, T, __FILE__, __LINE__)
+
+#define mysql_rwlock_init_with_src(K, T, F, L) \
+ inline_mysql_rwlock_init(K, T, F, L)
+
+/**
+ @def mysql_prlock_init(K, T)
+ Instrumented rw_pr_init.
+ @c mysql_prlock_init is a replacement for @c rw_pr_init.
+ @param K The PSI_rwlock_key for this instrumented prlock
+ @param T The prlock to initialize
+*/
+
+#define mysql_prlock_init(K, T) \
+ mysql_prlock_init_with_src(K, T, __FILE__, __LINE__)
+
+#define mysql_prlock_init_with_src(K, T, F, L) \
+ inline_mysql_prlock_init(K, T, F, L)
+
+/**
+ @def mysql_rwlock_destroy(T)
+ Instrumented rwlock_destroy.
+ @c mysql_rwlock_destroy is a drop-in replacement
+ for @c pthread_rwlock_destroy.
+*/
+
+#define mysql_rwlock_destroy(T) \
+ mysql_rwlock_destroy_with_src(T, __FILE__, __LINE__)
+
+#define mysql_rwlock_destroy_with_src(T, F, L) \
+ inline_mysql_rwlock_destroy(T, F, L)
+
+/**
+ @def mysql_prlock_destroy(T)
+ Instrumented rw_pr_destroy.
+ @c mysql_prlock_destroy is a drop-in replacement
+ for @c rw_pr_destroy.
+*/
+#define mysql_prlock_destroy(T) \
+ mysql_prlock_destroy_with_src(T, __FILE__, __LINE__)
+
+#define mysql_prlock_destroy_with_src(T, F, L) \
+ inline_mysql_prlock_destroy(T, F, L)
+
+/**
+ @def mysql_rwlock_rdlock(T)
+ Instrumented rwlock_rdlock.
+ @c mysql_rwlock_rdlock is a drop-in replacement
+ for @c pthread_rwlock_rdlock.
+*/
+
+#define mysql_rwlock_rdlock(T) \
+ mysql_rwlock_rdlock_with_src(T, __FILE__, __LINE__)
+
+#define mysql_rwlock_rdlock_with_src(T, F, L) \
+ inline_mysql_rwlock_rdlock(T, F, L)
+
+/**
+ @def mysql_prlock_rdlock(T)
+ Instrumented rw_pr_rdlock.
+ @c mysql_prlock_rdlock is a drop-in replacement
+ for @c rw_pr_rdlock.
+*/
+
+#define mysql_prlock_rdlock(T) \
+ mysql_prlock_rdlock_with_src(T, __FILE__, __LINE__)
+
+#define mysql_prlock_rdlock_with_src(T, F, L) \
+ inline_mysql_prlock_rdlock(T, F, L)
+
+/**
+ @def mysql_rwlock_wrlock(T)
+ Instrumented rwlock_wrlock.
+ @c mysql_rwlock_wrlock is a drop-in replacement
+ for @c pthread_rwlock_wrlock.
+*/
+
+#define mysql_rwlock_wrlock(T) \
+ mysql_rwlock_wrlock_with_src(T, __FILE__, __LINE__)
+
+#define mysql_rwlock_wrlock_with_src(T, F, L) \
+ inline_mysql_rwlock_wrlock(T, F, L)
+
+/**
+ @def mysql_prlock_wrlock(T)
+ Instrumented rw_pr_wrlock.
+ @c mysql_prlock_wrlock is a drop-in replacement
+ for @c rw_pr_wrlock.
+*/
+
+#define mysql_prlock_wrlock(T) \
+ mysql_prlock_wrlock_with_src(T, __FILE__, __LINE__)
+
+#define mysql_prlock_wrlock_with_src(T, F, L) \
+ inline_mysql_prlock_wrlock(T, F, L)
+
+/**
+ @def mysql_rwlock_tryrdlock(T)
+ Instrumented rwlock_tryrdlock.
+ @c mysql_rwlock_tryrdlock is a drop-in replacement
+ for @c pthread_rwlock_tryrdlock.
+*/
+
+#define mysql_rwlock_tryrdlock(T) \
+ mysql_rwlock_tryrdlock_with_src(T, __FILE__, __LINE__)
+
+#define mysql_rwlock_tryrdlock_with_src(T, F, L) \
+ inline_mysql_rwlock_tryrdlock(T, F, L)
+
+/**
+ @def mysql_rwlock_trywrlock(T)
+ Instrumented rwlock_trywrlock.
+ @c mysql_rwlock_trywrlock is a drop-in replacement
+ for @c pthread_rwlock_trywrlock.
+*/
+
+#define mysql_rwlock_trywrlock(T) \
+ mysql_rwlock_trywrlock_with_src(T, __FILE__, __LINE__)
+
+#define mysql_rwlock_trywrlock_with_src(T, F, L) \
+ inline_mysql_rwlock_trywrlock(T, F, L)
+
+/**
+ @def mysql_rwlock_unlock(T)
+ Instrumented rwlock_unlock.
+ @c mysql_rwlock_unlock is a drop-in replacement
+ for @c pthread_rwlock_unlock.
+*/
+#define mysql_rwlock_unlock(T) \
+ mysql_rwlock_unlock_with_src(T, __FILE__, __LINE__)
+
+#define mysql_rwlock_unlock_with_src(T, F, L) \
+ inline_mysql_rwlock_unlock(T, F, L)
+
+/**
+ @def mysql_prlock_unlock(T)
+ Instrumented rw_pr_unlock.
+ @c mysql_prlock_unlock is a drop-in replacement
+ for @c rw_pr_unlock.
+*/
+
+#define mysql_prlock_unlock(T) \
+ mysql_prlock_unlock_with_src(T, __FILE__, __LINE__)
+
+#define mysql_prlock_unlock_with_src(T, F, L) \
+ inline_mysql_prlock_unlock(T, F, L)
+
+static inline void inline_mysql_rwlock_register(
+ const char *category MY_ATTRIBUTE((unused)),
+ PSI_rwlock_info *info MY_ATTRIBUTE((unused)),
+ int count MY_ATTRIBUTE((unused))) {
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
+ PSI_RWLOCK_CALL(register_rwlock)(category, info, count);
+#endif
+}
+
+static inline int inline_mysql_rwlock_init(
+ PSI_rwlock_key key MY_ATTRIBUTE((unused)), mysql_rwlock_t *that,
+ const char *src_file MY_ATTRIBUTE((unused)),
+ int src_line MY_ATTRIBUTE((unused))) {
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
+ that->m_psi = PSI_RWLOCK_CALL(init_rwlock)(key, &that->m_rwlock);
+#else
+ that->m_psi = NULL;
+#endif
+ return native_rw_init(&that->m_rwlock);
+}
+
+#ifndef DISABLE_MYSQL_PRLOCK_H
+static inline int inline_mysql_prlock_init(
+ PSI_rwlock_key key MY_ATTRIBUTE((unused)), mysql_prlock_t *that,
+ const char *src_file MY_ATTRIBUTE((unused)),
+ int src_line MY_ATTRIBUTE((unused))) {
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
+ that->m_psi = PSI_RWLOCK_CALL(init_rwlock)(key, &that->m_prlock);
+#else
+ that->m_psi = NULL;
+#endif
+ return rw_pr_init(&that->m_prlock);
+}
+#endif
+
+static inline int inline_mysql_rwlock_destroy(
+ mysql_rwlock_t *that, const char *src_file MY_ATTRIBUTE((unused)),
+ int src_line MY_ATTRIBUTE((unused))) {
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
+ if (that->m_psi != NULL) {
+ PSI_RWLOCK_CALL(destroy_rwlock)(that->m_psi);
+ that->m_psi = NULL;
+ }
+#endif
+ return native_rw_destroy(&that->m_rwlock);
+}
+
+#ifndef DISABLE_MYSQL_PRLOCK_H
+static inline int inline_mysql_prlock_destroy(
+ mysql_prlock_t *that, const char *src_file MY_ATTRIBUTE((unused)),
+ int src_line MY_ATTRIBUTE((unused))) {
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
+ if (that->m_psi != NULL) {
+ PSI_RWLOCK_CALL(destroy_rwlock)(that->m_psi);
+ that->m_psi = NULL;
+ }
+#endif
+ return rw_pr_destroy(&that->m_prlock);
+}
+#endif
+
+static inline int inline_mysql_rwlock_rdlock(
+ mysql_rwlock_t *that, const char *src_file MY_ATTRIBUTE((unused)),
+ int src_line MY_ATTRIBUTE((unused))) {
+ int result;
+
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
+ if (that->m_psi != NULL) {
+ /* Instrumentation start */
+ PSI_rwlock_locker *locker;
+ PSI_rwlock_locker_state state;
+ locker = PSI_RWLOCK_CALL(start_rwlock_rdwait)(
+ &state, that->m_psi, PSI_RWLOCK_READLOCK, src_file, src_line);
+
+ /* Instrumented code */
+ result = native_rw_rdlock(&that->m_rwlock);
+
+ /* Instrumentation end */
+ if (locker != NULL) {
+ PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, result);
+ }
+
+ return result;
+ }
+#endif
+
+ /* Non instrumented code */
+ result = native_rw_rdlock(&that->m_rwlock);
+
+ return result;
+}
+
+#ifndef DISABLE_MYSQL_PRLOCK_H
+static inline int inline_mysql_prlock_rdlock(
+ mysql_prlock_t *that, const char *src_file MY_ATTRIBUTE((unused)),
+ int src_line MY_ATTRIBUTE((unused))) {
+ int result;
+
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
+ if (that->m_psi != NULL) {
+ /* Instrumentation start */
+ PSI_rwlock_locker *locker;
+ PSI_rwlock_locker_state state;
+ locker = PSI_RWLOCK_CALL(start_rwlock_rdwait)(
+ &state, that->m_psi, PSI_RWLOCK_READLOCK, src_file, src_line);
+
+ /* Instrumented code */
+ result = rw_pr_rdlock(&that->m_prlock);
+
+ /* Instrumentation end */
+ if (locker != NULL) {
+ PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, result);
+ }
+
+ return result;
+ }
+#endif
+
+ /* Non instrumented code */
+ result = rw_pr_rdlock(&that->m_prlock);
+
+ return result;
+}
+#endif
+
+static inline int inline_mysql_rwlock_wrlock(
+ mysql_rwlock_t *that, const char *src_file MY_ATTRIBUTE((unused)),
+ int src_line MY_ATTRIBUTE((unused))) {
+ int result;
+
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
+ if (that->m_psi != NULL) {
+ /* Instrumentation start */
+ PSI_rwlock_locker *locker;
+ PSI_rwlock_locker_state state;
+ locker = PSI_RWLOCK_CALL(start_rwlock_wrwait)(
+ &state, that->m_psi, PSI_RWLOCK_WRITELOCK, src_file, src_line);
+
+ /* Instrumented code */
+ result = native_rw_wrlock(&that->m_rwlock);
+
+ /* Instrumentation end */
+ if (locker != NULL) {
+ PSI_RWLOCK_CALL(end_rwlock_wrwait)(locker, result);
+ }
+
+ return result;
+ }
+#endif
+
+ /* Non instrumented code */
+ result = native_rw_wrlock(&that->m_rwlock);
+
+ return result;
+}
+
+#ifndef DISABLE_MYSQL_PRLOCK_H
+static inline int inline_mysql_prlock_wrlock(
+ mysql_prlock_t *that, const char *src_file MY_ATTRIBUTE((unused)),
+ int src_line MY_ATTRIBUTE((unused))) {
+ int result;
+
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
+ if (that->m_psi != NULL) {
+ /* Instrumentation start */
+ PSI_rwlock_locker *locker;
+ PSI_rwlock_locker_state state;
+ locker = PSI_RWLOCK_CALL(start_rwlock_wrwait)(
+ &state, that->m_psi, PSI_RWLOCK_WRITELOCK, src_file, src_line);
+
+ /* Instrumented code */
+ result = rw_pr_wrlock(&that->m_prlock);
+
+ /* Instrumentation end */
+ if (locker != NULL) {
+ PSI_RWLOCK_CALL(end_rwlock_wrwait)(locker, result);
+ }
+
+ return result;
+ }
+#endif
+
+ /* Non instrumented code */
+ result = rw_pr_wrlock(&that->m_prlock);
+
+ return result;
+}
+#endif
+
+static inline int inline_mysql_rwlock_tryrdlock(
+ mysql_rwlock_t *that, const char *src_file MY_ATTRIBUTE((unused)),
+ int src_line MY_ATTRIBUTE((unused))) {
+ int result;
+
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
+ if (that->m_psi != NULL) {
+ /* Instrumentation start */
+ PSI_rwlock_locker *locker;
+ PSI_rwlock_locker_state state;
+ locker = PSI_RWLOCK_CALL(start_rwlock_rdwait)(
+ &state, that->m_psi, PSI_RWLOCK_TRYREADLOCK, src_file, src_line);
+
+ /* Instrumented code */
+ result = native_rw_tryrdlock(&that->m_rwlock);
+
+ /* Instrumentation end */
+ if (locker != NULL) {
+ PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, result);
+ }
+
+ return result;
+ }
+#endif
+
+ /* Non instrumented code */
+ result = native_rw_tryrdlock(&that->m_rwlock);
+
+ return result;
+}
+
+static inline int inline_mysql_rwlock_trywrlock(
+ mysql_rwlock_t *that, const char *src_file MY_ATTRIBUTE((unused)),
+ int src_line MY_ATTRIBUTE((unused))) {
+ int result;
+
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
+ if (that->m_psi != NULL) {
+ /* Instrumentation start */
+ PSI_rwlock_locker *locker;
+ PSI_rwlock_locker_state state;
+ locker = PSI_RWLOCK_CALL(start_rwlock_wrwait)(
+ &state, that->m_psi, PSI_RWLOCK_TRYWRITELOCK, src_file, src_line);
+
+ /* Instrumented code */
+ result = native_rw_trywrlock(&that->m_rwlock);
+
+ /* Instrumentation end */
+ if (locker != NULL) {
+ PSI_RWLOCK_CALL(end_rwlock_wrwait)(locker, result);
+ }
+
+ return result;
+ }
+#endif
+
+ /* Non instrumented code */
+ result = native_rw_trywrlock(&that->m_rwlock);
+
+ return result;
+}
+
+static inline int inline_mysql_rwlock_unlock(
+ mysql_rwlock_t *that, const char *src_file MY_ATTRIBUTE((unused)),
+ int src_line MY_ATTRIBUTE((unused))) {
+ int result;
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
+ if (that->m_psi != NULL) {
+ PSI_RWLOCK_CALL(unlock_rwlock)(that->m_psi, PSI_RWLOCK_UNLOCK);
+ }
+#endif
+ result = native_rw_unlock(&that->m_rwlock);
+ return result;
+}
+
+#ifndef DISABLE_MYSQL_PRLOCK_H
+static inline int inline_mysql_prlock_unlock(
+ mysql_prlock_t *that, const char *src_file MY_ATTRIBUTE((unused)),
+ int src_line MY_ATTRIBUTE((unused))) {
+ int result;
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
+ if (that->m_psi != NULL) {
+ PSI_RWLOCK_CALL(unlock_rwlock)(that->m_psi, PSI_RWLOCK_UNLOCK);
+ }
+#endif
+ result = rw_pr_unlock(&that->m_prlock);
+ return result;
+}
+#endif
+
+#endif /* DISABLE_MYSQL_THREAD_H */
+
+/** @} (end of group psi_api_rwlock) */
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/mysql_socket.h b/contrib/libs/libmysql_r/include/mysql/psi/mysql_socket.h
new file mode 100644
index 0000000000..b050088838
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/mysql_socket.h
@@ -0,0 +1,1172 @@
+/* Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License, version 2.0,
+as published by the Free Software Foundation.
+
+This program is also distributed with certain software (including
+but not limited to OpenSSL) that is licensed under separate terms,
+as designated in a particular file or component or in included license
+documentation. The authors of MySQL hereby grant you an additional
+permission to link the program and your derivative works with the
+separately licensed software that they have included with MySQL.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License, version 2.0, for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+/**
+ @file include/mysql/psi/mysql_socket.h
+*/
+
+#ifndef MYSQL_SOCKET_H
+#define MYSQL_SOCKET_H
+
+#include <errno.h>
+/* For strlen() */
+#include <string.h>
+
+/* For MY_STAT */
+#include "my_dir.h"
+#include "my_io.h"
+/* For my_chsize */
+#include "my_sys.h"
+#include "mysql/psi/psi_socket.h"
+/* For socket api */
+#ifdef _WIN32
+#include <MSWSock.h>
+#ifdef WIN32_LEAN_AND_MEAN
+#include <winsock2.h>
+#include <ws2def.h>
+#endif
+#define SOCKBUF_T char
+#else
+#include <netinet/in.h>
+
+#define SOCKBUF_T void
+#endif
+
+#include "my_macros.h"
+#include "mysql/components/services/mysql_socket_bits.h"
+#include "pfs_socket_provider.h"
+
+#ifndef PSI_SOCKET_CALL
+#define PSI_SOCKET_CALL(M) psi_socket_service->M
+#endif
+
+/**
+ @defgroup psi_api_socket Socket Instrumentation (API)
+ @ingroup psi_api
+ @{
+*/
+
+/**
+ @def mysql_socket_register(P1, P2, P3)
+ Socket registration.
+*/
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+#define mysql_socket_register(P1, P2, P3) \
+ inline_mysql_socket_register(P1, P2, P3)
+#else
+#define mysql_socket_register(P1, P2, P3) \
+ do { \
+ } while (0)
+#endif
+
+/**
+ Set socket descriptor and address.
+ @param socket instrumented socket
+ @param addr unformatted socket address
+ @param addr_len length of socket addres
+*/
+
+static inline void mysql_socket_set_address(
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ MYSQL_SOCKET socket, const struct sockaddr *addr, socklen_t addr_len
+#else
+ MYSQL_SOCKET socket MY_ATTRIBUTE((unused)),
+ const struct sockaddr *addr MY_ATTRIBUTE((unused)),
+ socklen_t addr_len MY_ATTRIBUTE((unused))
+#endif
+) {
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ if (socket.m_psi != NULL) {
+ PSI_SOCKET_CALL(set_socket_info)(socket.m_psi, NULL, addr, addr_len);
+ }
+#endif
+}
+
+/**
+ Set socket descriptor and address.
+ @param socket instrumented socket
+*/
+static inline void mysql_socket_set_thread_owner(
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ MYSQL_SOCKET socket
+#else
+ MYSQL_SOCKET socket MY_ATTRIBUTE((unused))
+#endif
+) {
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ if (socket.m_psi != NULL) {
+ PSI_SOCKET_CALL(set_socket_thread_owner)(socket.m_psi);
+ }
+#endif
+}
+
+/**
+ MYSQL_SOCKET helper. Get socket descriptor.
+ @param mysql_socket Instrumented socket
+ @sa mysql_socket_setfd
+*/
+static inline my_socket mysql_socket_getfd(MYSQL_SOCKET mysql_socket) {
+ return mysql_socket.fd;
+}
+
+/**
+ MYSQL_SOCKET helper. Set socket descriptor.
+ @param mysql_socket Instrumented socket
+ @param fd Socket descriptor
+ @sa mysql_socket_getfd
+*/
+static inline void mysql_socket_setfd(MYSQL_SOCKET *mysql_socket,
+ my_socket fd) {
+ if (likely(mysql_socket != NULL)) {
+ mysql_socket->fd = fd;
+ }
+}
+
+/**
+ @def MYSQL_SOCKET_WAIT_VARIABLES
+ Instrumentation helper for socket waits.
+ This instrumentation declares local variables.
+ Do not use a ';' after this macro
+ @param LOCKER locker
+ @param STATE locker state
+ @sa MYSQL_START_SOCKET_WAIT.
+ @sa MYSQL_END_SOCKET_WAIT.
+*/
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+#define MYSQL_SOCKET_WAIT_VARIABLES(LOCKER, STATE) \
+ struct PSI_socket_locker *LOCKER; \
+ PSI_socket_locker_state STATE;
+#else
+#define MYSQL_SOCKET_WAIT_VARIABLES(LOCKER, STATE)
+#endif
+
+/**
+ @def MYSQL_START_SOCKET_WAIT
+ Instrumentation helper for socket waits.
+ This instrumentation marks the start of a wait event.
+ @param LOCKER locker
+ @param STATE locker state
+ @param SOCKET instrumented socket
+ @param OP The socket operation to be performed
+ @param COUNT bytes to be written/read
+ @sa MYSQL_END_SOCKET_WAIT.
+*/
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+#define MYSQL_START_SOCKET_WAIT(LOCKER, STATE, SOCKET, OP, COUNT) \
+ LOCKER = inline_mysql_start_socket_wait(STATE, SOCKET, OP, COUNT, __FILE__, \
+ __LINE__)
+#else
+#define MYSQL_START_SOCKET_WAIT(LOCKER, STATE, SOCKET, OP, COUNT) \
+ do { \
+ } while (0)
+#endif
+
+/**
+ @def MYSQL_END_SOCKET_WAIT
+ Instrumentation helper for socket waits.
+ This instrumentation marks the end of a wait event.
+ @param LOCKER locker
+ @param COUNT actual bytes written/read, or -1
+ @sa MYSQL_START_SOCKET_WAIT.
+*/
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+#define MYSQL_END_SOCKET_WAIT(LOCKER, COUNT) \
+ inline_mysql_end_socket_wait(LOCKER, COUNT)
+#else
+#define MYSQL_END_SOCKET_WAIT(LOCKER, COUNT) \
+ do { \
+ } while (0)
+#endif
+
+/**
+ @def MYSQL_SOCKET_SET_STATE
+ Set the state (IDLE, ACTIVE) of an instrumented socket.
+ @param SOCKET the instrumented socket
+ @param STATE the new state
+ @sa PSI_socket_state
+*/
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+#define MYSQL_SOCKET_SET_STATE(SOCKET, STATE) \
+ inline_mysql_socket_set_state(SOCKET, STATE)
+#else
+#define MYSQL_SOCKET_SET_STATE(SOCKET, STATE) \
+ do { \
+ } while (0)
+#endif
+
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+/**
+ Instrumentation calls for MYSQL_START_SOCKET_WAIT.
+ @sa MYSQL_START_SOCKET_WAIT.
+*/
+static inline struct PSI_socket_locker *inline_mysql_start_socket_wait(
+ PSI_socket_locker_state *state, MYSQL_SOCKET mysql_socket,
+ enum PSI_socket_operation op, size_t byte_count, const char *src_file,
+ int src_line) {
+ struct PSI_socket_locker *locker;
+ if (mysql_socket.m_psi != NULL) {
+ locker = PSI_SOCKET_CALL(start_socket_wait)(state, mysql_socket.m_psi, op,
+ byte_count, src_file, src_line);
+ } else {
+ locker = NULL;
+ }
+ return locker;
+}
+
+/**
+ Instrumentation calls for MYSQL_END_SOCKET_WAIT.
+ @sa MYSQL_END_SOCKET_WAIT.
+*/
+static inline void inline_mysql_end_socket_wait(
+ struct PSI_socket_locker *locker, size_t byte_count) {
+ if (locker != NULL) {
+ PSI_SOCKET_CALL(end_socket_wait)(locker, byte_count);
+ }
+}
+
+/**
+ Set the state (IDLE, ACTIVE) of an instrumented socket.
+ @param socket the instrumented socket
+ @param state the new state
+ @sa PSI_socket_state
+*/
+static inline void inline_mysql_socket_set_state(MYSQL_SOCKET socket,
+ enum PSI_socket_state state) {
+ if (socket.m_psi != NULL) {
+ PSI_SOCKET_CALL(set_socket_state)(socket.m_psi, state);
+ }
+}
+#endif /* HAVE_PSI_SOCKET_INTERFACE */
+
+/**
+ @def mysql_socket_socket(K, D, T, P)
+ Create a socket.
+ @c mysql_socket_socket is a replacement for @c socket.
+ @param K PSI_socket_key for this instrumented socket
+ @param D Socket domain
+ @param T Protocol type
+ @param P Transport protocol
+*/
+
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+#define mysql_socket_socket(K, D, T, P) inline_mysql_socket_socket(K, D, T, P)
+#else
+#define mysql_socket_socket(K, D, T, P) inline_mysql_socket_socket(D, T, P)
+#endif
+
+/**
+ @def mysql_socket_bind(FD, AP, L)
+ Bind a socket to a local port number and IP address
+ @c mysql_socket_bind is a replacement for @c bind.
+ @param FD Instrumented socket descriptor returned by socket()
+ @param AP Pointer to local port number and IP address in sockaddr structure
+ @param L Length of sockaddr structure
+*/
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+#define mysql_socket_bind(FD, AP, L) \
+ inline_mysql_socket_bind(__FILE__, __LINE__, FD, AP, L)
+#else
+#define mysql_socket_bind(FD, AP, L) inline_mysql_socket_bind(FD, AP, L)
+#endif
+
+/**
+ @def mysql_socket_getsockname(FD, AP, LP)
+ Return port number and IP address of the local host
+ @c mysql_socket_getsockname is a replacement for @c getsockname.
+ @param FD Instrumented socket descriptor returned by socket()
+ @param AP Pointer to returned address of local host in @c sockaddr structure
+ @param LP Pointer to length of @c sockaddr structure
+*/
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+#define mysql_socket_getsockname(FD, AP, LP) \
+ inline_mysql_socket_getsockname(__FILE__, __LINE__, FD, AP, LP)
+#else
+#define mysql_socket_getsockname(FD, AP, LP) \
+ inline_mysql_socket_getsockname(FD, AP, LP)
+#endif
+
+/**
+ @def mysql_socket_connect(FD, AP, L)
+ Establish a connection to a remote host.
+ @c mysql_socket_connect is a replacement for @c connect.
+ @param FD Instrumented socket descriptor returned by socket()
+ @param AP Pointer to target address in sockaddr structure
+ @param L Length of sockaddr structure
+*/
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+#define mysql_socket_connect(FD, AP, L) \
+ inline_mysql_socket_connect(__FILE__, __LINE__, FD, AP, L)
+#else
+#define mysql_socket_connect(FD, AP, L) inline_mysql_socket_connect(FD, AP, L)
+#endif
+
+/**
+ @def mysql_socket_getpeername(FD, AP, LP)
+ Get port number and IP address of remote host that a socket is connected to.
+ @c mysql_socket_getpeername is a replacement for @c getpeername.
+ @param FD Instrumented socket descriptor returned by socket() or accept()
+ @param AP Pointer to returned address of remote host in sockaddr structure
+ @param LP Pointer to length of sockaddr structure
+*/
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+#define mysql_socket_getpeername(FD, AP, LP) \
+ inline_mysql_socket_getpeername(__FILE__, __LINE__, FD, AP, LP)
+#else
+#define mysql_socket_getpeername(FD, AP, LP) \
+ inline_mysql_socket_getpeername(FD, AP, LP)
+#endif
+
+/**
+ @def mysql_socket_send(FD, B, N, FL)
+ Send data from the buffer, B, to a connected socket.
+ @c mysql_socket_send is a replacement for @c send.
+ @param FD Instrumented socket descriptor returned by socket() or accept()
+ @param B Buffer to send
+ @param N Number of bytes to send
+ @param FL Control flags
+*/
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+#define mysql_socket_send(FD, B, N, FL) \
+ inline_mysql_socket_send(__FILE__, __LINE__, FD, B, N, FL)
+#else
+#define mysql_socket_send(FD, B, N, FL) inline_mysql_socket_send(FD, B, N, FL)
+#endif
+
+/**
+ @def mysql_socket_recv(FD, B, N, FL)
+ Receive data from a connected socket.
+ @c mysql_socket_recv is a replacement for @c recv.
+ @param FD Instrumented socket descriptor returned by socket() or accept()
+ @param B Buffer to receive to
+ @param N Maximum bytes to receive
+ @param FL Control flags
+*/
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+#define mysql_socket_recv(FD, B, N, FL) \
+ inline_mysql_socket_recv(__FILE__, __LINE__, FD, B, N, FL)
+#else
+#define mysql_socket_recv(FD, B, N, FL) inline_mysql_socket_recv(FD, B, N, FL)
+#endif
+
+/**
+ @def mysql_socket_sendto(FD, B, N, FL, AP, L)
+ Send data to a socket at the specified address.
+ @c mysql_socket_sendto is a replacement for @c sendto.
+ @param FD Instrumented socket descriptor returned by socket()
+ @param B Buffer to send
+ @param N Number of bytes to send
+ @param FL Control flags
+ @param AP Pointer to destination sockaddr structure
+ @param L Size of sockaddr structure
+*/
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+#define mysql_socket_sendto(FD, B, N, FL, AP, L) \
+ inline_mysql_socket_sendto(__FILE__, __LINE__, FD, B, N, FL, AP, L)
+#else
+#define mysql_socket_sendto(FD, B, N, FL, AP, L) \
+ inline_mysql_socket_sendto(FD, B, N, FL, AP, L)
+#endif
+
+/**
+ @def mysql_socket_recvfrom(FD, B, N, FL, AP, L)
+ Receive data from a socket and return source address information
+ @c mysql_socket_recvfrom is a replacement for @c recvfrom.
+ @param FD Instrumented socket descriptor returned by socket()
+ @param B Buffer to receive to
+ @param N Maximum bytes to receive
+ @param FL Control flags
+ @param AP Pointer to source address in sockaddr_storage structure
+ @param LP Size of sockaddr_storage structure
+*/
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+#define mysql_socket_recvfrom(FD, B, N, FL, AP, LP) \
+ inline_mysql_socket_recvfrom(__FILE__, __LINE__, FD, B, N, FL, AP, LP)
+#else
+#define mysql_socket_recvfrom(FD, B, N, FL, AP, LP) \
+ inline_mysql_socket_recvfrom(FD, B, N, FL, AP, LP)
+#endif
+
+/**
+ @def mysql_socket_getsockopt(FD, LV, ON, OP, OL)
+ Get a socket option for the specified socket.
+ @c mysql_socket_getsockopt is a replacement for @c getsockopt.
+ @param FD Instrumented socket descriptor returned by socket()
+ @param LV Protocol level
+ @param ON Option to query
+ @param OP Buffer which will contain the value for the requested option
+ @param OL Pointer to length of OP
+*/
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+#define mysql_socket_getsockopt(FD, LV, ON, OP, OL) \
+ inline_mysql_socket_getsockopt(__FILE__, __LINE__, FD, LV, ON, OP, OL)
+#else
+#define mysql_socket_getsockopt(FD, LV, ON, OP, OL) \
+ inline_mysql_socket_getsockopt(FD, LV, ON, OP, OL)
+#endif
+
+/**
+ @def mysql_socket_setsockopt(FD, LV, ON, OP, OL)
+ Set a socket option for the specified socket.
+ @c mysql_socket_setsockopt is a replacement for @c setsockopt.
+ @param FD Instrumented socket descriptor returned by socket()
+ @param LV Protocol level
+ @param ON Option to modify
+ @param OP Buffer containing the value for the specified option
+ @param OL Pointer to length of OP
+*/
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+#define mysql_socket_setsockopt(FD, LV, ON, OP, OL) \
+ inline_mysql_socket_setsockopt(__FILE__, __LINE__, FD, LV, ON, OP, OL)
+#else
+#define mysql_socket_setsockopt(FD, LV, ON, OP, OL) \
+ inline_mysql_socket_setsockopt(FD, LV, ON, OP, OL)
+#endif
+
+/**
+ @def mysql_sock_set_nonblocking
+ Set socket to non-blocking.
+ @param FD instrumented socket descriptor
+*/
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+#define mysql_sock_set_nonblocking(FD) \
+ inline_mysql_sock_set_nonblocking(__FILE__, __LINE__, FD)
+#else
+#define mysql_sock_set_nonblocking(FD) inline_mysql_sock_set_nonblocking(FD)
+#endif
+
+/**
+ @def mysql_socket_listen(FD, N)
+ Set socket state to listen for an incoming connection.
+ @c mysql_socket_listen is a replacement for @c listen.
+ @param FD Instrumented socket descriptor, bound and connected
+ @param N Maximum number of pending connections allowed.
+*/
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+#define mysql_socket_listen(FD, N) \
+ inline_mysql_socket_listen(__FILE__, __LINE__, FD, N)
+#else
+#define mysql_socket_listen(FD, N) inline_mysql_socket_listen(FD, N)
+#endif
+
+/**
+ @def mysql_socket_accept(K, FD, AP, LP)
+ Accept a connection from any remote host; TCP only.
+ @c mysql_socket_accept is a replacement for @c accept.
+ @param K PSI_socket_key for this instrumented socket
+ @param FD Instrumented socket descriptor, bound and placed in a listen state
+ @param AP Pointer to sockaddr structure with returned IP address and port of
+ connected host
+ @param LP Pointer to length of valid information in AP
+*/
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+#define mysql_socket_accept(K, FD, AP, LP) \
+ inline_mysql_socket_accept(__FILE__, __LINE__, K, FD, AP, LP)
+#else
+#define mysql_socket_accept(K, FD, AP, LP) \
+ inline_mysql_socket_accept(FD, AP, LP)
+#endif
+
+/**
+ @def mysql_socket_close(FD)
+ Close a socket and sever any connections.
+ @c mysql_socket_close is a replacement for @c close.
+ @param FD Instrumented socket descriptor returned by socket() or accept()
+*/
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+#define mysql_socket_close(FD) inline_mysql_socket_close(__FILE__, __LINE__, FD)
+#else
+#define mysql_socket_close(FD) inline_mysql_socket_close(FD)
+#endif
+
+/**
+ @def mysql_socket_shutdown(FD, H)
+ Disable receives and/or sends on a socket.
+ @c mysql_socket_shutdown is a replacement for @c shutdown.
+ @param FD Instrumented socket descriptor returned by socket() or accept()
+ @param H Specifies which operations to shutdown
+*/
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+#define mysql_socket_shutdown(FD, H) \
+ inline_mysql_socket_shutdown(__FILE__, __LINE__, FD, H)
+#else
+#define mysql_socket_shutdown(FD, H) inline_mysql_socket_shutdown(FD, H)
+#endif
+
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+static inline void inline_mysql_socket_register(const char *category,
+ PSI_socket_info *info,
+ int count) {
+ PSI_SOCKET_CALL(register_socket)(category, info, count);
+}
+#endif
+
+/** mysql_socket_socket */
+
+static inline MYSQL_SOCKET inline_mysql_socket_socket(
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ PSI_socket_key key,
+#endif
+ int domain, int type, int protocol) {
+ MYSQL_SOCKET mysql_socket = MYSQL_INVALID_SOCKET;
+ mysql_socket.fd = socket(domain, type, protocol);
+
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ if (likely(mysql_socket.fd != INVALID_SOCKET)) {
+ mysql_socket.m_psi = PSI_SOCKET_CALL(init_socket)(
+ key, (const my_socket *)&mysql_socket.fd, NULL, 0);
+ }
+#endif
+ return mysql_socket;
+}
+
+/** mysql_socket_bind */
+
+static inline int inline_mysql_socket_bind(
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, const struct sockaddr *addr, socklen_t len) {
+ int result;
+
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ if (mysql_socket.m_psi != NULL) {
+ /* Instrumentation start */
+ PSI_socket_locker_state state;
+ PSI_socket_locker *locker;
+ locker = PSI_SOCKET_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
+ PSI_SOCKET_BIND, (size_t)0,
+ src_file, src_line);
+
+ /* Instrumented code */
+ result = bind(mysql_socket.fd, addr, len);
+
+ /* Instrumentation end */
+ if (result == 0) {
+ PSI_SOCKET_CALL(set_socket_info)(mysql_socket.m_psi, NULL, addr, len);
+ }
+
+ if (locker != NULL) {
+ PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
+ }
+
+ return result;
+ }
+#endif
+
+ /* Non instrumented code */
+ result = bind(mysql_socket.fd, addr, len);
+ return result;
+}
+
+/** mysql_socket_getsockname */
+
+static inline int inline_mysql_socket_getsockname(
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, struct sockaddr *addr, socklen_t *len) {
+ int result;
+
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ if (mysql_socket.m_psi != NULL) {
+ /* Instrumentation start */
+ PSI_socket_locker *locker;
+ PSI_socket_locker_state state;
+ locker = PSI_SOCKET_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
+ PSI_SOCKET_BIND, (size_t)0,
+ src_file, src_line);
+
+ /* Instrumented code */
+ result = getsockname(mysql_socket.fd, addr, len);
+
+ /* Instrumentation end */
+ if (locker != NULL) {
+ PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
+ }
+
+ return result;
+ }
+#endif
+
+ /* Non instrumented code */
+ result = getsockname(mysql_socket.fd, addr, len);
+
+ return result;
+}
+
+/** mysql_socket_connect */
+
+static inline int inline_mysql_socket_connect(
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, const struct sockaddr *addr, socklen_t len) {
+ int result;
+
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ if (mysql_socket.m_psi != NULL) {
+ /* Instrumentation start */
+ PSI_socket_locker *locker;
+ PSI_socket_locker_state state;
+ locker = PSI_SOCKET_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
+ PSI_SOCKET_CONNECT, (size_t)0,
+ src_file, src_line);
+
+ /* Instrumented code */
+ result = connect(mysql_socket.fd, addr, len);
+
+ /* Instrumentation end */
+ if (locker != NULL) {
+ PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
+ }
+
+ return result;
+ }
+#endif
+
+ /* Non instrumented code */
+ result = connect(mysql_socket.fd, addr, len);
+
+ return result;
+}
+
+/** mysql_socket_getpeername */
+
+static inline int inline_mysql_socket_getpeername(
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, struct sockaddr *addr, socklen_t *len) {
+ int result;
+
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ if (mysql_socket.m_psi != NULL) {
+ /* Instrumentation start */
+ PSI_socket_locker *locker;
+ PSI_socket_locker_state state;
+ locker = PSI_SOCKET_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
+ PSI_SOCKET_BIND, (size_t)0,
+ src_file, src_line);
+
+ /* Instrumented code */
+ result = getpeername(mysql_socket.fd, addr, len);
+
+ /* Instrumentation end */
+ if (locker != NULL) {
+ PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
+ }
+
+ return result;
+ }
+#endif
+
+ /* Non instrumented code */
+ result = getpeername(mysql_socket.fd, addr, len);
+
+ return result;
+}
+
+/** mysql_socket_send */
+
+static inline ssize_t inline_mysql_socket_send(
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, const SOCKBUF_T *buf, size_t n, int flags) {
+ ssize_t result;
+
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ if (mysql_socket.m_psi != NULL) {
+ /* Instrumentation start */
+ PSI_socket_locker *locker;
+ PSI_socket_locker_state state;
+ locker = PSI_SOCKET_CALL(start_socket_wait)(
+ &state, mysql_socket.m_psi, PSI_SOCKET_SEND, n, src_file, src_line);
+
+ /* Instrumented code */
+ result = send(mysql_socket.fd, buf, IF_WIN((int), ) n, flags);
+
+ /* Instrumentation end */
+ if (locker != NULL) {
+ size_t bytes_written;
+ bytes_written = (result > -1) ? result : 0;
+ PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_written);
+ }
+
+ return result;
+ }
+#endif
+
+ /* Non instrumented code */
+ result = send(mysql_socket.fd, buf, IF_WIN((int), ) n, flags);
+
+ return result;
+}
+
+/** mysql_socket_recv */
+
+static inline ssize_t inline_mysql_socket_recv(
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, SOCKBUF_T *buf, size_t n, int flags) {
+ ssize_t result;
+
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ if (mysql_socket.m_psi != NULL) {
+ /* Instrumentation start */
+ PSI_socket_locker *locker;
+ PSI_socket_locker_state state;
+ locker = PSI_SOCKET_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
+ PSI_SOCKET_RECV, (size_t)0,
+ src_file, src_line);
+
+ /* Instrumented code */
+ result = recv(mysql_socket.fd, buf, IF_WIN((int), ) n, flags);
+
+ /* Instrumentation end */
+ if (locker != NULL) {
+ size_t bytes_read;
+ bytes_read = (result > -1) ? result : 0;
+ PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_read);
+ }
+
+ return result;
+ }
+#endif
+
+ /* Non instrumented code */
+ result = recv(mysql_socket.fd, buf, IF_WIN((int), ) n, flags);
+
+ return result;
+}
+
+/** mysql_socket_sendto */
+
+static inline ssize_t inline_mysql_socket_sendto(
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, const SOCKBUF_T *buf, size_t n, int flags,
+ const struct sockaddr *addr, socklen_t addr_len) {
+ ssize_t result;
+
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ if (mysql_socket.m_psi != NULL) {
+ /* Instrumentation start */
+ PSI_socket_locker *locker;
+ PSI_socket_locker_state state;
+ locker = PSI_SOCKET_CALL(start_socket_wait)(
+ &state, mysql_socket.m_psi, PSI_SOCKET_SEND, n, src_file, src_line);
+
+ /* Instrumented code */
+ result =
+ sendto(mysql_socket.fd, buf, IF_WIN((int), ) n, flags, addr, addr_len);
+
+ /* Instrumentation end */
+ if (locker != NULL) {
+ size_t bytes_written;
+ bytes_written = (result > -1) ? result : 0;
+ PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_written);
+ }
+
+ return result;
+ }
+#endif
+
+ /* Non instrumented code */
+ result =
+ sendto(mysql_socket.fd, buf, IF_WIN((int), ) n, flags, addr, addr_len);
+
+ return result;
+}
+
+/** mysql_socket_recvfrom */
+
+static inline ssize_t inline_mysql_socket_recvfrom(
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, SOCKBUF_T *buf, size_t n, int flags,
+ struct sockaddr *addr, socklen_t *addr_len) {
+ ssize_t result;
+
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ if (mysql_socket.m_psi != NULL) {
+ /* Instrumentation start */
+ PSI_socket_locker *locker;
+ PSI_socket_locker_state state;
+ locker = PSI_SOCKET_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
+ PSI_SOCKET_RECV, (size_t)0,
+ src_file, src_line);
+
+ /* Instrumented code */
+ result = recvfrom(mysql_socket.fd, buf, IF_WIN((int), ) n, flags, addr,
+ addr_len);
+
+ /* Instrumentation end */
+ if (locker != NULL) {
+ size_t bytes_read;
+ bytes_read = (result > -1) ? result : 0;
+ PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_read);
+ }
+
+ return result;
+ }
+#endif
+
+ /* Non instrumented code */
+ result =
+ recvfrom(mysql_socket.fd, buf, IF_WIN((int), ) n, flags, addr, addr_len);
+
+ return result;
+}
+
+/** mysql_socket_getsockopt */
+
+static inline int inline_mysql_socket_getsockopt(
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, int level, int optname, SOCKBUF_T *optval,
+ socklen_t *optlen) {
+ int result;
+
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ if (mysql_socket.m_psi != NULL) {
+ /* Instrumentation start */
+ PSI_socket_locker *locker;
+ PSI_socket_locker_state state;
+ locker = PSI_SOCKET_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
+ PSI_SOCKET_OPT, (size_t)0,
+ src_file, src_line);
+
+ /* Instrumented code */
+ result = getsockopt(mysql_socket.fd, level, optname, optval, optlen);
+
+ /* Instrumentation end */
+ if (locker != NULL) {
+ PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
+ }
+
+ return result;
+ }
+#endif
+
+ /* Non instrumented code */
+ result = getsockopt(mysql_socket.fd, level, optname, optval, optlen);
+
+ return result;
+}
+
+/** mysql_socket_setsockopt */
+
+static inline int inline_mysql_socket_setsockopt(
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, int level, int optname, const SOCKBUF_T *optval,
+ socklen_t optlen) {
+ int result;
+
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ if (mysql_socket.m_psi) {
+ /* Instrumentation start */
+ PSI_socket_locker *locker;
+ PSI_socket_locker_state state;
+ locker = PSI_SOCKET_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
+ PSI_SOCKET_OPT, (size_t)0,
+ src_file, src_line);
+
+ /* Instrumented code */
+ result = setsockopt(mysql_socket.fd, level, optname, optval, optlen);
+
+ /* Instrumentation end */
+ if (locker != NULL) {
+ PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
+ }
+
+ return result;
+ }
+#endif
+
+ /* Non instrumented code */
+ result = setsockopt(mysql_socket.fd, level, optname, optval, optlen);
+
+ return result;
+}
+
+/** set_socket_nonblock */
+static inline int set_socket_nonblock(my_socket fd) {
+ int ret = 0;
+#ifdef _WIN32
+ {
+ u_long nonblocking = 1;
+ ret = ioctlsocket(fd, FIONBIO, &nonblocking);
+ }
+#else
+ {
+ int fd_flags;
+ fd_flags = fcntl(fd, F_GETFL, 0);
+ if (fd_flags < 0) {
+ return errno;
+ }
+#if defined(O_NONBLOCK)
+ fd_flags |= O_NONBLOCK;
+#elif defined(O_NDELAY)
+ fd_flags |= O_NDELAY;
+#elif defined(O_FNDELAY)
+ fd_flags |= O_FNDELAY;
+#else
+#error "No definition of non-blocking flag found."
+#endif /* O_NONBLOCK */
+ if (fcntl(fd, F_SETFL, fd_flags) == -1) {
+ ret = errno;
+ }
+ }
+#endif /* _WIN32 */
+ return ret;
+}
+
+/** mysql_socket_set_nonblocking */
+
+static inline int inline_mysql_sock_set_nonblocking(
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket) {
+ int result = 0;
+
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ if (mysql_socket.m_psi) {
+ /* Instrumentation start */
+ PSI_socket_locker *locker;
+ PSI_socket_locker_state state;
+ locker = PSI_SOCKET_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
+ PSI_SOCKET_OPT, (size_t)0,
+ src_file, src_line);
+
+ /* Instrumented code */
+ result = set_socket_nonblock(mysql_socket.fd);
+
+ /* Instrumentation end */
+ if (locker != NULL) {
+ PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
+ }
+
+ return result;
+ }
+#endif
+
+ /* Non instrumented code */
+ result = set_socket_nonblock(mysql_socket.fd);
+
+ return result;
+}
+
+/** mysql_socket_listen */
+
+static inline int inline_mysql_socket_listen(
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, int backlog) {
+ int result;
+
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ if (mysql_socket.m_psi != NULL) {
+ /* Instrumentation start */
+ PSI_socket_locker *locker;
+ PSI_socket_locker_state state;
+ locker = PSI_SOCKET_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
+ PSI_SOCKET_CONNECT, (size_t)0,
+ src_file, src_line);
+
+ /* Instrumented code */
+ result = listen(mysql_socket.fd, backlog);
+
+ /* Instrumentation end */
+ if (locker != NULL) {
+ PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
+ }
+
+ return result;
+ }
+#endif
+
+ /* Non instrumented code */
+ result = listen(mysql_socket.fd, backlog);
+
+ return result;
+}
+
+/** mysql_socket_accept */
+
+static inline MYSQL_SOCKET inline_mysql_socket_accept(
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ const char *src_file, uint src_line, PSI_socket_key key,
+#endif
+ MYSQL_SOCKET socket_listen, struct sockaddr *addr, socklen_t *addr_len) {
+ MYSQL_SOCKET socket_accept = MYSQL_INVALID_SOCKET;
+ socklen_t addr_length = (addr_len != NULL) ? *addr_len : 0;
+
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ if (socket_listen.m_psi != NULL) {
+ /* Instrumentation start */
+ PSI_socket_locker *locker;
+ PSI_socket_locker_state state;
+ locker = PSI_SOCKET_CALL(start_socket_wait)(&state, socket_listen.m_psi,
+ PSI_SOCKET_CONNECT, (size_t)0,
+ src_file, src_line);
+
+ /* Instrumented code */
+ socket_accept.fd = accept(socket_listen.fd, addr, &addr_length);
+
+ /* Instrumentation end */
+ if (locker != NULL) {
+ PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
+ }
+ } else
+#endif
+ {
+ /* Non instrumented code */
+ socket_accept.fd = accept(socket_listen.fd, addr, &addr_length);
+ }
+
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ if (likely(socket_accept.fd != INVALID_SOCKET)) {
+ /* Initialize the instrument with the new socket descriptor and address */
+ socket_accept.m_psi = PSI_SOCKET_CALL(init_socket)(
+ key, (const my_socket *)&socket_accept.fd, addr, addr_length);
+ }
+#endif
+
+ return socket_accept;
+}
+
+/** mysql_socket_close */
+
+static inline int inline_mysql_socket_close(
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket) {
+ int result;
+
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ if (mysql_socket.m_psi != NULL) {
+ /* Instrumentation start */
+ PSI_socket_locker *locker;
+ PSI_socket_locker_state state;
+ locker = PSI_SOCKET_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
+ PSI_SOCKET_CLOSE, (size_t)0,
+ src_file, src_line);
+
+ /* Instrumented code */
+ result = closesocket(mysql_socket.fd);
+
+ /* Instrumentation end */
+ if (locker != NULL) {
+ PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
+ }
+ /* Remove the instrumentation for this socket. */
+ if (mysql_socket.m_psi != NULL) {
+ PSI_SOCKET_CALL(destroy_socket)(mysql_socket.m_psi);
+ }
+
+ return result;
+ }
+#endif
+
+ /* Non instrumented code */
+ result = closesocket(mysql_socket.fd);
+
+ return result;
+}
+
+/** mysql_socket_shutdown */
+
+static inline int inline_mysql_socket_shutdown(
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, int how) {
+ int result;
+
+#ifdef _WIN32
+ static LPFN_DISCONNECTEX DisconnectEx = NULL;
+ if (DisconnectEx == NULL) {
+ DWORD dwBytesReturned;
+ GUID guidDisconnectEx = WSAID_DISCONNECTEX;
+ WSAIoctl(mysql_socket.fd, SIO_GET_EXTENSION_FUNCTION_POINTER,
+ &guidDisconnectEx, sizeof(GUID), &DisconnectEx,
+ sizeof(DisconnectEx), &dwBytesReturned, NULL, NULL);
+ }
+#endif
+
+/* Instrumentation start */
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+ if (mysql_socket.m_psi != NULL) {
+ PSI_socket_locker *locker;
+ PSI_socket_locker_state state;
+ locker = PSI_SOCKET_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
+ PSI_SOCKET_SHUTDOWN, (size_t)0,
+ src_file, src_line);
+
+/* Instrumented code */
+#ifdef _WIN32
+ if (DisconnectEx)
+ result = (DisconnectEx(mysql_socket.fd, (LPOVERLAPPED)NULL, (DWORD)0,
+ (DWORD)0) == TRUE)
+ ? 0
+ : -1;
+ else
+#endif
+ result = shutdown(mysql_socket.fd, how);
+
+ /* Instrumentation end */
+ if (locker != NULL) {
+ PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
+ }
+
+ return result;
+ }
+#endif
+
+/* Non instrumented code */
+#ifdef _WIN32
+ if (DisconnectEx)
+ result = (DisconnectEx(mysql_socket.fd, (LPOVERLAPPED)NULL, (DWORD)0,
+ (DWORD)0) == TRUE)
+ ? 0
+ : -1;
+ else
+#endif
+ result = shutdown(mysql_socket.fd, how);
+
+ return result;
+}
+
+/** @} (end of group psi_api_socket) */
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/mysql_stage.h b/contrib/libs/libmysql_r/include/mysql/psi/mysql_stage.h
new file mode 100644
index 0000000000..882dfa6106
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/mysql_stage.h
@@ -0,0 +1,198 @@
+/* Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_STAGE_H
+#define MYSQL_STAGE_H
+
+/**
+ @file include/mysql/psi/mysql_stage.h
+ Instrumentation helpers for stages.
+*/
+
+#include "mysql/psi/psi_stage.h"
+
+#include "my_inttypes.h"
+#include "pfs_stage_provider.h"
+
+#ifndef PSI_STAGE_CALL
+#define PSI_STAGE_CALL(M) psi_stage_service->M
+#endif
+
+/**
+ @defgroup psi_api_stage Stage Instrumentation (API)
+ @ingroup psi_api
+ @{
+*/
+
+/**
+ @def mysql_stage_register(P1, P2, P3)
+ Stage registration.
+*/
+#ifdef HAVE_PSI_STAGE_INTERFACE
+#define mysql_stage_register(P1, P2, P3) inline_mysql_stage_register(P1, P2, P3)
+#else
+#define mysql_stage_register(P1, P2, P3) \
+ do { \
+ } while (0)
+#endif
+
+/**
+ @def MYSQL_SET_STAGE
+ Set the current stage.
+ Use this API when the file and line
+ is passed from the caller.
+ @param K the stage key
+ @param F the source file name
+ @param L the source file line
+ @return the current stage progress
+*/
+#ifdef HAVE_PSI_STAGE_INTERFACE
+#define MYSQL_SET_STAGE(K, F, L) inline_mysql_set_stage(K, F, L)
+#else
+#define MYSQL_SET_STAGE(K, F, L) NULL
+#endif
+
+/**
+ @def mysql_set_stage
+ Set the current stage.
+ @param K the stage key
+ @return the current stage progress
+*/
+#ifdef HAVE_PSI_STAGE_INTERFACE
+#define mysql_set_stage(K) inline_mysql_set_stage(K, __FILE__, __LINE__)
+#else
+#define mysql_set_stage(K) NULL
+#endif
+
+/**
+ @def mysql_end_stage
+ End the last stage
+*/
+#ifdef HAVE_PSI_STAGE_INTERFACE
+#define mysql_end_stage inline_mysql_end_stage
+#else
+#define mysql_end_stage() \
+ do { \
+ } while (0)
+#endif
+
+#ifdef HAVE_PSI_STAGE_INTERFACE
+static inline void inline_mysql_stage_register(const char *category,
+ PSI_stage_info **info,
+ int count) {
+ PSI_STAGE_CALL(register_stage)(category, info, count);
+}
+#endif
+
+#ifdef HAVE_PSI_STAGE_INTERFACE
+static inline PSI_stage_progress *inline_mysql_set_stage(PSI_stage_key key,
+ const char *src_file,
+ int src_line) {
+ return PSI_STAGE_CALL(start_stage)(key, src_file, src_line);
+}
+#endif
+
+#ifdef HAVE_PSI_STAGE_INTERFACE
+static inline void inline_mysql_end_stage() { PSI_STAGE_CALL(end_stage)(); }
+#endif
+
+#ifdef HAVE_PSI_STAGE_INTERFACE
+#define mysql_stage_set_work_completed(P1, P2) \
+ inline_mysql_stage_set_work_completed(P1, P2)
+
+#define mysql_stage_get_work_completed(P1) \
+ inline_mysql_stage_get_work_completed(P1)
+#else
+#define mysql_stage_set_work_completed(P1, P2) \
+ do { \
+ } while (0)
+
+#define mysql_stage_get_work_completed(P1) \
+ do { \
+ } while (0)
+#endif
+
+#ifdef HAVE_PSI_STAGE_INTERFACE
+#define mysql_stage_inc_work_completed(P1, P2) \
+ inline_mysql_stage_inc_work_completed(P1, P2)
+#else
+#define mysql_stage_inc_work_completed(P1, P2) \
+ do { \
+ } while (0)
+#endif
+
+#ifdef HAVE_PSI_STAGE_INTERFACE
+#define mysql_stage_set_work_estimated(P1, P2) \
+ inline_mysql_stage_set_work_estimated(P1, P2)
+
+#define mysql_stage_get_work_estimated(P1) \
+ inline_mysql_stage_get_work_estimated(P1)
+#else
+#define mysql_stage_set_work_estimated(P1, P2) \
+ do { \
+ } while (0)
+
+#define mysql_stage_get_work_estimated(P1) \
+ do { \
+ } while (0)
+#endif
+
+#ifdef HAVE_PSI_STAGE_INTERFACE
+static inline void inline_mysql_stage_set_work_completed(
+ PSI_stage_progress *progress, ulonglong val) {
+ if (progress != NULL) {
+ progress->m_work_completed = val;
+ }
+}
+
+static inline ulonglong inline_mysql_stage_get_work_completed(
+ PSI_stage_progress *progress) {
+ return progress->m_work_completed;
+}
+#endif
+
+#ifdef HAVE_PSI_STAGE_INTERFACE
+static inline void inline_mysql_stage_inc_work_completed(
+ PSI_stage_progress *progress, ulonglong val) {
+ if (progress != NULL) {
+ progress->m_work_completed += val;
+ }
+}
+#endif
+
+#ifdef HAVE_PSI_STAGE_INTERFACE
+static inline void inline_mysql_stage_set_work_estimated(
+ PSI_stage_progress *progress, ulonglong val) {
+ if (progress != NULL) {
+ progress->m_work_estimated = val;
+ }
+}
+
+static inline ulonglong inline_mysql_stage_get_work_estimated(
+ PSI_stage_progress *progress) {
+ return progress->m_work_estimated;
+}
+#endif
+
+/** @} (end of group psi_api_stage) */
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/mysql_statement.h b/contrib/libs/libmysql_r/include/mysql/psi/mysql_statement.h
new file mode 100644
index 0000000000..e866089f0b
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/mysql_statement.h
@@ -0,0 +1,253 @@
+/* Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_STATEMENT_H
+#define MYSQL_STATEMENT_H
+
+/**
+ @file include/mysql/psi/mysql_statement.h
+ Instrumentation helpers for statements.
+*/
+
+#include "my_compiler.h"
+#include "my_inttypes.h"
+#include "mysql/psi/psi_stage.h"
+#include "mysql/psi/psi_statement.h"
+#include "pfs_stage_provider.h" // IWYU pragma: keep
+#include "pfs_statement_provider.h" // IWYU pragma: keep
+
+class Diagnostics_area;
+struct CHARSET_INFO;
+
+#ifndef PSI_STATEMENT_CALL
+#define PSI_STATEMENT_CALL(M) psi_statement_service->M
+#endif
+
+#ifndef PSI_DIGEST_CALL
+#define PSI_DIGEST_CALL(M) psi_statement_service->M
+#endif
+
+#ifndef PSI_STAGE_CALL
+#define PSI_STAGE_CALL(M) psi_stage_service->M
+#endif
+
+/**
+ @defgroup psi_api_statement Statement Instrumentation (API)
+ @ingroup psi_api
+ @{
+*/
+
+/**
+ @def mysql_statement_register(P1, P2, P3)
+ Statement registration.
+*/
+#define mysql_statement_register(P1, P2, P3) \
+ inline_mysql_statement_register(P1, P2, P3)
+
+#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
+#define MYSQL_DIGEST_START(LOCKER) inline_mysql_digest_start(LOCKER)
+#else
+#define MYSQL_DIGEST_START(LOCKER) NULL
+#endif
+
+#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
+#define MYSQL_DIGEST_END(LOCKER, DIGEST) inline_mysql_digest_end(LOCKER, DIGEST)
+#else
+#define MYSQL_DIGEST_END(LOCKER, DIGEST) \
+ do { \
+ } while (0)
+#endif
+
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+#define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN, CS, SPS) \
+ inline_mysql_start_statement(STATE, K, DB, DB_LEN, CS, SPS, __FILE__, \
+ __LINE__)
+#else
+#define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN, CS, SPS) NULL
+#endif
+
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+#define MYSQL_REFINE_STATEMENT(LOCKER, K) \
+ inline_mysql_refine_statement(LOCKER, K)
+#else
+#define MYSQL_REFINE_STATEMENT(LOCKER, K) NULL
+#endif
+
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+#define MYSQL_SET_STATEMENT_TEXT(LOCKER, P1, P2) \
+ inline_mysql_set_statement_text(LOCKER, P1, P2)
+#else
+#define MYSQL_SET_STATEMENT_TEXT(LOCKER, P1, P2) \
+ do { \
+ } while (0)
+#endif
+
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+#define MYSQL_SET_STATEMENT_QUERY_ID(LOCKER, P1) \
+ inline_mysql_set_statement_query_id(LOCKER, P1)
+#else
+#define MYSQL_SET_STATEMENT_QUERY_ID(LOCKER, P1) \
+ do { \
+ } while (0)
+#endif
+
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+#define MYSQL_SET_STATEMENT_LOCK_TIME(LOCKER, P1) \
+ inline_mysql_set_statement_lock_time(LOCKER, P1)
+#else
+#define MYSQL_SET_STATEMENT_LOCK_TIME(LOCKER, P1) \
+ do { \
+ } while (0)
+#endif
+
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+#define MYSQL_SET_STATEMENT_ROWS_SENT(LOCKER, P1) \
+ inline_mysql_set_statement_rows_sent(LOCKER, P1)
+#else
+#define MYSQL_SET_STATEMENT_ROWS_SENT(LOCKER, P1) \
+ do { \
+ } while (0)
+#endif
+
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+#define MYSQL_SET_STATEMENT_ROWS_EXAMINED(LOCKER, P1) \
+ inline_mysql_set_statement_rows_examined(LOCKER, P1)
+#else
+#define MYSQL_SET_STATEMENT_ROWS_EXAMINED(LOCKER, P1) \
+ do { \
+ } while (0)
+#endif
+
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+#define MYSQL_END_STATEMENT(LOCKER, DA) inline_mysql_end_statement(LOCKER, DA)
+#else
+#define MYSQL_END_STATEMENT(LOCKER, DA) \
+ do { \
+ } while (0)
+#endif
+
+static inline void inline_mysql_statement_register(
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+ const char *category, PSI_statement_info *info, int count
+#else
+ const char *category MY_ATTRIBUTE((unused)),
+ void *info MY_ATTRIBUTE((unused)), int count MY_ATTRIBUTE((unused))
+#endif
+) {
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+ PSI_STATEMENT_CALL(register_statement)(category, info, count);
+#endif
+}
+
+#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
+static inline struct PSI_digest_locker *inline_mysql_digest_start(
+ PSI_statement_locker *locker) {
+ PSI_digest_locker *digest_locker = NULL;
+
+ if (likely(locker != NULL)) {
+ digest_locker = PSI_DIGEST_CALL(digest_start)(locker);
+ }
+ return digest_locker;
+}
+#endif
+
+#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
+static inline void inline_mysql_digest_end(PSI_digest_locker *locker,
+ const sql_digest_storage *digest) {
+ if (likely(locker != NULL)) {
+ PSI_DIGEST_CALL(digest_end)(locker, digest);
+ }
+}
+#endif
+
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+static inline struct PSI_statement_locker *inline_mysql_start_statement(
+ PSI_statement_locker_state *state, PSI_statement_key key, const char *db,
+ uint db_len, const CHARSET_INFO *charset, PSI_sp_share *sp_share,
+ const char *src_file, int src_line) {
+ PSI_statement_locker *locker;
+ locker = PSI_STATEMENT_CALL(get_thread_statement_locker)(state, key, charset,
+ sp_share);
+ if (likely(locker != NULL)) {
+ PSI_STATEMENT_CALL(start_statement)(locker, db, db_len, src_file, src_line);
+ }
+ return locker;
+}
+
+static inline struct PSI_statement_locker *inline_mysql_refine_statement(
+ PSI_statement_locker *locker, PSI_statement_key key) {
+ if (likely(locker != NULL)) {
+ locker = PSI_STATEMENT_CALL(refine_statement)(locker, key);
+ }
+ return locker;
+}
+
+static inline void inline_mysql_set_statement_text(PSI_statement_locker *locker,
+ const char *text,
+ uint text_len) {
+ if (likely(locker != NULL)) {
+ PSI_STATEMENT_CALL(set_statement_text)(locker, text, text_len);
+ }
+}
+
+static inline void inline_mysql_set_statement_query_id(
+ PSI_statement_locker *locker, ulonglong id) {
+ if (likely(locker != NULL)) {
+ PSI_STATEMENT_CALL(set_statement_query_id)(locker, id);
+ }
+}
+
+static inline void inline_mysql_set_statement_lock_time(
+ PSI_statement_locker *locker, ulonglong count) {
+ if (likely(locker != NULL)) {
+ PSI_STATEMENT_CALL(set_statement_lock_time)(locker, count);
+ }
+}
+
+static inline void inline_mysql_set_statement_rows_sent(
+ PSI_statement_locker *locker, ulonglong count) {
+ if (likely(locker != NULL)) {
+ PSI_STATEMENT_CALL(set_statement_rows_sent)(locker, count);
+ }
+}
+
+static inline void inline_mysql_set_statement_rows_examined(
+ PSI_statement_locker *locker, ulonglong count) {
+ if (likely(locker != NULL)) {
+ PSI_STATEMENT_CALL(set_statement_rows_examined)(locker, count);
+ }
+}
+
+static inline void inline_mysql_end_statement(
+ struct PSI_statement_locker *locker, Diagnostics_area *stmt_da) {
+#ifdef HAVE_PSI_STAGE_INTERFACE
+ PSI_STAGE_CALL(end_stage)();
+#endif /* HAVE_PSI_STAGE_INTERFACE */
+ if (likely(locker != NULL)) {
+ PSI_STATEMENT_CALL(end_statement)(locker, stmt_da);
+ }
+}
+#endif
+
+/** @} (end of group psi_api_statement) */
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/mysql_table.h b/contrib/libs/libmysql_r/include/mysql/psi/mysql_table.h
new file mode 100644
index 0000000000..ba81c0ccdb
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/mysql_table.h
@@ -0,0 +1,146 @@
+/* Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_TABLE_H
+#define MYSQL_TABLE_H
+
+/**
+ @file include/mysql/psi/mysql_table.h
+ Instrumentation helpers for table io.
+*/
+
+#include "mysql/psi/psi_table.h"
+
+#ifndef PSI_TABLE_CALL
+#define PSI_TABLE_CALL(M) psi_table_service->M
+#endif
+
+/**
+ @defgroup psi_api_table Table Instrumentation (API)
+ @ingroup psi_api
+ @{
+*/
+
+/**
+ @def MYSQL_TABLE_WAIT_VARIABLES
+ Instrumentation helper for table waits.
+ This instrumentation declares local variables.
+ Do not use a ';' after this macro
+ @param LOCKER the locker
+ @param STATE the locker state
+ @sa MYSQL_START_TABLE_IO_WAIT.
+ @sa MYSQL_END_TABLE_IO_WAIT.
+ @sa MYSQL_START_TABLE_LOCK_WAIT.
+ @sa MYSQL_END_TABLE_LOCK_WAIT.
+*/
+#ifdef HAVE_PSI_TABLE_INTERFACE
+#define MYSQL_TABLE_WAIT_VARIABLES(LOCKER, STATE) \
+ struct PSI_table_locker *LOCKER; \
+ PSI_table_locker_state STATE;
+#else
+#define MYSQL_TABLE_WAIT_VARIABLES(LOCKER, STATE)
+#endif
+
+/**
+ @def MYSQL_START_TABLE_LOCK_WAIT
+ Instrumentation helper for table lock waits.
+ This instrumentation marks the start of a wait event.
+ @param LOCKER the locker
+ @param STATE the locker state
+ @param PSI the instrumented table
+ @param OP the table operation to be performed
+ @param FLAGS per table operation flags.
+ @sa MYSQL_END_TABLE_LOCK_WAIT.
+*/
+#ifdef HAVE_PSI_TABLE_INTERFACE
+#define MYSQL_START_TABLE_LOCK_WAIT(LOCKER, STATE, PSI, OP, FLAGS) \
+ LOCKER = inline_mysql_start_table_lock_wait(STATE, PSI, OP, FLAGS, __FILE__, \
+ __LINE__)
+#else
+#define MYSQL_START_TABLE_LOCK_WAIT(LOCKER, STATE, PSI, OP, FLAGS) \
+ do { \
+ } while (0)
+#endif
+
+/**
+ @def MYSQL_END_TABLE_LOCK_WAIT
+ Instrumentation helper for table lock waits.
+ This instrumentation marks the end of a wait event.
+ @param LOCKER the locker
+ @sa MYSQL_START_TABLE_LOCK_WAIT.
+*/
+#ifdef HAVE_PSI_TABLE_INTERFACE
+#define MYSQL_END_TABLE_LOCK_WAIT(LOCKER) \
+ inline_mysql_end_table_lock_wait(LOCKER)
+#else
+#define MYSQL_END_TABLE_LOCK_WAIT(LOCKER) \
+ do { \
+ } while (0)
+#endif
+
+#ifdef HAVE_PSI_TABLE_INTERFACE
+#define MYSQL_UNLOCK_TABLE(T) inline_mysql_unlock_table(T)
+#else
+#define MYSQL_UNLOCK_TABLE(T) \
+ do { \
+ } while (0)
+#endif
+
+#ifdef HAVE_PSI_TABLE_INTERFACE
+/**
+ Instrumentation calls for MYSQL_START_TABLE_LOCK_WAIT.
+ @sa MYSQL_END_TABLE_LOCK_WAIT.
+*/
+static inline struct PSI_table_locker *inline_mysql_start_table_lock_wait(
+ PSI_table_locker_state *state, struct PSI_table *psi,
+ enum PSI_table_lock_operation op, ulong flags, const char *src_file,
+ int src_line) {
+ if (psi != NULL) {
+ struct PSI_table_locker *locker;
+ locker = PSI_TABLE_CALL(start_table_lock_wait)(state, psi, op, flags,
+ src_file, src_line);
+ return locker;
+ }
+ return NULL;
+}
+
+/**
+ Instrumentation calls for MYSQL_END_TABLE_LOCK_WAIT.
+ @sa MYSQL_START_TABLE_LOCK_WAIT.
+*/
+static inline void inline_mysql_end_table_lock_wait(
+ struct PSI_table_locker *locker) {
+ if (locker != NULL) {
+ PSI_TABLE_CALL(end_table_lock_wait)(locker);
+ }
+}
+
+static inline void inline_mysql_unlock_table(struct PSI_table *table) {
+ if (table != NULL) {
+ PSI_TABLE_CALL(unlock_table)(table);
+ }
+}
+#endif
+
+/** @} (end of group psi_api_table) */
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/mysql_thread.h b/contrib/libs/libmysql_r/include/mysql/psi/mysql_thread.h
new file mode 100644
index 0000000000..3409031e46
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/mysql_thread.h
@@ -0,0 +1,161 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_THREAD_H
+#define MYSQL_THREAD_H
+
+/**
+ @file include/mysql/psi/mysql_thread.h
+ Instrumentation helpers for mysys threads.
+ This header file provides the necessary declarations
+ to use the mysys thread API with the performance schema instrumentation.
+ In some compilers (SunStudio), 'static inline' functions, when declared
+ but not used, are not optimized away (because they are unused) by default,
+ so that including a static inline function from a header file does
+ create unwanted dependencies, causing unresolved symbols at link time.
+ Other compilers, like gcc, optimize these dependencies by default.
+
+ Since the instrumented APIs declared here are wrapper on top
+ of my_thread / safemutex / etc APIs,
+ including mysql/psi/mysql_thread.h assumes that
+ the dependency on my_thread and safemutex already exists.
+*/
+
+#include "my_psi_config.h" // IWYU pragma: keep
+#include "my_thread.h"
+#include "my_thread_local.h"
+#include "mysql/psi/psi_thread.h"
+#ifdef MYSQL_SERVER
+#ifndef MYSQL_DYNAMIC_PLUGIN
+#error #include "pfs_thread_provider.h"
+#endif
+#endif
+
+#ifndef PSI_THREAD_CALL
+#define PSI_THREAD_CALL(M) psi_thread_service->M
+#endif
+
+/**
+ @defgroup psi_api_thread Thread Instrumentation (API)
+ @ingroup psi_api
+ @{
+*/
+
+/**
+ @def mysql_thread_register(P1, P2, P3)
+ Thread registration.
+*/
+#define mysql_thread_register(P1, P2, P3) \
+ inline_mysql_thread_register(P1, P2, P3)
+
+/**
+ @def mysql_thread_create(K, P1, P2, P3, P4)
+ Instrumented my_thread_create.
+ This function creates both the thread instrumentation and a thread.
+ @c mysql_thread_create is a replacement for @c my_thread_create.
+ The parameter P4 (or, if it is NULL, P1) will be used as the
+ instrumented thread "indentity".
+ Providing a P1 / P4 parameter with a different value for each call
+ will on average improve performances, since this thread identity value
+ is used internally to randomize access to data and prevent contention.
+ This is optional, and the improvement is not guaranteed, only statistical.
+ @param K The PSI_thread_key for this instrumented thread
+ @param P1 my_thread_create parameter 1
+ @param P2 my_thread_create parameter 2
+ @param P3 my_thread_create parameter 3
+ @param P4 my_thread_create parameter 4
+*/
+#ifdef HAVE_PSI_THREAD_INTERFACE
+#define mysql_thread_create(K, P1, P2, P3, P4) \
+ inline_mysql_thread_create(K, P1, P2, P3, P4)
+#else
+#define mysql_thread_create(K, P1, P2, P3, P4) my_thread_create(P1, P2, P3, P4)
+#endif
+
+/**
+ @def mysql_thread_set_psi_id(I)
+ Set the thread identifier for the instrumentation.
+ @param I The thread identifier
+*/
+#ifdef HAVE_PSI_THREAD_INTERFACE
+#define mysql_thread_set_psi_id(I) inline_mysql_thread_set_psi_id(I)
+#else
+#define mysql_thread_set_psi_id(I) \
+ do { \
+ } while (0)
+#endif
+
+/**
+ @def mysql_thread_set_psi_THD(T)
+ Set the thread sql session for the instrumentation.
+ @param T The thread sql session
+*/
+#ifdef HAVE_PSI_THREAD_INTERFACE
+#define mysql_thread_set_psi_THD(T) inline_mysql_thread_set_psi_THD(T)
+#else
+#define mysql_thread_set_psi_THD(T) \
+ do { \
+ } while (0)
+#endif
+
+static inline void inline_mysql_thread_register(
+#ifdef HAVE_PSI_THREAD_INTERFACE
+ const char *category, PSI_thread_info *info, int count
+#else
+ const char *category MY_ATTRIBUTE((unused)),
+ void *info MY_ATTRIBUTE((unused)), int count MY_ATTRIBUTE((unused))
+#endif
+) {
+#ifdef HAVE_PSI_THREAD_INTERFACE
+ PSI_THREAD_CALL(register_thread)(category, info, count);
+#endif
+}
+
+#ifdef HAVE_PSI_THREAD_INTERFACE
+static inline int inline_mysql_thread_create(PSI_thread_key key,
+ my_thread_handle *thread,
+ const my_thread_attr_t *attr,
+ my_start_routine start_routine,
+ void *arg) {
+ int result;
+ result = PSI_THREAD_CALL(spawn_thread)(key, thread, attr, start_routine, arg);
+ return result;
+}
+
+static inline void inline_mysql_thread_set_psi_id(my_thread_id id) {
+ struct PSI_thread *psi = PSI_THREAD_CALL(get_thread)();
+ PSI_THREAD_CALL(set_thread_id)(psi, id);
+}
+
+#ifdef __cplusplus
+class THD;
+static inline void inline_mysql_thread_set_psi_THD(THD *thd) {
+ struct PSI_thread *psi = PSI_THREAD_CALL(get_thread)();
+ PSI_THREAD_CALL(set_thread_THD)(psi, thd);
+}
+#endif /* __cplusplus */
+
+#endif
+
+/** @} (end of group psi_api_thread) */
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/psi_base.h b/contrib/libs/libmysql_r/include/mysql/psi/psi_base.h
new file mode 100644
index 0000000000..1aec993b10
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/psi_base.h
@@ -0,0 +1,134 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_PSI_BASE_H
+#define MYSQL_PSI_BASE_H
+
+#include "my_psi_config.h"
+
+/**
+ @file include/mysql/psi/psi_base.h
+ Performance schema instrumentation interface.
+
+ @defgroup instrumentation_interface Instrumentation Interface
+ @ingroup performance_schema
+ @{
+
+ @defgroup psi_api Instrumentation Programming Interface
+ @{
+ @}
+
+ @defgroup psi_abi Instrumentation Binary Interface
+ @{
+*/
+
+#define PSI_INSTRUMENT_ME 0
+
+#define PSI_DOCUMENT_ME ""
+
+#define PSI_NOT_INSTRUMENTED 0
+
+/**
+ Singleton flag.
+ This flag indicate that an instrumentation point is a singleton.
+*/
+#define PSI_FLAG_SINGLETON (1 << 0)
+
+/**
+ Mutable flag.
+ This flag indicate that an instrumentation point is a general placeholder,
+ that can mutate into a more specific instrumentation point.
+*/
+#define PSI_FLAG_MUTABLE (1 << 1)
+
+/**
+ Per Thread flag.
+ This flag indicates the instrumented object is per thread.
+ Reserved for future use.
+*/
+#define PSI_FLAG_THREAD (1 << 2)
+
+/**
+ Stage progress flag.
+ This flag apply to the stage instruments only.
+ It indicates the instrumentation provides progress data.
+*/
+#define PSI_FLAG_STAGE_PROGRESS (1 << 3)
+
+/**
+ Shared Exclusive flag.
+ Indicates that rwlock support the shared exclusive state.
+*/
+#define PSI_FLAG_RWLOCK_SX (1 << 4)
+
+/**
+ Transferable flag.
+ This flag indicate that an instrumented object can
+ be created by a thread and destroyed by another thread.
+*/
+#define PSI_FLAG_TRANSFER (1 << 5)
+
+/**
+ User flag.
+ This flag indicate that an instrumented object exists on a
+ user or foreground thread. If not set, then the object
+ exists on a system or background thread.
+*/
+#define PSI_FLAG_USER (1 << 6)
+
+/**
+ Global stat only flag.
+ This flag indicates statistics for the instrument
+ are aggregated globally only.
+ No per thread / account / user / host aggregations
+ are available.
+*/
+#define PSI_FLAG_ONLY_GLOBAL_STAT (1 << 7)
+
+/**
+ Priority lock flag.
+ Indicates that rwlock support the priority lock scheduling.
+*/
+#define PSI_FLAG_RWLOCK_PR (1 << 8)
+
+#define PSI_VOLATILITY_UNKNOWN 0
+#define PSI_VOLATILITY_PERMANENT 1
+#define PSI_VOLATILITY_PROVISIONING 2
+#define PSI_VOLATILITY_DDL 3
+#define PSI_VOLATILITY_CACHE 4
+#define PSI_VOLATILITY_SESSION 5
+#define PSI_VOLATILITY_TRANSACTION 6
+#define PSI_VOLATILITY_QUERY 7
+#define PSI_VOLATILITY_INTRA_QUERY 8
+
+#define PSI_COUNT_VOLATILITY 9
+
+struct PSI_placeholder {
+ int m_placeholder;
+};
+
+/**
+ @} (end of group psi_abi)
+ @} (end of group instrumentation_interface)
+*/
+
+#endif /* MYSQL_PSI_BASE_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/psi_cond.h b/contrib/libs/libmysql_r/include/mysql/psi/psi_cond.h
new file mode 100644
index 0000000000..8c21b72361
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/psi_cond.h
@@ -0,0 +1,86 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_PSI_COND_H
+#define MYSQL_PSI_COND_H
+
+/**
+ @file include/mysql/psi/psi_cond.h
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_cond Cond Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+#include "my_inttypes.h"
+#include "my_macros.h"
+#include "my_psi_config.h" // IWYU pragma: keep
+#include "my_sharedlib.h"
+#include "mysql/components/services/psi_cond_bits.h"
+#include "psi_base.h"
+
+/** Entry point for the performance schema interface. */
+struct PSI_cond_bootstrap {
+ /**
+ ABI interface finder.
+ Calling this method with an interface version number returns either
+ an instance of the ABI for this version, or NULL.
+ @sa PSI_COND_VERSION_1
+ @sa PSI_COND_VERSION_2
+ @sa PSI_CURRENT_COND_VERSION
+ */
+ void *(*get_interface)(int version);
+};
+
+#ifdef HAVE_PSI_COND_INTERFACE
+
+/**
+ Performance Schema Cond Interface, version 1.
+ @since PSI_COND_VERSION_1
+*/
+struct PSI_cond_service_v1 {
+ /** @sa register_cond_v1_t. */
+ register_cond_v1_t register_cond;
+ /** @sa init_cond_v1_t. */
+ init_cond_v1_t init_cond;
+ /** @sa destroy_cond_v1_t. */
+ destroy_cond_v1_t destroy_cond;
+ /** @sa signal_cond_v1_t. */
+ signal_cond_v1_t signal_cond;
+ /** @sa broadcast_cond_v1_t. */
+ broadcast_cond_v1_t broadcast_cond;
+ /** @sa start_cond_wait_v1_t. */
+ start_cond_wait_v1_t start_cond_wait;
+ /** @sa end_cond_wait_v1_t. */
+ end_cond_wait_v1_t end_cond_wait;
+};
+
+typedef struct PSI_cond_service_v1 PSI_cond_service_t;
+
+extern MYSQL_PLUGIN_IMPORT PSI_cond_service_t *psi_cond_service;
+
+#endif /* HAVE_PSI_COND_INTERFACE */
+
+/** @} (end of group psi_abi_cond) */
+
+#endif /* MYSQL_PSI_MUTEX_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/psi_data_lock.h b/contrib/libs/libmysql_r/include/mysql/psi/psi_data_lock.h
new file mode 100644
index 0000000000..06fbe99c0a
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/psi_data_lock.h
@@ -0,0 +1,428 @@
+/* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_PSI_DATA_LOCK_H
+#define MYSQL_PSI_DATA_LOCK_H
+
+/**
+ @file include/mysql/psi/psi_data_lock.h
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_data_lock Row Lock Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+#include "my_inttypes.h"
+#include "my_sharedlib.h"
+#include "psi_base.h"
+
+#ifdef HAVE_PSI_DATA_LOCK_INTERFACE
+
+/**
+ @def PSI_DATA_LOCK_VERSION_1
+ Performance Schema Row Lock Interface number for version 1.
+ This version is supported.
+*/
+#define PSI_DATA_LOCK_VERSION_1 1
+
+/**
+ @def PSI_DATA_LOCK_VERSION_2
+ Performance Schema Row Lock Interface number for version 2.
+ This version is not implemented, it's a placeholder.
+*/
+#define PSI_DATA_LOCK_VERSION_2 2
+
+/**
+ @def PSI_CURRENT_DATA_LOCK_VERSION
+ Performance Schema Row Lock Interface number for the most recent version.
+ The most current version is @c PSI_DATA_LOCK_VERSION_1
+*/
+#define PSI_CURRENT_DATA_LOCK_VERSION 1
+
+#ifndef USE_PSI_DATA_LOCK_2
+#ifndef USE_PSI_DATA_LOCK_1
+#ifdef __cplusplus
+#define USE_PSI_DATA_LOCK_1
+#endif /* __cplusplus */
+#endif /* USE_PSI_DATA_LOCK_1 */
+#endif /* USE_PSI_DATA_LOCK_2 */
+
+#ifdef USE_PSI_DATA_LOCK_1
+#define HAVE_PSI_DATA_LOCK_1
+#endif /* USE_PSI_DATA_LOCK_1 */
+
+#ifdef USE_PSI_DATA_LOCK_2
+#define HAVE_PSI_DATA_LOCK_2
+#endif
+
+/** Entry point for the performance schema interface. */
+struct PSI_data_lock_bootstrap {
+ /**
+ ABI interface finder.
+ Calling this method with an interface version number returns either
+ an instance of the ABI for this version, or NULL.
+ @sa PSI_DATA_LOCK_VERSION_1
+ @sa PSI_DATA_LOCK_VERSION_2
+ @sa PSI_CURRENT_DATA_LOCK_VERSION
+ */
+ void *(*get_interface)(int version);
+};
+typedef struct PSI_data_lock_bootstrap PSI_data_lock_bootstrap;
+
+#ifdef HAVE_PSI_DATA_LOCK_1
+
+/**
+ Server interface, row lock container.
+ This is the interface exposed
+ - by the server
+ - to the storage engines
+ used to collect the data for table DATA_LOCKS.
+ The server is to implement this interface.
+ The storage engine is to call all_lock_row()
+ to advertise row locks that exists within
+ the storage engine tables.
+*/
+class PSI_server_data_lock_container {
+ public:
+ PSI_server_data_lock_container() {}
+ virtual ~PSI_server_data_lock_container() {}
+
+ /**
+ Add a string to the container cache.
+ Cached strings have the same life cycle as the data container,
+ and are freed when the container is destroyed.
+ Also, duplicated strings value are cached with the same copy,
+ avoiding memory duplication.
+ This is useful in particular to cache table schema or table names,
+ which are duplicated a lot for different row locks on the same table.
+ */
+ virtual const char *cache_string(const char *string) = 0;
+ /**
+ Add binary data to the container cache.
+ @sa cache_string
+ */
+ virtual const char *cache_data(const char *ptr, size_t length) = 0;
+
+ /**
+ Check if the container accepts data for a particular engine.
+ This methods is used to prune data for queries like
+ @code SELECT * from performance_schema.data_locks WHERE ENGINE = ...
+ @endcode
+ */
+ virtual bool accept_engine(const char *engine, size_t engine_length) = 0;
+
+ /**
+ Check if the container accepts data for a particular lock.
+ This methods is used to prune data for queries like
+ @code SELECT * from performance_schema.data_locks WHERE ENGINE_LOCK_ID = ...
+ @endcode
+ */
+ virtual bool accept_lock_id(const char *engine_lock_id,
+ size_t engine_lock_id_length) = 0;
+
+ /**
+ Check if the container accepts data for a particular transaction.
+ This methods is used to prune data for queries like
+ @code SELECT * from performance_schema.data_locks WHERE
+ ENGINE_TRANSACTION_ID = ... @endcode
+ */
+ virtual bool accept_transaction_id(ulonglong transaction_id) = 0;
+
+ /**
+ Check if the container accepts data for a particular event.
+ This methods is used to prune data for queries like
+ @code SELECT * from performance_schema.data_locks
+ WHERE THREAD_ID = ... AND EVENT_ID = ... @endcode
+ */
+ virtual bool accept_thread_id_event_id(ulonglong thread_id,
+ ulonglong event_id) = 0;
+
+ /**
+ Check if the container accepts data for a particular object.
+ This methods is used to prune data for queries like
+ @code SELECT * from performance_schema.data_locks
+ WHERE OBJECT_SCHEMA = ...
+ AND OBJECT_NAME = ...
+ AND PARTITION_NAME = ...
+ AND SUBPARTITION_NAME = ... @endcode
+ */
+ virtual bool accept_object(const char *table_schema,
+ size_t table_schema_length, const char *table_name,
+ size_t table_name_length,
+ const char *partition_name,
+ size_t partition_name_length,
+ const char *sub_partition_name,
+ size_t sub_partition_name_length) = 0;
+
+ /** Add a row to table performance_schema.data_locks. */
+ virtual void add_lock_row(
+ const char *engine, size_t engine_length, const char *engine_lock_id,
+ size_t engine_lock_id_length, ulonglong transaction_id,
+ ulonglong thread_id, ulonglong event_id, const char *table_schema,
+ size_t table_schema_length, const char *table_name,
+ size_t table_name_length, const char *partition_name,
+ size_t partition_name_length, const char *sub_partition_name,
+ size_t sub_partition_name_length, const char *index_name,
+ size_t index_name_length, const void *identity, const char *lock_mode,
+ const char *lock_type, const char *lock_status,
+ const char *lock_data) = 0;
+};
+
+class PSI_server_data_lock_wait_container {
+ public:
+ PSI_server_data_lock_wait_container() {}
+ virtual ~PSI_server_data_lock_wait_container() {}
+
+ /** @sa PSI_server_data_lock_container::cache_string. */
+ virtual const char *cache_string(const char *string) = 0;
+
+ /** @sa PSI_server_data_lock_container::cache_data. */
+ virtual const char *cache_data(const char *ptr, size_t length) = 0;
+
+ /**
+ Check if the container accepts data for a particular engine.
+ This methods is used to prune data for queries like
+ @code SELECT * from performance_schema.data_lock_waits WHERE ENGINE = ...
+ @endcode
+ */
+ virtual bool accept_engine(const char *engine, size_t engine_length) = 0;
+
+ /**
+ Check if the container accepts data for a particular requesting lock id.
+ This methods is used to prune data for queries like
+ @code SELECT * from performance_schema.data_lock_waits WHERE
+ REQUESTING_ENGINE_LOCK_ID = ... @endcode
+ */
+ virtual bool accept_requesting_lock_id(const char *engine_lock_id,
+ size_t engine_lock_id_length) = 0;
+
+ /**
+ Check if the container accepts data for a particular blocking lock id.
+ This methods is used to prune data for queries like
+ @code SELECT * from performance_schema.data_lock_waits WHERE
+ BLOCKING_ENGINE_LOCK_ID = ... @endcode
+ */
+ virtual bool accept_blocking_lock_id(const char *engine_lock_id,
+ size_t engine_lock_id_length) = 0;
+
+ /**
+ Check if the container accepts data for a particular requesting transaction
+ id.
+ This methods is used to prune data for queries like
+ @code SELECT * from performance_schema.data_lock_waits WHERE
+ REQUESTING_ENGINE_TRANSACTION_ID = ... @endcode
+ */
+ virtual bool accept_requesting_transaction_id(ulonglong transaction_id) = 0;
+
+ /**
+ Check if the container accepts data for a particular blocking transaction
+ id.
+ This methods is used to prune data for queries like
+ @code SELECT * from performance_schema.data_lock_waits WHERE
+ BLOCKING_ENGINE_TRANSACTION_ID = ... @endcode
+ */
+ virtual bool accept_blocking_transaction_id(ulonglong transaction_id) = 0;
+
+ /**
+ Check if the container accepts data for a particular requesting event.
+ This methods is used to prune data for queries like
+ @code SELECT * from performance_schema.data_lock_waits
+ WHERE REQUESTING_THREAD_ID = ... AND REQUESTING_EVENT_ID = ... @endcode
+ */
+ virtual bool accept_requesting_thread_id_event_id(ulonglong thread_id,
+ ulonglong event_id) = 0;
+
+ /**
+ Check if the container accepts data for a particular blocking event.
+ This methods is used to prune data for queries like
+ @code SELECT * from performance_schema.data_lock_waits
+ WHERE BLOCKING_THREAD_ID = ... AND BLOCKING_EVENT_ID = ... @endcode
+ */
+ virtual bool accept_blocking_thread_id_event_id(ulonglong thread_id,
+ ulonglong event_id) = 0;
+
+ /** Add a row to table performance_schema.data_lock_waits. */
+ virtual void add_lock_wait_row(
+ const char *engine, size_t engine_length,
+ const char *requesting_engine_lock_id,
+ size_t requesting_engine_lock_id_length,
+ ulonglong requesting_transaction_id, ulonglong requesting_thread_id,
+ ulonglong requesting_event_id, const void *requesting_identity,
+ const char *blocking_engine_lock_id,
+ size_t blocking_engine_lock_id_length, ulonglong blocking_transaction_id,
+ ulonglong blocking_thread_id, ulonglong blocking_event_id,
+ const void *blocking_identity) = 0;
+};
+
+/**
+ Engine interface, row lock iterator.
+ This is the interface exposed
+ - by a storage engine
+ - to the server
+ used to iterate over all the row locks
+ present within the storage engine tables.
+ The storage engine is to implement this interface.
+ The server is to call scan() to ask the storage
+ engine to add more rows to the container given.
+*/
+class PSI_engine_data_lock_iterator {
+ public:
+ PSI_engine_data_lock_iterator() {}
+ virtual ~PSI_engine_data_lock_iterator() {}
+
+ /**
+ Scan for more data locks.
+ @param container The container to fill
+ @param with_lock_data True if column LOCK_DATA is required.
+ @return true if the iterator is done
+ */
+ virtual bool scan(PSI_server_data_lock_container *container,
+ bool with_lock_data) = 0;
+
+ /**
+ Fetch a given data lock.
+ @param container The container to fill
+ @param engine_lock_id The lock id to search
+ @param engine_lock_id_length Lock id length
+ @param with_lock_data True if column LOCK_DATA is required.
+ @return true if the iterator is done
+ */
+ virtual bool fetch(PSI_server_data_lock_container *container,
+ const char *engine_lock_id, size_t engine_lock_id_length,
+ bool with_lock_data) = 0;
+};
+
+class PSI_engine_data_lock_wait_iterator {
+ public:
+ PSI_engine_data_lock_wait_iterator() {}
+ virtual ~PSI_engine_data_lock_wait_iterator() {}
+
+ /**
+ Scan for more data lock waits.
+ @param container The container to fill
+ @return true if the iterator is done
+ */
+ virtual bool scan(PSI_server_data_lock_wait_container *container) = 0;
+
+ /**
+ Fetch a given data lock wait.
+ @param container The container to fill
+ @param requesting_engine_lock_id The requesting lock id to search
+ @param requesting_engine_lock_id_length The requesting lock id length
+ @param blocking_engine_lock_id The blocking lock id to search
+ @param blocking_engine_lock_id_length The blocking lock id length
+ @return true if the iterator is done
+ */
+ virtual bool fetch(PSI_server_data_lock_wait_container *container,
+ const char *requesting_engine_lock_id,
+ size_t requesting_engine_lock_id_length,
+ const char *blocking_engine_lock_id,
+ size_t blocking_engine_lock_id_length) = 0;
+};
+
+/**
+ Engine interface, row lock inspector.
+ This is the interface exposed
+ - by a storage engine
+ - to the server
+ to create an iterator over all row locks.
+ The storage engine is to implement this interface.
+ The server is to call create_iterator()
+ to ask the engine to create an iterator over all row locks.
+ A PSI_engine_data_lock_inspector is meant to be stateless,
+ and not associated to any opened table handle,
+ while the iterator created is meant to be stateful,
+ and dedicated to an opened performance_schema.row_locks table handle.
+*/
+class PSI_engine_data_lock_inspector {
+ public:
+ PSI_engine_data_lock_inspector() {}
+ virtual ~PSI_engine_data_lock_inspector() {}
+
+ /**
+ Create a data lock iterator.
+ The iterator returned is used to extract data_locks rows from the storage
+ engine.
+ @sa destroy_data_lock_iterator
+ */
+ virtual PSI_engine_data_lock_iterator *create_data_lock_iterator() = 0;
+
+ /**
+ Create a data lock wait iterator.
+ The iterator returned is used to extract data_lock_waits rows from the
+ storage engine.
+ @sa destroy_data_lock_wait_iterator
+ */
+ virtual PSI_engine_data_lock_wait_iterator *
+ create_data_lock_wait_iterator() = 0;
+
+ /**
+ Destroy a data lock iterator.
+ */
+ virtual void destroy_data_lock_iterator(
+ PSI_engine_data_lock_iterator *it) = 0;
+
+ /**
+ Destroy a data lock wait iterator.
+ */
+ virtual void destroy_data_lock_wait_iterator(
+ PSI_engine_data_lock_wait_iterator *it) = 0;
+};
+
+/**
+ Row Lock registration API.
+*/
+typedef void (*register_data_lock_v1_t)(
+ PSI_engine_data_lock_inspector *inspector);
+
+/**
+ Row Lock un registration API.
+*/
+typedef void (*unregister_data_lock_v1_t)(
+ PSI_engine_data_lock_inspector *inspector);
+
+/**
+ Performance Schema Row Lock Interface, version 1.
+ @since PSI_DATA_LOCK_VERSION_1
+*/
+struct PSI_data_lock_service_v1 {
+ register_data_lock_v1_t register_data_lock;
+ unregister_data_lock_v1_t unregister_data_lock;
+};
+
+#endif /* HAVE_PSI_DATA_LOCK_1 */
+
+/* Export the required version */
+#ifdef USE_PSI_DATA_LOCK_1
+typedef struct PSI_data_lock_service_v1 PSI_data_lock_service_t;
+#else
+typedef struct PSI_placeholder PSI_data_lock_service_t;
+#endif
+
+extern MYSQL_PLUGIN_IMPORT PSI_data_lock_service_t *psi_data_lock_service;
+
+#endif /* HAVE_PSI_DATA_LOCK_INTERFACE */
+
+/** @} (end of group psi_abi_data_lock) */
+
+#endif /* MYSQL_PSI_DATA_LOCK_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/psi_error.h b/contrib/libs/libmysql_r/include/mysql/psi/psi_error.h
new file mode 100644
index 0000000000..16a1395d24
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/psi_error.h
@@ -0,0 +1,87 @@
+/* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_PSI_ERROR_H
+#define MYSQL_PSI_ERROR_H
+
+/**
+ @file include/mysql/psi/psi_error.h
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_error Error Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+#include "my_macros.h"
+#include "my_psi_config.h" // IWYU pragma: keep
+#include "my_sharedlib.h"
+#include "mysql/components/services/psi_error_bits.h"
+
+/**
+ @def PSI_ERROR_VERSION_1
+ Performance Schema Error Interface number for version 1.
+ This version is supported.
+*/
+#define PSI_ERROR_VERSION_1 1
+
+/**
+ @def PSI_CURRENT_ERROR_VERSION
+ Performance Schema Error Interface number for the most recent version.
+ The most current version is @c PSI_ERROR_VERSION_1
+*/
+#define PSI_CURRENT_ERROR_VERSION 1
+
+/** Entry point for the performance schema interface. */
+struct PSI_error_bootstrap {
+ /**
+ ABI interface finder.
+ Calling this method with an interface version number returns either
+ an instance of the ABI for this version, or NULL.
+ @sa PSI_ERROR_VERSION_1
+ @sa PSI_ERROR_VERSION_2
+ @sa PSI_CURRENT_ERROR_VERSION
+ */
+ void *(*get_interface)(int version);
+};
+typedef struct PSI_error_bootstrap PSI_error_bootstrap;
+
+#ifdef HAVE_PSI_ERROR_INTERFACE
+
+/**
+ Performance Schema Error Interface, version 1.
+ @since PSI_ERROR_VERSION_1
+*/
+struct PSI_error_service_v1 {
+ /** @sa log_error_v1_t. */
+ log_error_v1_t log_error;
+};
+
+typedef struct PSI_error_service_v1 PSI_error_service_t;
+
+extern MYSQL_PLUGIN_IMPORT PSI_error_service_t *psi_error_service;
+
+#endif /* HAVE_PSI_ERROR_INTERFACE */
+
+/** @} (end of group psi_abi_error) */
+
+#endif /* MYSQL_PSI_ERROR_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/psi_file.h b/contrib/libs/libmysql_r/include/mysql/psi/psi_file.h
new file mode 100644
index 0000000000..fa1e22c7b7
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/psi_file.h
@@ -0,0 +1,114 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_PSI_FILE_H
+#define MYSQL_PSI_FILE_H
+
+/**
+ @file include/mysql/psi/psi_file.h
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_file File Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+#include "my_macros.h"
+#include "my_psi_config.h" // IWYU pragma: keep
+#include "my_sharedlib.h"
+#include "mysql/components/services/psi_file_bits.h"
+
+/**
+ @def PSI_FILE_VERSION_1
+ Performance Schema File Interface number for version 1.
+ This version is supported.
+*/
+#define PSI_FILE_VERSION_1 1
+
+/**
+ @def PSI_CURRENT_FILE_VERSION
+ Performance Schema File Interface number for the most recent version.
+ The most current version is @c PSI_FILE_VERSION_1
+*/
+#define PSI_CURRENT_FILE_VERSION 1
+
+/** Entry point for the performance schema interface. */
+struct PSI_file_bootstrap {
+ /**
+ ABI interface finder.
+ Calling this method with an interface version number returns either
+ an instance of the ABI for this version, or NULL.
+ @sa PSI_FILE_VERSION_1
+ @sa PSI_FILE_VERSION_2
+ @sa PSI_CURRENT_FILE_VERSION
+ */
+ void *(*get_interface)(int version);
+};
+
+#ifdef HAVE_PSI_FILE_INTERFACE
+
+/**
+ Performance Schema file Interface, version 1.
+ @since PSI_FILE_VERSION_1
+*/
+struct PSI_file_service_v1 {
+ /** @sa register_file_v1_t. */
+ register_file_v1_t register_file;
+ /** @sa create_file_v1_t. */
+ create_file_v1_t create_file;
+ /** @sa get_thread_file_name_locker_v1_t. */
+ get_thread_file_name_locker_v1_t get_thread_file_name_locker;
+ /** @sa get_thread_file_stream_locker_v1_t. */
+ get_thread_file_stream_locker_v1_t get_thread_file_stream_locker;
+ /** @sa get_thread_file_descriptor_locker_v1_t. */
+ get_thread_file_descriptor_locker_v1_t get_thread_file_descriptor_locker;
+ /** @sa start_file_open_wait_v1_t. */
+ start_file_open_wait_v1_t start_file_open_wait;
+ /** @sa end_file_open_wait_v1_t. */
+ end_file_open_wait_v1_t end_file_open_wait;
+ /** @sa end_file_open_wait_and_bind_to_descriptor_v1_t. */
+ end_file_open_wait_and_bind_to_descriptor_v1_t
+ end_file_open_wait_and_bind_to_descriptor;
+ /** @sa end_temp_file_open_wait_and_bind_to_descriptor_v1_t. */
+ end_temp_file_open_wait_and_bind_to_descriptor_v1_t
+ end_temp_file_open_wait_and_bind_to_descriptor;
+ /** @sa start_file_wait_v1_t. */
+ start_file_wait_v1_t start_file_wait;
+ /** @sa end_file_wait_v1_t. */
+ end_file_wait_v1_t end_file_wait;
+ /** @sa start_file_close_wait_v1_t. */
+ start_file_close_wait_v1_t start_file_close_wait;
+ /** @sa end_file_close_wait_v1_t. */
+ end_file_close_wait_v1_t end_file_close_wait;
+ /** @sa rename_file_close_wait_v1_t. */
+ end_file_rename_wait_v1_t end_file_rename_wait;
+};
+
+typedef struct PSI_file_service_v1 PSI_file_service_t;
+
+extern MYSQL_PLUGIN_IMPORT PSI_file_service_t *psi_file_service;
+
+#endif /* HAVE_PSI_FILE_INTERFACE */
+
+/** @} (end of group psi_abi_file) */
+
+#endif /* MYSQL_PSI_FILE_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/psi_idle.h b/contrib/libs/libmysql_r/include/mysql/psi/psi_idle.h
new file mode 100644
index 0000000000..8b5bec2bd6
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/psi_idle.h
@@ -0,0 +1,90 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_PSI_IDLE_H
+#define MYSQL_PSI_IDLE_H
+
+/**
+ @file include/mysql/psi/psi_idle.h
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_idle Idle Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+#include "my_inttypes.h"
+#include "my_macros.h"
+#include "my_psi_config.h" // IWYU pragma: keep
+#include "my_sharedlib.h"
+#include "mysql/components/services/psi_idle_bits.h"
+
+/**
+ @def PSI_IDLE_VERSION_1
+ Performance Schema Idle Interface number for version 1.
+ This version is supported.
+*/
+#define PSI_IDLE_VERSION_1 1
+
+/**
+ @def PSI_CURRENT_IDLE_VERSION
+ Performance Schema Idle Interface number for the most recent version.
+ The most current version is @c PSI_IDLE_VERSION_1
+*/
+#define PSI_CURRENT_IDLE_VERSION 1
+
+/** Entry point for the performance schema interface. */
+struct PSI_idle_bootstrap {
+ /**
+ ABI interface finder.
+ Calling this method with an interface version number returns either
+ an instance of the ABI for this version, or NULL.
+ @sa PSI_IDLE_VERSION_1
+ @sa PSI_IDLE_VERSION_2
+ @sa PSI_CURRENT_IDLE_VERSION
+ */
+ void *(*get_interface)(int version);
+};
+typedef struct PSI_idle_bootstrap PSI_idle_bootstrap;
+
+#ifdef HAVE_PSI_IDLE_INTERFACE
+
+/**
+ Performance Schema Idle Interface, version 1.
+ @since PSI_IDLE_VERSION_1
+*/
+struct PSI_idle_service_v1 {
+ /** @sa start_idle_wait_v1_t. */
+ start_idle_wait_v1_t start_idle_wait;
+ /** @sa end_idle_wait_v1_t. */
+ end_idle_wait_v1_t end_idle_wait;
+};
+
+typedef struct PSI_idle_service_v1 PSI_idle_service_t;
+
+extern MYSQL_PLUGIN_IMPORT PSI_idle_service_t *psi_idle_service;
+
+#endif /* HAVE_PSI_IDLE_INTERFACE */
+
+/** @} (end of group psi_abi_idle) */
+
+#endif /* MYSQL_PSI_IDLE_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/psi_mdl.h b/contrib/libs/libmysql_r/include/mysql/psi/psi_mdl.h
new file mode 100644
index 0000000000..127fb088b8
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/psi_mdl.h
@@ -0,0 +1,91 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_PSI_MDL_H
+#define MYSQL_PSI_MDL_H
+
+/**
+ @file include/mysql/psi/psi_mdl.h
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_mdl Metadata Lock Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+#include "my_inttypes.h"
+#include "my_macros.h"
+#include "my_psi_config.h" // IWYU pragma: keep
+#include "my_sharedlib.h"
+#include "mysql/components/services/psi_mdl_bits.h"
+
+/**
+ @def PSI_MDL_VERSION_1
+ Performance Schema Metadata Lock Interface number for version 1.
+ This version is supported.
+*/
+#define PSI_MDL_VERSION_1 1
+
+/**
+ @def PSI_CURRENT_MDL_VERSION
+ Performance Schema Metadata Lock Interface number for the most recent version.
+ The most current version is @c PSI_MDL_VERSION_1
+*/
+#define PSI_CURRENT_MDL_VERSION 1
+
+/** Entry point for the performance schema interface. */
+struct PSI_mdl_bootstrap {
+ /**
+ ABI interface finder.
+ Calling this method with an interface version number returns either
+ an instance of the ABI for this version, or NULL.
+ @sa PSI_MDL_VERSION_1
+ @sa PSI_MDL_VERSION_2
+ @sa PSI_CURRENT_MDL_VERSION
+ */
+ void *(*get_interface)(int version);
+};
+typedef struct PSI_mdl_bootstrap PSI_mdl_bootstrap;
+
+#ifdef HAVE_PSI_METADATA_INTERFACE
+
+/**
+ Performance Schema Metadata Lock Interface, version 1.
+ @since PSI_TRANSACTION_VERSION_1
+*/
+struct PSI_mdl_service_v1 {
+ create_metadata_lock_v1_t create_metadata_lock;
+ set_metadata_lock_status_v1_t set_metadata_lock_status;
+ destroy_metadata_lock_v1_t destroy_metadata_lock;
+ start_metadata_wait_v1_t start_metadata_wait;
+ end_metadata_wait_v1_t end_metadata_wait;
+};
+
+typedef struct PSI_mdl_service_v1 PSI_mdl_service_t;
+
+extern MYSQL_PLUGIN_IMPORT PSI_mdl_service_t *psi_mdl_service;
+
+#endif /* HAVE_PSI_METADATA_INTERFACE */
+
+/** @} (end of group psi_abi_mdl) */
+
+#endif /* MYSQL_PSI_MDL_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/psi_memory.h b/contrib/libs/libmysql_r/include/mysql/psi/psi_memory.h
new file mode 100644
index 0000000000..095bd34da5
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/psi_memory.h
@@ -0,0 +1,115 @@
+/* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_PSI_MEMORY_H
+#define MYSQL_PSI_MEMORY_H
+
+#include "my_psi_config.h" // IWYU pragma: keep
+#include "my_sharedlib.h"
+#include "mysql/components/services/psi_memory_bits.h"
+
+/*
+ MAINTAINER:
+ Note that this file is part of the public API,
+ because mysql.h exports
+ struct MEM_ROOT
+ See
+ - PSI_memory_key MEM_ROOT::m_psi_key
+ - include/mysql.h.pp
+*/
+
+/**
+ @file include/mysql/psi/psi_memory.h
+ Performance schema instrumentation interface.
+*/
+
+/**
+ @defgroup psi_abi_memory Memory Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+/**
+ Instrumented memory key.
+ To instrument memory, a memory key must be obtained using @c register_memory.
+ Using a zero key always disable the instrumentation.
+*/
+typedef unsigned int PSI_memory_key;
+
+/**
+ @def PSI_MEMORY_VERSION_1
+ Performance Schema Memory Interface number for version 1.
+ This version is supported.
+*/
+#define PSI_MEMORY_VERSION_1 1
+
+/**
+ @def PSI_CURRENT_MEMORY_VERSION
+ Performance Schema Memory Interface number for the most recent version.
+ The most current version is @c PSI_MEMORY_VERSION_1
+*/
+#define PSI_CURRENT_MEMORY_VERSION 1
+
+struct PSI_thread;
+
+/** Entry point for the performance schema interface. */
+struct PSI_memory_bootstrap {
+ /**
+ ABI interface finder.
+ Calling this method with an interface version number returns either
+ an instance of the ABI for this version, or NULL.
+ @sa PSI_MEMORY_VERSION_1
+ @sa PSI_MEMORY_VERSION_2
+ @sa PSI_CURRENT_MEMORY_VERSION
+ */
+ void *(*get_interface)(int version);
+};
+typedef struct PSI_memory_bootstrap PSI_memory_bootstrap;
+
+#ifdef HAVE_PSI_MEMORY_INTERFACE
+
+/**
+ Performance Schema Memory Interface, version 1.
+ @since PSI_MEMORY_VERSION_1
+*/
+struct PSI_memory_service_v1 {
+ /** @sa register_memory_v1_t. */
+ register_memory_v1_t register_memory;
+ /** @sa memory_alloc_v1_t. */
+ memory_alloc_v1_t memory_alloc;
+ /** @sa memory_realloc_v1_t. */
+ memory_realloc_v1_t memory_realloc;
+ /** @sa memory_claim_v1_t. */
+ memory_claim_v1_t memory_claim;
+ /** @sa memory_free_v1_t. */
+ memory_free_v1_t memory_free;
+};
+
+typedef struct PSI_memory_service_v1 PSI_memory_service_t;
+
+extern MYSQL_PLUGIN_IMPORT PSI_memory_service_t *psi_memory_service;
+
+#endif /* HAVE_PSI_MEMORY_INTERFACE */
+
+/** @} (end of group psi_abi_memory) */
+
+#endif /* MYSQL_PSI_MEMORY_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/psi_mutex.h b/contrib/libs/libmysql_r/include/mysql/psi/psi_mutex.h
new file mode 100644
index 0000000000..80f42f44ba
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/psi_mutex.h
@@ -0,0 +1,83 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_PSI_MUTEX_H
+#define MYSQL_PSI_MUTEX_H
+
+/**
+ @file include/mysql/psi/psi_mutex.h
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_mutex Mutex Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+#include "my_inttypes.h"
+#include "my_macros.h"
+#include "my_psi_config.h" // IWYU pragma: keep
+#include "my_sharedlib.h"
+#include "mysql/components/services/psi_mutex_bits.h"
+
+/** Entry point for the performance schema interface. */
+struct PSI_mutex_bootstrap {
+ /**
+ ABI interface finder.
+ Calling this method with an interface version number returns either
+ an instance of the ABI for this version, or NULL.
+ @sa PSI_MUTEX_VERSION_1
+ @sa PSI_MUTEX_VERSION_2
+ @sa PSI_CURRENT_MUTEX_VERSION
+ */
+ void *(*get_interface)(int version);
+};
+
+#ifdef HAVE_PSI_MUTEX_INTERFACE
+
+/**
+ Performance Schema Mutex Interface, version 1.
+ @since PSI_MUTEX_VERSION_1
+*/
+struct PSI_mutex_service_v1 {
+ /** @sa register_mutex_v1_t. */
+ register_mutex_v1_t register_mutex;
+ /** @sa init_mutex_v1_t. */
+ init_mutex_v1_t init_mutex;
+ /** @sa destroy_mutex_v1_t. */
+ destroy_mutex_v1_t destroy_mutex;
+ /** @sa start_mutex_wait_v1_t. */
+ start_mutex_wait_v1_t start_mutex_wait;
+ /** @sa end_mutex_wait_v1_t. */
+ end_mutex_wait_v1_t end_mutex_wait;
+ /** @sa unlock_mutex_v1_t. */
+ unlock_mutex_v1_t unlock_mutex;
+};
+
+typedef struct PSI_mutex_service_v1 PSI_mutex_service_t;
+
+extern MYSQL_PLUGIN_IMPORT PSI_mutex_service_t *psi_mutex_service;
+
+#endif /* HAVE_PSI_MUTEX_INTERFACE */
+
+/** @} (end of group psi_abi_mutex) */
+
+#endif /* MYSQL_PSI_MUTEX_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/psi_rwlock.h b/contrib/libs/libmysql_r/include/mysql/psi/psi_rwlock.h
new file mode 100644
index 0000000000..f31bc56482
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/psi_rwlock.h
@@ -0,0 +1,96 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_PSI_RWLOCK_H
+#define MYSQL_PSI_RWLOCK_H
+
+/**
+ @file include/mysql/psi/psi_rwlock.h
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_rwlock Rwlock Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+#include "my_inttypes.h"
+#include "my_macros.h"
+#include "my_psi_config.h" // IWYU pragma: keep
+#include "my_sharedlib.h"
+#include "mysql/components/services/psi_rwlock_bits.h"
+#include "psi_base.h"
+
+/*
+ MAINTAINER:
+ The following pattern:
+ typedef struct XYZ XYZ;
+ is not needed in C++, but required for C.
+*/
+
+/** Entry point for the performance schema interface. */
+struct PSI_rwlock_bootstrap {
+ /**
+ ABI interface finder.
+ Calling this method with an interface version number returns either
+ an instance of the ABI for this version, or NULL.
+ @sa PSI_RWLOCK_VERSION_1
+ @sa PSI_RWLOCK_VERSION_2
+ @sa PSI_CURRENT_RWLOCK_VERSION
+ */
+ void *(*get_interface)(int version);
+};
+typedef struct PSI_rwlock_bootstrap PSI_rwlock_bootstrap;
+
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
+
+/**
+ Performance Schema Rwlock Interface, version 2.
+ @since PSI_RWLOCK_VERSION_2
+*/
+struct PSI_rwlock_service_v2 {
+ /** @sa register_rwlock_v1_t. */
+ register_rwlock_v1_t register_rwlock;
+ /** @sa init_rwlock_v1_t. */
+ init_rwlock_v1_t init_rwlock;
+ /** @sa destroy_rwlock_v1_t. */
+ destroy_rwlock_v1_t destroy_rwlock;
+ /** @sa start_rwlock_rdwait_v1_t. */
+ start_rwlock_rdwait_v1_t start_rwlock_rdwait;
+ /** @sa end_rwlock_rdwait_v1_t. */
+ end_rwlock_rdwait_v1_t end_rwlock_rdwait;
+ /** @sa start_rwlock_wrwait_v1_t. */
+ start_rwlock_wrwait_v1_t start_rwlock_wrwait;
+ /** @sa end_rwlock_wrwait_v1_t. */
+ end_rwlock_wrwait_v1_t end_rwlock_wrwait;
+ /** @sa unlock_rwlock_v2_t. */
+ unlock_rwlock_v2_t unlock_rwlock;
+};
+
+typedef struct PSI_rwlock_service_v2 PSI_rwlock_service_t;
+
+extern MYSQL_PLUGIN_IMPORT PSI_rwlock_service_t *psi_rwlock_service;
+
+#endif /* HAVE_PSI_RWLOCK_INTERFACE */
+
+/** @} (end of group psi_abi_rwlock) */
+
+#endif /* MYSQL_PSI_RWLOCK_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/psi_socket.h b/contrib/libs/libmysql_r/include/mysql/psi/psi_socket.h
new file mode 100644
index 0000000000..4d3ae4df82
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/psi_socket.h
@@ -0,0 +1,94 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_PSI_SOCKET_H
+#define MYSQL_PSI_SOCKET_H
+
+/**
+ @file include/mysql/psi/psi_socket.h
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_socket Socket Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+#include "my_macros.h"
+#include "my_psi_config.h" // IWYU pragma: keep
+#include "my_sharedlib.h"
+#include "mysql/components/services/psi_socket_bits.h"
+
+/**
+ @def PSI_SOCKET_VERSION_1
+ Performance Schema Socket Interface number for version 1.
+ This version is supported.
+*/
+#define PSI_SOCKET_VERSION_1 1
+
+/** Entry point for the performance schema interface. */
+struct PSI_socket_bootstrap {
+ /**
+ ABI interface finder.
+ Calling this method with an interface version number returns either
+ an instance of the ABI for this version, or NULL.
+ @sa PSI_SOCKET_VERSION_1
+ @sa PSI_SOCKET_VERSION_2
+ @sa PSI_CURRENT_SOCKET_VERSION
+ */
+ void *(*get_interface)(int version);
+};
+typedef struct PSI_socket_bootstrap PSI_socket_bootstrap;
+
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+
+/**
+ Performance Schema Socket Interface, version 1.
+ @since PSI_SOCKET_VERSION_1
+*/
+struct PSI_socket_service_v1 {
+ /** @sa register_socket_v1_t. */
+ register_socket_v1_t register_socket;
+ /** @sa init_socket_v1_t. */
+ init_socket_v1_t init_socket;
+ /** @sa destroy_socket_v1_t. */
+ destroy_socket_v1_t destroy_socket;
+ /** @sa start_socket_wait_v1_t. */
+ start_socket_wait_v1_t start_socket_wait;
+ /** @sa end_socket_wait_v1_t. */
+ end_socket_wait_v1_t end_socket_wait;
+ /** @sa set_socket_state_v1_t. */
+ set_socket_state_v1_t set_socket_state;
+ /** @sa set_socket_info_v1_t. */
+ set_socket_info_v1_t set_socket_info;
+ /** @sa set_socket_thread_owner_v1_t. */
+ set_socket_thread_owner_v1_t set_socket_thread_owner;
+};
+
+typedef struct PSI_socket_service_v1 PSI_socket_service_t;
+
+extern MYSQL_PLUGIN_IMPORT PSI_socket_service_t *psi_socket_service;
+
+#endif /* HAVE_PSI_SOCKET_INTERFACE */
+
+/** @} (end of group psi_abi_socket) */
+
+#endif /* MYSQL_PSI_SOCKET_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/psi_stage.h b/contrib/libs/libmysql_r/include/mysql/psi/psi_stage.h
new file mode 100644
index 0000000000..33cb5241aa
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/psi_stage.h
@@ -0,0 +1,80 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_PSI_STAGE_H
+#define MYSQL_PSI_STAGE_H
+
+/**
+ @file include/mysql/psi/psi_stage.h
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_stage Stage Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+#include "my_inttypes.h"
+#include "my_macros.h"
+#include "my_psi_config.h"
+#include "my_sharedlib.h"
+#include "mysql/components/services/psi_stage_bits.h"
+#include "psi_base.h"
+
+/** Entry point for the performance schema interface. */
+struct PSI_stage_bootstrap {
+ /**
+ ABI interface finder.
+ Calling this method with an interface version number returns either
+ an instance of the ABI for this version, or NULL.
+ @sa PSI_STAGE_VERSION_1
+ @sa PSI_STAGE_VERSION_2
+ @sa PSI_CURRENT_STAGE_VERSION
+ */
+ void *(*get_interface)(int version);
+};
+
+#ifdef HAVE_PSI_STAGE_INTERFACE
+
+/**
+ Performance Schema Stage Interface, version 1.
+ @since PSI_STAGE_VERSION_1
+*/
+struct PSI_stage_service_v1 {
+ /** @sa register_stage_v1_t. */
+ register_stage_v1_t register_stage;
+ /** @sa start_stage_v1_t. */
+ start_stage_v1_t start_stage;
+ /** @sa get_current_stage_progress_v1_t. */
+ get_current_stage_progress_v1_t get_current_stage_progress;
+ /** @sa end_stage_v1_t. */
+ end_stage_v1_t end_stage;
+};
+
+typedef struct PSI_stage_service_v1 PSI_stage_service_t;
+
+extern MYSQL_PLUGIN_IMPORT PSI_stage_service_t *psi_stage_service;
+
+#endif /* HAVE_PSI_STAGE_INTERFACE */
+
+/** @} (end of group psi_abi_stage) */
+
+#endif /* MYSQL_PSI_FILE_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/psi_statement.h b/contrib/libs/libmysql_r/include/mysql/psi/psi_statement.h
new file mode 100644
index 0000000000..7556c2eddc
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/psi_statement.h
@@ -0,0 +1,155 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_PSI_STATEMENT_H
+#define MYSQL_PSI_STATEMENT_H
+
+/**
+ @file include/mysql/psi/psi_statement.h
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_statement Statement Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+#include "my_inttypes.h"
+#include "my_macros.h"
+#include "my_psi_config.h" // IWYU pragma: keep
+#include "my_sharedlib.h"
+#include "mysql/components/services/psi_statement_bits.h"
+#include "psi_base.h"
+
+/** Entry point for the performance schema interface. */
+struct PSI_statement_bootstrap {
+ /**
+ ABI interface finder.
+ Calling this method with an interface version number returns either
+ an instance of the ABI for this version, or NULL.
+ @sa PSI_STATEMENT_VERSION_1
+ @sa PSI_STATEMENT_VERSION_2
+ @sa PSI_CURRENT_STATEMENT_VERSION
+ */
+ void *(*get_interface)(int version);
+};
+typedef struct PSI_statement_bootstrap PSI_statement_bootstrap;
+
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+
+/**
+ Performance Schema Statement Interface, version 1.
+ @since PSI_STATEMENT_VERSION_1
+*/
+struct PSI_statement_service_v1 {
+ /* No binary compatibility with old PLUGIN */
+ void *this_interface_is_obsolete;
+};
+
+/**
+ Performance Schema Statement Interface, version 2.
+ @since PSI_STATEMENT_VERSION_2
+*/
+struct PSI_statement_service_v2 {
+ /** @sa register_statement_v1_t. */
+ register_statement_v1_t register_statement;
+ /** @sa get_thread_statement_locker_v1_t. */
+ get_thread_statement_locker_v1_t get_thread_statement_locker;
+ /** @sa refine_statement_v1_t. */
+ refine_statement_v1_t refine_statement;
+ /** @sa start_statement_v1_t. */
+ start_statement_v1_t start_statement;
+ /** @sa set_statement_text_v1_t. */
+ set_statement_text_v1_t set_statement_text;
+ /** @sa set_statement_query_id. */
+ set_statement_query_id_t set_statement_query_id;
+ /** @sa set_statement_lock_time_t. */
+ set_statement_lock_time_t set_statement_lock_time;
+ /** @sa set_statement_rows_sent_t. */
+ set_statement_rows_sent_t set_statement_rows_sent;
+ /** @sa set_statement_rows_examined_t. */
+ set_statement_rows_examined_t set_statement_rows_examined;
+ /** @sa inc_statement_created_tmp_disk_tables. */
+ inc_statement_created_tmp_disk_tables_t inc_statement_created_tmp_disk_tables;
+ /** @sa inc_statement_created_tmp_tables. */
+ inc_statement_created_tmp_tables_t inc_statement_created_tmp_tables;
+ /** @sa inc_statement_select_full_join. */
+ inc_statement_select_full_join_t inc_statement_select_full_join;
+ /** @sa inc_statement_select_full_range_join. */
+ inc_statement_select_full_range_join_t inc_statement_select_full_range_join;
+ /** @sa inc_statement_select_range. */
+ inc_statement_select_range_t inc_statement_select_range;
+ /** @sa inc_statement_select_range_check. */
+ inc_statement_select_range_check_t inc_statement_select_range_check;
+ /** @sa inc_statement_select_scan. */
+ inc_statement_select_scan_t inc_statement_select_scan;
+ /** @sa inc_statement_sort_merge_passes. */
+ inc_statement_sort_merge_passes_t inc_statement_sort_merge_passes;
+ /** @sa inc_statement_sort_range. */
+ inc_statement_sort_range_t inc_statement_sort_range;
+ /** @sa inc_statement_sort_rows. */
+ inc_statement_sort_rows_t inc_statement_sort_rows;
+ /** @sa inc_statement_sort_scan. */
+ inc_statement_sort_scan_t inc_statement_sort_scan;
+ /** @sa set_statement_no_index_used. */
+ set_statement_no_index_used_t set_statement_no_index_used;
+ /** @sa set_statement_no_good_index_used. */
+ set_statement_no_good_index_used_t set_statement_no_good_index_used;
+ /** @sa end_statement_v1_t. */
+ end_statement_v1_t end_statement;
+
+ /** @sa create_prepared_stmt_v1_t. */
+ create_prepared_stmt_v1_t create_prepared_stmt;
+ /** @sa destroy_prepared_stmt_v1_t. */
+ destroy_prepared_stmt_v1_t destroy_prepared_stmt;
+ /** @sa reprepare_prepared_stmt_v1_t. */
+ reprepare_prepared_stmt_v1_t reprepare_prepared_stmt;
+ /** @sa execute_prepared_stmt_v1_t. */
+ execute_prepared_stmt_v1_t execute_prepared_stmt;
+ /** @sa set_prepared_stmt_text_v1_t. */
+ set_prepared_stmt_text_v1_t set_prepared_stmt_text;
+
+ /** @sa digest_start_v1_t. */
+ digest_start_v1_t digest_start;
+ /** @sa digest_end_v1_t. */
+ digest_end_v1_t digest_end;
+
+ /** @sa get_sp_share_v1_t. */
+ get_sp_share_v1_t get_sp_share;
+ /** @sa release_sp_share_v1_t. */
+ release_sp_share_v1_t release_sp_share;
+ /** @sa start_sp_v1_t. */
+ start_sp_v1_t start_sp;
+ /** @sa start_sp_v1_t. */
+ end_sp_v1_t end_sp;
+ /** @sa drop_sp_v1_t. */
+ drop_sp_v1_t drop_sp;
+};
+
+typedef struct PSI_statement_service_v2 PSI_statement_service_t;
+
+extern MYSQL_PLUGIN_IMPORT PSI_statement_service_t *psi_statement_service;
+
+#endif /* HAVE_PSI_STATEMENT_INTERFACE */
+
+/** @} (end of group psi_abi_statement) */
+
+#endif /* MYSQL_PSI_STATEMENT_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/psi_system.h b/contrib/libs/libmysql_r/include/mysql/psi/psi_system.h
new file mode 100644
index 0000000000..2eeb6eb9a5
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/psi_system.h
@@ -0,0 +1,87 @@
+/* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_PSI_SYSTEM_H
+#define MYSQL_PSI_SYSTEM_H
+
+/**
+ @file include/mysql/psi/psi_system.h
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_system System Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+#include "my_inttypes.h"
+#include "my_macros.h"
+#include "my_psi_config.h" // IWYU pragma: keep
+#include "my_sharedlib.h"
+#include "mysql/components/services/psi_system_bits.h"
+
+/**
+ @def PSI_SYSTEM_VERSION_1
+ Performance Schema System Interface number for version 1.
+ This version is supported.
+*/
+#define PSI_SYSTEM_VERSION_1 1
+
+/**
+ @def PSI_CURRENT_SYSTEM_VERSION
+ Performance Schema System Interface number for the most recent version.
+ The most current version is @c PSI_SYSTEM_VERSION_1
+*/
+#define PSI_CURRENT_SYSTEM_VERSION 1
+
+/** Entry point for the performance schema interface. */
+struct PSI_system_bootstrap {
+ /**
+ ABI interface finder.
+ Calling this method with an interface version number returns either
+ an instance of the ABI for this version, or NULL.
+ @sa PSI_SYSTEM_VERSION_1
+ @sa PSI_CURRENT_SYSTEM_VERSION
+ */
+ void *(*get_interface)(int version);
+};
+typedef struct PSI_system_bootstrap PSI_system_bootstrap;
+
+#ifdef HAVE_PSI_SYSTEM_INTERFACE
+
+/**
+ Performance Schema System Interface, version 1.
+ @since PSI_SYSTEM_VERSION_1
+*/
+struct PSI_system_service_v1 {
+ /** @sa unload_plugin_v1_t. */
+ unload_plugin_v1_t unload_plugin;
+};
+
+typedef struct PSI_system_service_v1 PSI_system_service_t;
+
+extern MYSQL_PLUGIN_IMPORT PSI_system_service_t *psi_system_service;
+
+#endif /* HAVE_PSI_SYSTEM_INTERFACE */
+
+/** @} (end of group psi_abi_system) */
+
+#endif /* MYSQL_PSI_SYSTEM_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/psi_table.h b/contrib/libs/libmysql_r/include/mysql/psi/psi_table.h
new file mode 100644
index 0000000000..191e70f740
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/psi_table.h
@@ -0,0 +1,110 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_PSI_TABLE_H
+#define MYSQL_PSI_TABLE_H
+
+/**
+ @file include/mysql/psi/psi_table.h
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_table Table Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+#include "my_inttypes.h"
+#include "my_macros.h"
+#include "my_psi_config.h" // IWYU pragma: keep
+#include "my_sharedlib.h"
+#include "mysql/components/services/psi_table_bits.h"
+
+/**
+ @def PSI_TABLE_VERSION_1
+ Performance Schema Table Interface number for version 1.
+ This version is supported.
+*/
+#define PSI_TABLE_VERSION_1 1
+
+/**
+ @def PSI_CURRENT_TABLE_VERSION
+ Performance Schema Table Interface number for the most recent version.
+ The most current version is @c PSI_TABLE_VERSION_1
+*/
+#define PSI_CURRENT_TABLE_VERSION 1
+
+/** Entry point for the performance schema interface. */
+struct PSI_table_bootstrap {
+ /**
+ ABI interface finder.
+ Calling this method with an interface version number returns either
+ an instance of the ABI for this version, or NULL.
+ @sa PSI_TABLE_VERSION_1
+ @sa PSI_TABLE_VERSION_2
+ @sa PSI_CURRENT_TABLE_VERSION
+ */
+ void *(*get_interface)(int version);
+};
+typedef struct PSI_table_bootstrap PSI_table_bootstrap;
+
+#ifdef HAVE_PSI_TABLE_INTERFACE
+
+/**
+ Performance Schema Transaction Interface, version 1.
+ @since PSI_TABLE_VERSION_1
+*/
+struct PSI_table_service_v1 {
+ /** @sa get_table_share_v1_t. */
+ get_table_share_v1_t get_table_share;
+ /** @sa release_table_share_v1_t. */
+ release_table_share_v1_t release_table_share;
+ /** @sa drop_table_share_v1_t. */
+ drop_table_share_v1_t drop_table_share;
+ /** @sa open_table_v1_t. */
+ open_table_v1_t open_table;
+ /** @sa unbind_table_v1_t. */
+ unbind_table_v1_t unbind_table;
+ /** @sa rebind_table_v1_t. */
+ rebind_table_v1_t rebind_table;
+ /** @sa close_table_v1_t. */
+ close_table_v1_t close_table;
+ /** @sa start_table_io_wait_v1_t. */
+ start_table_io_wait_v1_t start_table_io_wait;
+ /** @sa end_table_io_wait_v1_t. */
+ end_table_io_wait_v1_t end_table_io_wait;
+ /** @sa start_table_lock_wait_v1_t. */
+ start_table_lock_wait_v1_t start_table_lock_wait;
+ /** @sa end_table_lock_wait_v1_t. */
+ end_table_lock_wait_v1_t end_table_lock_wait;
+ /** @sa end_table_lock_wait_v1_t. */
+ unlock_table_v1_t unlock_table;
+};
+
+typedef struct PSI_table_service_v1 PSI_table_service_t;
+
+extern MYSQL_PLUGIN_IMPORT PSI_table_service_t *psi_table_service;
+
+#endif /* HAVE_PSI_TABLE_INTERFACE */
+
+/** @} (end of group psi_abi_table) */
+
+#endif /* MYSQL_PSI_TRANSACTION_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/psi_thread.h b/contrib/libs/libmysql_r/include/mysql/psi/psi_thread.h
new file mode 100644
index 0000000000..ed1506b43d
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/psi_thread.h
@@ -0,0 +1,167 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_PSI_THREAD_H
+#define MYSQL_PSI_THREAD_H
+
+/**
+ @file include/mysql/psi/psi_thread.h
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_thread Thread Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+#include "my_inttypes.h"
+#include "my_macros.h"
+#include "my_psi_config.h" // IWYU pragma: keep
+#include "my_sharedlib.h"
+#include "mysql/components/services/psi_thread_bits.h"
+
+/**
+ @def PSI_THREAD_VERSION_1
+ Performance Schema Thread Interface number for version 1.
+ This version is obsolete.
+*/
+#define PSI_THREAD_VERSION_1 1
+
+/**
+ @def PSI_THREAD_VERSION_2
+ Performance Schema Thread Interface number for version 2.
+ This version is obsolete.
+*/
+#define PSI_THREAD_VERSION_2 2
+
+/**
+ @def PSI_THREAD_VERSION_3
+ Performance Schema Thread Interface number for version 3.
+ This version is supported.
+*/
+#define PSI_THREAD_VERSION_3 3
+
+/**
+ @def PSI_CURRENT_THREAD_VERSION
+ Performance Schema Thread Interface number for the most recent version.
+ The most current version is @c PSI_THREAD_VERSION_3
+*/
+#define PSI_CURRENT_THREAD_VERSION 3
+
+/** Entry point for the performance schema interface. */
+struct PSI_thread_bootstrap {
+ /**
+ ABI interface finder.
+ Calling this method with an interface version number returns either
+ an instance of the ABI for this version, or NULL.
+ @sa PSI_THREAD_VERSION_1
+ @sa PSI_THREAD_VERSION_2
+ @sa PSI_THREAD_VERSION_3
+ @sa PSI_CURRENT_THREAD_VERSION
+ */
+ void *(*get_interface)(int version);
+};
+typedef struct PSI_thread_bootstrap PSI_thread_bootstrap;
+
+#ifdef HAVE_PSI_THREAD_INTERFACE
+
+/**
+ Performance Schema Thread Interface, version 3.
+ @since PSI_THREAD_VERSION_3
+*/
+struct PSI_thread_service_v3 {
+ /** @sa register_thread_v1_t. */
+ register_thread_v1_t register_thread;
+ /** @sa spawn_thread_v1_t. */
+ spawn_thread_v1_t spawn_thread;
+ /** @sa new_thread_v1_t. */
+ new_thread_v1_t new_thread;
+ /** @sa set_thread_id_v1_t. */
+ set_thread_id_v1_t set_thread_id;
+ /** @sa get_current_thread_internal_id_v2_t. */
+ get_current_thread_internal_id_v2_t get_current_thread_internal_id;
+ /** @sa get_thread_internal_id_v2_t. */
+ get_thread_internal_id_v2_t get_thread_internal_id;
+ /** @sa get_thread_by_id_v2_t. */
+ get_thread_by_id_v2_t get_thread_by_id;
+ /** @sa set_thread_THD_v1_t. */
+ set_thread_THD_v1_t set_thread_THD;
+ /** @sa set_thread_os_id_v1_t. */
+ set_thread_os_id_v1_t set_thread_os_id;
+ /** @sa get_thread_v1_t. */
+ get_thread_v1_t get_thread;
+ /** @sa set_thread_user_v1_t. */
+ set_thread_user_v1_t set_thread_user;
+ /** @sa set_thread_account_v1_t. */
+ set_thread_account_v1_t set_thread_account;
+ /** @sa set_thread_db_v1_t. */
+ set_thread_db_v1_t set_thread_db;
+ /** @sa set_thread_command_v1_t. */
+ set_thread_command_v1_t set_thread_command;
+ /** @sa set_connection_type_v1_t. */
+ set_connection_type_v1_t set_connection_type;
+ /** @sa set_thread_start_time_v1_t. */
+ set_thread_start_time_v1_t set_thread_start_time;
+ /** @sa set_thread_info_v1_t. */
+ set_thread_info_v1_t set_thread_info;
+ /** @sa set_thread_resource_group_v1_t. */
+ set_thread_resource_group_v1_t set_thread_resource_group;
+ /** @sa set_thread_resource_group_by_id_v1_t. */
+ set_thread_resource_group_by_id_v1_t set_thread_resource_group_by_id;
+ /** @sa set_thread_v1_t. */
+ set_thread_v1_t set_thread;
+ /** @sa aggregate_thread_status_v1_t. */
+ aggregate_thread_status_v2_t aggregate_thread_status;
+ /** @sa delete_current_thread_v1_t. */
+ delete_current_thread_v1_t delete_current_thread;
+ /** @sa delete_thread_v1_t. */
+ delete_thread_v1_t delete_thread;
+ /** @sa set_thread_connect_attrs_v1_t. */
+ set_thread_connect_attrs_v1_t set_thread_connect_attrs;
+ /** @sa get_current_thread_event_id_v2_t. */
+ get_current_thread_event_id_v2_t get_current_thread_event_id;
+ /** @sa get_thread_event_id_v2_t. */
+ get_thread_event_id_v2_t get_thread_event_id;
+ /** @sa get_thread_system_attrs_v1_t. */
+ get_thread_system_attrs_v3_t get_thread_system_attrs;
+ /** @sa get_thread_system_attrs_by_id_v1_t. */
+ get_thread_system_attrs_by_id_v3_t get_thread_system_attrs_by_id;
+ /** @sa register_notification_v1_t. */
+ register_notification_v3_t register_notification;
+ /** @sa unregister_notification_v1_t. */
+ unregister_notification_v1_t unregister_notification;
+ /** @sa notify_session_connect_v1_t. */
+ notify_session_connect_v1_t notify_session_connect;
+ /** @sa notify_session_disconnect_v1_t. */
+ notify_session_disconnect_v1_t notify_session_disconnect;
+ /** @sa notify_session_change_user_v1_t. */
+ notify_session_change_user_v1_t notify_session_change_user;
+};
+
+typedef struct PSI_thread_service_v3 PSI_thread_service_t;
+
+extern MYSQL_PLUGIN_IMPORT PSI_thread_service_t *psi_thread_service;
+
+#endif /* HAVE_PSI_THREAD_INTERFACE */
+
+/** @} (end of group psi_abi_thread) */
+
+#endif /* MYSQL_PSI_THREAD_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/psi/psi_transaction.h b/contrib/libs/libmysql_r/include/mysql/psi/psi_transaction.h
new file mode 100644
index 0000000000..3c82456b31
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/psi/psi_transaction.h
@@ -0,0 +1,107 @@
+/* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_PSI_TRANSACTION_H
+#define MYSQL_PSI_TRANSACTION_H
+
+/**
+ @file include/mysql/psi/psi_transaction.h
+ Performance schema instrumentation interface.
+
+ @defgroup psi_abi_transaction Transaction Instrumentation (ABI)
+ @ingroup psi_abi
+ @{
+*/
+
+#include "my_inttypes.h"
+#include "my_macros.h"
+#include "my_psi_config.h" // IWYU pragma: keep
+#include "my_sharedlib.h"
+#include "mysql/components/services/psi_transaction_bits.h"
+
+/**
+ @def PSI_TRANSACTION_VERSION_1
+ Performance Schema Transaction Interface number for version 1.
+ This version is supported.
+*/
+#define PSI_TRANSACTION_VERSION_1 1
+
+/**
+ @def PSI_CURRENT_TRANSACTION_VERSION
+ Performance Schema Transaction Interface number for the most recent version.
+ The most current version is @c PSI_TRANSACTION_VERSION_1
+*/
+#define PSI_CURRENT_TRANSACTION_VERSION 1
+
+/** Entry point for the performance schema interface. */
+struct PSI_transaction_bootstrap {
+ /**
+ ABI interface finder.
+ Calling this method with an interface version number returns either
+ an instance of the ABI for this version, or NULL.
+ @sa PSI_TRANSACTION_VERSION_1
+ @sa PSI_TRANSACTION_VERSION_2
+ @sa PSI_CURRENT_TRANSACTION_VERSION
+ */
+ void *(*get_interface)(int version);
+};
+typedef struct PSI_transaction_bootstrap PSI_transaction_bootstrap;
+
+#ifdef HAVE_PSI_TRANSACTION_INTERFACE
+
+/**
+ Performance Schema Transaction Interface, version 1.
+ @since PSI_TRANSACTION_VERSION_1
+*/
+struct PSI_transaction_service_v1 {
+ /** @sa get_thread_transaction_locker_v1_t. */
+ get_thread_transaction_locker_v1_t get_thread_transaction_locker;
+ /** @sa start_transaction_v1_t. */
+ start_transaction_v1_t start_transaction;
+ /** @sa set_transaction_xid_v1_t. */
+ set_transaction_xid_v1_t set_transaction_xid;
+ /** @sa set_transaction_xa_state_v1_t. */
+ set_transaction_xa_state_v1_t set_transaction_xa_state;
+ /** @sa set_transaction_gtid_v1_t. */
+ set_transaction_gtid_v1_t set_transaction_gtid;
+ /** @sa set_transaction_trxid_v1_t. */
+ set_transaction_trxid_v1_t set_transaction_trxid;
+ /** @sa inc_transaction_savepoints_v1_t. */
+ inc_transaction_savepoints_v1_t inc_transaction_savepoints;
+ /** @sa inc_transaction_rollback_to_savepoint_v1_t. */
+ inc_transaction_rollback_to_savepoint_v1_t
+ inc_transaction_rollback_to_savepoint;
+ /** @sa inc_transaction_release_savepoint_v1_t. */
+ inc_transaction_release_savepoint_v1_t inc_transaction_release_savepoint;
+ /** @sa end_transaction_v1_t. */
+ end_transaction_v1_t end_transaction;
+};
+
+typedef struct PSI_transaction_service_v1 PSI_transaction_service_t;
+
+extern MYSQL_PLUGIN_IMPORT PSI_transaction_service_t *psi_transaction_service;
+
+#endif /* HAVE_PSI_TRANSACTION_INTERFACE */
+
+/** @} (end of group psi_abi_transaction) */
+
+#endif /* MYSQL_PSI_TRANSACTION_H */
diff --git a/contrib/libs/libmysql_r/include/mysql/service_command.h b/contrib/libs/libmysql_r/include/mysql/service_command.h
new file mode 100644
index 0000000000..ea1f775225
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/service_command.h
@@ -0,0 +1,448 @@
+#ifndef MYSQL_SERVICE_COMMAND_INCLUDED
+#define MYSQL_SERVICE_COMMAND_INCLUDED
+/* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/mysql/service_command.h
+ Header file for the Command service. This service is to provide means
+ of executing different commands, like COM_QUERY, COM_STMT_PREPARE,
+ in the server.
+*/
+
+#include "mysql/com_data.h"
+#include "mysql/service_srv_session.h"
+
+#include "decimal.h"
+#include "mysql_time.h"
+#ifndef MYSQL_ABI_CHECK
+#include <stdint.h> /* uint32_t */
+#include "field_types.h"
+#include "m_ctype.h"
+#endif
+
+/* POD structure for the field metadata from the server */
+struct st_send_field {
+ const char *db_name;
+ const char *table_name;
+ const char *org_table_name;
+ const char *col_name;
+ const char *org_col_name;
+ unsigned long length;
+ unsigned int charsetnr;
+ unsigned int flags;
+ unsigned int decimals;
+ enum_field_types type;
+};
+
+/**
+ Indicates beginning of metadata for the result set
+
+ @param ctx Plugin's context
+ @param num_cols Number of fields being sent
+ @param flags Flags to alter the metadata sending
+ @param resultcs Charset of the result set
+
+ @note resultcs is the charset in which the data should be encoded before
+ sent to the client. This is the value of the session variable
+ character_set_results. The implementor most probably will need to save
+ this value in the context and use it as "to" charset in get_string().
+
+ In case of CS_BINARY_REPRESENTATION, get_string() receives as a parameter
+ the charset of the string, as it is stored on disk.
+
+ In case of CS_TEXT_REPRESENTATION, the string value might be already a
+ stringified value or non-string data, which is in character_set_results.
+
+ @returns
+ 1 an error occurred, server will abort the command
+ 0 ok
+*/
+typedef int (*start_result_metadata_t)(void *ctx, uint num_cols, uint flags,
+ const CHARSET_INFO *resultcs);
+
+/**
+ Field metadata is provided via this callback
+
+ @param ctx Plugin's context
+ @param field Field's metadata (see field.h)
+ @param charset Field's charset
+
+ @returns
+ 1 an error occurred, server will abort the command
+ 0 ok
+*/
+typedef int (*field_metadata_t)(void *ctx, struct st_send_field *field,
+ const CHARSET_INFO *charset);
+
+/**
+ Indicates end of metadata for the result set
+
+ @param ctx Plugin's context
+ @param server_status Status of server (see mysql_com.h, SERVER_STATUS_*)
+ @param warn_count Number of warnings generated during execution to the
+ moment when the metadata is sent.
+ @returns
+ 1 an error occurred, server will abort the command
+ 0 ok
+*/
+typedef int (*end_result_metadata_t)(void *ctx, uint server_status,
+ uint warn_count);
+
+/**
+ Indicates the beginning of a new row in the result set/metadata
+
+ @param ctx Plugin's context
+
+ @returns
+ 1 an error occurred, server will abort the command
+ 0 ok
+*/
+typedef int (*start_row_t)(void *ctx);
+
+/**
+ Indicates the end of the current row in the result set/metadata
+
+ @param ctx Plugin's context
+
+ @returns
+ 1 an error occurred, server will abort the command
+ 0 ok
+*/
+typedef int (*end_row_t)(void *ctx);
+
+/**
+ An error occurred during execution
+
+ This callback indicates that an error occurred during command
+ execution and the partial row should be dropped. Server will raise error
+ and return.
+
+ @param ctx Plugin's context
+*/
+typedef void (*abort_row_t)(void *ctx);
+
+/**
+ Return client's capabilities (see mysql_com.h, CLIENT_*)
+
+ @param ctx Plugin's context
+
+ @return Bitmap of client's capabilities
+*/
+typedef ulong (*get_client_capabilities_t)(void *ctx);
+
+/**
+ Receive NULL value from server
+
+ @param ctx Plugin's context
+
+ @returns
+ 1 an error occurred, server will abort the command
+ 0 ok
+*/
+typedef int (*get_null_t)(void *ctx);
+
+/**
+ Receive TINY/SHORT/LONG value from server
+
+ @param ctx Plugin's context
+ @param value Value received
+
+ @note In order to know which type exactly was received, the plugin must
+ track the metadata that was sent just prior to the result set.
+
+ @returns
+ 1 an error occurred, server will abort the command
+ 0 ok
+*/
+typedef int (*get_integer_t)(void *ctx, longlong value);
+
+/**
+ Get LONGLONG value from server
+
+ @param ctx Plugin's context
+ @param value Value received
+ @param is_unsigned TRUE <=> value is unsigned
+
+ @returns
+ 1 an error occurred, server will abort the command
+ 0 ok
+*/
+typedef int (*get_longlong_t)(void *ctx, longlong value, uint is_unsigned);
+
+/**
+ Receive DECIMAL value from server
+
+ @param ctx Plugin's context
+ @param value Value received
+
+ @returns
+ 1 an error occurred, server will abort the command
+ 0 ok
+*/
+typedef int (*get_decimal_t)(void *ctx, const decimal_t *value);
+
+/**
+ Receive FLOAT/DOUBLE from server
+
+ @param ctx Plugin's context
+ @param value Value received
+ @param decimals Number of decimals
+
+ @note In order to know which type exactly was received, the plugin must
+ track the metadata that was sent just prior to the result set.
+
+ @returns
+ 1 an error occurred, server will abort the command
+ 0 ok
+*/
+typedef int (*get_double_t)(void *ctx, double value, uint32_t decimals);
+
+/**
+ Get DATE value from server
+
+ @param ctx Plugin's context
+ @param value Value received
+
+ @returns
+ 1 an error occurred during storing, server will abort the command
+ 0 ok
+*/
+typedef int (*get_date_t)(void *ctx, const MYSQL_TIME *value);
+
+/**
+ Receive TIME value from server
+
+ @param ctx Plugin's context
+ @param value Value received
+ @param decimals Number of decimals
+
+ @returns
+ 1 an error occurred during storing, server will abort the command
+ 0 ok
+*/
+typedef int (*get_time_t)(void *ctx, const MYSQL_TIME *value, uint decimals);
+
+/**
+ Receive DATETIME value from server
+
+ @param ctx Plugin's context
+ @param value Value received
+ @param decimals Number of decimals
+
+ @returns
+ 1 an error occurred during storing, server will abort the command
+ 0 ok
+*/
+typedef int (*get_datetime_t)(void *ctx, const MYSQL_TIME *value,
+ uint decimals);
+
+/**
+ Get STRING value from server
+
+ @param ctx Plugin's context
+ @param value Data
+ @param length Data length
+ @param valuecs Data charset
+
+ @note In case of CS_BINARY_REPRESENTATION, get_string() receives as
+ a parameter the charset of the string, as it is stored on disk.
+
+ In case of CS_TEXT_REPRESENTATION, the string value might be already a
+ stringified value or non-string data, which is in character_set_results.
+
+ @see start_result_metadata()
+
+ @returns
+ 1 an error occurred, server will abort the command
+ 0 ok
+*/
+typedef int (*get_string_t)(void *ctx, const char *value, size_t length,
+ const CHARSET_INFO *valuecs);
+
+/**
+ Command ended with success
+
+ @param ctx Plugin's context
+ @param server_status Status of server (see mysql_com.h,
+ SERVER_STATUS_*)
+ @param statement_warn_count Number of warnings thrown during execution
+ @param affected_rows Number of rows affected by the command
+ @param last_insert_id Last insert id being assigned during execution
+ @param message A message from server
+*/
+typedef void (*handle_ok_t)(void *ctx, uint server_status,
+ uint statement_warn_count, ulonglong affected_rows,
+ ulonglong last_insert_id, const char *message);
+
+/**
+ Command ended with ERROR
+
+ @param ctx Plugin's context
+ @param sql_errno Error code
+ @param err_msg Error message
+ @param sqlstate SQL state corresponding to the error code
+*/
+typedef void (*handle_error_t)(void *ctx, uint sql_errno, const char *err_msg,
+ const char *sqlstate);
+
+/**
+ Callback for shutdown notification from the server.
+
+ @param ctx Plugin's context
+ @param server_shutdown Whether this is a normal connection shutdown (0) or
+ server shutdown (1).
+*/
+typedef void (*shutdown_t)(void *ctx, int server_shutdown);
+
+struct st_command_service_cbs {
+ /*
+ For a statement that returns a result, the flow of called callbacks will be:
+
+ start_result_metadata()
+ field_metadata()
+ ....
+ end_result_metadata() (in the classic protocol this generates an EOF packet)
+ start_row()
+ get_xxx()
+ ...
+ end_row()
+ start_row()
+ get_xxx()
+ ...
+ end_row()
+ handle_ok() (with data for an EOF packet)
+
+ For a statement that does NOT return a result, but only status, like
+ INSERT, UPDATE, DELETE, REPLACE, TRUNCATE, CREATE, DROP, ALTER, etc. only
+ handle_ok() will be invoked, in case of success.
+
+ All statements that result in an error will invoke handle_error().
+
+ For statements that return a result set, handle_error() might be invoked
+ even after metadata was sent. This will indicate an error during the
+ execution of the statement.
+ */
+
+ /* Getting metadata */
+
+ start_result_metadata_t start_result_metadata;
+ field_metadata_t field_metadata;
+ end_result_metadata_t end_result_metadata;
+ start_row_t start_row;
+ end_row_t end_row;
+ abort_row_t abort_row;
+ get_client_capabilities_t get_client_capabilities;
+
+ /* Getting data */
+
+ get_null_t get_null;
+ get_integer_t get_integer;
+ get_longlong_t get_longlong;
+ get_decimal_t get_decimal;
+ get_double_t get_double;
+ get_date_t get_date;
+ get_time_t get_time;
+ get_datetime_t get_datetime;
+ get_string_t get_string;
+
+ /* Getting execution status */
+
+ handle_ok_t handle_ok;
+ handle_error_t handle_error;
+ shutdown_t shutdown;
+};
+
+enum cs_text_or_binary {
+ CS_TEXT_REPRESENTATION = 1, /* Let the server convert everything to string */
+ CS_BINARY_REPRESENTATION = 2, /* Let the server use native types */
+};
+
+extern "C" struct command_service_st {
+ int (*run_command)(MYSQL_SESSION session, enum enum_server_command command,
+ const union COM_DATA *data, const CHARSET_INFO *client_cs,
+ const struct st_command_service_cbs *callbacks,
+ enum cs_text_or_binary text_or_binary,
+ void *service_callbacks_ctx);
+} * command_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define command_service_run_command(t, command, data, cset, cbs, t_or_b, ctx) \
+ command_service->run_command((t), (command), (data), (cset), (cbs), \
+ (t_or_b), (ctx))
+#else
+
+/**
+ Executes a server command in a session.
+
+
+ There are two cases. Execution in a physical thread :
+ 1. initialized by the srv_session service
+ 2. NOT initialized by the srv_session service
+
+ In case of 1, if there is currently attached session, and it is
+ different from the passed one, the former will be automatically
+ detached. The session to be used for the execution will then be
+ attached. After the command is executed, the attached session will
+ not be detached. It will be detached by a next call to run_command()
+ with another session as parameter. In other words, for all sessions
+ used in a physical thread, there will be at most one in attached
+ state.
+
+ In case of 2, the current state (current_thd) will be
+ preserved. Then the given session will move to attached state and
+ the command will be executed. After the execution the state of the
+ session will be changed to detached and the preserved state
+ (current_thd) will be restored.
+
+ The client charset is used for commands like COM_QUERY and
+ COM_STMT_PREPARE to know how to threat the char* fields. This
+ charset will be used until the next call of run_command when it may
+ be changed again.
+
+ @param session The session
+ @param command The command to be executed.
+ @param data The data needed for the command to be executed
+ @param client_cs The charset for the string data input(COM_QUERY for example)
+ @param callbacks Callbacks to be used by the server to encode data and
+ to communicate with the client (plugin) side.
+ @param text_or_binary Select which representation the server will use for the
+ data passed to the callbacks. For more information
+ @see cs_text_or_binary enum
+ @param service_callbacks_ctx Context passed to the command service callbacks
+
+ @return
+ 0 success
+ 1 failure
+*/
+int command_service_run_command(MYSQL_SESSION session,
+ enum enum_server_command command,
+ const union COM_DATA *data,
+ const CHARSET_INFO *client_cs,
+ const struct st_command_service_cbs *callbacks,
+ enum cs_text_or_binary text_or_binary,
+ void *service_callbacks_ctx);
+
+#endif /* MYSQL_DYNAMIC_PLUGIN */
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/service_locking.h b/contrib/libs/libmysql_r/include/mysql/service_locking.h
new file mode 100644
index 0000000000..8fff201603
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/service_locking.h
@@ -0,0 +1,132 @@
+/*
+ Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef SERVICE_LOCKING_INCLUDED
+#define SERVICE_LOCKING_INCLUDED
+
+/**
+ @file include/mysql/service_locking.h
+
+ Implements ::mysql_locking_service_st
+*/
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdint.h>
+#endif /* MYSQL_ABI_CHECK */
+
+#ifdef __cplusplus
+class THD;
+#define MYSQL_THD THD *
+#else
+#define MYSQL_THD void *
+#endif
+
+/**
+ Types of locking service locks.
+ LOCKING_SERVICE_READ is compatible with LOCKING_SERVICE_READ.
+ All other combinations are incompatible.
+*/
+enum enum_locking_service_lock_type {
+ LOCKING_SERVICE_READ,
+ LOCKING_SERVICE_WRITE
+};
+
+typedef int (*mysql_acquire_locks_t)(
+ MYSQL_THD opaque_thd, const char *lock_namespace, const char **lock_names,
+ size_t lock_num, enum enum_locking_service_lock_type lock_type,
+ uint64_t lock_timeout);
+
+typedef int (*mysql_release_locks_t)(MYSQL_THD opaque_thd,
+ const char *lock_namespace);
+
+/**
+ @ingroup group_ext_plugin_services
+
+ This service provides support for taking read/write locks.
+ It is intended for use with fabric, but it is still a general
+ service. The locks are in a separate namespace from other
+ locks in the server, and there is also no interactions with
+ transactions (i.e. locks are not released on commit/abort).
+
+ These locks are implemented using the metadata lock (MDL) subsystem
+ and thus deadlocks involving locking service locks and other types
+ of metadata will be detected using the MDL deadlock detector.
+*/
+extern "C" struct mysql_locking_service_st {
+ /**
+ Acquire locking service locks.
+
+ @param opaque_thd Thread handle. If NULL, current_thd will be used.
+ @param lock_namespace Namespace of the locks to acquire.
+ @param lock_names Array of names of the locks to acquire.
+ @param lock_num Number of elements in 'lock_names'.
+ @param lock_type Lock type to acquire. LOCKING_SERVICE_READ or _WRITE.
+ @param lock_timeout Number of seconds to wait before giving up.
+
+ @retval 1 Acquisition failed, error has been reported.
+ @retval 0 Acquisition successful, all locks acquired.
+
+ @note both lock_namespace and lock_names are limited to 64 characters max.
+ Names are compared using binary comparison.
+
+ @sa acquire_locking_service_locks, MDL_context::acquire_locks
+ */
+ mysql_acquire_locks_t mysql_acquire_locks;
+ /**
+ Release all lock service locks taken by the given connection
+ in the given namespace.
+
+ @param opaque_thd Thread handle. If NULL, current_thd will be used.
+ @param lock_namespace Namespace of the locks to release.
+
+ @retval 1 Release failed, error has been reported.
+ @retval 0 Release successful, all locks acquired.
+
+ @sa release_locking_service_locks, MDL_context::release_locks
+ */
+ mysql_release_locks_t mysql_release_locks;
+} * mysql_locking_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define mysql_acquire_locking_service_locks(_THD, _NAMESPACE, _NAMES, _NUM, \
+ _TYPE, _TIMEOUT) \
+ mysql_locking_service->mysql_acquire_locks(_THD, _NAMESPACE, _NAMES, _NUM, \
+ _TYPE, _TIMEOUT)
+#define mysql_release_locking_service_locks(_THD, _NAMESPACE) \
+ mysql_locking_service->mysql_release_locks(_THD, _NAMESPACE)
+
+#else
+
+int mysql_acquire_locking_service_locks(
+ MYSQL_THD opaque_thd, const char *lock_namespace, const char **lock_names,
+ size_t lock_num, enum enum_locking_service_lock_type lock_type,
+ uint64_t lock_timeout);
+
+int mysql_release_locking_service_locks(MYSQL_THD opaque_thd,
+ const char *lock_namespace);
+
+#endif /* MYSQL_DYNAMIC_PLUGIN */
+
+#endif /* SERVICE_LOCKING_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/mysql/service_my_plugin_log.h b/contrib/libs/libmysql_r/include/mysql/service_my_plugin_log.h
new file mode 100644
index 0000000000..58fd30704b
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/service_my_plugin_log.h
@@ -0,0 +1,72 @@
+/* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/mysql/service_my_plugin_log.h
+ This service provides functions to report error conditions and log to
+ mysql error log.
+*/
+
+#ifndef MYSQL_SERVICE_MY_PLUGIN_LOG_INCLUDED
+#define MYSQL_SERVICE_MY_PLUGIN_LOG_INCLUDED
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdarg.h>
+#endif
+
+#if defined __SUNPRO_C || defined __SUNPRO_CC || \
+ (defined _MSC_VER && !defined __clang__)
+#define MY_ATTRIBUTE(A)
+#endif
+
+/* keep in sync with the loglevel enum in my_sys.h */
+enum plugin_log_level {
+ MY_ERROR_LEVEL,
+ MY_WARNING_LEVEL,
+ MY_INFORMATION_LEVEL
+};
+
+/**
+ @ingroup group_ext_plugin_services
+
+ Enables plugins to log messages into the server's error log.
+*/
+extern "C" struct my_plugin_log_service {
+ /** Write a message to the log */
+ int (*my_plugin_log_message)(MYSQL_PLUGIN *, enum plugin_log_level,
+ const char *, ...)
+ MY_ATTRIBUTE((format(printf, 3, 4)));
+} * my_plugin_log_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define my_plugin_log_message my_plugin_log_service->my_plugin_log_message
+
+#else
+
+int my_plugin_log_message(MYSQL_PLUGIN *plugin, enum plugin_log_level level,
+ const char *format, ...)
+ MY_ATTRIBUTE((format(printf, 3, 4)));
+
+#endif
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/service_mysql_alloc.h b/contrib/libs/libmysql_r/include/mysql/service_mysql_alloc.h
new file mode 100644
index 0000000000..220b164007
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/service_mysql_alloc.h
@@ -0,0 +1,130 @@
+/* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_SERVICE_MYSQL_ALLOC_INCLUDED
+#define MYSQL_SERVICE_MYSQL_ALLOC_INCLUDED
+
+/**
+ @file include/mysql/service_mysql_alloc.h
+*/
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdlib.h>
+#endif
+
+/* PSI_memory_key */
+#include "mysql/components/services/psi_memory_bits.h"
+
+/* myf */
+typedef int myf_t;
+
+typedef void *(*mysql_malloc_t)(PSI_memory_key key, size_t size, myf_t flags);
+typedef void *(*mysql_realloc_t)(PSI_memory_key key, void *ptr, size_t size,
+ myf_t flags);
+typedef void (*mysql_claim_t)(const void *ptr);
+typedef void (*mysql_free_t)(void *ptr);
+typedef void *(*my_memdup_t)(PSI_memory_key key, const void *from,
+ size_t length, myf_t flags);
+typedef char *(*my_strdup_t)(PSI_memory_key key, const char *from, myf_t flags);
+typedef char *(*my_strndup_t)(PSI_memory_key key, const char *from,
+ size_t length, myf_t flags);
+
+/**
+ @ingroup group_ext_plugin_services
+
+ This service allows plugins to allocate and free memory through the server's
+ memory handling routines.
+ This allows uniform memory handling and instrumentation.
+*/
+struct mysql_malloc_service_st {
+ /**
+ Allocates a block of memory
+
+ @sa my_malloc
+ */
+ mysql_malloc_t mysql_malloc;
+ /**
+ Reallocates a block of memory
+
+ @sa my_realloc
+ */
+ mysql_realloc_t mysql_realloc;
+ /**
+ Re-instruments a block of memory
+
+ @sa my_claim
+ */
+ mysql_claim_t mysql_claim;
+ /**
+ Frees a block of memory
+
+ @sa my_free
+ */
+ mysql_free_t mysql_free;
+ /**
+ Copies a buffer into a new buffer
+
+ @sa my_memdup
+ */
+ my_memdup_t my_memdup;
+ /**
+ Copies a string into a new buffer
+
+ @sa my_strdup
+ */
+ my_strdup_t my_strdup;
+ /**
+ Copies no more than n characters of a string into a new buffer
+
+ @sa my_strndup
+ */
+ my_strndup_t my_strndup;
+};
+
+extern "C" struct mysql_malloc_service_st *mysql_malloc_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define my_malloc mysql_malloc_service->mysql_malloc
+#define my_realloc mysql_malloc_service->mysql_realloc
+#define my_claim mysql_malloc_service->mysql_claim
+#define my_free mysql_malloc_service->mysql_free
+#define my_memdup mysql_malloc_service->my_memdup
+#define my_strdup mysql_malloc_service->my_strdup
+#define my_strndup mysql_malloc_service->my_strndup
+
+#else
+
+extern void *my_malloc(PSI_memory_key key, size_t size, myf_t flags);
+extern void *my_realloc(PSI_memory_key key, void *ptr, size_t size,
+ myf_t flags);
+extern void my_claim(const void *ptr);
+extern void my_free(void *ptr);
+extern void *my_memdup(PSI_memory_key key, const void *from, size_t length,
+ myf_t flags);
+extern char *my_strdup(PSI_memory_key key, const char *from, myf_t flags);
+extern char *my_strndup(PSI_memory_key key, const char *from, size_t length,
+ myf_t flags);
+
+#endif
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/service_mysql_keyring.h b/contrib/libs/libmysql_r/include/mysql/service_mysql_keyring.h
new file mode 100644
index 0000000000..94b08ec088
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/service_mysql_keyring.h
@@ -0,0 +1,109 @@
+/* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_SERVICE_MYSQL_PLUGIN_KEYRING_INCLUDED
+#define MYSQL_SERVICE_MYSQL_PLUGIN_KEYRING_INCLUDED
+
+/**
+ @file include/mysql/service_mysql_keyring.h
+*/
+
+/**
+ @ingroup group_ext_plugin_services
+
+ This service allows plugins to interact with key store backends.
+
+ A key currently is a blob of binary data, defined by a string
+ key type, that's meanigfull to the relevant backend.
+ Typical key_type values include "AES", "DES", "DSA" etc.
+ There's no length in the type, since it's defined by the number of bytes
+ the key takes.
+
+ A key is uniquely identified by the key_id and the user_id values, i.e.
+ all keys are assigned to a particular user.
+ There's only one exception to that: a single category for instance keys
+ that are not associated with any particular user id. This is signified
+ to the APIs by supplying NULL for user_id.
+ Plugins would typically pass user accounts to the user_id parameter, or
+ NULL if there's no user account to associate the key with.
+
+ Not all backends must implement all of the functions defined
+ in this interface.
+
+ The plugin service is a "bridge service", i.e. facade with no
+ real functionality that just calls the actual keyring plugin APIs.
+ This is needed to allow other plugins to call into the keyring
+ plugins and thus overcome the limitation that only the server
+ can call plugins.
+
+ @sa st_mysql_keyring
+*/
+extern "C" struct mysql_keyring_service_st {
+ /**
+ Stores a key into the keyring.
+ @sa my_key_store, st_mysql_keyring::mysql_key_store
+ */
+ int (*my_key_store_func)(const char *, const char *, const char *,
+ const void *, size_t);
+ /**
+ Receives a key from the keyring.
+ @sa my_key_fetch, st_mysql_keyring::mysql_key_fetch
+ */
+ int (*my_key_fetch_func)(const char *, char **, const char *, void **,
+ size_t *);
+
+ /**
+ Removes a key from the keyring.
+ @sa my_key_remove, st_mysql_keyring::mysql_key_remove
+ */
+ int (*my_key_remove_func)(const char *, const char *);
+ /**
+ Generates a new key inside the keyring backend
+ @sa my_key_generate, st_mysql_keyring::mysql_key_generate
+ */
+ int (*my_key_generate_func)(const char *, const char *, const char *, size_t);
+} * mysql_keyring_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define my_key_store(key_id, key_type, user_id, key, key_len) \
+ mysql_keyring_service->my_key_store_func(key_id, key_type, user_id, key, \
+ key_len)
+#define my_key_fetch(key_id, key_type, user_id, key, key_len) \
+ mysql_keyring_service->my_key_fetch_func(key_id, key_type, user_id, key, \
+ key_len)
+#define my_key_remove(key_id, user_id) \
+ mysql_keyring_service->my_key_remove_func(key_id, user_id)
+#define my_key_generate(key_id, key_type, user_id, key_len) \
+ mysql_keyring_service->my_key_generate_func(key_id, key_type, user_id, \
+ key_len)
+#else
+
+int my_key_store(const char *, const char *, const char *, const void *,
+ size_t);
+int my_key_fetch(const char *, char **, const char *, void **, size_t *);
+int my_key_remove(const char *, const char *);
+int my_key_generate(const char *, const char *, const char *, size_t);
+
+#endif
+
+#endif // MYSQL_SERVICE_MYSQL_PLUGIN_KEYRING_INCLUDED
diff --git a/contrib/libs/libmysql_r/include/mysql/service_mysql_password_policy.h b/contrib/libs/libmysql_r/include/mysql/service_mysql_password_policy.h
new file mode 100644
index 0000000000..273d9d861c
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/service_mysql_password_policy.h
@@ -0,0 +1,78 @@
+/* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_SERVICE_MYSQL_PLUGIN_AUTH_INCLUDED
+#define MYSQL_SERVICE_MYSQL_PLUGIN_AUTH_INCLUDED
+
+/**
+ @file include/mysql/service_mysql_password_policy.h
+
+ Definitions for the password validation service
+*/
+
+/**
+ @ingroup group_ext_plugin_services
+
+ This service allows plugins to validate passwords based on a common policy.
+
+ This is a "bridge service", i.e. facade with no
+ real functionality that just calls the actual password validation plugin
+ APIs. This serive is needed by other plugins to call into the password
+ validation plugins and thus overcome the limitation that only the server
+ can call plugins.
+
+ @sa st_mysql_validate_password
+*/
+extern "C" struct mysql_password_policy_service_st {
+ /**
+ Validates a password.
+
+ @sa my_validate_password_policy,
+ st_mysql_validate_password::validate_password
+ */
+ int (*my_validate_password_policy_func)(const char *, unsigned int);
+ /**
+ Evaluates the strength of a password in a scale 0-100
+
+ @sa my_calculate_password_strength,
+ st_mysql_validate_password::get_password_strength
+ */
+ int (*my_calculate_password_strength_func)(const char *, unsigned int);
+} * mysql_password_policy_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define my_validate_password_policy(buffer, length) \
+ mysql_password_policy_service->my_validate_password_policy_func(buffer, \
+ length)
+#define my_calculate_password_strength(buffer, length) \
+ mysql_password_policy_service->my_calculate_password_strength_func(buffer, \
+ length)
+
+#else
+
+int my_validate_password_policy(const char *, unsigned int);
+int my_calculate_password_strength(const char *, unsigned int);
+
+#endif
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/service_mysql_string.h b/contrib/libs/libmysql_r/include/mysql/service_mysql_string.h
new file mode 100644
index 0000000000..30c28ce46e
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/service_mysql_string.h
@@ -0,0 +1,133 @@
+/* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/mysql/service_mysql_string.h
+ This service provides functions to parse mysql String.
+*/
+
+#ifndef MYSQL_SERVICE_MYSQL_STRING_INCLUDED
+#define MYSQL_SERVICE_MYSQL_STRING_INCLUDED
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdlib.h>
+#endif
+
+typedef void *mysql_string_iterator_handle;
+typedef void *mysql_string_handle;
+
+extern "C" struct mysql_string_service_st {
+ int (*mysql_string_convert_to_char_ptr_type)(mysql_string_handle,
+ const char *, char *,
+ unsigned int, int *);
+ mysql_string_iterator_handle (*mysql_string_get_iterator_type)(
+ mysql_string_handle);
+ int (*mysql_string_iterator_next_type)(mysql_string_iterator_handle);
+ int (*mysql_string_iterator_isupper_type)(mysql_string_iterator_handle);
+ int (*mysql_string_iterator_islower_type)(mysql_string_iterator_handle);
+ int (*mysql_string_iterator_isdigit_type)(mysql_string_iterator_handle);
+ mysql_string_handle (*mysql_string_to_lowercase_type)(mysql_string_handle);
+ void (*mysql_string_free_type)(mysql_string_handle);
+ void (*mysql_string_iterator_free_type)(mysql_string_iterator_handle);
+} * mysql_string_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define mysql_string_convert_to_char_ptr(string_handle, charset_name, buffer, \
+ buffer_size, error) \
+ mysql_string_service->mysql_string_convert_to_char_ptr_type( \
+ string_handle, charset_name, buffer, buffer_size, error)
+
+#define mysql_string_get_iterator(string_handle) \
+ mysql_string_service->mysql_string_get_iterator_type(string_handle)
+
+#define mysql_string_iterator_next(iterator_handle) \
+ mysql_string_service->mysql_string_iterator_next_type(iterator_handle)
+
+#define mysql_string_iterator_isupper(iterator_handle) \
+ mysql_string_service->mysql_string_iterator_isupper_type(iterator_handle)
+
+#define mysql_string_iterator_islower(iterator_handle) \
+ mysql_string_service->mysql_string_iterator_islower_type(iterator_handle)
+
+#define mysql_string_iterator_isdigit(iterator_handle) \
+ mysql_string_service->mysql_string_iterator_isdigit_type(iterator_handle)
+
+#define mysql_string_to_lowercase(string_handle) \
+ mysql_string_service->mysql_string_to_lowercase_type(string_handle)
+
+#define mysql_string_free(mysql_string_handle) \
+ mysql_string_service->mysql_string_free_type(mysql_string_handle)
+
+#define mysql_string_iterator_free(mysql_string_iterator_handle) \
+ mysql_string_service->mysql_string_iterator_free_type( \
+ mysql_string_iterator_handle)
+#else
+
+/* This service function convert string into given character set */
+int mysql_string_convert_to_char_ptr(mysql_string_handle string_handle,
+ const char *charset_name, char *buffer,
+ unsigned int buffer_size, int *error);
+
+/* This service function returns the beginning of the iterator handle */
+mysql_string_iterator_handle mysql_string_get_iterator(
+ mysql_string_handle string_handle);
+/*
+ This service function gets the next iterator handle
+ returns 0 if reached the end else return 1
+*/
+int mysql_string_iterator_next(mysql_string_iterator_handle iterator_handle);
+
+/*
+ This service function return 1 if current iterator handle points to a
+ uppercase character else return 0 for client character set.
+*/
+int mysql_string_iterator_isupper(mysql_string_iterator_handle iterator_handle);
+
+/*
+ This service function return 1 if current iterator handle points to a
+ lowercase character else return 0 for client character set.
+*/
+int mysql_string_iterator_islower(mysql_string_iterator_handle iterator_handle);
+
+/*
+ This service function return 1 if current iterator handle points to a digit
+ else return 0 for client character sets.
+*/
+int mysql_string_iterator_isdigit(mysql_string_iterator_handle iterator_handle);
+
+/* convert string_handle into lowercase */
+mysql_string_handle mysql_string_to_lowercase(
+ mysql_string_handle string_handle);
+
+/* It deallocates the string created on server side during plugin operations */
+void mysql_string_free(mysql_string_handle);
+
+/*
+ It deallocates the string iterator created on server side
+ during plugin operations
+*/
+void mysql_string_iterator_free(mysql_string_iterator_handle);
+
+#endif
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/service_parser.h b/contrib/libs/libmysql_r/include/mysql/service_parser.h
new file mode 100644
index 0000000000..e89afad329
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/service_parser.h
@@ -0,0 +1,287 @@
+#ifndef MYSQL_SERVICE_PARSER_INCLUDED
+#define MYSQL_SERVICE_PARSER_INCLUDED
+/* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#include <mysql/mysql_lex_string.h>
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdlib.h>
+#endif
+
+class THD;
+class Item;
+#define MYSQL_THD THD *
+typedef Item *MYSQL_ITEM;
+
+/**
+ @file include/mysql/service_parser.h
+
+ Plugin service that provides access to the parser and some operations on the
+ parse tree.
+*/
+
+/* See DIGEST_HASH_SIZE in sql/sql_digest.h */
+#define PARSER_SERVICE_DIGEST_LENGTH 32
+
+#define STATEMENT_TYPE_SELECT 1
+#define STATEMENT_TYPE_UPDATE 2
+#define STATEMENT_TYPE_INSERT 3
+#define STATEMENT_TYPE_DELETE 4
+#define STATEMENT_TYPE_REPLACE 5
+#define STATEMENT_TYPE_OTHER 6
+
+typedef int (*parse_node_visit_function)(MYSQL_ITEM item, unsigned char *arg);
+
+typedef int (*sql_condition_handler_function)(int sql_errno,
+ const char *sqlstate,
+ const char *msg, void *state);
+
+struct my_thread_handle;
+
+typedef MYSQL_THD (*mysql_current_session_t)();
+
+typedef MYSQL_THD (*mysql_open_session_t)();
+
+typedef void (*mysql_start_thread_t)(MYSQL_THD thd,
+ void *(*callback_fun)(void *), void *arg,
+ struct my_thread_handle *thread_handle);
+
+typedef void (*mysql_join_thread_t)(struct my_thread_handle *thread_handle);
+
+typedef void (*mysql_set_current_database_t)(MYSQL_THD thd,
+ const MYSQL_LEX_STRING db);
+
+/**
+ Parses the query.
+
+ @param thd The session in which to parse.
+
+ @param query The query to parse.
+
+ @param is_prepared If non-zero, the query will be parsed as a prepared
+ statement and won't throw errors when the query string contains '?'.
+
+ @param handle_condition Callback function that is called if a condition is
+ raised during the preparation, parsing or cleanup after parsing. If this
+ argument is non-NULL, the diagnostics area will be cleared before this
+ function returns.
+
+ @param condition_handler_state Will be passed to handle_condition when
+ called. Otherwise ignored.
+
+ @retval 0 Success.
+ @retval 1 Parse error.
+*/
+typedef int (*mysql_parse_t)(MYSQL_THD thd, const MYSQL_LEX_STRING query,
+ unsigned char is_prepared,
+ sql_condition_handler_function handle_condition,
+ void *condition_handler_state);
+
+typedef int (*mysql_get_statement_type_t)(MYSQL_THD thd);
+
+/**
+ Returns the digest of the last parsed statement in the session.
+
+ @param thd The session in which the statement was parsed.
+
+ @param [out] digest An area of at least size PARSER_SERVICE_DIGEST_LENGTH,
+ where the digest is written.
+
+ @retval 0 Success.
+ @retval 1 Parse error.
+*/
+typedef int (*mysql_get_statement_digest_t)(MYSQL_THD thd,
+ unsigned char *digest);
+
+/**
+ Returns the number of parameters ('?') in the parsed query.
+ This works only if the last query was parsed as a prepared statement.
+
+ @param thd The session in which the query was parsed.
+
+ @return The number of parameter markers.
+*/
+typedef int (*mysql_get_number_params_t)(MYSQL_THD thd);
+
+/**
+ Stores in 'positions' the positions in the last parsed query of each
+ parameter marker('?'). Positions must be an already allocated array of at
+ least mysql_parser_service_st::mysql_get_number_params() size. This works
+ only if the last query was parsed as a prepared statement.
+
+ @param thd The session in which the query was parsed.
+
+ @param positions An already allocated array of at least
+ mysql_parser_service_st::mysql_get_number_params() size.
+
+ @return The number of parameter markers and hence number of written
+ positions.
+*/
+typedef int (*mysql_extract_prepared_params_t)(MYSQL_THD thd, int *positions);
+
+/**
+ Walks the tree depth first and applies a user defined function on each
+ literal.
+
+ @param thd The session in which the query was parsed.
+
+ @param processor Will be called for each literal in the parse tree.
+
+ @param arg Will be passed as argument to each call to 'processor'.
+*/
+typedef int (*mysql_visit_tree_t)(MYSQL_THD thd,
+ parse_node_visit_function processor,
+ unsigned char *arg);
+
+/**
+ Renders the MYSQL_ITEM as a string and returns a reference in the form of
+ a MYSQL_LEX_STRING. The string buffer is allocated by the server and must
+ be freed by mysql_free_string().
+
+ @param item The literal to print.
+
+ @return The result of printing the literal.
+
+ @see mysql_parser_service_st::mysql_free_string().
+*/
+typedef MYSQL_LEX_STRING (*mysql_item_string_t)(MYSQL_ITEM item);
+
+/**
+ Frees a string buffer allocated by the server.
+
+ @param string The string whose buffer will be freed.
+*/
+typedef void (*mysql_free_string_t)(MYSQL_LEX_STRING string);
+
+/**
+ Returns the current query string. This string is managed by the server and
+ should @b not be freed by a plugin.
+
+ @param thd The session in which the query was submitted.
+
+ @return The query string.
+*/
+typedef MYSQL_LEX_STRING (*mysql_get_query_t)(MYSQL_THD thd);
+
+/**
+ Returns the current query in normalized form. This string is managed by
+ the server and should @b not be freed by a plugin.
+
+ @param thd The session in which the query was submitted.
+
+ @return The query string normalized.
+*/
+typedef MYSQL_LEX_STRING (*mysql_get_normalized_query_t)(MYSQL_THD thd);
+
+extern "C" struct mysql_parser_service_st {
+ mysql_current_session_t mysql_current_session;
+ mysql_open_session_t mysql_open_session;
+ mysql_start_thread_t mysql_start_thread;
+ mysql_join_thread_t mysql_join_thread;
+ mysql_set_current_database_t mysql_set_current_database;
+ mysql_parse_t mysql_parse;
+ mysql_get_statement_type_t mysql_get_statement_type;
+ mysql_get_statement_digest_t mysql_get_statement_digest;
+ mysql_get_number_params_t mysql_get_number_params;
+ mysql_extract_prepared_params_t mysql_extract_prepared_params;
+ mysql_visit_tree_t mysql_visit_tree;
+ mysql_item_string_t mysql_item_string;
+ mysql_free_string_t mysql_free_string;
+ mysql_get_query_t mysql_get_query;
+ mysql_get_normalized_query_t mysql_get_normalized_query;
+} * mysql_parser_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define mysql_parser_current_session() \
+ mysql_parser_service->mysql_current_session()
+
+#define mysql_parser_open_session() mysql_parser_service->mysql_open_session()
+
+#define mysql_parser_start_thread(thd, func, arg, thread_handle) \
+ mysql_parser_service->mysql_start_thread(thd, func, arg, thread_handle)
+
+#define mysql_parser_join_thread(thread_handle) \
+ mysql_parser_service->mysql_join_thread(thread_handle)
+
+#define mysql_parser_set_current_database(thd, db) \
+ mysql_parser_service->mysql_set_current_database(thd, db)
+
+#define mysql_parser_parse(thd, query, is_prepared, condition_handler, \
+ condition_handler_state) \
+ mysql_parser_service->mysql_parse( \
+ thd, query, is_prepared, condition_handler, condition_handler_state)
+
+#define mysql_parser_get_statement_type(thd) \
+ mysql_parser_service->mysql_get_statement_type(thd)
+
+#define mysql_parser_get_statement_digest(thd, digest) \
+ mysql_parser_service->mysql_get_statement_digest(thd, digest)
+
+#define mysql_parser_get_number_params(thd) \
+ mysql_parser_service->mysql_get_number_params(thd)
+
+#define mysql_parser_extract_prepared_params(thd, positions) \
+ mysql_parser_service->mysql_extract_prepared_params(thd, positions)
+
+#define mysql_parser_visit_tree(thd, processor, arg) \
+ mysql_parser_service->mysql_visit_tree(thd, processor, arg)
+
+#define mysql_parser_item_string(item) \
+ mysql_parser_service->mysql_item_string(item)
+
+#define mysql_parser_free_string(string) \
+ mysql_parser_service->mysql_free_string(string)
+
+#define mysql_parser_get_query(thd) mysql_parser_service->mysql_get_query(thd)
+
+#define mysql_parser_get_normalized_query(thd) \
+ mysql_parser_service->mysql_get_normalized_query(thd)
+
+#else
+typedef void *(*callback_function)(void *);
+MYSQL_THD mysql_parser_current_session();
+MYSQL_THD mysql_parser_open_session();
+void mysql_parser_start_thread(MYSQL_THD thd, callback_function fun, void *arg,
+ struct my_thread_handle *thread_handle);
+void mysql_parser_join_thread(struct my_thread_handle *thread_handle);
+void mysql_parser_set_current_database(MYSQL_THD thd,
+ const MYSQL_LEX_STRING db);
+int mysql_parser_parse(MYSQL_THD thd, const MYSQL_LEX_STRING query,
+ unsigned char is_prepared,
+ sql_condition_handler_function handle_condition,
+ void *condition_handler_state);
+int mysql_parser_get_statement_type(MYSQL_THD thd);
+int mysql_parser_get_statement_digest(MYSQL_THD thd, unsigned char *digest);
+int mysql_parser_get_number_params(MYSQL_THD thd);
+int mysql_parser_extract_prepared_params(MYSQL_THD thd, int *positions);
+int mysql_parser_visit_tree(MYSQL_THD thd, parse_node_visit_function processor,
+ unsigned char *arg);
+MYSQL_LEX_STRING mysql_parser_item_string(MYSQL_ITEM item);
+void mysql_parser_free_string(MYSQL_LEX_STRING string);
+MYSQL_LEX_STRING mysql_parser_get_query(MYSQL_THD thd);
+MYSQL_LEX_STRING mysql_parser_get_normalized_query(MYSQL_THD thd);
+
+#endif /* MYSQL_DYNAMIC_PLUGIN */
+
+#endif /* MYSQL_SERVICE_PARSER_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/mysql/service_plugin_registry.h b/contrib/libs/libmysql_r/include/mysql/service_plugin_registry.h
new file mode 100644
index 0000000000..d180a06ad5
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/service_plugin_registry.h
@@ -0,0 +1,129 @@
+/* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License, version 2.0,
+as published by the Free Software Foundation.
+
+This program is also distributed with certain software (including
+but not limited to OpenSSL) that is licensed under separate terms,
+as designated in a particular file or component or in included license
+documentation. The authors of MySQL hereby grant you an additional
+permission to link the program and your derivative works with the
+separately licensed software that they have included with MySQL.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License, version 2.0, for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_SERVICE_PLUGIN_REGISTRY_INCLUDED
+/**
+ @file
+ Declaration of the registry plugin service
+*/
+
+#include <mysql/components/services/registry.h>
+
+/**
+ @ingroup group_ext_plugin_services
+ A bridge service allowing plugins to work with the registry.
+
+ This allows traditional MySQL plugins to interact with the service
+ registry.
+ All this plugins service does is to return a reference to the
+ registry service.
+ Using that the plugins can access the rest of the registry and
+ dynamic loaders services, as well as other services present in the
+ registry.
+ Note that the plugins must release the service references they
+ acquire otherwise resources will be leaked and normal unload order
+ may be affected.
+*/
+extern "C" struct plugin_registry_service_st {
+ /**
+ Acquire a pointer to the registry service
+
+ The reference must be released by calling
+ plugin_registry_service_st::mysql_plugin_registry_release_func()
+ See @ref mysql_plugin_registry_acquire() for more details.
+
+ Once you receive the registry pointer you can use it to aquire
+ references to other services your plugin might be interested in.
+
+ @note
+ This is to be considered an "expensive" operation because it
+ requires access to the global structures of the
+ @ref PAGE_COMPONENTS_REGISTRY. Avoid using it in situations
+ where fast and scalable execution is requred.
+ Since the registry service is very unlikely to change often
+ holding on to the reference to it for extended time periods
+ is a safe bet.
+
+ @note
+ Achieveing scalability through preserving references does not
+ come for free.
+ These are some of the effects on code that caches active
+ references:
+ - components implementing services to which active references
+ are held cannot be unloaded.
+ - code keeping an active refernece to e.g. a default service
+ implementation will not switch to a possible new default
+ service implementation installed by a component loaded in
+ the meanwhile, as taking the updated default service implementation
+ would only happen at the time of aquiring a new reference.
+
+ @return the registry pointer
+
+ See also: @ref PAGE_COMPONENTS, @ref PAGE_COMPONENTS_REGISTRY,
+ @ref mysql_plugin_registry_acquire(), @ref mysql_plugin_registry_release()
+ */
+ SERVICE_TYPE(registry) * (*mysql_plugin_registry_acquire_func)();
+ /**
+ Release a pointer to the registry service
+
+ Releases the reference to the registry service, as returned by
+ @ref mysql_plugin_registry_acquire().
+ After this call the reigstry_ptr is undefined and
+ should not be used anymore.
+ See @ref mysql_plugin_registry_release() for more details.
+
+ @warning
+ Before releasing the reference to the registry service please
+ make sure you have released all the other service references
+ that you explicitly or implicitly acquired. These can't be
+ released without a valid reference to the registry service.
+
+ @note
+ This is also to be considered an "expensive" operation.
+ See @ref plugin_registry_service_st::mysql_plugin_registry_acquire_func
+ for more details on pros and cons of re-acquiring references vs caching
+ and reusing them.
+
+ @param registry_ptr the registry pointer
+ @return execution status
+ @retval 0 success
+ @retval non-zero failure
+
+ See also @ref PAGE_COMPONENTS, @ref PAGE_COMPONENTS_REGISTRY,
+ @ref mysql_plugin_registry_release(), @ref mysql_plugin_registry_acquire()
+ */
+ int (*mysql_plugin_registry_release_func)(SERVICE_TYPE(registry) *
+ registry_ptr);
+} * plugin_registry_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+#define mysql_plugin_registry_acquire() \
+ plugin_registry_service->mysql_plugin_registry_acquire_func()
+#define mysql_plugin_registry_release(r) \
+ plugin_registry_service->mysql_plugin_registry_release_func(r)
+#else
+SERVICE_TYPE(registry) * mysql_plugin_registry_acquire();
+int mysql_plugin_registry_release(SERVICE_TYPE(registry) *);
+#endif
+
+#define MYSQL_SERVICE_PLUGIN_REGISTRY_INCLUDED
+#endif /* MYSQL_SERVICE_PLUGIN_REGISTRY_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/mysql/service_rpl_transaction_ctx.h b/contrib/libs/libmysql_r/include/mysql/service_rpl_transaction_ctx.h
new file mode 100644
index 0000000000..8fbcbf305e
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/service_rpl_transaction_ctx.h
@@ -0,0 +1,79 @@
+/* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_SERVICE_RPL_TRANSACTION_CTX_INCLUDED
+
+/**
+ @file include/mysql/service_rpl_transaction_ctx.h
+ This service provides a function for plugins to report if a transaction of a
+ given THD should continue or be aborted.
+
+ SYNOPSIS
+ set_transaction_ctx()
+ should be called during RUN_HOOK macro, on which we know that thread is
+ on plugin context and it is before
+ Rpl_transaction_ctx::is_transaction_rollback() check.
+*/
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdlib.h>
+#endif
+
+struct Transaction_termination_ctx {
+ unsigned long m_thread_id;
+ unsigned int m_flags; // reserved
+
+ /*
+ If the instruction is to rollback the transaction,
+ then this flag is set to false.
+ */
+ bool m_rollback_transaction;
+
+ /*
+ If the plugin has generated a GTID, then the follwoing
+ fields MUST be set.
+ */
+ bool m_generated_gtid;
+ int m_sidno;
+ long long int m_gno;
+};
+
+extern "C" struct rpl_transaction_ctx_service_st {
+ int (*set_transaction_ctx)(
+ Transaction_termination_ctx transaction_termination_ctx);
+} * rpl_transaction_ctx_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define set_transaction_ctx(transaction_termination_ctx) \
+ (rpl_transaction_ctx_service->set_transaction_ctx( \
+ (transaction_termination_ctx)))
+
+#else
+
+int set_transaction_ctx(
+ Transaction_termination_ctx transaction_termination_ctx);
+
+#endif
+
+#define MYSQL_SERVICE_RPL_TRANSACTION_CTX_INCLUDED
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/service_rpl_transaction_write_set.h b/contrib/libs/libmysql_r/include/mysql/service_rpl_transaction_write_set.h
new file mode 100644
index 0000000000..d4080cc55d
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/service_rpl_transaction_write_set.h
@@ -0,0 +1,78 @@
+/* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_SERVICE_TRANSACTION_WRITE_SET_INCLUDED
+
+/**
+ @file include/mysql/service_rpl_transaction_write_set.h
+ This service provides a function for plugins to get the write set of a given
+ transaction.
+
+ SYNOPSIS
+ get_transaction_write_set()
+ This service is used to fetch the write_set extracted for the currently
+ executing transaction by passing the thread_id as an input parameter for
+ the method.
+
+ @param [in] - thread_id - It is the thread identifier of the currently
+ executing thread.
+
+ In the current implementation it is being called during RUN_HOOK macro,
+ on which we know that thread is on plugin context.
+
+ Cleanup :
+ The service caller must take of the memory allocated during the service
+ call to prevent memory leaks.
+*/
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdlib.h>
+#endif
+
+/**
+ This structure is used to keep the list of the hash values of the records
+ changed in the transaction.
+*/
+struct Transaction_write_set {
+ unsigned int m_flags; // reserved
+ unsigned long write_set_size; // Size of the PKE set of the transaction.
+ unsigned long long *write_set; // A pointer to the PKE set.
+};
+
+extern "C" struct transaction_write_set_service_st {
+ Transaction_write_set *(*get_transaction_write_set)(
+ unsigned long m_thread_id);
+} * transaction_write_set_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define get_transaction_write_set(m_thread_id) \
+ (transaction_write_set_service->get_transaction_write_set((m_thread_id)))
+
+#else
+
+Transaction_write_set *get_transaction_write_set(unsigned long m_thread_id);
+
+#endif
+
+#define MYSQL_SERVICE_TRANSACTION_WRITE_SET_INCLUDED
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/service_rules_table.h b/contrib/libs/libmysql_r/include/mysql/service_rules_table.h
new file mode 100644
index 0000000000..79f2c6d9bb
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/service_rules_table.h
@@ -0,0 +1,185 @@
+#ifndef SERVICE_RULES_TABLE_INCLUDED
+#define SERVICE_RULES_TABLE_INCLUDED
+
+/* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#include <string>
+
+#include "my_dbug.h"
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdlib.h>
+#endif
+
+/**
+ @file include/mysql/service_rules_table.h
+
+ Plugin service that provides access to the rewrite rules table that is used
+ by the Rewriter plugin. No other use intended.
+*/
+
+class THD;
+struct TABLE_LIST;
+class Field;
+
+namespace rules_table_service {
+
+/**
+ There must be one function of this kind in order for the symbols in the
+ server's dynamic library to be visible to plugins.
+*/
+int dummy_function_to_ensure_we_are_linked_into_the_server();
+
+/**
+ Frees a const char pointer allocated in the server's dynamic library using
+ new[].
+*/
+void free_string(const char *str);
+
+/**
+ Writable cursor that allows reading and updating of rows in a persistent
+ table.
+*/
+class Cursor {
+ public:
+ typedef int column_id;
+
+ static const column_id ILLEGAL_COLUMN_ID = -1;
+
+ /**
+ Creates a cursor to an already-opened table. The constructor is kept
+ explicit because of implicit conversions from void*.
+ */
+ explicit Cursor(THD *thd);
+
+ /// Creates a past-the-end cursor.
+ Cursor() : m_thd(NULL), m_table_list(NULL), m_is_finished(true) {}
+
+ Cursor(const Cursor &) = default;
+
+ column_id pattern_column() const { return m_pattern_column; }
+ column_id pattern_database_column() const {
+ return m_pattern_database_column;
+ }
+ column_id replacement_column() const { return m_replacement_column; }
+ column_id enabled_column() const { return m_enabled_column; }
+ column_id message_column() const { return m_message_column; }
+ column_id pattern_digest_column() const { return m_pattern_digest_column; }
+ column_id normalized_pattern_column() const {
+ return m_normalized_pattern_column;
+ }
+
+ /**
+ True if the table does not contain columns named 'pattern', 'replacement',
+ 'enabled' and 'message'. In this case the cursor is equal to any
+ past-the-end Cursor.
+ */
+ bool table_is_malformed() { return m_table_is_malformed; }
+
+ /**
+ Fetches the value of the column with the given number as a C string.
+
+ This interface is meant for crossing dynamic library boundaries, hence the
+ use of C-style const char*. The function casts a column value to a C
+ string and returns a copy, allocated in the callee's DL. The pointer
+ must be freed using free_string().
+
+ @param fieldno One of PATTERN_COLUMN, REPLACEMENT_COLUMN, ENABLED_COLUMN
+ or MESSAGE_COLUMN.
+ */
+ const char *fetch_string(int fieldno);
+
+ /**
+ Equality operator. The only cursors that are equal are past-the-end
+ cursors.
+ */
+ bool operator==(const Cursor &other) {
+ return (m_is_finished == other.m_is_finished);
+ }
+
+ /**
+ Inequality operator. All cursors are considered different except
+ past-the-end cursors.
+ */
+ bool operator!=(const Cursor &other) { return !(*this == other); }
+
+ /**
+ Advances this Cursor. Read errors are kept, and had_serious_read_error()
+ will tell if there was an unexpected error (e.g. not EOF) while reading.
+ */
+ Cursor &operator++() {
+ if (!m_is_finished) read();
+ return *this;
+ }
+
+ /// Prepares the write buffer for updating the current row.
+ void make_writeable();
+
+ /**
+ Sets the value of column colno to a string value.
+
+ @param colno The column number.
+ @param str The string.
+ @param length The string's length.
+ */
+ void set(int colno, const char *str, size_t length);
+
+ /// Writes the row in the write buffer to the table at the current row.
+ int write();
+
+ /// True if there was an unexpected error while reading, e.g. other than EOF.
+ bool had_serious_read_error() const;
+
+ /// Closes the table scan if initiated and commits the transaction.
+ ~Cursor();
+
+ private:
+ int field_index(const char *field_name);
+
+ int m_pattern_column;
+ int m_pattern_database_column;
+ int m_replacement_column;
+ int m_enabled_column;
+ int m_message_column;
+ int m_pattern_digest_column;
+ int m_normalized_pattern_column;
+
+ THD *m_thd;
+ TABLE_LIST *m_table_list;
+
+ bool m_is_finished;
+ bool m_table_is_malformed;
+ int m_last_read_status;
+
+ int read();
+};
+
+/**
+ A past-the-end Cursor. All past-the-end cursors are considered equal
+ when compared with operator ==.
+*/
+Cursor end();
+
+} // namespace rules_table_service
+
+#endif // SERVICE_RULES_TABLE_INCLUDED
diff --git a/contrib/libs/libmysql_r/include/mysql/service_security_context.h b/contrib/libs/libmysql_r/include/mysql/service_security_context.h
new file mode 100644
index 0000000000..2da2edb39a
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/service_security_context.h
@@ -0,0 +1,166 @@
+/* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_SERVICE_SECURITY_CONTEXT
+#define MYSQL_SERVICE_SECURITY_CONTEXT
+
+/**
+ @file include/mysql/service_security_context.h
+
+ Definitions for the password validation service.
+
+ @sa security_context_service_st
+*/
+
+#include "mysql/plugin.h"
+
+#ifdef __cplusplus
+class Security_context;
+/** an opaque class reference hiding the actual security context object. */
+#define MYSQL_SECURITY_CONTEXT Security_context *
+#else
+#define MYSQL_SECURITY_CONTEXT void *
+#endif
+typedef char my_svc_bool;
+
+/**
+ @ingroup group_ext_plugin_services
+
+ This service provides functions for plugins and storage engines to
+ manipulate the thread's security context.
+
+ The service allows creation, copying, filling in by user accout and
+ destruction of security context objects.
+ It also allows getting and setting the security context for a thread.
+ And it also allows reading and setting security context properties.
+
+ The range of the above services allows plugins to inspect the security
+ context they're running it, impersonate a user account of their choice
+ (a.k.a. sudo in Unix) and craft a security context not related to an
+ existing user account.
+
+ No authentication is done in any of the above services. Authentication
+ is specific to the media and does not belong to the security context,
+ that's used mostly for authorization.
+
+ Make sure you keep the original security context of a thread or restore
+ it when done, as leaving a different security context active may lead to
+ various kinds of problems.
+
+ @sa Security_context, THD, MYSQL_SECURITY_CONTEXT
+*/
+extern "C" struct security_context_service_st {
+ /**
+ Retrieves a handle to the current security context for a thread.
+ @sa ::thd_get_security_context
+ */
+ my_svc_bool (*thd_get_security_context)(MYSQL_THD,
+ MYSQL_SECURITY_CONTEXT *out_ctx);
+ /**
+ Sets a new security context for a thread
+ @sa ::thd_set_security_context
+ */
+ my_svc_bool (*thd_set_security_context)(MYSQL_THD,
+ MYSQL_SECURITY_CONTEXT in_ctx);
+
+ /**
+ Creates a new security context
+ @sa ::security_context_create
+ */
+ my_svc_bool (*security_context_create)(MYSQL_SECURITY_CONTEXT *out_ctx);
+ /**
+ Creates a new security context
+ @sa ::security_context_create
+ */
+ my_svc_bool (*security_context_destroy)(MYSQL_SECURITY_CONTEXT);
+ /**
+ Creates a copy of a security context
+ @sa ::security_context_copy
+ */
+ my_svc_bool (*security_context_copy)(MYSQL_SECURITY_CONTEXT in_ctx,
+ MYSQL_SECURITY_CONTEXT *out_ctx);
+
+ /**
+ Fills in a security context with the attributes of a user account
+ @sa ::security_context_lookup
+ */
+ my_svc_bool (*security_context_lookup)(MYSQL_SECURITY_CONTEXT ctx,
+ const char *user, const char *host,
+ const char *ip, const char *db);
+
+ /**
+ Retrieves the value for a named attribute of a security context
+ @sa ::security_context_get_option
+ */
+ my_svc_bool (*security_context_get_option)(MYSQL_SECURITY_CONTEXT,
+ const char *name,
+ void *inout_pvalue);
+ /**
+ Sets a new value for a named attribute of a security context
+ @sa ::security_context_set_option
+ */
+ my_svc_bool (*security_context_set_option)(MYSQL_SECURITY_CONTEXT,
+ const char *name, void *pvalue);
+} * security_context_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define thd_get_security_context(_THD, _CTX) \
+ security_context_service->thd_get_security_context(_THD, _CTX)
+#define thd_set_security_context(_THD, _CTX) \
+ security_context_service->thd_set_security_context(_THD, _CTX)
+
+#define security_context_create(_CTX) \
+ security_context_service->security_context_create(_CTX)
+#define security_context_destroy(_CTX) \
+ security_context_service->security_context_destroy(_CTX)
+#define security_context_copy(_CTX1, _CTX2) \
+ security_context_service->security_context_copy(_CTX1, _CTX2)
+
+#define security_context_lookup(_CTX, _U, _H, _IP, _DB) \
+ security_context_service->security_context_lookup(_CTX, _U, _H, _IP, _DB)
+
+#define security_context_get_option(_SEC_CTX, _NAME, _VALUE) \
+ security_context_service->security_context_get_option(_SEC_CTX, _NAME, _VALUE)
+#define security_context_set_option(_SEC_CTX, _NAME, _VALUE) \
+ security_context_service->security_context_set_option(_SEC_CTX, _NAME, _VALUE)
+#else
+my_svc_bool thd_get_security_context(MYSQL_THD,
+ MYSQL_SECURITY_CONTEXT *out_ctx);
+my_svc_bool thd_set_security_context(MYSQL_THD, MYSQL_SECURITY_CONTEXT in_ctx);
+
+my_svc_bool security_context_create(MYSQL_SECURITY_CONTEXT *out_ctx);
+my_svc_bool security_context_destroy(MYSQL_SECURITY_CONTEXT ctx);
+my_svc_bool security_context_copy(MYSQL_SECURITY_CONTEXT in_ctx,
+ MYSQL_SECURITY_CONTEXT *out_ctx);
+
+my_svc_bool security_context_lookup(MYSQL_SECURITY_CONTEXT ctx,
+ const char *user, const char *host,
+ const char *ip, const char *db);
+
+my_svc_bool security_context_get_option(MYSQL_SECURITY_CONTEXT,
+ const char *name, void *inout_pvalue);
+my_svc_bool security_context_set_option(MYSQL_SECURITY_CONTEXT,
+ const char *name, void *pvalue);
+#endif /* !MYSQL_DYNAMIC_PLUGIN */
+
+#endif /* !MYSQL_SERVICE_SECURITY_CONTEXT */
diff --git a/contrib/libs/libmysql_r/include/mysql/service_srv_session.h b/contrib/libs/libmysql_r/include/mysql/service_srv_session.h
new file mode 100644
index 0000000000..f83916c75e
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/service_srv_session.h
@@ -0,0 +1,177 @@
+/* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+#ifndef MYSQL_SRV_SESSION_SERVICE_INCLUDED
+#define MYSQL_SRV_SESSION_SERVICE_INCLUDED
+
+/**
+ @file include/mysql/service_srv_session.h
+ Header file for the Server session service. This service is to provide
+ of creating sessions with the server. These sessions can be furtherly used
+ together with the Command service to execute commands in the server.
+*/
+
+#ifdef __cplusplus
+class Srv_session;
+typedef class Srv_session *MYSQL_SESSION;
+#else
+struct Srv_session;
+typedef struct Srv_session *MYSQL_SESSION;
+#endif
+
+#ifndef MYSQL_ABI_CHECK
+#include "mysql/plugin.h" /* MYSQL_THD */
+#endif
+
+typedef void (*srv_session_error_cb)(void *ctx, unsigned int sql_errno,
+ const char *err_msg);
+
+extern "C" struct srv_session_service_st {
+ int (*init_session_thread)(const void *plugin);
+
+ void (*deinit_session_thread)();
+
+ MYSQL_SESSION(*open_session)
+ (srv_session_error_cb error_cb, void *plugix_ctx);
+
+ int (*detach_session)(MYSQL_SESSION session);
+
+ int (*close_session)(MYSQL_SESSION session);
+
+ int (*server_is_available)();
+
+ int (*attach_session)(MYSQL_SESSION session, MYSQL_THD *ret_previous_thd);
+} * srv_session_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define srv_session_init_thread(plugin) \
+ srv_session_service->init_session_thread((plugin))
+
+#define srv_session_deinit_thread() srv_session_service->deinit_session_thread()
+
+#define srv_session_open(cb, ctx) srv_session_service->open_session((cb), (ctx))
+
+#define srv_session_detach(session) \
+ srv_session_service->detach_session((session))
+
+#define srv_session_close(session) srv_session_service->close_session((session))
+
+#define srv_session_server_is_available() \
+ srv_session_service->server_is_available()
+
+#define srv_session_attach(session, thd) \
+ srv_session_service->attach_session((session), (thd))
+
+#else
+
+/**
+ Initializes the current physical thread to use with session service.
+
+ Call this function ONLY in physical threads which are not initialized in
+ any way by the server.
+
+ @param plugin Pointer to the plugin structure, passed to the plugin over
+ the plugin init function.
+
+ @return
+ 0 success
+ 1 failure
+*/
+int srv_session_init_thread(const void *plugin);
+
+/**
+ Deinitializes the current physical thread to use with session service.
+
+
+ Call this function ONLY in physical threads which were initialized using
+ srv_session_init_thread().
+*/
+void srv_session_deinit_thread();
+
+/**
+ Opens a server session.
+
+ In a thread not initialized by the server itself, this function should be
+ called only after srv_session_init_thread() has already been called.
+
+ @param error_cb session error callback
+ @param plugin_ctx Plugin's context, opaque pointer that would
+ be provided to callbacks. Might be NULL.
+ @return
+ session on success
+ NULL on failure
+*/
+MYSQL_SESSION srv_session_open(srv_session_error_cb error_cb, void *plugin_ctx);
+
+/**
+ Detaches a session from current physical thread.
+
+ Detaches a previously session. Which can only occur when the MYSQL_SESSION
+ was manually attached by "srv_session_attach".
+ Other srv_session calls automatically attached/detached the THD when the
+ MYSQL_SESSION is used (for example command_service_run_command()).
+
+ @param session Session to detach
+
+ @returns
+ 0 success
+ 1 failure
+*/
+int srv_session_detach(MYSQL_SESSION session);
+
+/**
+ Closes a previously opened session.
+
+ @param session Session to close
+
+ @return
+ 0 success
+ 1 failure
+*/
+int srv_session_close(MYSQL_SESSION session);
+
+/**
+ Returns if the server is available (not booting or shutting down)
+
+ @return
+ 0 not available
+ 1 available
+*/
+int srv_session_server_is_available();
+
+/**
+ Attaches a session to current physical thread.
+
+ Previously attached THD is detached and returned through ret_previous_thd.
+ THD associated with session is attached.
+
+ @param session Session to attach
+
+ @returns
+ 0 success
+ 1 failure
+*/
+int srv_session_attach(MYSQL_SESSION session, MYSQL_THD *ret_previous_thd);
+
+#endif
+
+#endif /* MYSQL_SRV_SESSION_SERVICE_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/mysql/service_srv_session_info.h b/contrib/libs/libmysql_r/include/mysql/service_srv_session_info.h
new file mode 100644
index 0000000000..c32425749c
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/service_srv_session_info.h
@@ -0,0 +1,180 @@
+#ifndef MYSQL_SERVICE_SRV_SESSION_INFO_INCLUDED
+#define MYSQL_SERVICE_SRV_SESSION_INFO_INCLUDED
+/* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/mysql/service_srv_session_info.h
+ Service providing setters and getters for some properties of a session
+*/
+
+#include "mysql/service_srv_session.h"
+#ifndef MYSQL_ABI_CHECK
+#include <stdint.h> /* uint16_t */
+#include "m_string.h" /* LEX_CSTRING */
+#include "my_thread.h" /* my_thread_id */
+#include "my_thread_local.h"
+#include "mysql_com.h" /* Vio for violite.h */
+#include "plugin.h" /* MYSQL_THD */
+
+enum enum_vio_type : int;
+#endif
+
+extern "C" struct srv_session_info_service_st {
+ MYSQL_THD (*get_thd)(MYSQL_SESSION session);
+
+ my_thread_id (*get_session_id)(MYSQL_SESSION session);
+
+ LEX_CSTRING (*get_current_db)(MYSQL_SESSION session);
+
+ uint16_t (*get_client_port)(MYSQL_SESSION session);
+ int (*set_client_port)(MYSQL_SESSION session, uint16_t port);
+
+ int (*set_connection_type)(MYSQL_SESSION session, enum enum_vio_type type);
+
+ int (*killed)(MYSQL_SESSION session);
+
+ unsigned int (*session_count)();
+ unsigned int (*thread_count)(const void *plugin);
+} * srv_session_info_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define srv_session_info_get_thd(session) \
+ srv_session_info_service->get_thd((session))
+#define srv_session_info_get_session_id(sess) \
+ srv_session_info_service->get_session_id((sess))
+#define srv_session_info_get_current_db(sess) \
+ srv_session_info_service->get_current_db((sess))
+#define srv_session_info_get_client_port(sess) \
+ srv_session_info_service->get_client_port((sess))
+#define srv_session_info_set_client_port(sess, port) \
+ srv_session_info_service->set_client_port((sess), (port))
+#define srv_session_info_set_connection_type(sess, type) \
+ srv_session_info_service->set_connection_type((sess), (type))
+#define srv_session_info_killed(sess) srv_session_info_service->killed((sess))
+#define srv_session_info_session_count(sess) \
+ srv_session_info_service->session_count(sess)
+#define srv_session_info_thread_count(plugin) \
+ srv_session_info_service->thread_count(plugin)
+
+#else
+
+/**
+ Returns the THD of a session.
+
+ @param session Session
+
+ @returns
+ address of the THD
+*/
+MYSQL_THD srv_session_info_get_thd(MYSQL_SESSION session);
+
+/**
+ Returns the ID of a session.
+
+ @param session Session
+*/
+my_thread_id srv_session_info_get_session_id(MYSQL_SESSION session);
+
+/**
+ Returns the current database of a session.
+
+ @note {NULL, 0} is returned case of no current database or session is NULL
+
+
+ @param session Session
+*/
+LEX_CSTRING srv_session_info_get_current_db(MYSQL_SESSION session);
+
+/**
+ Returns the client port of a session.
+
+ @note The client port in SHOW PROCESSLIST, INFORMATION_SCHEMA.PROCESSLIST.
+ This port is NOT shown in PERFORMANCE_SCHEMA.THREADS.
+
+ @param session Session
+*/
+uint16_t srv_session_info_get_client_port(MYSQL_SESSION session);
+
+/**
+ Sets the client port of a session.
+
+ @note The client port in SHOW PROCESSLIST, INFORMATION_SCHEMA.PROCESSLIST.
+ This port is NOT shown in PERFORMANCE_SCHEMA.THREADS.
+
+ @param session Session
+ @param port Port number
+
+ @return
+ 0 success
+ 1 failure
+*/
+int srv_session_info_set_client_port(MYSQL_SESSION session, uint16_t port);
+
+/**
+ Sets the connection type of a session.
+
+ @see enum_vio_type
+
+ @note The type is shown in PERFORMANCE_SCHEMA.THREADS. The value is translated
+ from the enum to a string according to @see vio_type_names array
+ in vio/vio.c
+
+ @note If NO_VIO_TYPE passed as type the call will fail.
+
+ @return
+ 0 success
+ 1 failure
+*/
+int srv_session_info_set_connection_type(MYSQL_SESSION session,
+ enum enum_vio_type type);
+
+/**
+ Returns whether the session was killed
+
+ @param session Session
+
+ @return
+ 0 not killed
+ 1 killed
+*/
+int srv_session_info_killed(MYSQL_SESSION session);
+
+/**
+ Returns the number opened sessions in thread initialized by srv_session
+ service.
+*/
+unsigned int srv_session_info_session_count();
+
+/**
+ Returns the number opened sessions in thread initialized by srv_session
+ service.
+
+ @param plugin Pointer to the plugin structure, passed to the plugin over
+ the plugin init function.
+*/
+unsigned int srv_session_info_thread_count(const void *plugin);
+
+#endif /* MYSQL_DYNAMIC_PLUGIN */
+
+#endif /* MYSQL_SERVICE_SRV_SESSION_INFO_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/mysql/service_thd_alloc.h b/contrib/libs/libmysql_r/include/mysql/service_thd_alloc.h
new file mode 100644
index 0000000000..af66bcdad5
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/service_thd_alloc.h
@@ -0,0 +1,127 @@
+#ifndef MYSQL_SERVICE_THD_ALLOC_INCLUDED
+/* Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/mysql/service_thd_alloc.h
+ This service provides functions to allocate memory in a connection local
+ memory pool. The memory allocated there will be automatically freed at the
+ end of the statement, don't use it for allocations that should live longer
+ than that. For short living allocations this is more efficient than
+ using my_malloc and friends, and automatic "garbage collection" allows not
+ to think about memory leaks.
+
+ The pool is best for small to medium objects, don't use it for large
+ allocations - they are better served with my_malloc.
+*/
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdlib.h>
+#endif
+
+class THD;
+#define MYSQL_THD THD *
+
+#include <mysql/mysql_lex_string.h>
+
+extern "C" struct thd_alloc_service_st {
+ void *(*thd_alloc_func)(MYSQL_THD, size_t);
+ void *(*thd_calloc_func)(MYSQL_THD, size_t);
+ char *(*thd_strdup_func)(MYSQL_THD, const char *);
+ char *(*thd_strmake_func)(MYSQL_THD, const char *, size_t);
+ void *(*thd_memdup_func)(MYSQL_THD, const void *, size_t);
+ MYSQL_LEX_STRING *(*thd_make_lex_string_func)(MYSQL_THD, MYSQL_LEX_STRING *,
+ const char *, size_t, int);
+} * thd_alloc_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define thd_alloc(thd, size) (thd_alloc_service->thd_alloc_func((thd), (size)))
+
+#define thd_calloc(thd, size) \
+ (thd_alloc_service->thd_calloc_func((thd), (size)))
+
+#define thd_strdup(thd, str) (thd_alloc_service->thd_strdup_func((thd), (str)))
+
+#define thd_strmake(thd, str, size) \
+ (thd_alloc_service->thd_strmake_func((thd), (str), (size)))
+
+#define thd_memdup(thd, str, size) \
+ (thd_alloc_service->thd_memdup_func((thd), (str), (size)))
+
+#define thd_make_lex_string(thd, lex_str, str, size, allocate_lex_string) \
+ (thd_alloc_service->thd_make_lex_string_func((thd), (lex_str), (str), \
+ (size), (allocate_lex_string)))
+
+#else
+
+/**
+ Allocate memory in the connection's local memory pool
+
+ @details
+ When properly used in place of @c my_malloc(), this can significantly
+ improve concurrency. Don't use this or related functions to allocate
+ large chunks of memory. Use for temporary storage only. The memory
+ will be freed automatically at the end of the statement; no explicit
+ code is required to prevent memory leaks.
+
+ @see alloc_root()
+*/
+void *thd_alloc(MYSQL_THD thd, size_t size);
+/**
+ @see thd_alloc()
+*/
+void *thd_calloc(MYSQL_THD thd, size_t size);
+/**
+ @see thd_alloc()
+*/
+char *thd_strdup(MYSQL_THD thd, const char *str);
+/**
+ @see thd_alloc()
+*/
+char *thd_strmake(MYSQL_THD thd, const char *str, size_t size);
+/**
+ @see thd_alloc()
+*/
+void *thd_memdup(MYSQL_THD thd, const void *str, size_t size);
+
+/**
+ Create a LEX_STRING in this connection's local memory pool
+
+ @param thd user thread connection handle
+ @param lex_str pointer to LEX_STRING object to be initialized
+ @param str initializer to be copied into lex_str
+ @param size length of str, in bytes
+ @param allocate_lex_string flag: if TRUE, allocate new LEX_STRING object,
+ instead of using lex_str value
+ @return NULL on failure, or pointer to the LEX_STRING object
+
+ @see thd_alloc()
+*/
+MYSQL_LEX_STRING *thd_make_lex_string(MYSQL_THD thd, MYSQL_LEX_STRING *lex_str,
+ const char *str, size_t size,
+ int allocate_lex_string);
+
+#endif
+
+#define MYSQL_SERVICE_THD_ALLOC_INCLUDED
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/service_thd_wait.h b/contrib/libs/libmysql_r/include/mysql/service_thd_wait.h
new file mode 100644
index 0000000000..59109983f1
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/service_thd_wait.h
@@ -0,0 +1,108 @@
+/* Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_SERVICE_THD_WAIT_INCLUDED
+#define MYSQL_SERVICE_THD_WAIT_INCLUDED
+
+/**
+ @file include/mysql/service_thd_wait.h
+ This service provides functions for plugins and storage engines to report
+ when they are going to sleep/stall.
+
+ SYNOPSIS
+ thd_wait_begin() - call just before a wait begins
+ thd Thread object
+ Use NULL if the thd is NOT known.
+ wait_type Type of wait
+ 1 -- short wait (e.g. for mutex)
+ 2 -- medium wait (e.g. for disk io)
+ 3 -- large wait (e.g. for locked row/table)
+ NOTES
+ This is used by the threadpool to have better knowledge of which
+ threads that currently are actively running on CPUs. When a thread
+ reports that it's going to sleep/stall, the threadpool scheduler is
+ free to start another thread in the pool most likely. The expected wait
+ time is simply an indication of how long the wait is expected to
+ become, the real wait time could be very different.
+
+ thd_wait_end() called immediately after the wait is complete
+
+ thd_wait_end() MUST be called if thd_wait_begin() was called.
+
+ Using thd_wait_...() service is optional but recommended. Using it will
+ improve performance as the thread pool will be more active at managing the
+ thread workload.
+*/
+
+class THD;
+#define MYSQL_THD THD *
+
+/*
+ One should only report wait events that could potentially block for a
+ long time. A mutex wait is too short of an event to report. The reason
+ is that an event which is reported leads to a new thread starts
+ executing a query and this has a negative impact of usage of CPU caches
+ and thus the expected gain of starting a new thread must be higher than
+ the expected cost of lost performance due to starting a new thread.
+
+ Good examples of events that should be reported are waiting for row locks
+ that could easily be for many milliseconds or even seconds and the same
+ holds true for global read locks, table locks and other meta data locks.
+ Another event of interest is going to sleep for an extended time.
+
+ Note that user-level locks no longer use THD_WAIT_USER_LOCK wait type.
+ Since their implementation relies on metadata locks manager it uses
+ THD_WAIT_META_DATA_LOCK instead.
+*/
+typedef enum _thd_wait_type_e {
+ THD_WAIT_SLEEP = 1,
+ THD_WAIT_DISKIO = 2,
+ THD_WAIT_ROW_LOCK = 3,
+ THD_WAIT_GLOBAL_LOCK = 4,
+ THD_WAIT_META_DATA_LOCK = 5,
+ THD_WAIT_TABLE_LOCK = 6,
+ THD_WAIT_USER_LOCK = 7,
+ THD_WAIT_BINLOG = 8,
+ THD_WAIT_GROUP_COMMIT = 9,
+ THD_WAIT_SYNC = 10,
+ THD_WAIT_LAST = 11
+} thd_wait_type;
+
+extern "C" struct thd_wait_service_st {
+ void (*thd_wait_begin_func)(MYSQL_THD, int);
+ void (*thd_wait_end_func)(MYSQL_THD);
+} * thd_wait_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define thd_wait_begin(_THD, _WAIT_TYPE) \
+ thd_wait_service->thd_wait_begin_func(_THD, _WAIT_TYPE)
+#define thd_wait_end(_THD) thd_wait_service->thd_wait_end_func(_THD)
+
+#else
+
+void thd_wait_begin(MYSQL_THD thd, int wait_type);
+void thd_wait_end(MYSQL_THD thd);
+
+#endif
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/service_thread_scheduler.h b/contrib/libs/libmysql_r/include/mysql/service_thread_scheduler.h
new file mode 100644
index 0000000000..17c3d5820f
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/service_thread_scheduler.h
@@ -0,0 +1,87 @@
+/*
+ Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef SERVICE_THREAD_SCHEDULER_INCLUDED
+#define SERVICE_THREAD_SCHEDULER_INCLUDED
+
+/**
+ @file include/mysql/service_thread_scheduler.h
+*/
+
+struct Connection_handler_functions;
+struct THD_event_functions;
+
+extern "C" struct my_thread_scheduler_service {
+ int (*connection_handler_set)(struct Connection_handler_functions *,
+ struct THD_event_functions *);
+ int (*connection_handler_reset)();
+} * my_thread_scheduler_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define my_connection_handler_set(F, M) \
+ my_thread_scheduler_service->connection_handler_set((F), (M))
+#define my_connection_handler_reset() \
+ my_thread_scheduler_service->connection_handler_reset()
+
+#else
+
+/**
+ Instantiates Plugin_connection_handler based on the supplied
+ Conection_handler_functions and sets it as the current
+ connection handler.
+
+ Also sets the THD_event_functions functions which will
+ be called by the server when e.g. begining a wait.
+
+ Remembers the existing connection handler so that it can be restored later.
+
+ @param chf struct with functions to be called when e.g. handling
+ new clients.
+ @param tef struct with functions to be called when events
+ (e.g. lock wait) happens.
+
+ @note Both pointers (i.e. not the structs themselves) will be copied,
+ so the structs must not disappear.
+
+ @note We don't support dynamically loading more than one connection handler.
+
+ @retval 1 failure
+ @retval 0 success
+*/
+int my_connection_handler_set(struct Connection_handler_functions *chf,
+ struct THD_event_functions *tef);
+
+/**
+ Destroys the current connection handler and restores the previous.
+ Should only be called after calling my_connection_handler_set().
+
+ @retval 1 failure
+ @retval 0 success
+*/
+int my_connection_handler_reset();
+
+#endif /* MYSQL_DYNAMIC_PLUGIN */
+
+#endif /* SERVICE_THREAD_SCHEDULER_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/mysql/services.h b/contrib/libs/libmysql_r/include/mysql/services.h
new file mode 100644
index 0000000000..5e685ec994
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/services.h
@@ -0,0 +1,48 @@
+#ifndef MYSQL_SERVICES_INCLUDED
+/* Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/mysql/services.h
+*/
+
+#include <mysql/service_command.h>
+#include <mysql/service_locking.h>
+#include <mysql/service_my_plugin_log.h>
+#include <mysql/service_mysql_alloc.h>
+#include <mysql/service_mysql_keyring.h>
+#include <mysql/service_mysql_password_policy.h>
+#include <mysql/service_mysql_string.h>
+#include <mysql/service_parser.h>
+#include <mysql/service_plugin_registry.h>
+#include <mysql/service_rpl_transaction_ctx.h>
+#include <mysql/service_rpl_transaction_write_set.h>
+#include <mysql/service_rules_table.h>
+#include <mysql/service_security_context.h>
+#include <mysql/service_srv_session.h>
+#include <mysql/service_srv_session_info.h>
+#include <mysql/service_thd_alloc.h>
+#include <mysql/service_thd_wait.h>
+#include <mysql/service_thread_scheduler.h>
+
+#define MYSQL_SERVICES_INCLUDED
+#endif /* MYSQL_SERVICES_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/mysql/status_var.h b/contrib/libs/libmysql_r/include/mysql/status_var.h
new file mode 100644
index 0000000000..3dcef2f29e
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/status_var.h
@@ -0,0 +1,95 @@
+/* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef status_var_h
+#define status_var_h
+
+/**
+ Declarations for SHOW STATUS support in plugins
+*/
+enum enum_mysql_show_type {
+ SHOW_UNDEF,
+ SHOW_BOOL,
+ SHOW_INT, ///< shown as _unsigned_ int
+ SHOW_LONG, ///< shown as _unsigned_ long
+ SHOW_LONGLONG, ///< shown as _unsigned_ longlong
+ SHOW_CHAR,
+ SHOW_CHAR_PTR,
+ SHOW_ARRAY,
+ SHOW_FUNC,
+ SHOW_DOUBLE,
+ /*
+ This include defines server-only values of the enum.
+ Using them in plugins is not supported.
+ */
+ SHOW_KEY_CACHE_LONG,
+ SHOW_KEY_CACHE_LONGLONG,
+ SHOW_LONG_STATUS,
+ SHOW_DOUBLE_STATUS,
+ SHOW_HAVE,
+ SHOW_MY_BOOL,
+ SHOW_HA_ROWS,
+ SHOW_SYS,
+ SHOW_LONG_NOFLUSH,
+ SHOW_LONGLONG_STATUS,
+ SHOW_LEX_STRING,
+ /*
+ Support for signed values are extended for plugins.
+ */
+ SHOW_SIGNED_INT,
+ SHOW_SIGNED_LONG,
+ SHOW_SIGNED_LONGLONG
+};
+
+/**
+ Status variable scope.
+ Only GLOBAL status variable scope is available in plugins.
+*/
+enum enum_mysql_show_scope {
+ SHOW_SCOPE_UNDEF,
+ SHOW_SCOPE_GLOBAL,
+ /* Server-only values. Not supported in plugins. */
+ SHOW_SCOPE_SESSION,
+ SHOW_SCOPE_ALL
+};
+
+/**
+ SHOW STATUS Server status variable
+*/
+struct SHOW_VAR {
+ const char *name;
+ char *value;
+ enum enum_mysql_show_type type;
+ enum enum_mysql_show_scope scope;
+};
+
+#define SHOW_VAR_MAX_NAME_LEN 64
+#define SHOW_VAR_FUNC_BUFF_SIZE 1024
+#ifdef __cplusplus
+class THD;
+#define MYSQL_THD THD *
+#else
+#define MYSQL_THD void *
+#endif
+typedef int (*mysql_show_var_func)(MYSQL_THD, SHOW_VAR *, char *);
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql/udf_registration_types.h b/contrib/libs/libmysql_r/include/mysql/udf_registration_types.h
new file mode 100644
index 0000000000..874b2ff36f
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql/udf_registration_types.h
@@ -0,0 +1,90 @@
+/* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License, version 2.0,
+as published by the Free Software Foundation.
+
+This program is also distributed with certain software (including
+but not limited to OpenSSL) that is licensed under separate terms,
+as designated in a particular file or component or in included license
+documentation. The authors of MySQL hereby grant you an additional
+permission to link the program and your derivative works with the
+separately licensed software that they have included with MySQL.
+
+Without limiting anything contained in the foregoing, this file,
+which is part of C Driver for MySQL (Connector/C), is also subject to the
+Universal FOSS Exception, version 1.0, a copy of which can be found at
+http://oss.oracle.com/licenses/universal-foss-exception.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License, version 2.0, for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef UDF_REGISTRATION_TYPES_H
+#define UDF_REGISTRATION_TYPES_H
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdbool.h>
+#endif
+
+/**
+Type of the user defined function return slot and arguments
+*/
+enum Item_result {
+ INVALID_RESULT = -1, /** not valid for UDFs */
+ STRING_RESULT = 0, /** char * */
+ REAL_RESULT, /** double */
+ INT_RESULT, /** long long */
+ ROW_RESULT, /** not valid for UDFs */
+ DECIMAL_RESULT /** char *, to be converted to/from a decimal */
+};
+
+typedef struct UDF_ARGS {
+ unsigned int arg_count; /**< Number of arguments */
+ enum Item_result *arg_type; /**< Pointer to item_results */
+ char **args; /**< Pointer to argument */
+ unsigned long *lengths; /**< Length of string arguments */
+ char *maybe_null; /**< Set to 1 for all maybe_null args */
+ char **attributes; /**< Pointer to attribute name */
+ unsigned long *attribute_lengths; /**< Length of attribute arguments */
+ void *extension;
+} UDF_ARGS;
+
+/**
+Information about the result of a user defined function
+
+@todo add a notion for determinism of the UDF.
+
+@sa Item_udf_func::update_used_tables()
+*/
+typedef struct UDF_INIT {
+ bool maybe_null; /** 1 if function can return NULL */
+ unsigned int decimals; /** for real functions */
+ unsigned long max_length; /** For string functions */
+ char *ptr; /** free pointer for function data */
+ bool const_item; /** 1 if function always returns the same value */
+ void *extension;
+} UDF_INIT;
+
+enum Item_udftype { UDFTYPE_FUNCTION = 1, UDFTYPE_AGGREGATE };
+
+typedef void (*Udf_func_clear)(UDF_INIT *, unsigned char *, unsigned char *);
+typedef void (*Udf_func_add)(UDF_INIT *, UDF_ARGS *, unsigned char *,
+ unsigned char *);
+typedef void (*Udf_func_deinit)(UDF_INIT *);
+typedef bool (*Udf_func_init)(UDF_INIT *, UDF_ARGS *, char *);
+typedef void (*Udf_func_any)(void);
+typedef double (*Udf_func_double)(UDF_INIT *, UDF_ARGS *, unsigned char *,
+ unsigned char *);
+typedef long long (*Udf_func_longlong)(UDF_INIT *, UDF_ARGS *, unsigned char *,
+ unsigned char *);
+typedef char *(*Udf_func_string)(UDF_INIT *, UDF_ARGS *, char *,
+ unsigned long *, unsigned char *,
+ unsigned char *);
+
+#endif /* UDF_REGISTRATION_TYPES_H */
diff --git a/contrib/libs/libmysql_r/include/mysql_async.h b/contrib/libs/libmysql_r/include/mysql_async.h
new file mode 100644
index 0000000000..0f8368e722
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql_async.h
@@ -0,0 +1,199 @@
+/* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef MYSQL_ASYNC_INCLUDED
+#define MYSQL_ASYNC_INCLUDED
+
+#define MYSQL_ASYNC_INCLUDED
+
+#include <mysql.h>
+
+/*
+ NOTE:this file should not be included as part of packaging.
+*/
+/* Async MySQL extension fields here. */
+
+/*
+ This enum is to represent different asynchronous operations like reading the
+ network, writing to network, idle state, or complete state.
+*/
+enum net_async_operation {
+ NET_ASYNC_OP_IDLE = 0, /* default state */
+ NET_ASYNC_OP_READING, /* used by my_net_read calls */
+ NET_ASYNC_OP_WRITING, /* used by my_net_write calls */
+ NET_ASYNC_OP_COMPLETE /* network read or write is complete */
+};
+
+/* Reading a packet is a multi-step process, so we have a state machine. */
+enum net_async_read_packet_state {
+ NET_ASYNC_PACKET_READ_IDLE = 0, /* default packet read state */
+ NET_ASYNC_PACKET_READ_HEADER, /* read packet header */
+ NET_ASYNC_PACKET_READ_BODY, /* read packet contents */
+ NET_ASYNC_PACKET_READ_COMPLETE /* state to define if packet is
+ completely read */
+};
+
+/* Different states when reading a query result. */
+enum net_read_query_result_status {
+ NET_ASYNC_READ_QUERY_RESULT_IDLE = 0, /* default state */
+ NET_ASYNC_READ_QUERY_RESULT_FIELD_COUNT, /* read Ok or read field
+ count sent as part of
+ COM_QUERY */
+ NET_ASYNC_READ_QUERY_RESULT_FIELD_INFO /* read result of above
+ COM_* command */
+};
+
+/* Sending a command involves the write as well as reading the status. */
+enum net_send_command_status {
+ NET_ASYNC_SEND_COMMAND_IDLE = 0, /* default send command state */
+ NET_ASYNC_SEND_COMMAND_WRITE_COMMAND, /* send COM_* command */
+ NET_ASYNC_SEND_COMMAND_READ_STATUS /* read result of above COM_*
+ command */
+};
+
+/*
+ Async operations are broadly classified into 3 phases:
+ Connection phase, phase of sending data to server (which is writing phase)
+ and reading data from server (which is reading phase). Below enum describes
+ the same
+*/
+enum net_async_block_state {
+ NET_NONBLOCKING_CONNECT = 0,
+ NET_NONBLOCKING_READ,
+ NET_NONBLOCKING_WRITE
+};
+
+struct io_vec {
+ void *iov_base; /* Starting address */
+ size_t iov_len; /* Number of bytes to transfer */
+};
+
+typedef struct NET_ASYNC {
+ /* The position in buff we continue reads from when data is next available */
+ unsigned char *cur_pos;
+ /** Blocking state */
+ enum net_async_block_state async_blocking_state;
+ /** Our current operation */
+ enum net_async_operation async_operation;
+ /** How many bytes we want to read */
+ size_t async_bytes_wanted;
+ /*
+ Simple state to know if we're reading the first row, and
+ command/query statuses.
+ */
+ bool read_rows_is_first_read;
+ enum net_send_command_status async_send_command_status;
+ enum net_read_query_result_status async_read_query_result_status;
+
+ /* State when waiting on an async read */
+ enum net_async_read_packet_state async_packet_read_state;
+ /* Size of the packet we're currently reading */
+ size_t async_packet_length;
+
+ /*
+ Headers and vector for our async writes; see net_serv.c for
+ detailed description.
+ */
+ unsigned char *async_write_headers;
+ struct io_vec *async_write_vector;
+ size_t async_write_vector_size;
+ size_t async_write_vector_current;
+ unsigned char
+ inline_async_write_header[NET_HEADER_SIZE + COMP_HEADER_SIZE + 1 + 1];
+ struct io_vec inline_async_write_vector[3];
+
+ /* State for reading responses that are larger than MAX_PACKET_LENGTH */
+ unsigned long async_multipacket_read_saved_whereb;
+ unsigned long async_multipacket_read_total_len;
+ bool async_multipacket_read_started;
+} NET_ASYNC;
+
+struct NET_EXTENSION {
+ NET_ASYNC *net_async_context;
+};
+
+NET_EXTENSION *net_extension_init();
+void net_extension_free(NET *);
+
+#define NET_EXTENSION_PTR(N) \
+ ((NET_EXTENSION *)((N)->extension ? (N)->extension : NULL))
+
+#define NET_ASYNC_DATA(M) \
+ ((NET_EXTENSION_PTR(M)) ? (NET_EXTENSION_PTR(M)->net_async_context) : NULL)
+
+/*
+ Asynchronous operations are broadly classified into 2 categories.
+ 1. Connection
+ 2. Query execution
+ This classification is defined in below enum
+*/
+enum mysql_async_operation_status {
+ ASYNC_OP_UNSET = 0,
+ ASYNC_OP_CONNECT,
+ ASYNC_OP_QUERY
+};
+
+/*
+ Query execution in an asynchronous fashion is broadly divided into 3 states
+ which is described in below enum
+*/
+enum mysql_async_query_state_enum {
+ QUERY_IDLE = 0,
+ QUERY_SENDING,
+ QUERY_READING_RESULT
+};
+
+typedef struct MYSQL_ASYNC {
+ /* Buffer storing the rows result for cli_read_rows_nonblocking */
+ MYSQL_DATA *rows_result_buffer;
+ /* a pointer to keep track of the previous row of the current result row */
+ MYSQL_ROWS **prev_row_ptr;
+ /* Context needed to track the state of a connection being established */
+ struct mysql_async_connect *connect_context;
+ /* Status of the current async op */
+ enum mysql_async_operation_status async_op_status;
+ /* Size of the current running async query */
+ size_t async_query_length;
+ /* If a query is running, this is its state */
+ enum mysql_async_query_state_enum async_query_state;
+ /* context needed to support metadata read operation */
+ unsigned long *async_read_metadata_field_len;
+ MYSQL_FIELD *async_read_metadata_fields;
+ MYSQL_ROWS async_read_metadata_data;
+ unsigned int async_read_metadata_cur_field;
+ /* a pointer to keep track of the result sets */
+ struct MYSQL_RES *async_store_result_result;
+} MYSQL_ASYNC;
+
+enum net_async_status my_net_write_nonblocking(NET *net,
+ const unsigned char *packet,
+ size_t len, bool *res);
+enum net_async_status net_write_command_nonblocking(
+ NET *net, unsigned char command, const unsigned char *prefix,
+ size_t prefix_len, const unsigned char *packet, size_t packet_len,
+ bool *res);
+enum net_async_status my_net_read_nonblocking(NET *net, unsigned long *len_ptr,
+ unsigned long *complen_ptr);
+
+int mysql_get_socket_descriptor(MYSQL *mysql);
+
+#endif /* MYSQL_ASYNC_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/mysql_com.h b/contrib/libs/libmysql_r/include/mysql_com.h
new file mode 100644
index 0000000000..38a3b58747
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql_com.h
@@ -0,0 +1,1089 @@
+/* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ Without limiting anything contained in the foregoing, this file,
+ which is part of C Driver for MySQL (Connector/C), is also subject to the
+ Universal FOSS Exception, version 1.0, a copy of which can be found at
+ http://oss.oracle.com/licenses/universal-foss-exception.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/mysql_com.h
+ Common definition between mysql server & client.
+*/
+
+#ifndef _mysql_com_h
+#define _mysql_com_h
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdbool.h>
+#endif
+
+#include "my_command.h"
+
+/*
+ We need a definition for my_socket. On the client, <mysql.h> already provides
+ it, but on the server side, we need to get it from a header.
+*/
+#ifndef my_socket_defined
+#include "my_io.h"
+#endif
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdbool.h>
+#endif
+
+#define SYSTEM_CHARSET_MBMAXLEN 3
+#define FILENAME_CHARSET_MBMAXLEN 5
+#define NAME_CHAR_LEN 64 /**< Field/table name length */
+#define PARTITION_EXPR_CHAR_LEN \
+ 2048 /**< Maximum expression length in chars \
+ */
+#define USERNAME_CHAR_LENGTH 32
+#define USERNAME_CHAR_LENGTH_STR "32"
+#ifndef NAME_LEN
+#define NAME_LEN (NAME_CHAR_LEN * SYSTEM_CHARSET_MBMAXLEN)
+#endif
+#define USERNAME_LENGTH (USERNAME_CHAR_LENGTH * SYSTEM_CHARSET_MBMAXLEN)
+#define CONNECT_STRING_MAXLEN 1024
+
+#define MYSQL_AUTODETECT_CHARSET_NAME "auto"
+
+#define SERVER_VERSION_LENGTH 60
+#define SQLSTATE_LENGTH 5
+
+/**
+ Maximum length of comments
+
+ pre 5.6: 60 characters
+*/
+#define TABLE_COMMENT_INLINE_MAXLEN 180
+#define TABLE_COMMENT_MAXLEN 2048
+#define COLUMN_COMMENT_MAXLEN 1024
+#define INDEX_COMMENT_MAXLEN 1024
+#define TABLE_PARTITION_COMMENT_MAXLEN 1024
+#define TABLESPACE_COMMENT_MAXLEN 2048
+
+/**
+ Maximum length of protocol packet.
+ @ref page_protocol_basic_ok_packet length limit also restricted to this value
+ as any length greater than this value will have first byte of
+ @ref page_protocol_basic_ok_packet to be 254 thus does not
+ provide a means to identify if this is @ref page_protocol_basic_ok_packet or
+ @ref page_protocol_basic_eof_packet.
+*/
+#define MAX_PACKET_LENGTH (256L * 256L * 256L - 1)
+
+#define LOCAL_HOST "localhost"
+#define LOCAL_HOST_NAMEDPIPE "."
+
+#if defined(_WIN32)
+#define MYSQL_NAMEDPIPE "MySQL"
+#define MYSQL_SERVICENAME "MySQL"
+#endif /* _WIN32 */
+
+/** The length of the header part for each generated column in the .frm file.*/
+#define FRM_GCOL_HEADER_SIZE 4
+/**
+ Maximum length of the expression statement defined for generated columns.
+*/
+#define GENERATED_COLUMN_EXPRESSION_MAXLEN 65535 - FRM_GCOL_HEADER_SIZE
+/**
+ Length of random string sent by server on handshake; this is also length of
+ obfuscated password, received from client
+*/
+#define SCRAMBLE_LENGTH 20
+#define AUTH_PLUGIN_DATA_PART_1_LENGTH 8
+/** length of password stored in the db: new passwords are preceeded with '*'*/
+#define SCRAMBLED_PASSWORD_CHAR_LENGTH (SCRAMBLE_LENGTH * 2 + 1)
+
+/**
+ @defgroup group_cs_column_definition_flags Column Definition Flags
+ @ingroup group_cs
+
+ @brief Values for the flags bitmask used by ::Send_field:flags
+
+ Currently need to fit into 32 bits.
+
+ Each bit represents an optional feature of the protocol.
+
+ Both the client and the server are sending these.
+
+ The intersection of the two determines what optional parts of the
+ protocol will be used.
+*/
+
+/**
+ @addtogroup group_cs_column_definition_flags
+ @{
+*/
+
+#define NOT_NULL_FLAG 1 /**< Field can't be NULL */
+#define PRI_KEY_FLAG 2 /**< Field is part of a primary key */
+#define UNIQUE_KEY_FLAG 4 /**< Field is part of a unique key */
+#define MULTIPLE_KEY_FLAG 8 /**< Field is part of a key */
+#define BLOB_FLAG 16 /**< Field is a blob */
+#define UNSIGNED_FLAG 32 /**< Field is unsigned */
+#define ZEROFILL_FLAG 64 /**< Field is zerofill */
+#define BINARY_FLAG 128 /**< Field is binary */
+
+/* The following are only sent to new clients */
+#define ENUM_FLAG 256 /**< field is an enum */
+#define AUTO_INCREMENT_FLAG 512 /**< field is a autoincrement field */
+#define TIMESTAMP_FLAG 1024 /**< Field is a timestamp */
+#define SET_FLAG 2048 /**< field is a set */
+#define NO_DEFAULT_VALUE_FLAG 4096 /**< Field doesn't have default value */
+#define ON_UPDATE_NOW_FLAG 8192 /**< Field is set to NOW on UPDATE */
+#define NUM_FLAG 32768 /**< Field is num (for clients) */
+#define PART_KEY_FLAG 16384 /**< Intern; Part of some key */
+#define GROUP_FLAG 32768 /**< Intern: Group field */
+#define UNIQUE_FLAG 65536 /**< Intern: Used by sql_yacc */
+#define BINCMP_FLAG 131072 /**< Intern: Used by sql_yacc */
+#define GET_FIXED_FIELDS_FLAG \
+ (1 << 18) /**< Used to get fields in item tree \
+ */
+#define FIELD_IN_PART_FUNC_FLAG (1 << 19) /**< Field part of partition func */
+/**
+ Intern: Field in TABLE object for new version of altered table,
+ which participates in a newly added index.
+*/
+#define FIELD_IN_ADD_INDEX (1 << 20)
+#define FIELD_IS_RENAMED (1 << 21) /**< Intern: Field is being renamed */
+#define FIELD_FLAGS_STORAGE_MEDIA 22 /**< Field storage media, bit 22-23 */
+#define FIELD_FLAGS_STORAGE_MEDIA_MASK (3 << FIELD_FLAGS_STORAGE_MEDIA)
+#define FIELD_FLAGS_COLUMN_FORMAT 24 /**< Field column format, bit 24-25 */
+#define FIELD_FLAGS_COLUMN_FORMAT_MASK (3 << FIELD_FLAGS_COLUMN_FORMAT)
+#define FIELD_IS_DROPPED (1 << 26) /**< Intern: Field is being dropped */
+#define EXPLICIT_NULL_FLAG \
+ (1 << 27) /**< Field is explicitly specified as \
+ NULL by the user */
+#define FIELD_IS_MARKED \
+ (1 << 28) /**< Intern: field is marked, \
+ general purpose */
+
+/** Field will not be loaded in secondary engine. */
+#define NOT_SECONDARY_FLAG (1 << 29)
+
+/** @}*/
+
+/**
+ @defgroup group_cs_com_refresh_flags COM_REFRESH Flags
+ @ingroup group_cs
+
+ @brief Values for the `sub_command` in ::COM_REFRESH
+
+ Currently the protocol carries only 8 bits of these flags.
+
+ The rest (8-end) are used only internally in the server.
+*/
+
+/**
+ @addtogroup group_cs_com_refresh_flags
+ @{
+*/
+
+#define REFRESH_GRANT 1 /**< Refresh grant tables, FLUSH PRIVILEGES */
+#define REFRESH_LOG 2 /**< Start on new log file, FLUSH LOGS */
+#define REFRESH_TABLES 4 /**< close all tables, FLUSH TABLES */
+#define REFRESH_HOSTS 8 /**< Flush host cache, FLUSH HOSTS */
+#define REFRESH_STATUS 16 /**< Flush status variables, FLUSH STATUS */
+#define REFRESH_THREADS 32 /**< Flush thread cache */
+#define REFRESH_SLAVE \
+ 64 /**< Reset master info and restart slave \
+ thread, RESET SLAVE */
+#define REFRESH_MASTER \
+ 128 /**< Remove all bin logs in the index \
+ and truncate the index, RESET MASTER */
+#define REFRESH_ERROR_LOG 256 /**< Rotate only the erorr log */
+#define REFRESH_ENGINE_LOG 512 /**< Flush all storage engine logs */
+#define REFRESH_BINARY_LOG 1024 /**< Flush the binary log */
+#define REFRESH_RELAY_LOG 2048 /**< Flush the relay log */
+#define REFRESH_GENERAL_LOG 4096 /**< Flush the general log */
+#define REFRESH_SLOW_LOG 8192 /**< Flush the slow query log */
+#define REFRESH_READ_LOCK 16384 /**< Lock tables for read. */
+/**
+ Wait for an impending flush before closing the tables.
+
+ @sa REFRESH_READ_LOCK, handle_reload_request, close_cached_tables
+*/
+#define REFRESH_FAST 32768
+#define REFRESH_USER_RESOURCES 0x80000L /** FLISH RESOUCES. @sa ::reset_mqh */
+#define REFRESH_FOR_EXPORT 0x100000L /** FLUSH TABLES ... FOR EXPORT */
+#define REFRESH_OPTIMIZER_COSTS 0x200000L /** FLUSH OPTIMIZER_COSTS */
+#define REFRESH_PERSIST 0x400000L /** RESET PERSIST */
+
+/** @}*/
+
+/**
+ @defgroup group_cs_capabilities_flags Capabilities Flags
+ @ingroup group_cs
+
+ @brief Values for the capabilities flag bitmask used by the MySQL protocol
+
+ Currently need to fit into 32 bits.
+
+ Each bit represents an optional feature of the protocol.
+
+ Both the client and the server are sending these.
+
+ The intersection of the two determines whast optional parts of the
+ protocol will be used.
+*/
+
+/**
+ @addtogroup group_cs_capabilities_flags
+ @{
+*/
+
+/**
+ Use the improved version of Old Password Authentication.
+
+ Not used.
+
+ @note Assumed to be set since 4.1.1.
+*/
+#define CLIENT_LONG_PASSWORD 1
+/**
+ Send found rows instead of affected rows in @ref
+ page_protocol_basic_eof_packet
+*/
+#define CLIENT_FOUND_ROWS 2
+/**
+ @brief Get all column flags
+
+ Longer flags in Protocol::ColumnDefinition320.
+
+ @todo Reference Protocol::ColumnDefinition320
+
+ Server
+ ------
+
+ Supports longer flags.
+
+ Client
+ ------
+
+ Expects longer flags.
+*/
+#define CLIENT_LONG_FLAG 4
+/**
+ Database (schema) name can be specified on connect in Handshake Response
+ Packet.
+
+ @todo Reference Handshake Response Packet.
+
+ Server
+ ------
+
+ Supports schema-name in Handshake Response Packet.
+
+ Client
+ ------
+
+ Handshake Response Packet contains a schema-name.
+
+ @sa send_client_reply_packet()
+*/
+#define CLIENT_CONNECT_WITH_DB 8
+#define CLIENT_NO_SCHEMA 16 /**< Don't allow database.table.column */
+/**
+ Compression protocol supported.
+
+ @todo Reference Compression
+
+ Server
+ ------
+
+ Supports compression.
+
+ Client
+ ------
+
+ Switches to Compression compressed protocol after successful authentication.
+*/
+#define CLIENT_COMPRESS 32
+/**
+ Special handling of ODBC behavior.
+
+ @note No special behavior since 3.22.
+*/
+#define CLIENT_ODBC 64
+/**
+ Can use LOAD DATA LOCAL.
+
+ Server
+ ------
+
+ Enables the LOCAL INFILE request of LOAD DATA|XML.
+
+ Client
+ ------
+
+ Will handle LOCAL INFILE request.
+*/
+#define CLIENT_LOCAL_FILES 128
+/**
+ Ignore spaces before '('
+
+ Server
+ ------
+
+ Parser can ignore spaces before '('.
+
+ Client
+ ------
+
+ Let the parser ignore spaces before '('.
+*/
+#define CLIENT_IGNORE_SPACE 256
+/**
+ New 4.1 protocol
+
+ @todo Reference the new 4.1 protocol
+
+ Server
+ ------
+
+ Supports the 4.1 protocol.
+
+ Client
+ ------
+
+ Uses the 4.1 protocol.
+
+ @note this value was CLIENT_CHANGE_USER in 3.22, unused in 4.0
+*/
+#define CLIENT_PROTOCOL_41 512
+/**
+ This is an interactive client
+
+ Use @ref System_variables::net_wait_timeout
+ versus @ref System_variables::net_interactive_timeout.
+
+ Server
+ ------
+
+ Supports interactive and noninteractive clients.
+
+ Client
+ ------
+
+ Client is interactive.
+
+ @sa mysql_real_connect()
+*/
+#define CLIENT_INTERACTIVE 1024
+/**
+ Use SSL encryption for the session
+
+ @todo Reference SSL
+
+ Server
+ ------
+
+ Supports SSL
+
+ Client
+ ------
+
+ Switch to SSL after sending the capability-flags.
+*/
+#define CLIENT_SSL 2048
+/**
+ Client only flag. Not used.
+
+ Client
+ ------
+
+ Do not issue SIGPIPE if network failures occur (libmysqlclient only).
+
+ @sa mysql_real_connect()
+*/
+#define CLIENT_IGNORE_SIGPIPE 4096
+/**
+ Client knows about transactions
+
+ Server
+ ------
+
+ Can send status flags in @ref page_protocol_basic_ok_packet /
+ @ref page_protocol_basic_eof_packet.
+
+ Client
+ ------
+
+ Expects status flags in @ref page_protocol_basic_ok_packet /
+ @ref page_protocol_basic_eof_packet.
+
+ @note This flag is optional in 3.23, but always set by the server since 4.0.
+ @sa send_server_handshake_packet(), parse_client_handshake_packet(),
+ net_send_ok(), net_send_eof()
+*/
+#define CLIENT_TRANSACTIONS 8192
+#define CLIENT_RESERVED 16384 /**< DEPRECATED: Old flag for 4.1 protocol */
+#define CLIENT_RESERVED2 \
+ 32768 /**< DEPRECATED: Old flag for 4.1 authentication \
+ CLIENT_SECURE_CONNECTION */
+/**
+ Enable/disable multi-stmt support
+
+ Also sets @ref CLIENT_MULTI_RESULTS. Currently not checked anywhere.
+
+ Server
+ ------
+
+ Can handle multiple statements per COM_QUERY and COM_STMT_PREPARE.
+
+ Client
+ -------
+
+ May send multiple statements per COM_QUERY and COM_STMT_PREPARE.
+
+ @note Was named ::CLIENT_MULTI_QUERIES in 4.1.0, renamed later.
+
+ Requires
+ --------
+
+ ::CLIENT_PROTOCOL_41
+
+ @todo Reference COM_QUERY and COM_STMT_PREPARE
+*/
+#define CLIENT_MULTI_STATEMENTS (1UL << 16)
+/**
+ Enable/disable multi-results
+
+ Server
+ ------
+
+ Can send multiple resultsets for COM_QUERY.
+ Error if the server needs to send them and client
+ does not support them.
+
+ Client
+ -------
+
+ Can handle multiple resultsets for COM_QUERY.
+
+ Requires
+ --------
+
+ ::CLIENT_PROTOCOL_41
+
+ @sa mysql_execute_command(), sp_head::MULTI_RESULTS
+*/
+#define CLIENT_MULTI_RESULTS (1UL << 17)
+/**
+ Multi-results and OUT parameters in PS-protocol.
+
+ Server
+ ------
+
+ Can send multiple resultsets for COM_STMT_EXECUTE.
+
+ Client
+ ------
+
+ Can handle multiple resultsets for COM_STMT_EXECUTE.
+
+ Requires
+ --------
+
+ ::CLIENT_PROTOCOL_41
+
+ @todo Reference COM_STMT_EXECUTE and PS-protocol
+
+ @sa Protocol_binary::send_out_parameters
+*/
+#define CLIENT_PS_MULTI_RESULTS (1UL << 18)
+
+/**
+ Client supports plugin authentication
+
+ Server
+ ------
+
+ Sends extra data in Initial Handshake Packet and supports the pluggable
+ authentication protocol.
+
+ Client
+ ------
+
+ Supports authentication plugins.
+
+ Requires
+ --------
+
+ ::CLIENT_PROTOCOL_41
+
+ @todo Reference plugin authentication, Initial Handshake Packet,
+ Authentication plugins
+
+ @sa send_change_user_packet(), send_client_reply_packet(), run_plugin_auth(),
+ parse_com_change_user_packet(), parse_client_handshake_packet()
+*/
+#define CLIENT_PLUGIN_AUTH (1UL << 19)
+/**
+ Client supports connection attributes
+
+ Server
+ ------
+
+ Permits connection attributes in Protocol::HandshakeResponse41.
+
+ Client
+ ------
+
+ Sends connection attributes in Protocol::HandshakeResponse41.
+
+ @todo Reference Protocol::HandshakeResponse41
+
+ @sa send_client_connect_attrs(), read_client_connect_attrs()
+*/
+#define CLIENT_CONNECT_ATTRS (1UL << 20)
+
+/**
+ Enable authentication response packet to be larger than 255 bytes.
+
+ When the ability to change default plugin require that the initial password
+ field in the Protocol::HandshakeResponse41 paclet can be of arbitrary size.
+ However, the 4.1 client-server protocol limits the length of the
+ auth-data-field sent from client to server to 255 bytes.
+ The solution is to change the type of the field to a true length encoded
+ string and indicate the protocol change
+ with this client capability flag.
+
+ Server
+ ------
+
+ Understands length-encoded integer for auth response data in
+ Protocol::HandshakeResponse41.
+
+ Client
+ ------
+
+ Length of auth response data in Protocol::HandshakeResponse41
+ is a length-encoded integer.
+
+ @todo Reference Protocol::HandshakeResponse41
+
+ @note The flag was introduced in 5.6.6, but had the wrong value.
+
+ @sa send_client_reply_packet(), parse_client_handshake_packet(),
+ get_56_lenc_string(), get_41_lenc_string()
+*/
+#define CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA (1UL << 21)
+
+/**
+ Don't close the connection for a user account with expired password.
+
+ Server
+ ------
+
+ Announces support for expired password extension.
+
+ Client
+ ------
+
+ Can handle expired passwords.
+
+ @todo Reference expired password
+
+ @sa MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, disconnect_on_expired_password
+ ACL_USER::password_expired, check_password_lifetime(), acl_authenticate()
+*/
+#define CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS (1UL << 22)
+
+/**
+ Capable of handling server state change information. Its a hint to the
+ server to include the state change information in
+ @ref page_protocol_basic_ok_packet.
+
+ Server
+ ------
+ Can set ::SERVER_SESSION_STATE_CHANGED in the ::SERVER_STATUS_flags_enum
+ and send @ref sect_protocol_basic_ok_packet_sessinfo in a
+ @ref page_protocol_basic_ok_packet.
+
+ Client
+ ------
+
+ Expects the server to send @ref sect_protocol_basic_ok_packet_sessinfo in
+ a @ref page_protocol_basic_ok_packet.
+
+ @sa enum_session_state_type, read_ok_ex(), net_send_ok(), Session_tracker,
+ State_tracker
+*/
+#define CLIENT_SESSION_TRACK (1UL << 23)
+/**
+ Client no longer needs @ref page_protocol_basic_eof_packet and will
+ use @ref page_protocol_basic_ok_packet instead.
+ @sa net_send_ok()
+
+ Server
+ ------
+
+ Can send OK after a Text Resultset.
+
+ Client
+ ------
+
+ Expects an @ref page_protocol_basic_ok_packet (instead of
+ @ref page_protocol_basic_eof_packet) after the resultset rows of a
+ Text Resultset.
+
+ Background
+ ----------
+
+ To support ::CLIENT_SESSION_TRACK, additional information must be sent after
+ all successful commands. Although the @ref page_protocol_basic_ok_packet is
+ extensible, the @ref page_protocol_basic_eof_packet is not due to the overlap
+ of its bytes with the content of the Text Resultset Row.
+
+ Therefore, the @ref page_protocol_basic_eof_packet in the
+ Text Resultset is replaced with an @ref page_protocol_basic_ok_packet.
+ @ref page_protocol_basic_eof_packet is deprecated as of MySQL 5.7.5.
+
+ @todo Reference Text Resultset
+
+ @sa cli_safe_read_with_ok(), read_ok_ex(), net_send_ok(), net_send_eof()
+*/
+#define CLIENT_DEPRECATE_EOF (1UL << 24)
+
+/**
+ Verify server certificate.
+
+ Client only flag.
+
+ @deprecated in favor of --ssl-mode.
+*/
+#define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30)
+
+/**
+ The client can handle optional metadata information in the resultset.
+*/
+#define CLIENT_OPTIONAL_RESULTSET_METADATA (1UL << 25)
+
+/**
+ Don't reset the options after an unsuccessful connect
+
+ Client only flag.
+
+ Typically passed via ::mysql_real_connect() 's client_flag parameter.
+
+ @sa mysql_real_connect()
+*/
+#define CLIENT_REMEMBER_OPTIONS (1UL << 31)
+/** @}*/
+
+/** a compatibility alias for CLIENT_COMPRESS */
+#define CAN_CLIENT_COMPRESS CLIENT_COMPRESS
+
+/** Gather all possible capabilites (flags) supported by the server */
+#define CLIENT_ALL_FLAGS \
+ (CLIENT_LONG_PASSWORD | CLIENT_FOUND_ROWS | CLIENT_LONG_FLAG | \
+ CLIENT_CONNECT_WITH_DB | CLIENT_NO_SCHEMA | CLIENT_COMPRESS | CLIENT_ODBC | \
+ CLIENT_LOCAL_FILES | CLIENT_IGNORE_SPACE | CLIENT_PROTOCOL_41 | \
+ CLIENT_INTERACTIVE | CLIENT_SSL | CLIENT_IGNORE_SIGPIPE | \
+ CLIENT_TRANSACTIONS | CLIENT_RESERVED | CLIENT_RESERVED2 | \
+ CLIENT_MULTI_STATEMENTS | CLIENT_MULTI_RESULTS | CLIENT_PS_MULTI_RESULTS | \
+ CLIENT_SSL_VERIFY_SERVER_CERT | CLIENT_REMEMBER_OPTIONS | \
+ CLIENT_PLUGIN_AUTH | CLIENT_CONNECT_ATTRS | \
+ CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA | \
+ CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS | CLIENT_SESSION_TRACK | \
+ CLIENT_DEPRECATE_EOF | CLIENT_OPTIONAL_RESULTSET_METADATA)
+
+/**
+ Switch off from ::CLIENT_ALL_FLAGS the flags that are optional and
+ depending on build flags.
+ If any of the optional flags is supported by the build it will be switched
+ on before sending to the client during the connection handshake.
+*/
+#define CLIENT_BASIC_FLAGS \
+ (((CLIENT_ALL_FLAGS & ~CLIENT_SSL) & ~CLIENT_COMPRESS) & \
+ ~CLIENT_SSL_VERIFY_SERVER_CERT)
+
+/** The status flags are a bit-field */
+enum SERVER_STATUS_flags_enum {
+ /**
+ Is raised when a multi-statement transaction
+ has been started, either explicitly, by means
+ of BEGIN or COMMIT AND CHAIN, or
+ implicitly, by the first transactional
+ statement, when autocommit=off.
+ */
+ SERVER_STATUS_IN_TRANS = 1,
+ SERVER_STATUS_AUTOCOMMIT = 2, /**< Server in auto_commit mode */
+ SERVER_MORE_RESULTS_EXISTS = 8, /**< Multi query - next query exists */
+ SERVER_QUERY_NO_GOOD_INDEX_USED = 16,
+ SERVER_QUERY_NO_INDEX_USED = 32,
+ /**
+ The server was able to fulfill the clients request and opened a
+ read-only non-scrollable cursor for a query. This flag comes
+ in reply to COM_STMT_EXECUTE and COM_STMT_FETCH commands.
+ Used by Binary Protocol Resultset to signal that COM_STMT_FETCH
+ must be used to fetch the row-data.
+ @todo Refify "Binary Protocol Resultset" and "COM_STMT_FETCH".
+ */
+ SERVER_STATUS_CURSOR_EXISTS = 64,
+ /**
+ This flag is sent when a read-only cursor is exhausted, in reply to
+ COM_STMT_FETCH command.
+ */
+ SERVER_STATUS_LAST_ROW_SENT = 128,
+ SERVER_STATUS_DB_DROPPED = 256, /**< A database was dropped */
+ SERVER_STATUS_NO_BACKSLASH_ESCAPES = 512,
+ /**
+ Sent to the client if after a prepared statement reprepare
+ we discovered that the new statement returns a different
+ number of result set columns.
+ */
+ SERVER_STATUS_METADATA_CHANGED = 1024,
+ SERVER_QUERY_WAS_SLOW = 2048,
+ /**
+ To mark ResultSet containing output parameter values.
+ */
+ SERVER_PS_OUT_PARAMS = 4096,
+
+ /**
+ Set at the same time as SERVER_STATUS_IN_TRANS if the started
+ multi-statement transaction is a read-only transaction. Cleared
+ when the transaction commits or aborts. Since this flag is sent
+ to clients in OK and EOF packets, the flag indicates the
+ transaction status at the end of command execution.
+ */
+ SERVER_STATUS_IN_TRANS_READONLY = 8192,
+
+ /**
+ This status flag, when on, implies that one of the state information has
+ changed on the server because of the execution of the last statement.
+ */
+ SERVER_SESSION_STATE_CHANGED = (1UL << 14)
+};
+
+/**
+ Server status flags that must be cleared when starting
+ execution of a new SQL statement.
+ Flags from this set are only added to the
+ current server status by the execution engine, but
+ never removed -- the execution engine expects them
+ to disappear automagically by the next command.
+*/
+#define SERVER_STATUS_CLEAR_SET \
+ (SERVER_QUERY_NO_GOOD_INDEX_USED | SERVER_QUERY_NO_INDEX_USED | \
+ SERVER_MORE_RESULTS_EXISTS | SERVER_STATUS_METADATA_CHANGED | \
+ SERVER_QUERY_WAS_SLOW | SERVER_STATUS_DB_DROPPED | \
+ SERVER_STATUS_CURSOR_EXISTS | SERVER_STATUS_LAST_ROW_SENT | \
+ SERVER_SESSION_STATE_CHANGED)
+
+/** Max length of a error message. Should be kept in sync with ::ERRMSGSIZE. */
+#define MYSQL_ERRMSG_SIZE 512
+#define NET_READ_TIMEOUT 30 /**< Timeout on read */
+#define NET_WRITE_TIMEOUT 60 /**< Timeout on write */
+#define NET_WAIT_TIMEOUT 8 * 60 * 60 /**< Wait for new query */
+
+/**
+ Flag used by the parser. Kill only the query and not the connection.
+
+ @sa SQLCOM_KILL, sql_kill(), LEX::type
+*/
+#define ONLY_KILL_QUERY 1
+
+#ifndef MYSQL_VIO
+struct Vio;
+#define MYSQL_VIO struct Vio *
+#endif
+
+#define MAX_TINYINT_WIDTH 3 /**< Max width for a TINY w.o. sign */
+#define MAX_SMALLINT_WIDTH 5 /**< Max width for a SHORT w.o. sign */
+#define MAX_MEDIUMINT_WIDTH 8 /**< Max width for a INT24 w.o. sign */
+#define MAX_INT_WIDTH 10 /**< Max width for a LONG w.o. sign */
+#define MAX_BIGINT_WIDTH 20 /**< Max width for a LONGLONG */
+#define MAX_CHAR_WIDTH 255 /**< Max length for a CHAR colum */
+#define MAX_BLOB_WIDTH 16777216 /**< Default width for blob */
+
+typedef struct NET {
+ MYSQL_VIO vio;
+ unsigned char *buff, *buff_end, *write_pos, *read_pos;
+ my_socket fd; /* For Perl DBI/dbd */
+ /**
+ Set if we are doing several queries in one
+ command ( as in LOAD TABLE ... FROM MASTER ),
+ and do not want to confuse the client with OK at the wrong time
+ */
+ unsigned long remain_in_buf, length, buf_length, where_b;
+ unsigned long max_packet, max_packet_size;
+ unsigned int pkt_nr, compress_pkt_nr;
+ unsigned int write_timeout, read_timeout, retry_count;
+ int fcntl;
+ unsigned int *return_status;
+ unsigned char reading_or_writing;
+ unsigned char save_char;
+ bool compress;
+ unsigned int last_errno;
+ unsigned char error;
+ /** Client library error message buffer. Actually belongs to struct MYSQL. */
+ char last_error[MYSQL_ERRMSG_SIZE];
+ /** Client library sqlstate buffer. Set along with the error message. */
+ char sqlstate[SQLSTATE_LENGTH + 1];
+ /**
+ Extension pointer, for the caller private use.
+ Any program linking with the networking library can use this pointer,
+ which is handy when private connection specific data needs to be
+ maintained.
+ The mysqld server process uses this pointer internally,
+ to maintain the server internal instrumentation for the connection.
+ */
+ void *extension;
+} NET;
+
+#define packet_error (~(unsigned long)0)
+
+/**
+ @addtogroup group_cs_backward_compatibility Backward compatibility
+ @ingroup group_cs
+ @{
+*/
+#define CLIENT_MULTI_QUERIES CLIENT_MULTI_STATEMENTS
+#define FIELD_TYPE_DECIMAL MYSQL_TYPE_DECIMAL
+#define FIELD_TYPE_NEWDECIMAL MYSQL_TYPE_NEWDECIMAL
+#define FIELD_TYPE_TINY MYSQL_TYPE_TINY
+#define FIELD_TYPE_SHORT MYSQL_TYPE_SHORT
+#define FIELD_TYPE_LONG MYSQL_TYPE_LONG
+#define FIELD_TYPE_FLOAT MYSQL_TYPE_FLOAT
+#define FIELD_TYPE_DOUBLE MYSQL_TYPE_DOUBLE
+#define FIELD_TYPE_NULL MYSQL_TYPE_NULL
+#define FIELD_TYPE_TIMESTAMP MYSQL_TYPE_TIMESTAMP
+#define FIELD_TYPE_LONGLONG MYSQL_TYPE_LONGLONG
+#define FIELD_TYPE_INT24 MYSQL_TYPE_INT24
+#define FIELD_TYPE_DATE MYSQL_TYPE_DATE
+#define FIELD_TYPE_TIME MYSQL_TYPE_TIME
+#define FIELD_TYPE_DATETIME MYSQL_TYPE_DATETIME
+#define FIELD_TYPE_YEAR MYSQL_TYPE_YEAR
+#define FIELD_TYPE_NEWDATE MYSQL_TYPE_NEWDATE
+#define FIELD_TYPE_ENUM MYSQL_TYPE_ENUM
+#define FIELD_TYPE_SET MYSQL_TYPE_SET
+#define FIELD_TYPE_TINY_BLOB MYSQL_TYPE_TINY_BLOB
+#define FIELD_TYPE_MEDIUM_BLOB MYSQL_TYPE_MEDIUM_BLOB
+#define FIELD_TYPE_LONG_BLOB MYSQL_TYPE_LONG_BLOB
+#define FIELD_TYPE_BLOB MYSQL_TYPE_BLOB
+#define FIELD_TYPE_VAR_STRING MYSQL_TYPE_VAR_STRING
+#define FIELD_TYPE_STRING MYSQL_TYPE_STRING
+#define FIELD_TYPE_CHAR MYSQL_TYPE_TINY
+#define FIELD_TYPE_INTERVAL MYSQL_TYPE_ENUM
+#define FIELD_TYPE_GEOMETRY MYSQL_TYPE_GEOMETRY
+#define FIELD_TYPE_BIT MYSQL_TYPE_BIT
+/** @}*/
+
+/**
+ @addtogroup group_cs_shutdown_kill_constants Shutdown/kill enums and constants
+ @ingroup group_cs
+
+ @sa THD::is_killable
+ @{
+*/
+#define MYSQL_SHUTDOWN_KILLABLE_CONNECT (unsigned char)(1 << 0)
+#define MYSQL_SHUTDOWN_KILLABLE_TRANS (unsigned char)(1 << 1)
+#define MYSQL_SHUTDOWN_KILLABLE_LOCK_TABLE (unsigned char)(1 << 2)
+#define MYSQL_SHUTDOWN_KILLABLE_UPDATE (unsigned char)(1 << 3)
+
+/**
+ We want levels to be in growing order of hardness (because we use number
+ comparisons).
+
+ @note ::SHUTDOWN_DEFAULT does not respect the growing property, but it's ok.
+*/
+enum mysql_enum_shutdown_level {
+ SHUTDOWN_DEFAULT = 0,
+ /** Wait for existing connections to finish */
+ SHUTDOWN_WAIT_CONNECTIONS = MYSQL_SHUTDOWN_KILLABLE_CONNECT,
+ /** Wait for existing transactons to finish */
+ SHUTDOWN_WAIT_TRANSACTIONS = MYSQL_SHUTDOWN_KILLABLE_TRANS,
+ /** Wait for existing updates to finish (=> no partial MyISAM update) */
+ SHUTDOWN_WAIT_UPDATES = MYSQL_SHUTDOWN_KILLABLE_UPDATE,
+ /** Flush InnoDB buffers and other storage engines' buffers*/
+ SHUTDOWN_WAIT_ALL_BUFFERS = (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1),
+ /** Don't flush InnoDB buffers, flush other storage engines' buffers*/
+ SHUTDOWN_WAIT_CRITICAL_BUFFERS = (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1) + 1,
+ /** Query level of the KILL command */
+ KILL_QUERY = 254,
+ /** Connection level of the KILL command */
+ KILL_CONNECTION = 255
+};
+/** @}*/
+
+enum enum_resultset_metadata {
+ /** No metadata will be sent. */
+ RESULTSET_METADATA_NONE = 0,
+ /** The server will send all metadata. */
+ RESULTSET_METADATA_FULL = 1
+};
+
+enum enum_cursor_type {
+ CURSOR_TYPE_NO_CURSOR = 0,
+ CURSOR_TYPE_READ_ONLY = 1,
+ CURSOR_TYPE_FOR_UPDATE = 2,
+ CURSOR_TYPE_SCROLLABLE = 4
+};
+
+/** options for ::mysql_options() */
+enum enum_mysql_set_option {
+ MYSQL_OPTION_MULTI_STATEMENTS_ON,
+ MYSQL_OPTION_MULTI_STATEMENTS_OFF
+};
+
+/**
+ Type of state change information that the server can include in the Ok
+ packet.
+
+ @note
+ - session_state_type shouldn't go past 255 (i.e. 1-byte boundary).
+ - Modify the definition of ::SESSION_TRACK_END when a new member is added.
+*/
+enum enum_session_state_type {
+ SESSION_TRACK_SYSTEM_VARIABLES, /**< Session system variables */
+ SESSION_TRACK_SCHEMA, /**< Current schema */
+ SESSION_TRACK_STATE_CHANGE, /**< track session state changes */
+ SESSION_TRACK_GTIDS, /**< See also: session_track_gtids */
+ SESSION_TRACK_TRANSACTION_CHARACTERISTICS, /**< Transaction chistics */
+ SESSION_TRACK_TRANSACTION_STATE /**< Transaction state */
+};
+
+/** start of ::enum_session_state_type */
+#define SESSION_TRACK_BEGIN SESSION_TRACK_SYSTEM_VARIABLES
+
+/** End of ::enum_session_state_type */
+#define SESSION_TRACK_END SESSION_TRACK_TRANSACTION_STATE
+
+/** is T a valid session state type */
+#define IS_SESSION_STATE_TYPE(T) \
+ (((int)(T) >= SESSION_TRACK_BEGIN) && ((T) <= SESSION_TRACK_END))
+
+#define net_new_transaction(net) ((net)->pkt_nr = 0)
+
+bool my_net_init(struct NET *net, MYSQL_VIO vio);
+void my_net_local_init(struct NET *net);
+void net_end(struct NET *net);
+void net_clear(struct NET *net, bool check_buffer);
+void net_claim_memory_ownership(struct NET *net);
+bool net_realloc(struct NET *net, size_t length);
+bool net_flush(struct NET *net);
+bool my_net_write(struct NET *net, const unsigned char *packet, size_t len);
+bool net_write_command(struct NET *net, unsigned char command,
+ const unsigned char *header, size_t head_len,
+ const unsigned char *packet, size_t len);
+bool net_write_packet(struct NET *net, const unsigned char *packet,
+ size_t length);
+unsigned long my_net_read(struct NET *net);
+void my_net_set_write_timeout(struct NET *net, unsigned int timeout);
+void my_net_set_read_timeout(struct NET *net, unsigned int timeout);
+void my_net_set_retry_count(struct NET *net, unsigned int retry_count);
+
+struct rand_struct {
+ unsigned long seed1, seed2, max_value;
+ double max_value_dbl;
+};
+
+/* Include the types here so existing UDFs can keep compiling */
+#include <mysql/udf_registration_types.h>
+
+/**
+ @addtogroup group_cs_compresson_constants Constants when using compression
+ @ingroup group_cs
+ @{
+*/
+#define NET_HEADER_SIZE 4 /**< standard header size */
+#define COMP_HEADER_SIZE 3 /**< compression header extra size */
+/** @}*/
+
+/* Prototypes to password functions */
+
+/*
+ These functions are used for authentication by client and server and
+ implemented in sql/password.c
+*/
+
+void randominit(struct rand_struct *, unsigned long seed1, unsigned long seed2);
+double my_rnd(struct rand_struct *);
+void create_random_string(char *to, unsigned int length,
+ struct rand_struct *rand_st);
+
+void hash_password(unsigned long *to, const char *password,
+ unsigned int password_len);
+void make_scrambled_password_323(char *to, const char *password);
+void scramble_323(char *to, const char *message, const char *password);
+bool check_scramble_323(const unsigned char *reply, const char *message,
+ unsigned long *salt);
+void get_salt_from_password_323(unsigned long *res, const char *password);
+void make_password_from_salt_323(char *to, const unsigned long *salt);
+
+void make_scrambled_password(char *to, const char *password);
+void scramble(char *to, const char *message, const char *password);
+bool check_scramble(const unsigned char *reply, const char *message,
+ const unsigned char *hash_stage2);
+void get_salt_from_password(unsigned char *res, const char *password);
+void make_password_from_salt(char *to, const unsigned char *hash_stage2);
+char *octet2hex(char *to, const char *str, unsigned int len);
+
+/* end of password.c */
+
+bool generate_sha256_scramble(unsigned char *dst, size_t dst_size,
+ const char *src, size_t src_size, const char *rnd,
+ size_t rnd_size);
+
+// extern "C" since it is an (undocumented) part of the libmysql ABI.
+#ifdef __cplusplus
+extern "C" {
+#endif
+char *get_tty_password(const char *opt_message);
+#ifdef __cplusplus
+}
+#endif
+
+const char *mysql_errno_to_sqlstate(unsigned int mysql_errno);
+
+/* Some other useful functions */
+
+// Need to be extern "C" for the time being, due to memcached.
+#ifdef __cplusplus
+extern "C" {
+#endif
+bool my_thread_init(void);
+void my_thread_end(void);
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef STDCALL
+unsigned long STDCALL net_field_length(unsigned char **packet);
+unsigned long STDCALL net_field_length_checked(unsigned char **packet,
+ unsigned long max_length);
+#endif
+unsigned long long net_field_length_ll(unsigned char **packet);
+unsigned char *net_store_length(unsigned char *pkg, unsigned long long length);
+unsigned int net_length_size(unsigned long long num);
+unsigned int net_field_length_size(const unsigned char *pos);
+
+#define NULL_LENGTH ((unsigned long)~0) /**< For ::net_store_length() */
+#define MYSQL_STMT_HEADER 4
+#define MYSQL_LONG_DATA_HEADER 6
+
+#define NOT_FIXED_DEC 31
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysql_time.h b/contrib/libs/libmysql_r/include/mysql_time.h
new file mode 100644
index 0000000000..fee0733ef1
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql_time.h
@@ -0,0 +1,71 @@
+/* Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ Without limiting anything contained in the foregoing, this file,
+ which is part of C Driver for MySQL (Connector/C), is also subject to the
+ Universal FOSS Exception, version 1.0, a copy of which can be found at
+ http://oss.oracle.com/licenses/universal-foss-exception.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef _mysql_time_h_
+#define _mysql_time_h_
+
+/**
+ @file include/mysql_time.h
+ Time declarations shared between the server and client API:
+ you should not add anything to this header unless it's used
+ (and hence should be visible) in mysql.h.
+ If you're looking for a place to add new time-related declaration,
+ it's most likely my_time.h. See also "C API Handling of Date
+ and Time Values" chapter in documentation.
+*/
+
+// Do not not pull in the server header "my_inttypes.h" from client code.
+// IWYU pragma: no_include "my_inttypes.h"
+
+enum enum_mysql_timestamp_type {
+ MYSQL_TIMESTAMP_NONE = -2,
+ MYSQL_TIMESTAMP_ERROR = -1,
+ MYSQL_TIMESTAMP_DATE = 0,
+ MYSQL_TIMESTAMP_DATETIME = 1,
+ MYSQL_TIMESTAMP_TIME = 2
+};
+
+/*
+ Structure which is used to represent datetime values inside MySQL.
+
+ We assume that values in this structure are normalized, i.e. year <= 9999,
+ month <= 12, day <= 31, hour <= 23, hour <= 59, hour <= 59. Many functions
+ in server such as my_system_gmt_sec() or make_time() family of functions
+ rely on this (actually now usage of make_*() family relies on a bit weaker
+ restriction). Also functions that produce MYSQL_TIME as result ensure this.
+ There is one exception to this rule though if this structure holds time
+ value (time_type == MYSQL_TIMESTAMP_TIME) days and hour member can hold
+ bigger values.
+*/
+typedef struct MYSQL_TIME {
+ unsigned int year, month, day, hour, minute, second;
+ unsigned long second_part; /**< microseconds */
+ bool neg;
+ enum enum_mysql_timestamp_type time_type;
+} MYSQL_TIME;
+
+#endif /* _mysql_time_h_ */
diff --git a/contrib/libs/libmysql_r/include/mysql_version.h b/contrib/libs/libmysql_r/include/mysql_version.h
new file mode 100644
index 0000000000..0b80ffb0a7
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysql_version.h
@@ -0,0 +1,32 @@
+/* Copyright Abandoned 1996,1999 TCX DataKonsult AB & Monty Program KB
+ & Detron HB, 1996, 1999-2004, 2007 MySQL AB.
+ This file is public domain and comes with NO WARRANTY of any kind
+*/
+
+/* Version numbers for protocol & mysqld */
+
+#ifndef _mysql_version_h
+#define _mysql_version_h
+
+#define PROTOCOL_VERSION 10
+#define MYSQL_SERVER_VERSION "8.0.17"
+#define MYSQL_BASE_VERSION "mysqld-8.0"
+#define MYSQL_SERVER_SUFFIX_DEF ""
+#define MYSQL_VERSION_ID 80017
+#define MYSQL_PORT 3306
+#define MYSQL_ADMIN_PORT 33062
+#define MYSQL_PORT_DEFAULT 0
+#define MYSQL_UNIX_ADDR "/run/mysqld/mysqld.sock"
+#define MYSQL_CONFIG_NAME "my"
+#define MYSQL_PERSIST_CONFIG_NAME "mysqld-auto"
+#define MYSQL_COMPILATION_COMMENT "Source distribution"
+#define MYSQL_COMPILATION_COMMENT_SERVER "Source distribution"
+#define LIBMYSQL_VERSION "8.0.17"
+#define LIBMYSQL_VERSION_ID 80017
+#define SYS_SCHEMA_VERSION "2.1.0"
+
+#ifndef LICENSE
+#define LICENSE GPL
+#endif /* LICENSE */
+
+#endif /* _mysql_version_h */
diff --git a/contrib/libs/libmysql_r/include/mysqld_error.h b/contrib/libs/libmysql_r/include/mysqld_error.h
new file mode 100644
index 0000000000..4f280687b3
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysqld_error.h
@@ -0,0 +1,5051 @@
+/* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+/* Autogenerated file, please don't edit */
+
+#ifndef MYSQLD_ERROR_INCLUDED
+#define MYSQLD_ERROR_INCLUDED
+
+static const int errmsg_section_start[] = { 1000, 3000, 3500, 10000 };
+static const int errmsg_section_size[] = { 888, 227, 417, 3485 };
+
+static const int total_error_count = 5017;
+
+//#define OBSOLETE_ER_HASHCHK 1000
+//#define OBSOLETE_ER_NISAMCHK 1001
+#define ER_NO 1002
+#define ER_YES 1003
+#define ER_CANT_CREATE_FILE 1004
+#define ER_CANT_CREATE_TABLE 1005
+#define ER_CANT_CREATE_DB 1006
+#define ER_DB_CREATE_EXISTS 1007
+#define ER_DB_DROP_EXISTS 1008
+//#define OBSOLETE_ER_DB_DROP_DELETE 1009
+#define ER_DB_DROP_RMDIR 1010
+//#define OBSOLETE_ER_CANT_DELETE_FILE 1011
+#define ER_CANT_FIND_SYSTEM_REC 1012
+#define ER_CANT_GET_STAT 1013
+//#define OBSOLETE_ER_CANT_GET_WD 1014
+#define ER_CANT_LOCK 1015
+#define ER_CANT_OPEN_FILE 1016
+#define ER_FILE_NOT_FOUND 1017
+#define ER_CANT_READ_DIR 1018
+//#define OBSOLETE_ER_CANT_SET_WD 1019
+#define ER_CHECKREAD 1020
+//#define OBSOLETE_ER_DISK_FULL 1021
+#define ER_DUP_KEY 1022
+//#define OBSOLETE_ER_ERROR_ON_CLOSE 1023
+#define ER_ERROR_ON_READ 1024
+#define ER_ERROR_ON_RENAME 1025
+#define ER_ERROR_ON_WRITE 1026
+#define ER_FILE_USED 1027
+#define ER_FILSORT_ABORT 1028
+//#define OBSOLETE_ER_FORM_NOT_FOUND 1029
+#define ER_GET_ERRNO 1030
+#define ER_ILLEGAL_HA 1031
+#define ER_KEY_NOT_FOUND 1032
+#define ER_NOT_FORM_FILE 1033
+#define ER_NOT_KEYFILE 1034
+#define ER_OLD_KEYFILE 1035
+#define ER_OPEN_AS_READONLY 1036
+#define ER_OUTOFMEMORY 1037
+#define ER_OUT_OF_SORTMEMORY 1038
+//#define OBSOLETE_ER_UNEXPECTED_EOF 1039
+#define ER_CON_COUNT_ERROR 1040
+#define ER_OUT_OF_RESOURCES 1041
+#define ER_BAD_HOST_ERROR 1042
+#define ER_HANDSHAKE_ERROR 1043
+#define ER_DBACCESS_DENIED_ERROR 1044
+#define ER_ACCESS_DENIED_ERROR 1045
+#define ER_NO_DB_ERROR 1046
+#define ER_UNKNOWN_COM_ERROR 1047
+#define ER_BAD_NULL_ERROR 1048
+#define ER_BAD_DB_ERROR 1049
+#define ER_TABLE_EXISTS_ERROR 1050
+#define ER_BAD_TABLE_ERROR 1051
+#define ER_NON_UNIQ_ERROR 1052
+#define ER_SERVER_SHUTDOWN 1053
+#define ER_BAD_FIELD_ERROR 1054
+#define ER_WRONG_FIELD_WITH_GROUP 1055
+#define ER_WRONG_GROUP_FIELD 1056
+#define ER_WRONG_SUM_SELECT 1057
+#define ER_WRONG_VALUE_COUNT 1058
+#define ER_TOO_LONG_IDENT 1059
+#define ER_DUP_FIELDNAME 1060
+#define ER_DUP_KEYNAME 1061
+#define ER_DUP_ENTRY 1062
+#define ER_WRONG_FIELD_SPEC 1063
+#define ER_PARSE_ERROR 1064
+#define ER_EMPTY_QUERY 1065
+#define ER_NONUNIQ_TABLE 1066
+#define ER_INVALID_DEFAULT 1067
+#define ER_MULTIPLE_PRI_KEY 1068
+#define ER_TOO_MANY_KEYS 1069
+#define ER_TOO_MANY_KEY_PARTS 1070
+#define ER_TOO_LONG_KEY 1071
+#define ER_KEY_COLUMN_DOES_NOT_EXITS 1072
+#define ER_BLOB_USED_AS_KEY 1073
+#define ER_TOO_BIG_FIELDLENGTH 1074
+#define ER_WRONG_AUTO_KEY 1075
+#define ER_READY 1076
+//#define OBSOLETE_ER_NORMAL_SHUTDOWN 1077
+//#define OBSOLETE_ER_GOT_SIGNAL 1078
+#define ER_SHUTDOWN_COMPLETE 1079
+#define ER_FORCING_CLOSE 1080
+#define ER_IPSOCK_ERROR 1081
+#define ER_NO_SUCH_INDEX 1082
+#define ER_WRONG_FIELD_TERMINATORS 1083
+#define ER_BLOBS_AND_NO_TERMINATED 1084
+#define ER_TEXTFILE_NOT_READABLE 1085
+#define ER_FILE_EXISTS_ERROR 1086
+#define ER_LOAD_INFO 1087
+#define ER_ALTER_INFO 1088
+#define ER_WRONG_SUB_KEY 1089
+#define ER_CANT_REMOVE_ALL_FIELDS 1090
+#define ER_CANT_DROP_FIELD_OR_KEY 1091
+#define ER_INSERT_INFO 1092
+#define ER_UPDATE_TABLE_USED 1093
+#define ER_NO_SUCH_THREAD 1094
+#define ER_KILL_DENIED_ERROR 1095
+#define ER_NO_TABLES_USED 1096
+#define ER_TOO_BIG_SET 1097
+#define ER_NO_UNIQUE_LOGFILE 1098
+#define ER_TABLE_NOT_LOCKED_FOR_WRITE 1099
+#define ER_TABLE_NOT_LOCKED 1100
+#define ER_BLOB_CANT_HAVE_DEFAULT 1101
+#define ER_WRONG_DB_NAME 1102
+#define ER_WRONG_TABLE_NAME 1103
+#define ER_TOO_BIG_SELECT 1104
+#define ER_UNKNOWN_ERROR 1105
+#define ER_UNKNOWN_PROCEDURE 1106
+#define ER_WRONG_PARAMCOUNT_TO_PROCEDURE 1107
+#define ER_WRONG_PARAMETERS_TO_PROCEDURE 1108
+#define ER_UNKNOWN_TABLE 1109
+#define ER_FIELD_SPECIFIED_TWICE 1110
+#define ER_INVALID_GROUP_FUNC_USE 1111
+#define ER_UNSUPPORTED_EXTENSION 1112
+#define ER_TABLE_MUST_HAVE_COLUMNS 1113
+#define ER_RECORD_FILE_FULL 1114
+#define ER_UNKNOWN_CHARACTER_SET 1115
+#define ER_TOO_MANY_TABLES 1116
+#define ER_TOO_MANY_FIELDS 1117
+#define ER_TOO_BIG_ROWSIZE 1118
+#define ER_STACK_OVERRUN 1119
+#define ER_WRONG_OUTER_JOIN_UNUSED 1120
+#define ER_NULL_COLUMN_IN_INDEX 1121
+#define ER_CANT_FIND_UDF 1122
+#define ER_CANT_INITIALIZE_UDF 1123
+#define ER_UDF_NO_PATHS 1124
+#define ER_UDF_EXISTS 1125
+#define ER_CANT_OPEN_LIBRARY 1126
+#define ER_CANT_FIND_DL_ENTRY 1127
+#define ER_FUNCTION_NOT_DEFINED 1128
+#define ER_HOST_IS_BLOCKED 1129
+#define ER_HOST_NOT_PRIVILEGED 1130
+#define ER_PASSWORD_ANONYMOUS_USER 1131
+#define ER_PASSWORD_NOT_ALLOWED 1132
+#define ER_PASSWORD_NO_MATCH 1133
+#define ER_UPDATE_INFO 1134
+#define ER_CANT_CREATE_THREAD 1135
+#define ER_WRONG_VALUE_COUNT_ON_ROW 1136
+#define ER_CANT_REOPEN_TABLE 1137
+#define ER_INVALID_USE_OF_NULL 1138
+#define ER_REGEXP_ERROR 1139
+#define ER_MIX_OF_GROUP_FUNC_AND_FIELDS 1140
+#define ER_NONEXISTING_GRANT 1141
+#define ER_TABLEACCESS_DENIED_ERROR 1142
+#define ER_COLUMNACCESS_DENIED_ERROR 1143
+#define ER_ILLEGAL_GRANT_FOR_TABLE 1144
+#define ER_GRANT_WRONG_HOST_OR_USER 1145
+#define ER_NO_SUCH_TABLE 1146
+#define ER_NONEXISTING_TABLE_GRANT 1147
+#define ER_NOT_ALLOWED_COMMAND 1148
+#define ER_SYNTAX_ERROR 1149
+//#define OBSOLETE_ER_UNUSED1 1150
+//#define OBSOLETE_ER_UNUSED2 1151
+#define ER_ABORTING_CONNECTION 1152
+#define ER_NET_PACKET_TOO_LARGE 1153
+#define ER_NET_READ_ERROR_FROM_PIPE 1154
+#define ER_NET_FCNTL_ERROR 1155
+#define ER_NET_PACKETS_OUT_OF_ORDER 1156
+#define ER_NET_UNCOMPRESS_ERROR 1157
+#define ER_NET_READ_ERROR 1158
+#define ER_NET_READ_INTERRUPTED 1159
+#define ER_NET_ERROR_ON_WRITE 1160
+#define ER_NET_WRITE_INTERRUPTED 1161
+#define ER_TOO_LONG_STRING 1162
+#define ER_TABLE_CANT_HANDLE_BLOB 1163
+#define ER_TABLE_CANT_HANDLE_AUTO_INCREMENT 1164
+//#define OBSOLETE_ER_UNUSED3 1165
+#define ER_WRONG_COLUMN_NAME 1166
+#define ER_WRONG_KEY_COLUMN 1167
+#define ER_WRONG_MRG_TABLE 1168
+#define ER_DUP_UNIQUE 1169
+#define ER_BLOB_KEY_WITHOUT_LENGTH 1170
+#define ER_PRIMARY_CANT_HAVE_NULL 1171
+#define ER_TOO_MANY_ROWS 1172
+#define ER_REQUIRES_PRIMARY_KEY 1173
+//#define OBSOLETE_ER_NO_RAID_COMPILED 1174
+#define ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE 1175
+#define ER_KEY_DOES_NOT_EXITS 1176
+#define ER_CHECK_NO_SUCH_TABLE 1177
+#define ER_CHECK_NOT_IMPLEMENTED 1178
+#define ER_CANT_DO_THIS_DURING_AN_TRANSACTION 1179
+#define ER_ERROR_DURING_COMMIT 1180
+#define ER_ERROR_DURING_ROLLBACK 1181
+#define ER_ERROR_DURING_FLUSH_LOGS 1182
+//#define OBSOLETE_ER_ERROR_DURING_CHECKPOINT 1183
+#define ER_NEW_ABORTING_CONNECTION 1184
+//#define OBSOLETE_ER_DUMP_NOT_IMPLEMENTED 1185
+//#define OBSOLETE_ER_FLUSH_MASTER_BINLOG_CLOSED 1186
+//#define OBSOLETE_ER_INDEX_REBUILD 1187
+#define ER_MASTER 1188
+#define ER_MASTER_NET_READ 1189
+#define ER_MASTER_NET_WRITE 1190
+#define ER_FT_MATCHING_KEY_NOT_FOUND 1191
+#define ER_LOCK_OR_ACTIVE_TRANSACTION 1192
+#define ER_UNKNOWN_SYSTEM_VARIABLE 1193
+#define ER_CRASHED_ON_USAGE 1194
+#define ER_CRASHED_ON_REPAIR 1195
+#define ER_WARNING_NOT_COMPLETE_ROLLBACK 1196
+#define ER_TRANS_CACHE_FULL 1197
+//#define OBSOLETE_ER_SLAVE_MUST_STOP 1198
+#define ER_SLAVE_NOT_RUNNING 1199
+#define ER_BAD_SLAVE 1200
+#define ER_MASTER_INFO 1201
+#define ER_SLAVE_THREAD 1202
+#define ER_TOO_MANY_USER_CONNECTIONS 1203
+#define ER_SET_CONSTANTS_ONLY 1204
+#define ER_LOCK_WAIT_TIMEOUT 1205
+#define ER_LOCK_TABLE_FULL 1206
+#define ER_READ_ONLY_TRANSACTION 1207
+//#define OBSOLETE_ER_DROP_DB_WITH_READ_LOCK 1208
+//#define OBSOLETE_ER_CREATE_DB_WITH_READ_LOCK 1209
+#define ER_WRONG_ARGUMENTS 1210
+#define ER_NO_PERMISSION_TO_CREATE_USER 1211
+//#define OBSOLETE_ER_UNION_TABLES_IN_DIFFERENT_DIR 1212
+#define ER_LOCK_DEADLOCK 1213
+#define ER_TABLE_CANT_HANDLE_FT 1214
+#define ER_CANNOT_ADD_FOREIGN 1215
+#define ER_NO_REFERENCED_ROW 1216
+#define ER_ROW_IS_REFERENCED 1217
+#define ER_CONNECT_TO_MASTER 1218
+//#define OBSOLETE_ER_QUERY_ON_MASTER 1219
+#define ER_ERROR_WHEN_EXECUTING_COMMAND 1220
+#define ER_WRONG_USAGE 1221
+#define ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT 1222
+#define ER_CANT_UPDATE_WITH_READLOCK 1223
+#define ER_MIXING_NOT_ALLOWED 1224
+#define ER_DUP_ARGUMENT 1225
+#define ER_USER_LIMIT_REACHED 1226
+#define ER_SPECIFIC_ACCESS_DENIED_ERROR 1227
+#define ER_LOCAL_VARIABLE 1228
+#define ER_GLOBAL_VARIABLE 1229
+#define ER_NO_DEFAULT 1230
+#define ER_WRONG_VALUE_FOR_VAR 1231
+#define ER_WRONG_TYPE_FOR_VAR 1232
+#define ER_VAR_CANT_BE_READ 1233
+#define ER_CANT_USE_OPTION_HERE 1234
+#define ER_NOT_SUPPORTED_YET 1235
+#define ER_MASTER_FATAL_ERROR_READING_BINLOG 1236
+#define ER_SLAVE_IGNORED_TABLE 1237
+#define ER_INCORRECT_GLOBAL_LOCAL_VAR 1238
+#define ER_WRONG_FK_DEF 1239
+#define ER_KEY_REF_DO_NOT_MATCH_TABLE_REF 1240
+#define ER_OPERAND_COLUMNS 1241
+#define ER_SUBQUERY_NO_1_ROW 1242
+#define ER_UNKNOWN_STMT_HANDLER 1243
+#define ER_CORRUPT_HELP_DB 1244
+//#define OBSOLETE_ER_CYCLIC_REFERENCE 1245
+#define ER_AUTO_CONVERT 1246
+#define ER_ILLEGAL_REFERENCE 1247
+#define ER_DERIVED_MUST_HAVE_ALIAS 1248
+#define ER_SELECT_REDUCED 1249
+#define ER_TABLENAME_NOT_ALLOWED_HERE 1250
+#define ER_NOT_SUPPORTED_AUTH_MODE 1251
+#define ER_SPATIAL_CANT_HAVE_NULL 1252
+#define ER_COLLATION_CHARSET_MISMATCH 1253
+//#define OBSOLETE_ER_SLAVE_WAS_RUNNING 1254
+//#define OBSOLETE_ER_SLAVE_WAS_NOT_RUNNING 1255
+#define ER_TOO_BIG_FOR_UNCOMPRESS 1256
+#define ER_ZLIB_Z_MEM_ERROR 1257
+#define ER_ZLIB_Z_BUF_ERROR 1258
+#define ER_ZLIB_Z_DATA_ERROR 1259
+#define ER_CUT_VALUE_GROUP_CONCAT 1260
+#define ER_WARN_TOO_FEW_RECORDS 1261
+#define ER_WARN_TOO_MANY_RECORDS 1262
+#define ER_WARN_NULL_TO_NOTNULL 1263
+#define ER_WARN_DATA_OUT_OF_RANGE 1264
+#define WARN_DATA_TRUNCATED 1265
+#define ER_WARN_USING_OTHER_HANDLER 1266
+#define ER_CANT_AGGREGATE_2COLLATIONS 1267
+//#define OBSOLETE_ER_DROP_USER 1268
+#define ER_REVOKE_GRANTS 1269
+#define ER_CANT_AGGREGATE_3COLLATIONS 1270
+#define ER_CANT_AGGREGATE_NCOLLATIONS 1271
+#define ER_VARIABLE_IS_NOT_STRUCT 1272
+#define ER_UNKNOWN_COLLATION 1273
+#define ER_SLAVE_IGNORED_SSL_PARAMS 1274
+//#define OBSOLETE_ER_SERVER_IS_IN_SECURE_AUTH_MODE 1275
+#define ER_WARN_FIELD_RESOLVED 1276
+#define ER_BAD_SLAVE_UNTIL_COND 1277
+#define ER_MISSING_SKIP_SLAVE 1278
+#define ER_UNTIL_COND_IGNORED 1279
+#define ER_WRONG_NAME_FOR_INDEX 1280
+#define ER_WRONG_NAME_FOR_CATALOG 1281
+//#define OBSOLETE_ER_WARN_QC_RESIZE 1282
+#define ER_BAD_FT_COLUMN 1283
+#define ER_UNKNOWN_KEY_CACHE 1284
+#define ER_WARN_HOSTNAME_WONT_WORK 1285
+#define ER_UNKNOWN_STORAGE_ENGINE 1286
+#define ER_WARN_DEPRECATED_SYNTAX 1287
+#define ER_NON_UPDATABLE_TABLE 1288
+#define ER_FEATURE_DISABLED 1289
+#define ER_OPTION_PREVENTS_STATEMENT 1290
+#define ER_DUPLICATED_VALUE_IN_TYPE 1291
+#define ER_TRUNCATED_WRONG_VALUE 1292
+//#define OBSOLETE_ER_TOO_MUCH_AUTO_TIMESTAMP_COLS 1293
+#define ER_INVALID_ON_UPDATE 1294
+#define ER_UNSUPPORTED_PS 1295
+#define ER_GET_ERRMSG 1296
+#define ER_GET_TEMPORARY_ERRMSG 1297
+#define ER_UNKNOWN_TIME_ZONE 1298
+#define ER_WARN_INVALID_TIMESTAMP 1299
+#define ER_INVALID_CHARACTER_STRING 1300
+#define ER_WARN_ALLOWED_PACKET_OVERFLOWED 1301
+#define ER_CONFLICTING_DECLARATIONS 1302
+#define ER_SP_NO_RECURSIVE_CREATE 1303
+#define ER_SP_ALREADY_EXISTS 1304
+#define ER_SP_DOES_NOT_EXIST 1305
+#define ER_SP_DROP_FAILED 1306
+#define ER_SP_STORE_FAILED 1307
+#define ER_SP_LILABEL_MISMATCH 1308
+#define ER_SP_LABEL_REDEFINE 1309
+#define ER_SP_LABEL_MISMATCH 1310
+#define ER_SP_UNINIT_VAR 1311
+#define ER_SP_BADSELECT 1312
+#define ER_SP_BADRETURN 1313
+#define ER_SP_BADSTATEMENT 1314
+#define ER_UPDATE_LOG_DEPRECATED_IGNORED 1315
+#define ER_UPDATE_LOG_DEPRECATED_TRANSLATED 1316
+#define ER_QUERY_INTERRUPTED 1317
+#define ER_SP_WRONG_NO_OF_ARGS 1318
+#define ER_SP_COND_MISMATCH 1319
+#define ER_SP_NORETURN 1320
+#define ER_SP_NORETURNEND 1321
+#define ER_SP_BAD_CURSOR_QUERY 1322
+#define ER_SP_BAD_CURSOR_SELECT 1323
+#define ER_SP_CURSOR_MISMATCH 1324
+#define ER_SP_CURSOR_ALREADY_OPEN 1325
+#define ER_SP_CURSOR_NOT_OPEN 1326
+#define ER_SP_UNDECLARED_VAR 1327
+#define ER_SP_WRONG_NO_OF_FETCH_ARGS 1328
+#define ER_SP_FETCH_NO_DATA 1329
+#define ER_SP_DUP_PARAM 1330
+#define ER_SP_DUP_VAR 1331
+#define ER_SP_DUP_COND 1332
+#define ER_SP_DUP_CURS 1333
+#define ER_SP_CANT_ALTER 1334
+#define ER_SP_SUBSELECT_NYI 1335
+#define ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG 1336
+#define ER_SP_VARCOND_AFTER_CURSHNDLR 1337
+#define ER_SP_CURSOR_AFTER_HANDLER 1338
+#define ER_SP_CASE_NOT_FOUND 1339
+#define ER_FPARSER_TOO_BIG_FILE 1340
+#define ER_FPARSER_BAD_HEADER 1341
+#define ER_FPARSER_EOF_IN_COMMENT 1342
+#define ER_FPARSER_ERROR_IN_PARAMETER 1343
+#define ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER 1344
+#define ER_VIEW_NO_EXPLAIN 1345
+//#define OBSOLETE_ER_FRM_UNKNOWN_TYPE 1346
+#define ER_WRONG_OBJECT 1347
+#define ER_NONUPDATEABLE_COLUMN 1348
+//#define OBSOLETE_ER_VIEW_SELECT_DERIVED_UNUSED 1349
+#define ER_VIEW_SELECT_CLAUSE 1350
+#define ER_VIEW_SELECT_VARIABLE 1351
+#define ER_VIEW_SELECT_TMPTABLE 1352
+#define ER_VIEW_WRONG_LIST 1353
+#define ER_WARN_VIEW_MERGE 1354
+#define ER_WARN_VIEW_WITHOUT_KEY 1355
+#define ER_VIEW_INVALID 1356
+#define ER_SP_NO_DROP_SP 1357
+//#define OBSOLETE_ER_SP_GOTO_IN_HNDLR 1358
+#define ER_TRG_ALREADY_EXISTS 1359
+#define ER_TRG_DOES_NOT_EXIST 1360
+#define ER_TRG_ON_VIEW_OR_TEMP_TABLE 1361
+#define ER_TRG_CANT_CHANGE_ROW 1362
+#define ER_TRG_NO_SUCH_ROW_IN_TRG 1363
+#define ER_NO_DEFAULT_FOR_FIELD 1364
+#define ER_DIVISION_BY_ZERO 1365
+#define ER_TRUNCATED_WRONG_VALUE_FOR_FIELD 1366
+#define ER_ILLEGAL_VALUE_FOR_TYPE 1367
+#define ER_VIEW_NONUPD_CHECK 1368
+#define ER_VIEW_CHECK_FAILED 1369
+#define ER_PROCACCESS_DENIED_ERROR 1370
+#define ER_RELAY_LOG_FAIL 1371
+//#define OBSOLETE_ER_PASSWD_LENGTH 1372
+#define ER_UNKNOWN_TARGET_BINLOG 1373
+#define ER_IO_ERR_LOG_INDEX_READ 1374
+#define ER_BINLOG_PURGE_PROHIBITED 1375
+#define ER_FSEEK_FAIL 1376
+#define ER_BINLOG_PURGE_FATAL_ERR 1377
+#define ER_LOG_IN_USE 1378
+#define ER_LOG_PURGE_UNKNOWN_ERR 1379
+#define ER_RELAY_LOG_INIT 1380
+#define ER_NO_BINARY_LOGGING 1381
+#define ER_RESERVED_SYNTAX 1382
+//#define OBSOLETE_ER_WSAS_FAILED 1383
+//#define OBSOLETE_ER_DIFF_GROUPS_PROC 1384
+//#define OBSOLETE_ER_NO_GROUP_FOR_PROC 1385
+//#define OBSOLETE_ER_ORDER_WITH_PROC 1386
+//#define OBSOLETE_ER_LOGGING_PROHIBIT_CHANGING_OF 1387
+//#define OBSOLETE_ER_NO_FILE_MAPPING 1388
+//#define OBSOLETE_ER_WRONG_MAGIC 1389
+#define ER_PS_MANY_PARAM 1390
+#define ER_KEY_PART_0 1391
+#define ER_VIEW_CHECKSUM 1392
+#define ER_VIEW_MULTIUPDATE 1393
+#define ER_VIEW_NO_INSERT_FIELD_LIST 1394
+#define ER_VIEW_DELETE_MERGE_VIEW 1395
+#define ER_CANNOT_USER 1396
+#define ER_XAER_NOTA 1397
+#define ER_XAER_INVAL 1398
+#define ER_XAER_RMFAIL 1399
+#define ER_XAER_OUTSIDE 1400
+#define ER_XAER_RMERR 1401
+#define ER_XA_RBROLLBACK 1402
+#define ER_NONEXISTING_PROC_GRANT 1403
+#define ER_PROC_AUTO_GRANT_FAIL 1404
+#define ER_PROC_AUTO_REVOKE_FAIL 1405
+#define ER_DATA_TOO_LONG 1406
+#define ER_SP_BAD_SQLSTATE 1407
+#define ER_STARTUP 1408
+#define ER_LOAD_FROM_FIXED_SIZE_ROWS_TO_VAR 1409
+#define ER_CANT_CREATE_USER_WITH_GRANT 1410
+#define ER_WRONG_VALUE_FOR_TYPE 1411
+#define ER_TABLE_DEF_CHANGED 1412
+#define ER_SP_DUP_HANDLER 1413
+#define ER_SP_NOT_VAR_ARG 1414
+#define ER_SP_NO_RETSET 1415
+#define ER_CANT_CREATE_GEOMETRY_OBJECT 1416
+//#define OBSOLETE_ER_FAILED_ROUTINE_BREAK_BINLOG 1417
+#define ER_BINLOG_UNSAFE_ROUTINE 1418
+#define ER_BINLOG_CREATE_ROUTINE_NEED_SUPER 1419
+//#define OBSOLETE_ER_EXEC_STMT_WITH_OPEN_CURSOR 1420
+#define ER_STMT_HAS_NO_OPEN_CURSOR 1421
+#define ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG 1422
+#define ER_NO_DEFAULT_FOR_VIEW_FIELD 1423
+#define ER_SP_NO_RECURSION 1424
+#define ER_TOO_BIG_SCALE 1425
+#define ER_TOO_BIG_PRECISION 1426
+#define ER_M_BIGGER_THAN_D 1427
+#define ER_WRONG_LOCK_OF_SYSTEM_TABLE 1428
+#define ER_CONNECT_TO_FOREIGN_DATA_SOURCE 1429
+#define ER_QUERY_ON_FOREIGN_DATA_SOURCE 1430
+#define ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST 1431
+#define ER_FOREIGN_DATA_STRING_INVALID_CANT_CREATE 1432
+#define ER_FOREIGN_DATA_STRING_INVALID 1433
+//#define OBSOLETE_ER_CANT_CREATE_FEDERATED_TABLE 1434
+#define ER_TRG_IN_WRONG_SCHEMA 1435
+#define ER_STACK_OVERRUN_NEED_MORE 1436
+#define ER_TOO_LONG_BODY 1437
+#define ER_WARN_CANT_DROP_DEFAULT_KEYCACHE 1438
+#define ER_TOO_BIG_DISPLAYWIDTH 1439
+#define ER_XAER_DUPID 1440
+#define ER_DATETIME_FUNCTION_OVERFLOW 1441
+#define ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG 1442
+#define ER_VIEW_PREVENT_UPDATE 1443
+#define ER_PS_NO_RECURSION 1444
+#define ER_SP_CANT_SET_AUTOCOMMIT 1445
+//#define OBSOLETE_ER_MALFORMED_DEFINER 1446
+#define ER_VIEW_FRM_NO_USER 1447
+#define ER_VIEW_OTHER_USER 1448
+#define ER_NO_SUCH_USER 1449
+#define ER_FORBID_SCHEMA_CHANGE 1450
+#define ER_ROW_IS_REFERENCED_2 1451
+#define ER_NO_REFERENCED_ROW_2 1452
+#define ER_SP_BAD_VAR_SHADOW 1453
+#define ER_TRG_NO_DEFINER 1454
+#define ER_OLD_FILE_FORMAT 1455
+#define ER_SP_RECURSION_LIMIT 1456
+//#define OBSOLETE_ER_SP_PROC_TABLE_CORRUPT 1457
+#define ER_SP_WRONG_NAME 1458
+#define ER_TABLE_NEEDS_UPGRADE 1459
+#define ER_SP_NO_AGGREGATE 1460
+#define ER_MAX_PREPARED_STMT_COUNT_REACHED 1461
+#define ER_VIEW_RECURSIVE 1462
+#define ER_NON_GROUPING_FIELD_USED 1463
+#define ER_TABLE_CANT_HANDLE_SPKEYS 1464
+#define ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA 1465
+#define ER_REMOVED_SPACES 1466
+#define ER_AUTOINC_READ_FAILED 1467
+#define ER_USERNAME 1468
+#define ER_HOSTNAME 1469
+#define ER_WRONG_STRING_LENGTH 1470
+#define ER_NON_INSERTABLE_TABLE 1471
+#define ER_ADMIN_WRONG_MRG_TABLE 1472
+#define ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT 1473
+#define ER_NAME_BECOMES_EMPTY 1474
+#define ER_AMBIGUOUS_FIELD_TERM 1475
+#define ER_FOREIGN_SERVER_EXISTS 1476
+#define ER_FOREIGN_SERVER_DOESNT_EXIST 1477
+#define ER_ILLEGAL_HA_CREATE_OPTION 1478
+#define ER_PARTITION_REQUIRES_VALUES_ERROR 1479
+#define ER_PARTITION_WRONG_VALUES_ERROR 1480
+#define ER_PARTITION_MAXVALUE_ERROR 1481
+//#define OBSOLETE_ER_PARTITION_SUBPARTITION_ERROR 1482
+//#define OBSOLETE_ER_PARTITION_SUBPART_MIX_ERROR 1483
+#define ER_PARTITION_WRONG_NO_PART_ERROR 1484
+#define ER_PARTITION_WRONG_NO_SUBPART_ERROR 1485
+#define ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR 1486
+//#define OBSOLETE_ER_NO_CONST_EXPR_IN_RANGE_OR_LIST_ERROR 1487
+#define ER_FIELD_NOT_FOUND_PART_ERROR 1488
+//#define OBSOLETE_ER_LIST_OF_FIELDS_ONLY_IN_HASH_ERROR 1489
+#define ER_INCONSISTENT_PARTITION_INFO_ERROR 1490
+#define ER_PARTITION_FUNC_NOT_ALLOWED_ERROR 1491
+#define ER_PARTITIONS_MUST_BE_DEFINED_ERROR 1492
+#define ER_RANGE_NOT_INCREASING_ERROR 1493
+#define ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR 1494
+#define ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR 1495
+#define ER_PARTITION_ENTRY_ERROR 1496
+#define ER_MIX_HANDLER_ERROR 1497
+#define ER_PARTITION_NOT_DEFINED_ERROR 1498
+#define ER_TOO_MANY_PARTITIONS_ERROR 1499
+#define ER_SUBPARTITION_ERROR 1500
+#define ER_CANT_CREATE_HANDLER_FILE 1501
+#define ER_BLOB_FIELD_IN_PART_FUNC_ERROR 1502
+#define ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF 1503
+#define ER_NO_PARTS_ERROR 1504
+#define ER_PARTITION_MGMT_ON_NONPARTITIONED 1505
+#define ER_FOREIGN_KEY_ON_PARTITIONED 1506
+#define ER_DROP_PARTITION_NON_EXISTENT 1507
+#define ER_DROP_LAST_PARTITION 1508
+#define ER_COALESCE_ONLY_ON_HASH_PARTITION 1509
+#define ER_REORG_HASH_ONLY_ON_SAME_NO 1510
+#define ER_REORG_NO_PARAM_ERROR 1511
+#define ER_ONLY_ON_RANGE_LIST_PARTITION 1512
+#define ER_ADD_PARTITION_SUBPART_ERROR 1513
+#define ER_ADD_PARTITION_NO_NEW_PARTITION 1514
+#define ER_COALESCE_PARTITION_NO_PARTITION 1515
+#define ER_REORG_PARTITION_NOT_EXIST 1516
+#define ER_SAME_NAME_PARTITION 1517
+#define ER_NO_BINLOG_ERROR 1518
+#define ER_CONSECUTIVE_REORG_PARTITIONS 1519
+#define ER_REORG_OUTSIDE_RANGE 1520
+#define ER_PARTITION_FUNCTION_FAILURE 1521
+//#define OBSOLETE_ER_PART_STATE_ERROR 1522
+#define ER_LIMITED_PART_RANGE 1523
+#define ER_PLUGIN_IS_NOT_LOADED 1524
+#define ER_WRONG_VALUE 1525
+#define ER_NO_PARTITION_FOR_GIVEN_VALUE 1526
+#define ER_FILEGROUP_OPTION_ONLY_ONCE 1527
+#define ER_CREATE_FILEGROUP_FAILED 1528
+#define ER_DROP_FILEGROUP_FAILED 1529
+#define ER_TABLESPACE_AUTO_EXTEND_ERROR 1530
+#define ER_WRONG_SIZE_NUMBER 1531
+#define ER_SIZE_OVERFLOW_ERROR 1532
+#define ER_ALTER_FILEGROUP_FAILED 1533
+#define ER_BINLOG_ROW_LOGGING_FAILED 1534
+//#define OBSOLETE_ER_BINLOG_ROW_WRONG_TABLE_DEF 1535
+//#define OBSOLETE_ER_BINLOG_ROW_RBR_TO_SBR 1536
+#define ER_EVENT_ALREADY_EXISTS 1537
+//#define OBSOLETE_ER_EVENT_STORE_FAILED 1538
+#define ER_EVENT_DOES_NOT_EXIST 1539
+//#define OBSOLETE_ER_EVENT_CANT_ALTER 1540
+//#define OBSOLETE_ER_EVENT_DROP_FAILED 1541
+#define ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG 1542
+#define ER_EVENT_ENDS_BEFORE_STARTS 1543
+#define ER_EVENT_EXEC_TIME_IN_THE_PAST 1544
+//#define OBSOLETE_ER_EVENT_OPEN_TABLE_FAILED 1545
+//#define OBSOLETE_ER_EVENT_NEITHER_M_EXPR_NOR_M_AT 1546
+//#define OBSOLETE_ER_COL_COUNT_DOESNT_MATCH_CORRUPTED 1547
+//#define OBSOLETE_ER_CANNOT_LOAD_FROM_TABLE 1548
+//#define OBSOLETE_ER_EVENT_CANNOT_DELETE 1549
+//#define OBSOLETE_ER_EVENT_COMPILE_ERROR 1550
+#define ER_EVENT_SAME_NAME 1551
+//#define OBSOLETE_ER_EVENT_DATA_TOO_LONG 1552
+#define ER_DROP_INDEX_FK 1553
+#define ER_WARN_DEPRECATED_SYNTAX_WITH_VER 1554
+//#define OBSOLETE_ER_CANT_WRITE_LOCK_LOG_TABLE 1555
+#define ER_CANT_LOCK_LOG_TABLE 1556
+#define ER_FOREIGN_DUPLICATE_KEY_OLD_UNUSED 1557
+#define ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE 1558
+//#define OBSOLETE_ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR 1559
+#define ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT 1560
+//#define OBSOLETE_ER_NDB_CANT_SWITCH_BINLOG_FORMAT 1561
+#define ER_PARTITION_NO_TEMPORARY 1562
+#define ER_PARTITION_CONST_DOMAIN_ERROR 1563
+#define ER_PARTITION_FUNCTION_IS_NOT_ALLOWED 1564
+//#define OBSOLETE_ER_DDL_LOG_ERROR_UNUSED 1565
+#define ER_NULL_IN_VALUES_LESS_THAN 1566
+#define ER_WRONG_PARTITION_NAME 1567
+#define ER_CANT_CHANGE_TX_CHARACTERISTICS 1568
+#define ER_DUP_ENTRY_AUTOINCREMENT_CASE 1569
+//#define OBSOLETE_ER_EVENT_MODIFY_QUEUE_ERROR 1570
+#define ER_EVENT_SET_VAR_ERROR 1571
+#define ER_PARTITION_MERGE_ERROR 1572
+//#define OBSOLETE_ER_CANT_ACTIVATE_LOG 1573
+//#define OBSOLETE_ER_RBR_NOT_AVAILABLE 1574
+#define ER_BASE64_DECODE_ERROR 1575
+#define ER_EVENT_RECURSION_FORBIDDEN 1576
+//#define OBSOLETE_ER_EVENTS_DB_ERROR 1577
+#define ER_ONLY_INTEGERS_ALLOWED 1578
+#define ER_UNSUPORTED_LOG_ENGINE 1579
+#define ER_BAD_LOG_STATEMENT 1580
+#define ER_CANT_RENAME_LOG_TABLE 1581
+#define ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT 1582
+#define ER_WRONG_PARAMETERS_TO_NATIVE_FCT 1583
+#define ER_WRONG_PARAMETERS_TO_STORED_FCT 1584
+#define ER_NATIVE_FCT_NAME_COLLISION 1585
+#define ER_DUP_ENTRY_WITH_KEY_NAME 1586
+#define ER_BINLOG_PURGE_EMFILE 1587
+#define ER_EVENT_CANNOT_CREATE_IN_THE_PAST 1588
+#define ER_EVENT_CANNOT_ALTER_IN_THE_PAST 1589
+//#define OBSOLETE_ER_SLAVE_INCIDENT 1590
+#define ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT 1591
+#define ER_BINLOG_UNSAFE_STATEMENT 1592
+#define ER_BINLOG_FATAL_ERROR 1593
+//#define OBSOLETE_ER_SLAVE_RELAY_LOG_READ_FAILURE 1594
+//#define OBSOLETE_ER_SLAVE_RELAY_LOG_WRITE_FAILURE 1595
+//#define OBSOLETE_ER_SLAVE_CREATE_EVENT_FAILURE 1596
+//#define OBSOLETE_ER_SLAVE_MASTER_COM_FAILURE 1597
+#define ER_BINLOG_LOGGING_IMPOSSIBLE 1598
+#define ER_VIEW_NO_CREATION_CTX 1599
+#define ER_VIEW_INVALID_CREATION_CTX 1600
+//#define OBSOLETE_ER_SR_INVALID_CREATION_CTX 1601
+#define ER_TRG_CORRUPTED_FILE 1602
+#define ER_TRG_NO_CREATION_CTX 1603
+#define ER_TRG_INVALID_CREATION_CTX 1604
+#define ER_EVENT_INVALID_CREATION_CTX 1605
+#define ER_TRG_CANT_OPEN_TABLE 1606
+//#define OBSOLETE_ER_CANT_CREATE_SROUTINE 1607
+//#define OBSOLETE_ER_NEVER_USED 1608
+#define ER_NO_FORMAT_DESCRIPTION_EVENT_BEFORE_BINLOG_STATEMENT 1609
+#define ER_SLAVE_CORRUPT_EVENT 1610
+//#define OBSOLETE_ER_LOAD_DATA_INVALID_COLUMN_UNUSED 1611
+#define ER_LOG_PURGE_NO_FILE 1612
+#define ER_XA_RBTIMEOUT 1613
+#define ER_XA_RBDEADLOCK 1614
+#define ER_NEED_REPREPARE 1615
+//#define OBSOLETE_ER_DELAYED_NOT_SUPPORTED 1616
+#define WARN_NO_MASTER_INFO 1617
+#define WARN_OPTION_IGNORED 1618
+#define ER_PLUGIN_DELETE_BUILTIN 1619
+#define WARN_PLUGIN_BUSY 1620
+#define ER_VARIABLE_IS_READONLY 1621
+#define ER_WARN_ENGINE_TRANSACTION_ROLLBACK 1622
+//#define OBSOLETE_ER_SLAVE_HEARTBEAT_FAILURE 1623
+#define ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE 1624
+#define ER_NDB_REPLICATION_SCHEMA_ERROR 1625
+#define ER_CONFLICT_FN_PARSE_ERROR 1626
+#define ER_EXCEPTIONS_WRITE_ERROR 1627
+#define ER_TOO_LONG_TABLE_COMMENT 1628
+#define ER_TOO_LONG_FIELD_COMMENT 1629
+#define ER_FUNC_INEXISTENT_NAME_COLLISION 1630
+#define ER_DATABASE_NAME 1631
+#define ER_TABLE_NAME 1632
+#define ER_PARTITION_NAME 1633
+#define ER_SUBPARTITION_NAME 1634
+#define ER_TEMPORARY_NAME 1635
+#define ER_RENAMED_NAME 1636
+#define ER_TOO_MANY_CONCURRENT_TRXS 1637
+#define WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED 1638
+#define ER_DEBUG_SYNC_TIMEOUT 1639
+#define ER_DEBUG_SYNC_HIT_LIMIT 1640
+#define ER_DUP_SIGNAL_SET 1641
+#define ER_SIGNAL_WARN 1642
+#define ER_SIGNAL_NOT_FOUND 1643
+#define ER_SIGNAL_EXCEPTION 1644
+#define ER_RESIGNAL_WITHOUT_ACTIVE_HANDLER 1645
+#define ER_SIGNAL_BAD_CONDITION_TYPE 1646
+#define WARN_COND_ITEM_TRUNCATED 1647
+#define ER_COND_ITEM_TOO_LONG 1648
+#define ER_UNKNOWN_LOCALE 1649
+#define ER_SLAVE_IGNORE_SERVER_IDS 1650
+//#define OBSOLETE_ER_QUERY_CACHE_DISABLED 1651
+#define ER_SAME_NAME_PARTITION_FIELD 1652
+#define ER_PARTITION_COLUMN_LIST_ERROR 1653
+#define ER_WRONG_TYPE_COLUMN_VALUE_ERROR 1654
+#define ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR 1655
+#define ER_MAXVALUE_IN_VALUES_IN 1656
+#define ER_TOO_MANY_VALUES_ERROR 1657
+#define ER_ROW_SINGLE_PARTITION_FIELD_ERROR 1658
+#define ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD 1659
+#define ER_PARTITION_FIELDS_TOO_LONG 1660
+#define ER_BINLOG_ROW_ENGINE_AND_STMT_ENGINE 1661
+#define ER_BINLOG_ROW_MODE_AND_STMT_ENGINE 1662
+#define ER_BINLOG_UNSAFE_AND_STMT_ENGINE 1663
+#define ER_BINLOG_ROW_INJECTION_AND_STMT_ENGINE 1664
+#define ER_BINLOG_STMT_MODE_AND_ROW_ENGINE 1665
+#define ER_BINLOG_ROW_INJECTION_AND_STMT_MODE 1666
+#define ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE 1667
+#define ER_BINLOG_UNSAFE_LIMIT 1668
+//#define OBSOLETE_ER_UNUSED4 1669
+#define ER_BINLOG_UNSAFE_SYSTEM_TABLE 1670
+#define ER_BINLOG_UNSAFE_AUTOINC_COLUMNS 1671
+#define ER_BINLOG_UNSAFE_UDF 1672
+#define ER_BINLOG_UNSAFE_SYSTEM_VARIABLE 1673
+#define ER_BINLOG_UNSAFE_SYSTEM_FUNCTION 1674
+#define ER_BINLOG_UNSAFE_NONTRANS_AFTER_TRANS 1675
+#define ER_MESSAGE_AND_STATEMENT 1676
+//#define OBSOLETE_ER_SLAVE_CONVERSION_FAILED 1677
+#define ER_SLAVE_CANT_CREATE_CONVERSION 1678
+#define ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT 1679
+#define ER_PATH_LENGTH 1680
+#define ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT 1681
+#define ER_WRONG_NATIVE_TABLE_STRUCTURE 1682
+#define ER_WRONG_PERFSCHEMA_USAGE 1683
+#define ER_WARN_I_S_SKIPPED_TABLE 1684
+#define ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT 1685
+#define ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_DIRECT 1686
+#define ER_SPATIAL_MUST_HAVE_GEOM_COL 1687
+#define ER_TOO_LONG_INDEX_COMMENT 1688
+#define ER_LOCK_ABORTED 1689
+#define ER_DATA_OUT_OF_RANGE 1690
+#define ER_WRONG_SPVAR_TYPE_IN_LIMIT 1691
+#define ER_BINLOG_UNSAFE_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE 1692
+#define ER_BINLOG_UNSAFE_MIXED_STATEMENT 1693
+#define ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SQL_LOG_BIN 1694
+#define ER_STORED_FUNCTION_PREVENTS_SWITCH_SQL_LOG_BIN 1695
+#define ER_FAILED_READ_FROM_PAR_FILE 1696
+#define ER_VALUES_IS_NOT_INT_TYPE_ERROR 1697
+#define ER_ACCESS_DENIED_NO_PASSWORD_ERROR 1698
+#define ER_SET_PASSWORD_AUTH_PLUGIN 1699
+//#define OBSOLETE_ER_GRANT_PLUGIN_USER_EXISTS 1700
+#define ER_TRUNCATE_ILLEGAL_FK 1701
+#define ER_PLUGIN_IS_PERMANENT 1702
+#define ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN 1703
+#define ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX 1704
+#define ER_STMT_CACHE_FULL 1705
+#define ER_MULTI_UPDATE_KEY_CONFLICT 1706
+#define ER_TABLE_NEEDS_REBUILD 1707
+#define WARN_OPTION_BELOW_LIMIT 1708
+#define ER_INDEX_COLUMN_TOO_LONG 1709
+#define ER_ERROR_IN_TRIGGER_BODY 1710
+#define ER_ERROR_IN_UNKNOWN_TRIGGER_BODY 1711
+#define ER_INDEX_CORRUPT 1712
+#define ER_UNDO_RECORD_TOO_BIG 1713
+#define ER_BINLOG_UNSAFE_INSERT_IGNORE_SELECT 1714
+#define ER_BINLOG_UNSAFE_INSERT_SELECT_UPDATE 1715
+#define ER_BINLOG_UNSAFE_REPLACE_SELECT 1716
+#define ER_BINLOG_UNSAFE_CREATE_IGNORE_SELECT 1717
+#define ER_BINLOG_UNSAFE_CREATE_REPLACE_SELECT 1718
+#define ER_BINLOG_UNSAFE_UPDATE_IGNORE 1719
+#define ER_PLUGIN_NO_UNINSTALL 1720
+#define ER_PLUGIN_NO_INSTALL 1721
+#define ER_BINLOG_UNSAFE_WRITE_AUTOINC_SELECT 1722
+#define ER_BINLOG_UNSAFE_CREATE_SELECT_AUTOINC 1723
+#define ER_BINLOG_UNSAFE_INSERT_TWO_KEYS 1724
+#define ER_TABLE_IN_FK_CHECK 1725
+#define ER_UNSUPPORTED_ENGINE 1726
+#define ER_BINLOG_UNSAFE_AUTOINC_NOT_FIRST 1727
+#define ER_CANNOT_LOAD_FROM_TABLE_V2 1728
+#define ER_MASTER_DELAY_VALUE_OUT_OF_RANGE 1729
+#define ER_ONLY_FD_AND_RBR_EVENTS_ALLOWED_IN_BINLOG_STATEMENT 1730
+#define ER_PARTITION_EXCHANGE_DIFFERENT_OPTION 1731
+#define ER_PARTITION_EXCHANGE_PART_TABLE 1732
+#define ER_PARTITION_EXCHANGE_TEMP_TABLE 1733
+#define ER_PARTITION_INSTEAD_OF_SUBPARTITION 1734
+#define ER_UNKNOWN_PARTITION 1735
+#define ER_TABLES_DIFFERENT_METADATA 1736
+#define ER_ROW_DOES_NOT_MATCH_PARTITION 1737
+#define ER_BINLOG_CACHE_SIZE_GREATER_THAN_MAX 1738
+#define ER_WARN_INDEX_NOT_APPLICABLE 1739
+#define ER_PARTITION_EXCHANGE_FOREIGN_KEY 1740
+//#define OBSOLETE_ER_NO_SUCH_KEY_VALUE 1741
+#define ER_RPL_INFO_DATA_TOO_LONG 1742
+//#define OBSOLETE_ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE 1743
+//#define OBSOLETE_ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE 1744
+#define ER_BINLOG_STMT_CACHE_SIZE_GREATER_THAN_MAX 1745
+#define ER_CANT_UPDATE_TABLE_IN_CREATE_TABLE_SELECT 1746
+#define ER_PARTITION_CLAUSE_ON_NONPARTITIONED 1747
+#define ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET 1748
+//#define OBSOLETE_ER_NO_SUCH_PARTITION__UNUSED 1749
+#define ER_CHANGE_RPL_INFO_REPOSITORY_FAILURE 1750
+#define ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_CREATED_TEMP_TABLE 1751
+#define ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_DROPPED_TEMP_TABLE 1752
+#define ER_MTS_FEATURE_IS_NOT_SUPPORTED 1753
+#define ER_MTS_UPDATED_DBS_GREATER_MAX 1754
+#define ER_MTS_CANT_PARALLEL 1755
+#define ER_MTS_INCONSISTENT_DATA 1756
+#define ER_FULLTEXT_NOT_SUPPORTED_WITH_PARTITIONING 1757
+#define ER_DA_INVALID_CONDITION_NUMBER 1758
+#define ER_INSECURE_PLAIN_TEXT 1759
+#define ER_INSECURE_CHANGE_MASTER 1760
+#define ER_FOREIGN_DUPLICATE_KEY_WITH_CHILD_INFO 1761
+#define ER_FOREIGN_DUPLICATE_KEY_WITHOUT_CHILD_INFO 1762
+#define ER_SQLTHREAD_WITH_SECURE_SLAVE 1763
+#define ER_TABLE_HAS_NO_FT 1764
+#define ER_VARIABLE_NOT_SETTABLE_IN_SF_OR_TRIGGER 1765
+#define ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION 1766
+//#define OBSOLETE_ER_GTID_NEXT_IS_NOT_IN_GTID_NEXT_LIST 1767
+//#define OBSOLETE_ER_CANT_CHANGE_GTID_NEXT_IN_TRANSACTION 1768
+#define ER_SET_STATEMENT_CANNOT_INVOKE_FUNCTION 1769
+#define ER_GTID_NEXT_CANT_BE_AUTOMATIC_IF_GTID_NEXT_LIST_IS_NON_NULL 1770
+//#define OBSOLETE_ER_SKIPPING_LOGGED_TRANSACTION 1771
+#define ER_MALFORMED_GTID_SET_SPECIFICATION 1772
+#define ER_MALFORMED_GTID_SET_ENCODING 1773
+#define ER_MALFORMED_GTID_SPECIFICATION 1774
+#define ER_GNO_EXHAUSTED 1775
+#define ER_BAD_SLAVE_AUTO_POSITION 1776
+#define ER_AUTO_POSITION_REQUIRES_GTID_MODE_NOT_OFF 1777
+#define ER_CANT_DO_IMPLICIT_COMMIT_IN_TRX_WHEN_GTID_NEXT_IS_SET 1778
+#define ER_GTID_MODE_ON_REQUIRES_ENFORCE_GTID_CONSISTENCY_ON 1779
+//#define OBSOLETE_ER_GTID_MODE_REQUIRES_BINLOG 1780
+#define ER_CANT_SET_GTID_NEXT_TO_GTID_WHEN_GTID_MODE_IS_OFF 1781
+#define ER_CANT_SET_GTID_NEXT_TO_ANONYMOUS_WHEN_GTID_MODE_IS_ON 1782
+#define ER_CANT_SET_GTID_NEXT_LIST_TO_NON_NULL_WHEN_GTID_MODE_IS_OFF 1783
+//#define OBSOLETE_ER_FOUND_GTID_EVENT_WHEN_GTID_MODE_IS_OFF__UNUSED 1784
+#define ER_GTID_UNSAFE_NON_TRANSACTIONAL_TABLE 1785
+#define ER_GTID_UNSAFE_CREATE_SELECT 1786
+//#define OBSOLETE_ER_GTID_UNSAFE_CREATE_DROP_TEMP_TABLE_IN_TRANSACTION 1787
+#define ER_GTID_MODE_CAN_ONLY_CHANGE_ONE_STEP_AT_A_TIME 1788
+#define ER_MASTER_HAS_PURGED_REQUIRED_GTIDS 1789
+#define ER_CANT_SET_GTID_NEXT_WHEN_OWNING_GTID 1790
+#define ER_UNKNOWN_EXPLAIN_FORMAT 1791
+#define ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION 1792
+#define ER_TOO_LONG_TABLE_PARTITION_COMMENT 1793
+#define ER_SLAVE_CONFIGURATION 1794
+#define ER_INNODB_FT_LIMIT 1795
+#define ER_INNODB_NO_FT_TEMP_TABLE 1796
+#define ER_INNODB_FT_WRONG_DOCID_COLUMN 1797
+#define ER_INNODB_FT_WRONG_DOCID_INDEX 1798
+#define ER_INNODB_ONLINE_LOG_TOO_BIG 1799
+#define ER_UNKNOWN_ALTER_ALGORITHM 1800
+#define ER_UNKNOWN_ALTER_LOCK 1801
+#define ER_MTS_CHANGE_MASTER_CANT_RUN_WITH_GAPS 1802
+#define ER_MTS_RECOVERY_FAILURE 1803
+#define ER_MTS_RESET_WORKERS 1804
+#define ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2 1805
+#define ER_SLAVE_SILENT_RETRY_TRANSACTION 1806
+#define ER_DISCARD_FK_CHECKS_RUNNING 1807
+#define ER_TABLE_SCHEMA_MISMATCH 1808
+#define ER_TABLE_IN_SYSTEM_TABLESPACE 1809
+#define ER_IO_READ_ERROR 1810
+#define ER_IO_WRITE_ERROR 1811
+#define ER_TABLESPACE_MISSING 1812
+#define ER_TABLESPACE_EXISTS 1813
+#define ER_TABLESPACE_DISCARDED 1814
+#define ER_INTERNAL_ERROR 1815
+#define ER_INNODB_IMPORT_ERROR 1816
+#define ER_INNODB_INDEX_CORRUPT 1817
+#define ER_INVALID_YEAR_COLUMN_LENGTH 1818
+#define ER_NOT_VALID_PASSWORD 1819
+#define ER_MUST_CHANGE_PASSWORD 1820
+#define ER_FK_NO_INDEX_CHILD 1821
+#define ER_FK_NO_INDEX_PARENT 1822
+#define ER_FK_FAIL_ADD_SYSTEM 1823
+#define ER_FK_CANNOT_OPEN_PARENT 1824
+#define ER_FK_INCORRECT_OPTION 1825
+#define ER_FK_DUP_NAME 1826
+#define ER_PASSWORD_FORMAT 1827
+#define ER_FK_COLUMN_CANNOT_DROP 1828
+#define ER_FK_COLUMN_CANNOT_DROP_CHILD 1829
+#define ER_FK_COLUMN_NOT_NULL 1830
+#define ER_DUP_INDEX 1831
+#define ER_FK_COLUMN_CANNOT_CHANGE 1832
+#define ER_FK_COLUMN_CANNOT_CHANGE_CHILD 1833
+//#define OBSOLETE_ER_UNUSED5 1834
+#define ER_MALFORMED_PACKET 1835
+#define ER_READ_ONLY_MODE 1836
+#define ER_GTID_NEXT_TYPE_UNDEFINED_GTID 1837
+#define ER_VARIABLE_NOT_SETTABLE_IN_SP 1838
+//#define OBSOLETE_ER_CANT_SET_GTID_PURGED_WHEN_GTID_MODE_IS_OFF 1839
+#define ER_CANT_SET_GTID_PURGED_WHEN_GTID_EXECUTED_IS_NOT_EMPTY 1840
+#define ER_CANT_SET_GTID_PURGED_WHEN_OWNED_GTIDS_IS_NOT_EMPTY 1841
+#define ER_GTID_PURGED_WAS_CHANGED 1842
+#define ER_GTID_EXECUTED_WAS_CHANGED 1843
+#define ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES 1844
+#define ER_ALTER_OPERATION_NOT_SUPPORTED 1845
+#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON 1846
+#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COPY 1847
+#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_PARTITION 1848
+#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_RENAME 1849
+#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COLUMN_TYPE 1850
+#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_CHECK 1851
+//#define OBSOLETE_ER_UNUSED6 1852
+#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOPK 1853
+#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_AUTOINC 1854
+#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_HIDDEN_FTS 1855
+#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_CHANGE_FTS 1856
+#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FTS 1857
+#define ER_SQL_SLAVE_SKIP_COUNTER_NOT_SETTABLE_IN_GTID_MODE 1858
+#define ER_DUP_UNKNOWN_IN_INDEX 1859
+#define ER_IDENT_CAUSES_TOO_LONG_PATH 1860
+#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOT_NULL 1861
+#define ER_MUST_CHANGE_PASSWORD_LOGIN 1862
+#define ER_ROW_IN_WRONG_PARTITION 1863
+#define ER_MTS_EVENT_BIGGER_PENDING_JOBS_SIZE_MAX 1864
+//#define OBSOLETE_ER_INNODB_NO_FT_USES_PARSER 1865
+#define ER_BINLOG_LOGICAL_CORRUPTION 1866
+#define ER_WARN_PURGE_LOG_IN_USE 1867
+#define ER_WARN_PURGE_LOG_IS_ACTIVE 1868
+#define ER_AUTO_INCREMENT_CONFLICT 1869
+#define WARN_ON_BLOCKHOLE_IN_RBR 1870
+#define ER_SLAVE_MI_INIT_REPOSITORY 1871
+#define ER_SLAVE_RLI_INIT_REPOSITORY 1872
+#define ER_ACCESS_DENIED_CHANGE_USER_ERROR 1873
+#define ER_INNODB_READ_ONLY 1874
+#define ER_STOP_SLAVE_SQL_THREAD_TIMEOUT 1875
+#define ER_STOP_SLAVE_IO_THREAD_TIMEOUT 1876
+#define ER_TABLE_CORRUPT 1877
+#define ER_TEMP_FILE_WRITE_FAILURE 1878
+#define ER_INNODB_FT_AUX_NOT_HEX_ID 1879
+#define ER_OLD_TEMPORALS_UPGRADED 1880
+#define ER_INNODB_FORCED_RECOVERY 1881
+#define ER_AES_INVALID_IV 1882
+#define ER_PLUGIN_CANNOT_BE_UNINSTALLED 1883
+#define ER_GTID_UNSAFE_BINLOG_SPLITTABLE_STATEMENT_AND_ASSIGNED_GTID 1884
+#define ER_SLAVE_HAS_MORE_GTIDS_THAN_MASTER 1885
+#define ER_MISSING_KEY 1886
+#define WARN_NAMED_PIPE_ACCESS_EVERYONE 1887
+#define ER_FILE_CORRUPT 3000
+#define ER_ERROR_ON_MASTER 3001
+//#define OBSOLETE_ER_INCONSISTENT_ERROR 3002
+#define ER_STORAGE_ENGINE_NOT_LOADED 3003
+#define ER_GET_STACKED_DA_WITHOUT_ACTIVE_HANDLER 3004
+#define ER_WARN_LEGACY_SYNTAX_CONVERTED 3005
+#define ER_BINLOG_UNSAFE_FULLTEXT_PLUGIN 3006
+#define ER_CANNOT_DISCARD_TEMPORARY_TABLE 3007
+#define ER_FK_DEPTH_EXCEEDED 3008
+#define ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE_V2 3009
+#define ER_WARN_TRIGGER_DOESNT_HAVE_CREATED 3010
+#define ER_REFERENCED_TRG_DOES_NOT_EXIST 3011
+#define ER_EXPLAIN_NOT_SUPPORTED 3012
+#define ER_INVALID_FIELD_SIZE 3013
+#define ER_MISSING_HA_CREATE_OPTION 3014
+#define ER_ENGINE_OUT_OF_MEMORY 3015
+#define ER_PASSWORD_EXPIRE_ANONYMOUS_USER 3016
+#define ER_SLAVE_SQL_THREAD_MUST_STOP 3017
+#define ER_NO_FT_MATERIALIZED_SUBQUERY 3018
+#define ER_INNODB_UNDO_LOG_FULL 3019
+#define ER_INVALID_ARGUMENT_FOR_LOGARITHM 3020
+#define ER_SLAVE_CHANNEL_IO_THREAD_MUST_STOP 3021
+#define ER_WARN_OPEN_TEMP_TABLES_MUST_BE_ZERO 3022
+#define ER_WARN_ONLY_MASTER_LOG_FILE_NO_POS 3023
+#define ER_QUERY_TIMEOUT 3024
+#define ER_NON_RO_SELECT_DISABLE_TIMER 3025
+#define ER_DUP_LIST_ENTRY 3026
+//#define OBSOLETE_ER_SQL_MODE_NO_EFFECT 3027
+#define ER_AGGREGATE_ORDER_FOR_UNION 3028
+#define ER_AGGREGATE_ORDER_NON_AGG_QUERY 3029
+#define ER_SLAVE_WORKER_STOPPED_PREVIOUS_THD_ERROR 3030
+#define ER_DONT_SUPPORT_SLAVE_PRESERVE_COMMIT_ORDER 3031
+#define ER_SERVER_OFFLINE_MODE 3032
+#define ER_GIS_DIFFERENT_SRIDS 3033
+#define ER_GIS_UNSUPPORTED_ARGUMENT 3034
+#define ER_GIS_UNKNOWN_ERROR 3035
+#define ER_GIS_UNKNOWN_EXCEPTION 3036
+#define ER_GIS_INVALID_DATA 3037
+#define ER_BOOST_GEOMETRY_EMPTY_INPUT_EXCEPTION 3038
+#define ER_BOOST_GEOMETRY_CENTROID_EXCEPTION 3039
+#define ER_BOOST_GEOMETRY_OVERLAY_INVALID_INPUT_EXCEPTION 3040
+#define ER_BOOST_GEOMETRY_TURN_INFO_EXCEPTION 3041
+#define ER_BOOST_GEOMETRY_SELF_INTERSECTION_POINT_EXCEPTION 3042
+#define ER_BOOST_GEOMETRY_UNKNOWN_EXCEPTION 3043
+#define ER_STD_BAD_ALLOC_ERROR 3044
+#define ER_STD_DOMAIN_ERROR 3045
+#define ER_STD_LENGTH_ERROR 3046
+#define ER_STD_INVALID_ARGUMENT 3047
+#define ER_STD_OUT_OF_RANGE_ERROR 3048
+#define ER_STD_OVERFLOW_ERROR 3049
+#define ER_STD_RANGE_ERROR 3050
+#define ER_STD_UNDERFLOW_ERROR 3051
+#define ER_STD_LOGIC_ERROR 3052
+#define ER_STD_RUNTIME_ERROR 3053
+#define ER_STD_UNKNOWN_EXCEPTION 3054
+#define ER_GIS_DATA_WRONG_ENDIANESS 3055
+#define ER_CHANGE_MASTER_PASSWORD_LENGTH 3056
+#define ER_USER_LOCK_WRONG_NAME 3057
+#define ER_USER_LOCK_DEADLOCK 3058
+#define ER_REPLACE_INACCESSIBLE_ROWS 3059
+#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS 3060
+#define ER_ILLEGAL_USER_VAR 3061
+#define ER_GTID_MODE_OFF 3062
+//#define OBSOLETE_ER_UNSUPPORTED_BY_REPLICATION_THREAD 3063
+#define ER_INCORRECT_TYPE 3064
+#define ER_FIELD_IN_ORDER_NOT_SELECT 3065
+#define ER_AGGREGATE_IN_ORDER_NOT_SELECT 3066
+#define ER_INVALID_RPL_WILD_TABLE_FILTER_PATTERN 3067
+#define ER_NET_OK_PACKET_TOO_LARGE 3068
+#define ER_INVALID_JSON_DATA 3069
+#define ER_INVALID_GEOJSON_MISSING_MEMBER 3070
+#define ER_INVALID_GEOJSON_WRONG_TYPE 3071
+#define ER_INVALID_GEOJSON_UNSPECIFIED 3072
+#define ER_DIMENSION_UNSUPPORTED 3073
+#define ER_SLAVE_CHANNEL_DOES_NOT_EXIST 3074
+//#define OBSOLETE_ER_SLAVE_MULTIPLE_CHANNELS_HOST_PORT 3075
+#define ER_SLAVE_CHANNEL_NAME_INVALID_OR_TOO_LONG 3076
+#define ER_SLAVE_NEW_CHANNEL_WRONG_REPOSITORY 3077
+//#define OBSOLETE_ER_SLAVE_CHANNEL_DELETE 3078
+#define ER_SLAVE_MULTIPLE_CHANNELS_CMD 3079
+#define ER_SLAVE_MAX_CHANNELS_EXCEEDED 3080
+#define ER_SLAVE_CHANNEL_MUST_STOP 3081
+#define ER_SLAVE_CHANNEL_NOT_RUNNING 3082
+#define ER_SLAVE_CHANNEL_WAS_RUNNING 3083
+#define ER_SLAVE_CHANNEL_WAS_NOT_RUNNING 3084
+#define ER_SLAVE_CHANNEL_SQL_THREAD_MUST_STOP 3085
+#define ER_SLAVE_CHANNEL_SQL_SKIP_COUNTER 3086
+#define ER_WRONG_FIELD_WITH_GROUP_V2 3087
+#define ER_MIX_OF_GROUP_FUNC_AND_FIELDS_V2 3088
+#define ER_WARN_DEPRECATED_SYSVAR_UPDATE 3089
+#define ER_WARN_DEPRECATED_SQLMODE 3090
+#define ER_CANNOT_LOG_PARTIAL_DROP_DATABASE_WITH_GTID 3091
+#define ER_GROUP_REPLICATION_CONFIGURATION 3092
+#define ER_GROUP_REPLICATION_RUNNING 3093
+#define ER_GROUP_REPLICATION_APPLIER_INIT_ERROR 3094
+#define ER_GROUP_REPLICATION_STOP_APPLIER_THREAD_TIMEOUT 3095
+#define ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR 3096
+#define ER_GROUP_REPLICATION_COMMUNICATION_LAYER_JOIN_ERROR 3097
+#define ER_BEFORE_DML_VALIDATION_ERROR 3098
+#define ER_PREVENTS_VARIABLE_WITHOUT_RBR 3099
+#define ER_RUN_HOOK_ERROR 3100
+#define ER_TRANSACTION_ROLLBACK_DURING_COMMIT 3101
+#define ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED 3102
+#define ER_UNSUPPORTED_ALTER_INPLACE_ON_VIRTUAL_COLUMN 3103
+#define ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN 3104
+#define ER_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN 3105
+#define ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN 3106
+#define ER_GENERATED_COLUMN_NON_PRIOR 3107
+#define ER_DEPENDENT_BY_GENERATED_COLUMN 3108
+#define ER_GENERATED_COLUMN_REF_AUTO_INC 3109
+#define ER_FEATURE_NOT_AVAILABLE 3110
+#define ER_CANT_SET_GTID_MODE 3111
+#define ER_CANT_USE_AUTO_POSITION_WITH_GTID_MODE_OFF 3112
+//#define OBSOLETE_ER_CANT_REPLICATE_ANONYMOUS_WITH_AUTO_POSITION 3113
+//#define OBSOLETE_ER_CANT_REPLICATE_ANONYMOUS_WITH_GTID_MODE_ON 3114
+//#define OBSOLETE_ER_CANT_REPLICATE_GTID_WITH_GTID_MODE_OFF 3115
+#define ER_CANT_ENFORCE_GTID_CONSISTENCY_WITH_ONGOING_GTID_VIOLATING_TX 3116
+#define ER_ENFORCE_GTID_CONSISTENCY_WARN_WITH_ONGOING_GTID_VIOLATING_TX 3117
+#define ER_ACCOUNT_HAS_BEEN_LOCKED 3118
+#define ER_WRONG_TABLESPACE_NAME 3119
+#define ER_TABLESPACE_IS_NOT_EMPTY 3120
+#define ER_WRONG_FILE_NAME 3121
+#define ER_BOOST_GEOMETRY_INCONSISTENT_TURNS_EXCEPTION 3122
+#define ER_WARN_OPTIMIZER_HINT_SYNTAX_ERROR 3123
+#define ER_WARN_BAD_MAX_EXECUTION_TIME 3124
+#define ER_WARN_UNSUPPORTED_MAX_EXECUTION_TIME 3125
+#define ER_WARN_CONFLICTING_HINT 3126
+#define ER_WARN_UNKNOWN_QB_NAME 3127
+#define ER_UNRESOLVED_HINT_NAME 3128
+#define ER_WARN_ON_MODIFYING_GTID_EXECUTED_TABLE 3129
+#define ER_PLUGGABLE_PROTOCOL_COMMAND_NOT_SUPPORTED 3130
+#define ER_LOCKING_SERVICE_WRONG_NAME 3131
+#define ER_LOCKING_SERVICE_DEADLOCK 3132
+#define ER_LOCKING_SERVICE_TIMEOUT 3133
+#define ER_GIS_MAX_POINTS_IN_GEOMETRY_OVERFLOWED 3134
+#define ER_SQL_MODE_MERGED 3135
+#define ER_VTOKEN_PLUGIN_TOKEN_MISMATCH 3136
+#define ER_VTOKEN_PLUGIN_TOKEN_NOT_FOUND 3137
+#define ER_CANT_SET_VARIABLE_WHEN_OWNING_GTID 3138
+#define ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED 3139
+#define ER_INVALID_JSON_TEXT 3140
+#define ER_INVALID_JSON_TEXT_IN_PARAM 3141
+#define ER_INVALID_JSON_BINARY_DATA 3142
+#define ER_INVALID_JSON_PATH 3143
+#define ER_INVALID_JSON_CHARSET 3144
+#define ER_INVALID_JSON_CHARSET_IN_FUNCTION 3145
+#define ER_INVALID_TYPE_FOR_JSON 3146
+#define ER_INVALID_CAST_TO_JSON 3147
+#define ER_INVALID_JSON_PATH_CHARSET 3148
+#define ER_INVALID_JSON_PATH_WILDCARD 3149
+#define ER_JSON_VALUE_TOO_BIG 3150
+#define ER_JSON_KEY_TOO_BIG 3151
+#define ER_JSON_USED_AS_KEY 3152
+#define ER_JSON_VACUOUS_PATH 3153
+#define ER_JSON_BAD_ONE_OR_ALL_ARG 3154
+#define ER_NUMERIC_JSON_VALUE_OUT_OF_RANGE 3155
+#define ER_INVALID_JSON_VALUE_FOR_CAST 3156
+#define ER_JSON_DOCUMENT_TOO_DEEP 3157
+#define ER_JSON_DOCUMENT_NULL_KEY 3158
+#define ER_SECURE_TRANSPORT_REQUIRED 3159
+#define ER_NO_SECURE_TRANSPORTS_CONFIGURED 3160
+#define ER_DISABLED_STORAGE_ENGINE 3161
+#define ER_USER_DOES_NOT_EXIST 3162
+#define ER_USER_ALREADY_EXISTS 3163
+#define ER_AUDIT_API_ABORT 3164
+#define ER_INVALID_JSON_PATH_ARRAY_CELL 3165
+#define ER_BUFPOOL_RESIZE_INPROGRESS 3166
+#define ER_FEATURE_DISABLED_SEE_DOC 3167
+#define ER_SERVER_ISNT_AVAILABLE 3168
+#define ER_SESSION_WAS_KILLED 3169
+#define ER_CAPACITY_EXCEEDED 3170
+#define ER_CAPACITY_EXCEEDED_IN_RANGE_OPTIMIZER 3171
+//#define OBSOLETE_ER_TABLE_NEEDS_UPG_PART 3172
+#define ER_CANT_WAIT_FOR_EXECUTED_GTID_SET_WHILE_OWNING_A_GTID 3173
+#define ER_CANNOT_ADD_FOREIGN_BASE_COL_VIRTUAL 3174
+#define ER_CANNOT_CREATE_VIRTUAL_INDEX_CONSTRAINT 3175
+#define ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE 3176
+#define ER_LOCK_REFUSED_BY_ENGINE 3177
+#define ER_UNSUPPORTED_ALTER_ONLINE_ON_VIRTUAL_COLUMN 3178
+#define ER_MASTER_KEY_ROTATION_NOT_SUPPORTED_BY_SE 3179
+//#define OBSOLETE_ER_MASTER_KEY_ROTATION_ERROR_BY_SE 3180
+#define ER_MASTER_KEY_ROTATION_BINLOG_FAILED 3181
+#define ER_MASTER_KEY_ROTATION_SE_UNAVAILABLE 3182
+#define ER_TABLESPACE_CANNOT_ENCRYPT 3183
+#define ER_INVALID_ENCRYPTION_OPTION 3184
+#define ER_CANNOT_FIND_KEY_IN_KEYRING 3185
+#define ER_CAPACITY_EXCEEDED_IN_PARSER 3186
+#define ER_UNSUPPORTED_ALTER_ENCRYPTION_INPLACE 3187
+#define ER_KEYRING_UDF_KEYRING_SERVICE_ERROR 3188
+#define ER_USER_COLUMN_OLD_LENGTH 3189
+#define ER_CANT_RESET_MASTER 3190
+#define ER_GROUP_REPLICATION_MAX_GROUP_SIZE 3191
+#define ER_CANNOT_ADD_FOREIGN_BASE_COL_STORED 3192
+#define ER_TABLE_REFERENCED 3193
+//#define OBSOLETE_ER_PARTITION_ENGINE_DEPRECATED_FOR_TABLE 3194
+//#define OBSOLETE_ER_WARN_USING_GEOMFROMWKB_TO_SET_SRID_ZERO 3195
+//#define OBSOLETE_ER_WARN_USING_GEOMFROMWKB_TO_SET_SRID 3196
+#define ER_XA_RETRY 3197
+#define ER_KEYRING_AWS_UDF_AWS_KMS_ERROR 3198
+#define ER_BINLOG_UNSAFE_XA 3199
+#define ER_UDF_ERROR 3200
+#define ER_KEYRING_MIGRATION_FAILURE 3201
+#define ER_KEYRING_ACCESS_DENIED_ERROR 3202
+#define ER_KEYRING_MIGRATION_STATUS 3203
+//#define OBSOLETE_ER_PLUGIN_FAILED_TO_OPEN_TABLES 3204
+//#define OBSOLETE_ER_PLUGIN_FAILED_TO_OPEN_TABLE 3205
+//#define OBSOLETE_ER_AUDIT_LOG_NO_KEYRING_PLUGIN_INSTALLED 3206
+//#define OBSOLETE_ER_AUDIT_LOG_ENCRYPTION_PASSWORD_HAS_NOT_BEEN_SET 3207
+//#define OBSOLETE_ER_AUDIT_LOG_COULD_NOT_CREATE_AES_KEY 3208
+//#define OBSOLETE_ER_AUDIT_LOG_ENCRYPTION_PASSWORD_CANNOT_BE_FETCHED 3209
+//#define OBSOLETE_ER_AUDIT_LOG_JSON_FILTERING_NOT_ENABLED 3210
+//#define OBSOLETE_ER_AUDIT_LOG_UDF_INSUFFICIENT_PRIVILEGE 3211
+//#define OBSOLETE_ER_AUDIT_LOG_SUPER_PRIVILEGE_REQUIRED 3212
+//#define OBSOLETE_ER_COULD_NOT_REINITIALIZE_AUDIT_LOG_FILTERS 3213
+//#define OBSOLETE_ER_AUDIT_LOG_UDF_INVALID_ARGUMENT_TYPE 3214
+//#define OBSOLETE_ER_AUDIT_LOG_UDF_INVALID_ARGUMENT_COUNT 3215
+//#define OBSOLETE_ER_AUDIT_LOG_HAS_NOT_BEEN_INSTALLED 3216
+//#define OBSOLETE_ER_AUDIT_LOG_UDF_READ_INVALID_MAX_ARRAY_LENGTH_ARG_TYPE 3217
+#define ER_AUDIT_LOG_UDF_READ_INVALID_MAX_ARRAY_LENGTH_ARG_VALUE 3218
+//#define OBSOLETE_ER_AUDIT_LOG_JSON_FILTER_PARSING_ERROR 3219
+//#define OBSOLETE_ER_AUDIT_LOG_JSON_FILTER_NAME_CANNOT_BE_EMPTY 3220
+//#define OBSOLETE_ER_AUDIT_LOG_JSON_USER_NAME_CANNOT_BE_EMPTY 3221
+//#define OBSOLETE_ER_AUDIT_LOG_JSON_FILTER_DOES_NOT_EXISTS 3222
+//#define OBSOLETE_ER_AUDIT_LOG_USER_FIRST_CHARACTER_MUST_BE_ALPHANUMERIC 3223
+//#define OBSOLETE_ER_AUDIT_LOG_USER_NAME_INVALID_CHARACTER 3224
+//#define OBSOLETE_ER_AUDIT_LOG_HOST_NAME_INVALID_CHARACTER 3225
+#define OBSOLETE_WARN_DEPRECATED_MAXDB_SQL_MODE_FOR_TIMESTAMP 3226
+#define ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE 3500
+#define ER_ACL_OPERATION_FAILED 3501
+#define ER_UNSUPPORTED_INDEX_ALGORITHM 3502
+#define ER_NO_SUCH_DB 3503
+#define ER_TOO_BIG_ENUM 3504
+#define ER_TOO_LONG_SET_ENUM_VALUE 3505
+#define ER_INVALID_DD_OBJECT 3506
+#define ER_UPDATING_DD_TABLE 3507
+#define ER_INVALID_DD_OBJECT_ID 3508
+#define ER_INVALID_DD_OBJECT_NAME 3509
+#define ER_TABLESPACE_MISSING_WITH_NAME 3510
+#define ER_TOO_LONG_ROUTINE_COMMENT 3511
+#define ER_SP_LOAD_FAILED 3512
+#define ER_INVALID_BITWISE_OPERANDS_SIZE 3513
+#define ER_INVALID_BITWISE_AGGREGATE_OPERANDS_SIZE 3514
+#define ER_WARN_UNSUPPORTED_HINT 3515
+#define ER_UNEXPECTED_GEOMETRY_TYPE 3516
+#define ER_SRS_PARSE_ERROR 3517
+#define ER_SRS_PROJ_PARAMETER_MISSING 3518
+#define ER_WARN_SRS_NOT_FOUND 3519
+#define ER_SRS_NOT_CARTESIAN 3520
+#define ER_SRS_NOT_CARTESIAN_UNDEFINED 3521
+#define ER_PK_INDEX_CANT_BE_INVISIBLE 3522
+#define ER_UNKNOWN_AUTHID 3523
+#define ER_FAILED_ROLE_GRANT 3524
+#define ER_OPEN_ROLE_TABLES 3525
+#define ER_FAILED_DEFAULT_ROLES 3526
+#define ER_COMPONENTS_NO_SCHEME 3527
+#define ER_COMPONENTS_NO_SCHEME_SERVICE 3528
+#define ER_COMPONENTS_CANT_LOAD 3529
+#define ER_ROLE_NOT_GRANTED 3530
+#define ER_FAILED_REVOKE_ROLE 3531
+#define ER_RENAME_ROLE 3532
+#define ER_COMPONENTS_CANT_ACQUIRE_SERVICE_IMPLEMENTATION 3533
+#define ER_COMPONENTS_CANT_SATISFY_DEPENDENCY 3534
+#define ER_COMPONENTS_LOAD_CANT_REGISTER_SERVICE_IMPLEMENTATION 3535
+#define ER_COMPONENTS_LOAD_CANT_INITIALIZE 3536
+#define ER_COMPONENTS_UNLOAD_NOT_LOADED 3537
+#define ER_COMPONENTS_UNLOAD_CANT_DEINITIALIZE 3538
+#define ER_COMPONENTS_CANT_RELEASE_SERVICE 3539
+#define ER_COMPONENTS_UNLOAD_CANT_UNREGISTER_SERVICE 3540
+#define ER_COMPONENTS_CANT_UNLOAD 3541
+#define ER_WARN_UNLOAD_THE_NOT_PERSISTED 3542
+#define ER_COMPONENT_TABLE_INCORRECT 3543
+#define ER_COMPONENT_MANIPULATE_ROW_FAILED 3544
+#define ER_COMPONENTS_UNLOAD_DUPLICATE_IN_GROUP 3545
+#define ER_CANT_SET_GTID_PURGED_DUE_SETS_CONSTRAINTS 3546
+#define ER_CANNOT_LOCK_USER_MANAGEMENT_CACHES 3547
+#define ER_SRS_NOT_FOUND 3548
+#define ER_VARIABLE_NOT_PERSISTED 3549
+#define ER_IS_QUERY_INVALID_CLAUSE 3550
+#define ER_UNABLE_TO_STORE_STATISTICS 3551
+#define ER_NO_SYSTEM_SCHEMA_ACCESS 3552
+#define ER_NO_SYSTEM_TABLESPACE_ACCESS 3553
+#define ER_NO_SYSTEM_TABLE_ACCESS 3554
+#define ER_NO_SYSTEM_TABLE_ACCESS_FOR_DICTIONARY_TABLE 3555
+#define ER_NO_SYSTEM_TABLE_ACCESS_FOR_SYSTEM_TABLE 3556
+#define ER_NO_SYSTEM_TABLE_ACCESS_FOR_TABLE 3557
+#define ER_INVALID_OPTION_KEY 3558
+#define ER_INVALID_OPTION_VALUE 3559
+#define ER_INVALID_OPTION_KEY_VALUE_PAIR 3560
+#define ER_INVALID_OPTION_START_CHARACTER 3561
+#define ER_INVALID_OPTION_END_CHARACTER 3562
+#define ER_INVALID_OPTION_CHARACTERS 3563
+#define ER_DUPLICATE_OPTION_KEY 3564
+#define ER_WARN_SRS_NOT_FOUND_AXIS_ORDER 3565
+#define ER_NO_ACCESS_TO_NATIVE_FCT 3566
+#define ER_RESET_MASTER_TO_VALUE_OUT_OF_RANGE 3567
+#define ER_UNRESOLVED_TABLE_LOCK 3568
+#define ER_DUPLICATE_TABLE_LOCK 3569
+#define ER_BINLOG_UNSAFE_SKIP_LOCKED 3570
+#define ER_BINLOG_UNSAFE_NOWAIT 3571
+#define ER_LOCK_NOWAIT 3572
+#define ER_CTE_RECURSIVE_REQUIRES_UNION 3573
+#define ER_CTE_RECURSIVE_REQUIRES_NONRECURSIVE_FIRST 3574
+#define ER_CTE_RECURSIVE_FORBIDS_AGGREGATION 3575
+#define ER_CTE_RECURSIVE_FORBIDDEN_JOIN_ORDER 3576
+#define ER_CTE_RECURSIVE_REQUIRES_SINGLE_REFERENCE 3577
+#define ER_SWITCH_TMP_ENGINE 3578
+#define ER_WINDOW_NO_SUCH_WINDOW 3579
+#define ER_WINDOW_CIRCULARITY_IN_WINDOW_GRAPH 3580
+#define ER_WINDOW_NO_CHILD_PARTITIONING 3581
+#define ER_WINDOW_NO_INHERIT_FRAME 3582
+#define ER_WINDOW_NO_REDEFINE_ORDER_BY 3583
+#define ER_WINDOW_FRAME_START_ILLEGAL 3584
+#define ER_WINDOW_FRAME_END_ILLEGAL 3585
+#define ER_WINDOW_FRAME_ILLEGAL 3586
+#define ER_WINDOW_RANGE_FRAME_ORDER_TYPE 3587
+#define ER_WINDOW_RANGE_FRAME_TEMPORAL_TYPE 3588
+#define ER_WINDOW_RANGE_FRAME_NUMERIC_TYPE 3589
+#define ER_WINDOW_RANGE_BOUND_NOT_CONSTANT 3590
+#define ER_WINDOW_DUPLICATE_NAME 3591
+#define ER_WINDOW_ILLEGAL_ORDER_BY 3592
+#define ER_WINDOW_INVALID_WINDOW_FUNC_USE 3593
+#define ER_WINDOW_INVALID_WINDOW_FUNC_ALIAS_USE 3594
+#define ER_WINDOW_NESTED_WINDOW_FUNC_USE_IN_WINDOW_SPEC 3595
+#define ER_WINDOW_ROWS_INTERVAL_USE 3596
+#define ER_WINDOW_NO_GROUP_ORDER_UNUSED 3597
+#define ER_WINDOW_EXPLAIN_JSON 3598
+#define ER_WINDOW_FUNCTION_IGNORES_FRAME 3599
+#define ER_WL9236_NOW_UNUSED 3600
+#define ER_INVALID_NO_OF_ARGS 3601
+#define ER_FIELD_IN_GROUPING_NOT_GROUP_BY 3602
+#define ER_TOO_LONG_TABLESPACE_COMMENT 3603
+#define ER_ENGINE_CANT_DROP_TABLE 3604
+#define ER_ENGINE_CANT_DROP_MISSING_TABLE 3605
+#define ER_TABLESPACE_DUP_FILENAME 3606
+#define ER_DB_DROP_RMDIR2 3607
+#define ER_IMP_NO_FILES_MATCHED 3608
+#define ER_IMP_SCHEMA_DOES_NOT_EXIST 3609
+#define ER_IMP_TABLE_ALREADY_EXISTS 3610
+#define ER_IMP_INCOMPATIBLE_MYSQLD_VERSION 3611
+#define ER_IMP_INCOMPATIBLE_DD_VERSION 3612
+#define ER_IMP_INCOMPATIBLE_SDI_VERSION 3613
+#define ER_WARN_INVALID_HINT 3614
+#define ER_VAR_DOES_NOT_EXIST 3615
+#define ER_LONGITUDE_OUT_OF_RANGE 3616
+#define ER_LATITUDE_OUT_OF_RANGE 3617
+#define ER_NOT_IMPLEMENTED_FOR_GEOGRAPHIC_SRS 3618
+#define ER_ILLEGAL_PRIVILEGE_LEVEL 3619
+#define ER_NO_SYSTEM_VIEW_ACCESS 3620
+#define ER_COMPONENT_FILTER_FLABBERGASTED 3621
+#define ER_PART_EXPR_TOO_LONG 3622
+#define ER_UDF_DROP_DYNAMICALLY_REGISTERED 3623
+#define ER_UNABLE_TO_STORE_COLUMN_STATISTICS 3624
+#define ER_UNABLE_TO_UPDATE_COLUMN_STATISTICS 3625
+#define ER_UNABLE_TO_DROP_COLUMN_STATISTICS 3626
+#define ER_UNABLE_TO_BUILD_HISTOGRAM 3627
+#define ER_MANDATORY_ROLE 3628
+#define ER_MISSING_TABLESPACE_FILE 3629
+#define ER_PERSIST_ONLY_ACCESS_DENIED_ERROR 3630
+#define ER_CMD_NEED_SUPER 3631
+#define ER_PATH_IN_DATADIR 3632
+#define ER_CLONE_DDL_IN_PROGRESS 3633
+#define ER_CLONE_TOO_MANY_CONCURRENT_CLONES 3634
+#define ER_APPLIER_LOG_EVENT_VALIDATION_ERROR 3635
+#define ER_CTE_MAX_RECURSION_DEPTH 3636
+#define ER_NOT_HINT_UPDATABLE_VARIABLE 3637
+#define ER_CREDENTIALS_CONTRADICT_TO_HISTORY 3638
+#define ER_WARNING_PASSWORD_HISTORY_CLAUSES_VOID 3639
+#define ER_CLIENT_DOES_NOT_SUPPORT 3640
+#define ER_I_S_SKIPPED_TABLESPACE 3641
+#define ER_TABLESPACE_ENGINE_MISMATCH 3642
+#define ER_WRONG_SRID_FOR_COLUMN 3643
+#define ER_CANNOT_ALTER_SRID_DUE_TO_INDEX 3644
+#define ER_WARN_BINLOG_PARTIAL_UPDATES_DISABLED 3645
+#define ER_WARN_BINLOG_V1_ROW_EVENTS_DISABLED 3646
+#define ER_WARN_BINLOG_PARTIAL_UPDATES_SUGGESTS_PARTIAL_IMAGES 3647
+#define ER_COULD_NOT_APPLY_JSON_DIFF 3648
+#define ER_CORRUPTED_JSON_DIFF 3649
+#define ER_RESOURCE_GROUP_EXISTS 3650
+#define ER_RESOURCE_GROUP_NOT_EXISTS 3651
+#define ER_INVALID_VCPU_ID 3652
+#define ER_INVALID_VCPU_RANGE 3653
+#define ER_INVALID_THREAD_PRIORITY 3654
+#define ER_DISALLOWED_OPERATION 3655
+#define ER_RESOURCE_GROUP_BUSY 3656
+#define ER_RESOURCE_GROUP_DISABLED 3657
+#define ER_FEATURE_UNSUPPORTED 3658
+#define ER_ATTRIBUTE_IGNORED 3659
+#define ER_INVALID_THREAD_ID 3660
+#define ER_RESOURCE_GROUP_BIND_FAILED 3661
+#define ER_INVALID_USE_OF_FORCE_OPTION 3662
+#define ER_GROUP_REPLICATION_COMMAND_FAILURE 3663
+#define ER_SDI_OPERATION_FAILED 3664
+#define ER_MISSING_JSON_TABLE_VALUE 3665
+#define ER_WRONG_JSON_TABLE_VALUE 3666
+#define ER_TF_MUST_HAVE_ALIAS 3667
+#define ER_TF_FORBIDDEN_JOIN_TYPE 3668
+#define ER_JT_VALUE_OUT_OF_RANGE 3669
+#define ER_JT_MAX_NESTED_PATH 3670
+#define ER_PASSWORD_EXPIRATION_NOT_SUPPORTED_BY_AUTH_METHOD 3671
+#define ER_INVALID_GEOJSON_CRS_NOT_TOP_LEVEL 3672
+#define ER_BAD_NULL_ERROR_NOT_IGNORED 3673
+#define WARN_USELESS_SPATIAL_INDEX 3674
+#define ER_DISK_FULL_NOWAIT 3675
+#define ER_PARSE_ERROR_IN_DIGEST_FN 3676
+#define ER_UNDISCLOSED_PARSE_ERROR_IN_DIGEST_FN 3677
+#define ER_SCHEMA_DIR_EXISTS 3678
+#define ER_SCHEMA_DIR_MISSING 3679
+#define ER_SCHEMA_DIR_CREATE_FAILED 3680
+#define ER_SCHEMA_DIR_UNKNOWN 3681
+#define ER_ONLY_IMPLEMENTED_FOR_SRID_0_AND_4326 3682
+#define ER_BINLOG_EXPIRE_LOG_DAYS_AND_SECS_USED_TOGETHER 3683
+#define ER_REGEXP_BUFFER_OVERFLOW 3684
+#define ER_REGEXP_ILLEGAL_ARGUMENT 3685
+#define ER_REGEXP_INDEX_OUTOFBOUNDS_ERROR 3686
+#define ER_REGEXP_INTERNAL_ERROR 3687
+#define ER_REGEXP_RULE_SYNTAX 3688
+#define ER_REGEXP_BAD_ESCAPE_SEQUENCE 3689
+#define ER_REGEXP_UNIMPLEMENTED 3690
+#define ER_REGEXP_MISMATCHED_PAREN 3691
+#define ER_REGEXP_BAD_INTERVAL 3692
+#define ER_REGEXP_MAX_LT_MIN 3693
+#define ER_REGEXP_INVALID_BACK_REF 3694
+#define ER_REGEXP_LOOK_BEHIND_LIMIT 3695
+#define ER_REGEXP_MISSING_CLOSE_BRACKET 3696
+#define ER_REGEXP_INVALID_RANGE 3697
+#define ER_REGEXP_STACK_OVERFLOW 3698
+#define ER_REGEXP_TIME_OUT 3699
+#define ER_REGEXP_PATTERN_TOO_BIG 3700
+#define ER_CANT_SET_ERROR_LOG_SERVICE 3701
+#define ER_EMPTY_PIPELINE_FOR_ERROR_LOG_SERVICE 3702
+#define ER_COMPONENT_FILTER_DIAGNOSTICS 3703
+#define ER_NOT_IMPLEMENTED_FOR_CARTESIAN_SRS 3704
+#define ER_NOT_IMPLEMENTED_FOR_PROJECTED_SRS 3705
+#define ER_NONPOSITIVE_RADIUS 3706
+#define ER_RESTART_SERVER_FAILED 3707
+#define ER_SRS_MISSING_MANDATORY_ATTRIBUTE 3708
+#define ER_SRS_MULTIPLE_ATTRIBUTE_DEFINITIONS 3709
+#define ER_SRS_NAME_CANT_BE_EMPTY_OR_WHITESPACE 3710
+#define ER_SRS_ORGANIZATION_CANT_BE_EMPTY_OR_WHITESPACE 3711
+#define ER_SRS_ID_ALREADY_EXISTS 3712
+#define ER_WARN_SRS_ID_ALREADY_EXISTS 3713
+#define ER_CANT_MODIFY_SRID_0 3714
+#define ER_WARN_RESERVED_SRID_RANGE 3715
+#define ER_CANT_MODIFY_SRS_USED_BY_COLUMN 3716
+#define ER_SRS_INVALID_CHARACTER_IN_ATTRIBUTE 3717
+#define ER_SRS_ATTRIBUTE_STRING_TOO_LONG 3718
+#define ER_DEPRECATED_UTF8_ALIAS 3719
+#define ER_DEPRECATED_NATIONAL 3720
+#define ER_INVALID_DEFAULT_UTF8MB4_COLLATION 3721
+#define ER_UNABLE_TO_COLLECT_LOG_STATUS 3722
+#define ER_RESERVED_TABLESPACE_NAME 3723
+#define ER_UNABLE_TO_SET_OPTION 3724
+#define ER_SLAVE_POSSIBLY_DIVERGED_AFTER_DDL 3725
+#define ER_SRS_NOT_GEOGRAPHIC 3726
+#define ER_POLYGON_TOO_LARGE 3727
+#define ER_SPATIAL_UNIQUE_INDEX 3728
+#define ER_INDEX_TYPE_NOT_SUPPORTED_FOR_SPATIAL_INDEX 3729
+#define ER_FK_CANNOT_DROP_PARENT 3730
+#define ER_GEOMETRY_PARAM_LONGITUDE_OUT_OF_RANGE 3731
+#define ER_GEOMETRY_PARAM_LATITUDE_OUT_OF_RANGE 3732
+#define ER_FK_CANNOT_USE_VIRTUAL_COLUMN 3733
+#define ER_FK_NO_COLUMN_PARENT 3734
+#define ER_CANT_SET_ERROR_SUPPRESSION_LIST 3735
+#define ER_SRS_GEOGCS_INVALID_AXES 3736
+#define ER_SRS_INVALID_SEMI_MAJOR_AXIS 3737
+#define ER_SRS_INVALID_INVERSE_FLATTENING 3738
+#define ER_SRS_INVALID_ANGULAR_UNIT 3739
+#define ER_SRS_INVALID_PRIME_MERIDIAN 3740
+#define ER_TRANSFORM_SOURCE_SRS_NOT_SUPPORTED 3741
+#define ER_TRANSFORM_TARGET_SRS_NOT_SUPPORTED 3742
+#define ER_TRANSFORM_SOURCE_SRS_MISSING_TOWGS84 3743
+#define ER_TRANSFORM_TARGET_SRS_MISSING_TOWGS84 3744
+#define ER_TEMP_TABLE_PREVENTS_SWITCH_SESSION_BINLOG_FORMAT 3745
+#define ER_TEMP_TABLE_PREVENTS_SWITCH_GLOBAL_BINLOG_FORMAT 3746
+#define ER_RUNNING_APPLIER_PREVENTS_SWITCH_GLOBAL_BINLOG_FORMAT 3747
+#define ER_CLIENT_GTID_UNSAFE_CREATE_DROP_TEMP_TABLE_IN_TRX_IN_SBR 3748
+//#define OBSOLETE_ER_XA_CANT_CREATE_MDL_BACKUP 3749
+#define ER_TABLE_WITHOUT_PK 3750
+#define ER_WARN_DATA_TRUNCATED_FUNCTIONAL_INDEX 3751
+#define ER_WARN_DATA_OUT_OF_RANGE_FUNCTIONAL_INDEX 3752
+#define ER_FUNCTIONAL_INDEX_ON_JSON_OR_GEOMETRY_FUNCTION 3753
+#define ER_FUNCTIONAL_INDEX_REF_AUTO_INCREMENT 3754
+#define ER_CANNOT_DROP_COLUMN_FUNCTIONAL_INDEX 3755
+#define ER_FUNCTIONAL_INDEX_PRIMARY_KEY 3756
+#define ER_FUNCTIONAL_INDEX_ON_LOB 3757
+#define ER_FUNCTIONAL_INDEX_FUNCTION_IS_NOT_ALLOWED 3758
+#define ER_FULLTEXT_FUNCTIONAL_INDEX 3759
+#define ER_SPATIAL_FUNCTIONAL_INDEX 3760
+#define ER_WRONG_KEY_COLUMN_FUNCTIONAL_INDEX 3761
+#define ER_FUNCTIONAL_INDEX_ON_FIELD 3762
+#define ER_GENERATED_COLUMN_NAMED_FUNCTION_IS_NOT_ALLOWED 3763
+#define ER_GENERATED_COLUMN_ROW_VALUE 3764
+#define ER_GENERATED_COLUMN_VARIABLES 3765
+#define ER_DEPENDENT_BY_DEFAULT_GENERATED_VALUE 3766
+#define ER_DEFAULT_VAL_GENERATED_NON_PRIOR 3767
+#define ER_DEFAULT_VAL_GENERATED_REF_AUTO_INC 3768
+#define ER_DEFAULT_VAL_GENERATED_FUNCTION_IS_NOT_ALLOWED 3769
+#define ER_DEFAULT_VAL_GENERATED_NAMED_FUNCTION_IS_NOT_ALLOWED 3770
+#define ER_DEFAULT_VAL_GENERATED_ROW_VALUE 3771
+#define ER_DEFAULT_VAL_GENERATED_VARIABLES 3772
+#define ER_DEFAULT_AS_VAL_GENERATED 3773
+#define ER_UNSUPPORTED_ACTION_ON_DEFAULT_VAL_GENERATED 3774
+#define ER_GTID_UNSAFE_ALTER_ADD_COL_WITH_DEFAULT_EXPRESSION 3775
+#define ER_FK_CANNOT_CHANGE_ENGINE 3776
+#define ER_WARN_DEPRECATED_USER_SET_EXPR 3777
+#define ER_WARN_DEPRECATED_UTF8MB3_COLLATION 3778
+#define ER_WARN_DEPRECATED_NESTED_COMMENT_SYNTAX 3779
+#define ER_FK_INCOMPATIBLE_COLUMNS 3780
+#define ER_GR_HOLD_WAIT_TIMEOUT 3781
+#define ER_GR_HOLD_KILLED 3782
+#define ER_GR_HOLD_MEMBER_STATUS_ERROR 3783
+#define ER_RPL_ENCRYPTION_FAILED_TO_FETCH_KEY 3784
+#define ER_RPL_ENCRYPTION_KEY_NOT_FOUND 3785
+#define ER_RPL_ENCRYPTION_KEYRING_INVALID_KEY 3786
+#define ER_RPL_ENCRYPTION_HEADER_ERROR 3787
+#define ER_RPL_ENCRYPTION_FAILED_TO_ROTATE_LOGS 3788
+#define ER_RPL_ENCRYPTION_KEY_EXISTS_UNEXPECTED 3789
+#define ER_RPL_ENCRYPTION_FAILED_TO_GENERATE_KEY 3790
+#define ER_RPL_ENCRYPTION_FAILED_TO_STORE_KEY 3791
+#define ER_RPL_ENCRYPTION_FAILED_TO_REMOVE_KEY 3792
+#define ER_RPL_ENCRYPTION_UNABLE_TO_CHANGE_OPTION 3793
+#define ER_RPL_ENCRYPTION_MASTER_KEY_RECOVERY_FAILED 3794
+#define ER_SLOW_LOG_MODE_IGNORED_WHEN_NOT_LOGGING_TO_FILE 3795
+#define ER_GRP_TRX_CONSISTENCY_NOT_ALLOWED 3796
+#define ER_GRP_TRX_CONSISTENCY_BEFORE 3797
+#define ER_GRP_TRX_CONSISTENCY_AFTER_ON_TRX_BEGIN 3798
+#define ER_GRP_TRX_CONSISTENCY_BEGIN_NOT_ALLOWED 3799
+#define ER_FUNCTIONAL_INDEX_ROW_VALUE_IS_NOT_ALLOWED 3800
+#define ER_RPL_ENCRYPTION_FAILED_TO_ENCRYPT 3801
+#define ER_PAGE_TRACKING_NOT_STARTED 3802
+#define ER_PAGE_TRACKING_RANGE_NOT_TRACKED 3803
+#define ER_PAGE_TRACKING_CANNOT_PURGE 3804
+#define ER_RPL_ENCRYPTION_CANNOT_ROTATE_BINLOG_MASTER_KEY 3805
+#define ER_BINLOG_MASTER_KEY_RECOVERY_OUT_OF_COMBINATION 3806
+#define ER_BINLOG_MASTER_KEY_ROTATION_FAIL_TO_OPERATE_KEY 3807
+#define ER_BINLOG_MASTER_KEY_ROTATION_FAIL_TO_ROTATE_LOGS 3808
+#define ER_BINLOG_MASTER_KEY_ROTATION_FAIL_TO_REENCRYPT_LOG 3809
+#define ER_BINLOG_MASTER_KEY_ROTATION_FAIL_TO_CLEANUP_UNUSED_KEYS 3810
+#define ER_BINLOG_MASTER_KEY_ROTATION_FAIL_TO_CLEANUP_AUX_KEY 3811
+#define ER_NON_BOOLEAN_EXPR_FOR_CHECK_CONSTRAINT 3812
+#define ER_COLUMN_CHECK_CONSTRAINT_REFERENCES_OTHER_COLUMN 3813
+#define ER_CHECK_CONSTRAINT_NAMED_FUNCTION_IS_NOT_ALLOWED 3814
+#define ER_CHECK_CONSTRAINT_FUNCTION_IS_NOT_ALLOWED 3815
+#define ER_CHECK_CONSTRAINT_VARIABLES 3816
+#define ER_CHECK_CONSTRAINT_ROW_VALUE 3817
+#define ER_CHECK_CONSTRAINT_REFERS_AUTO_INCREMENT_COLUMN 3818
+#define ER_CHECK_CONSTRAINT_VIOLATED 3819
+#define ER_CHECK_CONSTRAINT_REFERS_UNKNOWN_COLUMN 3820
+#define ER_CHECK_CONSTRAINT_NOT_FOUND 3821
+#define ER_CHECK_CONSTRAINT_DUP_NAME 3822
+#define ER_CHECK_CONSTRAINT_CLAUSE_USING_FK_REFER_ACTION_COLUMN 3823
+#define WARN_UNENCRYPTED_TABLE_IN_ENCRYPTED_DB 3824
+#define ER_INVALID_ENCRYPTION_REQUEST 3825
+#define ER_CANNOT_SET_TABLE_ENCRYPTION 3826
+#define ER_CANNOT_SET_DATABASE_ENCRYPTION 3827
+#define ER_CANNOT_SET_TABLESPACE_ENCRYPTION 3828
+#define ER_TABLESPACE_CANNOT_BE_ENCRYPTED 3829
+#define ER_TABLESPACE_CANNOT_BE_DECRYPTED 3830
+#define ER_TABLESPACE_TYPE_UNKNOWN 3831
+#define ER_TARGET_TABLESPACE_UNENCRYPTED 3832
+#define ER_CANNOT_USE_ENCRYPTION_CLAUSE 3833
+#define ER_INVALID_MULTIPLE_CLAUSES 3834
+#define ER_UNSUPPORTED_USE_OF_GRANT_AS 3835
+#define ER_UKNOWN_AUTH_ID_OR_ACCESS_DENIED_FOR_GRANT_AS 3836
+#define ER_DEPENDENT_BY_FUNCTIONAL_INDEX 3837
+#define ER_PLUGIN_NOT_EARLY 3838
+#define ER_INNODB_REDO_LOG_ARCHIVE_START_SUBDIR_PATH 3839
+#define ER_INNODB_REDO_LOG_ARCHIVE_START_TIMEOUT 3840
+#define ER_INNODB_REDO_LOG_ARCHIVE_DIRS_INVALID 3841
+#define ER_INNODB_REDO_LOG_ARCHIVE_LABEL_NOT_FOUND 3842
+#define ER_INNODB_REDO_LOG_ARCHIVE_DIR_EMPTY 3843
+#define ER_INNODB_REDO_LOG_ARCHIVE_NO_SUCH_DIR 3844
+#define ER_INNODB_REDO_LOG_ARCHIVE_DIR_CLASH 3845
+#define ER_INNODB_REDO_LOG_ARCHIVE_DIR_PERMISSIONS 3846
+#define ER_INNODB_REDO_LOG_ARCHIVE_FILE_CREATE 3847
+#define ER_INNODB_REDO_LOG_ARCHIVE_ACTIVE 3848
+#define ER_INNODB_REDO_LOG_ARCHIVE_INACTIVE 3849
+#define ER_INNODB_REDO_LOG_ARCHIVE_FAILED 3850
+#define ER_INNODB_REDO_LOG_ARCHIVE_SESSION 3851
+#define ER_STD_REGEX_ERROR 3852
+#define ER_INVALID_JSON_TYPE 3853
+#define ER_CANNOT_CONVERT_STRING 3854
+#define ER_DEPENDENT_BY_PARTITION_FUNC 3855
+#define ER_WARN_DEPRECATED_FLOAT_AUTO_INCREMENT 3856
+#define ER_RPL_CANT_STOP_SLAVE_WHILE_LOCKED_BACKUP 3857
+#define ER_WARN_DEPRECATED_FLOAT_DIGITS 3858
+#define ER_WARN_DEPRECATED_FLOAT_UNSIGNED 3859
+#define ER_WARN_DEPRECATED_INTEGER_DISPLAY_WIDTH 3860
+#define ER_WARN_DEPRECATED_ZEROFILL 3861
+#define ER_CLONE_DONOR 3862
+#define ER_CLONE_PROTOCOL 3863
+#define ER_CLONE_DONOR_VERSION 3864
+#define ER_CLONE_OS 3865
+#define ER_CLONE_PLATFORM 3866
+#define ER_CLONE_CHARSET 3867
+#define ER_CLONE_CONFIG 3868
+#define ER_CLONE_SYS_CONFIG 3869
+#define ER_CLONE_PLUGIN_MATCH 3870
+#define ER_CLONE_LOOPBACK 3871
+#define ER_CLONE_ENCRYPTION 3872
+#define ER_CLONE_DISK_SPACE 3873
+#define ER_CLONE_IN_PROGRESS 3874
+#define ER_CLONE_DISALLOWED 3875
+#define ER_CANNOT_GRANT_ROLES_TO_ANONYMOUS_USER 3876
+#define ER_SECONDARY_ENGINE_PLUGIN 3877
+#define ER_SECOND_PASSWORD_CANNOT_BE_EMPTY 3878
+#define ER_DB_ACCESS_DENIED 3879
+#define ER_DA_AUTH_ID_WITH_SYSTEM_USER_PRIV_IN_MANDATORY_ROLES 3880
+#define ER_DA_RPL_GTID_TABLE_CANNOT_OPEN 3881
+#define ER_GEOMETRY_IN_UNKNOWN_LENGTH_UNIT 3882
+#define ER_DA_PLUGIN_INSTALL_ERROR 3883
+#define ER_NO_SESSION_TEMP 3884
+#define ER_DA_UNKNOWN_ERROR_NUMBER 3885
+#define ER_COLUMN_CHANGE_SIZE 3886
+#define ER_REGEXP_INVALID_CAPTURE_GROUP_NAME 3887
+#define ER_DA_SSL_LIBRARY_ERROR 3888
+#define ER_SECONDARY_ENGINE 3889
+#define ER_SECONDARY_ENGINE_DDL 3890
+#define ER_INCORRECT_CURRENT_PASSWORD 3891
+#define ER_MISSING_CURRENT_PASSWORD 3892
+#define ER_CURRENT_PASSWORD_NOT_REQUIRED 3893
+#define ER_PASSWORD_CANNOT_BE_RETAINED_ON_PLUGIN_CHANGE 3894
+#define ER_CURRENT_PASSWORD_CANNOT_BE_RETAINED 3895
+#define ER_PARTIAL_REVOKES_EXIST 3896
+#define ER_CANNOT_GRANT_SYSTEM_PRIV_TO_MANDATORY_ROLE 3897
+#define ER_XA_REPLICATION_FILTERS 3898
+#define ER_UNSUPPORTED_SQL_MODE 3899
+#define ER_REGEXP_INVALID_FLAG 3900
+#define ER_PARTIAL_REVOKE_AND_DB_GRANT_BOTH_EXISTS 3901
+#define ER_UNIT_NOT_FOUND 3902
+#define ER_INVALID_JSON_VALUE_FOR_FUNC_INDEX 3903
+#define ER_JSON_VALUE_OUT_OF_RANGE_FOR_FUNC_INDEX 3904
+#define ER_EXCEEDED_MV_KEYS_NUM 3905
+#define ER_EXCEEDED_MV_KEYS_SPACE 3906
+#define ER_FUNCTIONAL_INDEX_DATA_IS_TOO_LONG 3907
+#define ER_WRONG_MVI_VALUE 3908
+#define ER_WARN_FUNC_INDEX_NOT_APPLICABLE 3909
+#define ER_GRP_RPL_UDF_ERROR 3910
+#define ER_UPDATE_GTID_PURGED_WITH_GR 3911
+#define ER_GROUPING_ON_TIMESTAMP_IN_DST 3912
+#define ER_TABLE_NAME_CAUSES_TOO_LONG_PATH 3913
+#define ER_AUDIT_LOG_INSUFFICIENT_PRIVILEGE 3914
+//#define OBSOLETE_ER_AUDIT_LOG_PASSWORD_HAS_BEEN_COPIED 3915
+#define ER_DA_GRP_RPL_STARTED_AUTO_REJOIN 3916
+#define ER_PARSER_TRACE 10000
+#define ER_BOOTSTRAP_CANT_THREAD 10001
+#define ER_TRIGGER_INVALID_VALUE 10002
+#define ER_OPT_WRONG_TREE 10003
+#define ER_DD_FAILSAFE 10004
+#define ER_DD_NO_WRITES_NO_REPOPULATION 10005
+#define ER_DD_VERSION_FOUND 10006
+#define ER_DD_VERSION_INSTALLED 10007
+#define ER_DD_VERSION_UNSUPPORTED 10008
+//#define OBSOLETE_ER_LOG_SYSLOG_FACILITY_FAIL 10009
+#define ER_LOG_SYSLOG_CANNOT_OPEN 10010
+#define ER_LOG_SLOW_CANNOT_OPEN 10011
+#define ER_LOG_GENERAL_CANNOT_OPEN 10012
+#define ER_LOG_CANNOT_WRITE 10013
+#define ER_RPL_ZOMBIE_ENCOUNTERED 10014
+#define ER_RPL_GTID_TABLE_CANNOT_OPEN 10015
+#define ER_SYSTEM_SCHEMA_NOT_FOUND 10016
+#define ER_DD_INIT_UPGRADE_FAILED 10017
+#define ER_VIEW_UNKNOWN_CHARSET_OR_COLLATION 10018
+#define ER_DD_VIEW_CANT_ALLOC_CHARSET 10019
+#define ER_DD_INIT_FAILED 10020
+#define ER_DD_UPDATING_PLUGIN_MD_FAILED 10021
+#define ER_DD_POPULATING_TABLES_FAILED 10022
+#define ER_DD_VIEW_CANT_CREATE 10023
+#define ER_DD_METADATA_NOT_FOUND 10024
+#define ER_DD_CACHE_NOT_EMPTY_AT_SHUTDOWN 10025
+#define ER_DD_OBJECT_REMAINS 10026
+#define ER_DD_OBJECT_REMAINS_IN_RELEASER 10027
+#define ER_DD_OBJECT_RELEASER_REMAINS 10028
+#define ER_DD_CANT_GET_OBJECT_KEY 10029
+#define ER_DD_CANT_CREATE_OBJECT_KEY 10030
+#define ER_CANT_CREATE_HANDLE_MGR_THREAD 10031
+#define ER_RPL_REPO_HAS_GAPS 10032
+#define ER_INVALID_VALUE_FOR_ENFORCE_GTID_CONSISTENCY 10033
+#define ER_CHANGED_ENFORCE_GTID_CONSISTENCY 10034
+#define ER_CHANGED_GTID_MODE 10035
+#define ER_DISABLED_STORAGE_ENGINE_AS_DEFAULT 10036
+#define ER_DEBUG_SYNC_HIT 10037
+#define ER_DEBUG_SYNC_EXECUTED 10038
+#define ER_DEBUG_SYNC_THREAD_MAX 10039
+#define ER_DEBUG_SYNC_OOM 10040
+#define ER_CANT_INIT_TC_LOG 10041
+#define ER_EVENT_CANT_INIT_QUEUE 10042
+#define ER_EVENT_PURGING_QUEUE 10043
+#define ER_EVENT_LAST_EXECUTION 10044
+#define ER_EVENT_MESSAGE_STACK 10045
+#define ER_EVENT_EXECUTION_FAILED 10046
+#define ER_CANT_INIT_SCHEDULER_THREAD 10047
+#define ER_SCHEDULER_STOPPED 10048
+#define ER_CANT_CREATE_SCHEDULER_THREAD 10049
+#define ER_SCHEDULER_WAITING 10050
+#define ER_SCHEDULER_STARTED 10051
+#define ER_SCHEDULER_STOPPING_FAILED_TO_GET_EVENT 10052
+#define ER_SCHEDULER_STOPPING_FAILED_TO_CREATE_WORKER 10053
+#define ER_SCHEDULER_KILLING 10054
+#define ER_UNABLE_TO_RESOLVE_IP 10055
+#define ER_UNABLE_TO_RESOLVE_HOSTNAME 10056
+#define ER_HOSTNAME_RESEMBLES_IPV4 10057
+#define ER_HOSTNAME_DOESNT_RESOLVE_TO 10058
+#define ER_ADDRESSES_FOR_HOSTNAME_HEADER 10059
+#define ER_ADDRESSES_FOR_HOSTNAME_LIST_ITEM 10060
+#define ER_TRG_WITHOUT_DEFINER 10061
+#define ER_TRG_NO_CLIENT_CHARSET 10062
+#define ER_PARSING_VIEW 10063
+#define ER_COMPONENTS_INFRASTRUCTURE_BOOTSTRAP 10064
+#define ER_COMPONENTS_INFRASTRUCTURE_SHUTDOWN 10065
+#define ER_COMPONENTS_PERSIST_LOADER_BOOTSTRAP 10066
+#define ER_DEPART_WITH_GRACE 10067
+#define ER_CA_SELF_SIGNED 10068
+#define ER_SSL_LIBRARY_ERROR 10069
+#define ER_NO_THD_NO_UUID 10070
+#define ER_UUID_SALT 10071
+#define ER_UUID_IS 10072
+#define ER_UUID_INVALID 10073
+#define ER_UUID_SCRUB 10074
+#define ER_CREATING_NEW_UUID 10075
+#define ER_CANT_CREATE_UUID 10076
+#define ER_UNKNOWN_UNSUPPORTED_STORAGE_ENGINE 10077
+#define ER_SECURE_AUTH_VALUE_UNSUPPORTED 10078
+#define ER_INVALID_INSTRUMENT 10079
+#define ER_INNODB_MANDATORY 10080
+//#define OBSOLETE_ER_INNODB_CANNOT_BE_IGNORED 10081
+//#define OBSOLETE_ER_OLD_PASSWORDS_NO_MIDDLE_GROUND 10082
+#define ER_VERBOSE_REQUIRES_HELP 10083
+#define ER_POINTLESS_WITHOUT_SLOWLOG 10084
+#define ER_WASTEFUL_NET_BUFFER_SIZE 10085
+#define ER_DEPRECATED_TIMESTAMP_IMPLICIT_DEFAULTS 10086
+#define ER_FT_BOOL_SYNTAX_INVALID 10087
+#define ER_CREDENTIALLESS_AUTO_USER_BAD 10088
+#define ER_CONNECTION_HANDLING_OOM 10089
+#define ER_THREAD_HANDLING_OOM 10090
+#define ER_CANT_CREATE_TEST_FILE 10091
+#define ER_CANT_CREATE_PID_FILE 10092
+#define ER_CANT_REMOVE_PID_FILE 10093
+#define ER_CANT_CREATE_SHUTDOWN_THREAD 10094
+#define ER_SEC_FILE_PRIV_CANT_ACCESS_DIR 10095
+#define ER_SEC_FILE_PRIV_IGNORED 10096
+#define ER_SEC_FILE_PRIV_EMPTY 10097
+#define ER_SEC_FILE_PRIV_NULL 10098
+#define ER_SEC_FILE_PRIV_DIRECTORY_INSECURE 10099
+#define ER_SEC_FILE_PRIV_CANT_STAT 10100
+#define ER_SEC_FILE_PRIV_DIRECTORY_PERMISSIONS 10101
+#define ER_SEC_FILE_PRIV_ARGUMENT_TOO_LONG 10102
+#define ER_CANT_CREATE_NAMED_PIPES_THREAD 10103
+#define ER_CANT_CREATE_TCPIP_THREAD 10104
+#define ER_CANT_CREATE_SHM_THREAD 10105
+#define ER_CANT_CREATE_INTERRUPT_THREAD 10106
+#define ER_WRITABLE_CONFIG_REMOVED 10107
+#define ER_CORE_VALUES 10108
+#define ER_WRONG_DATETIME_SPEC 10109
+#define ER_RPL_BINLOG_FILTERS_OOM 10110
+#define ER_KEYCACHE_OOM 10111
+#define ER_CONFIRMING_THE_FUTURE 10112
+#define ER_BACK_IN_TIME 10113
+#define ER_FUTURE_DATE 10114
+#define ER_UNSUPPORTED_DATE 10115
+#define ER_STARTING_AS 10116
+#define ER_SHUTTING_DOWN_SLAVE_THREADS 10117
+#define ER_DISCONNECTING_REMAINING_CLIENTS 10118
+#define ER_ABORTING 10119
+#define ER_BINLOG_END 10120
+#define ER_CALL_ME_LOCALHOST 10121
+#define ER_USER_REQUIRES_ROOT 10122
+#define ER_REALLY_RUN_AS_ROOT 10123
+#define ER_USER_WHAT_USER 10124
+#define ER_TRANSPORTS_WHAT_TRANSPORTS 10125
+#define ER_FAIL_SETGID 10126
+#define ER_FAIL_SETUID 10127
+#define ER_FAIL_SETREGID 10128
+#define ER_FAIL_SETREUID 10129
+#define ER_FAIL_CHROOT 10130
+#define ER_WIN_LISTEN_BUT_HOW 10131
+#define ER_NOT_RIGHT_NOW 10132
+#define ER_FIXING_CLIENT_CHARSET 10133
+#define ER_OOM 10134
+#define ER_FAILED_TO_LOCK_MEM 10135
+#define ER_MYINIT_FAILED 10136
+#define ER_BEG_INITFILE 10137
+#define ER_END_INITFILE 10138
+#define ER_CHANGED_MAX_OPEN_FILES 10139
+#define ER_CANT_INCREASE_MAX_OPEN_FILES 10140
+#define ER_CHANGED_MAX_CONNECTIONS 10141
+#define ER_CHANGED_TABLE_OPEN_CACHE 10142
+#define ER_THE_USER_ABIDES 10143
+#define ER_RPL_CANT_ADD_DO_TABLE 10144
+#define ER_RPL_CANT_ADD_IGNORE_TABLE 10145
+#define ER_TRACK_VARIABLES_BOGUS 10146
+#define ER_EXCESS_ARGUMENTS 10147
+#define ER_VERBOSE_HINT 10148
+#define ER_CANT_READ_ERRMSGS 10149
+#define ER_CANT_INIT_DBS 10150
+#define ER_LOG_OUTPUT_CONTRADICTORY 10151
+#define ER_NO_CSV_NO_LOG_TABLES 10152
+#define ER_RPL_REWRITEDB_MISSING_ARROW 10153
+#define ER_RPL_REWRITEDB_EMPTY_FROM 10154
+#define ER_RPL_REWRITEDB_EMPTY_TO 10155
+#define ER_LOG_FILES_GIVEN_LOG_OUTPUT_IS_TABLE 10156
+#define ER_LOG_FILE_INVALID 10157
+#define ER_LOWER_CASE_TABLE_NAMES_CS_DD_ON_CI_FS_UNSUPPORTED 10158
+#define ER_LOWER_CASE_TABLE_NAMES_USING_2 10159
+#define ER_LOWER_CASE_TABLE_NAMES_USING_0 10160
+#define ER_NEED_LOG_BIN 10161
+#define ER_NEED_FILE_INSTEAD_OF_DIR 10162
+#define ER_LOG_BIN_BETTER_WITH_NAME 10163
+#define ER_BINLOG_NEEDS_SERVERID 10164
+#define ER_RPL_CANT_MAKE_PATHS 10165
+#define ER_CANT_INITIALIZE_GTID 10166
+#define ER_CANT_INITIALIZE_EARLY_PLUGINS 10167
+#define ER_CANT_INITIALIZE_BUILTIN_PLUGINS 10168
+#define ER_CANT_INITIALIZE_DYNAMIC_PLUGINS 10169
+#define ER_PERFSCHEMA_INIT_FAILED 10170
+#define ER_STACKSIZE_UNEXPECTED 10171
+//#define OBSOLETE_ER_CANT_SET_DATADIR 10172
+#define ER_CANT_STAT_DATADIR 10173
+#define ER_CANT_CHOWN_DATADIR 10174
+#define ER_CANT_SET_UP_PERSISTED_VALUES 10175
+#define ER_CANT_SAVE_GTIDS 10176
+#define ER_AUTH_CANT_SET_DEFAULT_PLUGIN 10177
+#define ER_CANT_JOIN_SHUTDOWN_THREAD 10178
+#define ER_CANT_HASH_DO_AND_IGNORE_RULES 10179
+#define ER_CANT_OPEN_CA 10180
+#define ER_CANT_ACCESS_CAPATH 10181
+#define ER_SSL_TRYING_DATADIR_DEFAULTS 10182
+#define ER_AUTO_OPTIONS_FAILED 10183
+#define ER_CANT_INIT_TIMER 10184
+#define ER_SERVERID_TOO_LARGE 10185
+#define ER_DEFAULT_SE_UNAVAILABLE 10186
+#define ER_CANT_OPEN_ERROR_LOG 10187
+#define ER_INVALID_ERROR_LOG_NAME 10188
+#define ER_RPL_INFINITY_DENIED 10189
+#define ER_RPL_INFINITY_IGNORED 10190
+//#define OBSOLETE_ER_NDB_TABLES_NOT_READY 10191
+#define ER_TABLE_CHECK_INTACT 10192
+#define ER_DD_TABLESPACE_NOT_FOUND 10193
+#define ER_DD_TRG_CONNECTION_COLLATION_MISSING 10194
+#define ER_DD_TRG_DB_COLLATION_MISSING 10195
+#define ER_DD_TRG_DEFINER_OOM 10196
+#define ER_DD_TRG_FILE_UNREADABLE 10197
+#define ER_TRG_CANT_PARSE 10198
+#define ER_DD_TRG_CANT_ADD 10199
+#define ER_DD_CANT_RESOLVE_VIEW 10200
+#define ER_DD_VIEW_WITHOUT_DEFINER 10201
+#define ER_PLUGIN_INIT_FAILED 10202
+#define ER_RPL_TRX_DELEGATES_INIT_FAILED 10203
+#define ER_RPL_BINLOG_STORAGE_DELEGATES_INIT_FAILED 10204
+#define ER_RPL_BINLOG_TRANSMIT_DELEGATES_INIT_FAILED 10205
+#define ER_RPL_BINLOG_RELAY_DELEGATES_INIT_FAILED 10206
+#define ER_RPL_PLUGIN_FUNCTION_FAILED 10207
+#define ER_SQL_HA_READ_FAILED 10208
+#define ER_SR_BOGUS_VALUE 10209
+#define ER_SR_INVALID_CONTEXT 10210
+#define ER_READING_TABLE_FAILED 10211
+#define ER_DES_FILE_WRONG_KEY 10212
+#define ER_CANT_SET_PERSISTED 10213
+#define ER_JSON_PARSE_ERROR 10214
+#define ER_CONFIG_OPTION_WITHOUT_GROUP 10215
+#define ER_VALGRIND_DO_QUICK_LEAK_CHECK 10216
+#define ER_VALGRIND_COUNT_LEAKS 10217
+#define ER_LOAD_DATA_INFILE_FAILED_IN_UNEXPECTED_WAY 10218
+#define ER_UNKNOWN_ERROR_NUMBER 10219
+#define ER_UDF_CANT_ALLOC_FOR_STRUCTURES 10220
+#define ER_UDF_CANT_ALLOC_FOR_FUNCTION 10221
+#define ER_UDF_INVALID_ROW_IN_FUNCTION_TABLE 10222
+#define ER_UDF_CANT_OPEN_FUNCTION_TABLE 10223
+#define ER_XA_RECOVER_FOUND_TRX_IN_SE 10224
+#define ER_XA_RECOVER_FOUND_XA_TRX 10225
+#define ER_XA_IGNORING_XID 10226
+#define ER_XA_COMMITTING_XID 10227
+#define ER_XA_ROLLING_BACK_XID 10228
+#define ER_XA_STARTING_RECOVERY 10229
+#define ER_XA_NO_MULTI_2PC_HEURISTIC_RECOVER 10230
+#define ER_XA_RECOVER_EXPLANATION 10231
+#define ER_XA_RECOVERY_DONE 10232
+#define ER_TRX_GTID_COLLECT_REJECT 10233
+#define ER_SQL_AUTHOR_DEFAULT_ROLES_FAIL 10234
+#define ER_SQL_USER_TABLE_CREATE_WARNING 10235
+#define ER_SQL_USER_TABLE_ALTER_WARNING 10236
+#define ER_ROW_IN_WRONG_PARTITION_PLEASE_REPAIR 10237
+#define ER_MYISAM_CRASHED_ERROR_IN_THREAD 10238
+#define ER_MYISAM_CRASHED_ERROR_IN 10239
+#define ER_TOO_MANY_STORAGE_ENGINES 10240
+#define ER_SE_TYPECODE_CONFLICT 10241
+#define ER_TRX_WRITE_SET_OOM 10242
+#define ER_HANDLERTON_OOM 10243
+#define ER_CONN_SHM_LISTENER 10244
+#define ER_CONN_SHM_CANT_CREATE_SERVICE 10245
+#define ER_CONN_SHM_CANT_CREATE_CONNECTION 10246
+#define ER_CONN_PIP_CANT_CREATE_EVENT 10247
+#define ER_CONN_PIP_CANT_CREATE_PIPE 10248
+#define ER_CONN_PER_THREAD_NO_THREAD 10249
+#define ER_CONN_TCP_NO_SOCKET 10250
+#define ER_CONN_TCP_CREATED 10251
+#define ER_CONN_TCP_ADDRESS 10252
+#define ER_CONN_TCP_IPV6_AVAILABLE 10253
+#define ER_CONN_TCP_IPV6_UNAVAILABLE 10254
+#define ER_CONN_TCP_ERROR_WITH_STRERROR 10255
+#define ER_CONN_TCP_CANT_RESOLVE_HOSTNAME 10256
+#define ER_CONN_TCP_IS_THERE_ANOTHER_USING_PORT 10257
+#define ER_CONN_UNIX_IS_THERE_ANOTHER_USING_SOCKET 10258
+#define ER_CONN_UNIX_PID_CLAIMED_SOCKET_FILE 10259
+#define ER_CONN_TCP_CANT_RESET_V6ONLY 10260
+#define ER_CONN_TCP_BIND_RETRY 10261
+#define ER_CONN_TCP_BIND_FAIL 10262
+#define ER_CONN_TCP_IP_NOT_LOGGED 10263
+#define ER_CONN_TCP_RESOLVE_INFO 10264
+#define ER_CONN_TCP_START_FAIL 10265
+#define ER_CONN_TCP_LISTEN_FAIL 10266
+#define ER_CONN_UNIX_PATH_TOO_LONG 10267
+#define ER_CONN_UNIX_LOCK_FILE_FAIL 10268
+#define ER_CONN_UNIX_NO_FD 10269
+#define ER_CONN_UNIX_NO_BIND_NO_START 10270
+#define ER_CONN_UNIX_LISTEN_FAILED 10271
+#define ER_CONN_UNIX_LOCK_FILE_GIVING_UP 10272
+#define ER_CONN_UNIX_LOCK_FILE_CANT_CREATE 10273
+#define ER_CONN_UNIX_LOCK_FILE_CANT_OPEN 10274
+#define ER_CONN_UNIX_LOCK_FILE_CANT_READ 10275
+#define ER_CONN_UNIX_LOCK_FILE_EMPTY 10276
+#define ER_CONN_UNIX_LOCK_FILE_PIDLESS 10277
+#define ER_CONN_UNIX_LOCK_FILE_CANT_WRITE 10278
+#define ER_CONN_UNIX_LOCK_FILE_CANT_DELETE 10279
+#define ER_CONN_UNIX_LOCK_FILE_CANT_SYNC 10280
+#define ER_CONN_UNIX_LOCK_FILE_CANT_CLOSE 10281
+#define ER_CONN_SOCKET_SELECT_FAILED 10282
+#define ER_CONN_SOCKET_ACCEPT_FAILED 10283
+#define ER_AUTH_RSA_CANT_FIND 10284
+#define ER_AUTH_RSA_CANT_PARSE 10285
+#define ER_AUTH_RSA_CANT_READ 10286
+#define ER_AUTH_RSA_FILES_NOT_FOUND 10287
+#define ER_CONN_ATTR_TRUNCATED 10288
+#define ER_X509_CIPHERS_MISMATCH 10289
+#define ER_X509_ISSUER_MISMATCH 10290
+#define ER_X509_SUBJECT_MISMATCH 10291
+#define ER_AUTH_CANT_ACTIVATE_ROLE 10292
+#define ER_X509_NEEDS_RSA_PRIVKEY 10293
+#define ER_X509_CANT_WRITE_KEY 10294
+#define ER_X509_CANT_CHMOD_KEY 10295
+#define ER_X509_CANT_READ_CA_KEY 10296
+#define ER_X509_CANT_READ_CA_CERT 10297
+#define ER_X509_CANT_CREATE_CERT 10298
+#define ER_X509_CANT_WRITE_CERT 10299
+#define ER_AUTH_CANT_CREATE_RSA_PAIR 10300
+#define ER_AUTH_CANT_WRITE_PRIVKEY 10301
+#define ER_AUTH_CANT_WRITE_PUBKEY 10302
+#define ER_AUTH_SSL_CONF_PREVENTS_CERT_GENERATION 10303
+#define ER_AUTH_USING_EXISTING_CERTS 10304
+#define ER_AUTH_CERTS_SAVED_TO_DATADIR 10305
+#define ER_AUTH_CERT_GENERATION_DISABLED 10306
+#define ER_AUTH_RSA_CONF_PREVENTS_KEY_GENERATION 10307
+#define ER_AUTH_KEY_GENERATION_SKIPPED_PAIR_PRESENT 10308
+#define ER_AUTH_KEYS_SAVED_TO_DATADIR 10309
+#define ER_AUTH_KEY_GENERATION_DISABLED 10310
+#define ER_AUTHCACHE_PROXIES_PRIV_SKIPPED_NEEDS_RESOLVE 10311
+#define ER_AUTHCACHE_PLUGIN_MISSING 10312
+#define ER_AUTHCACHE_PLUGIN_CONFIG 10313
+//#define OBSOLETE_ER_AUTHCACHE_ROLE_TABLES_DODGY 10314
+#define ER_AUTHCACHE_USER_SKIPPED_NEEDS_RESOLVE 10315
+#define ER_AUTHCACHE_USER_TABLE_DODGY 10316
+#define ER_AUTHCACHE_USER_IGNORED_DEPRECATED_PASSWORD 10317
+#define ER_AUTHCACHE_USER_IGNORED_NEEDS_PLUGIN 10318
+#define ER_AUTHCACHE_USER_IGNORED_INVALID_PASSWORD 10319
+#define ER_AUTHCACHE_EXPIRED_PASSWORD_UNSUPPORTED 10320
+#define ER_NO_SUPER_WITHOUT_USER_PLUGIN 10321
+#define ER_AUTHCACHE_DB_IGNORED_EMPTY_NAME 10322
+#define ER_AUTHCACHE_DB_SKIPPED_NEEDS_RESOLVE 10323
+#define ER_AUTHCACHE_DB_ENTRY_LOWERCASED_REVOKE_WILL_FAIL 10324
+#define ER_AUTHCACHE_TABLE_PROXIES_PRIV_MISSING 10325
+#define ER_AUTHCACHE_CANT_OPEN_AND_LOCK_PRIVILEGE_TABLES 10326
+#define ER_AUTHCACHE_CANT_INIT_GRANT_SUBSYSTEM 10327
+#define ER_AUTHCACHE_PROCS_PRIV_SKIPPED_NEEDS_RESOLVE 10328
+#define ER_AUTHCACHE_PROCS_PRIV_ENTRY_IGNORED_BAD_ROUTINE_TYPE 10329
+#define ER_AUTHCACHE_TABLES_PRIV_SKIPPED_NEEDS_RESOLVE 10330
+#define ER_USER_NOT_IN_EXTRA_USERS_BINLOG_POSSIBLY_INCOMPLETE 10331
+#define ER_DD_SCHEMA_NOT_FOUND 10332
+#define ER_DD_TABLE_NOT_FOUND 10333
+#define ER_DD_SE_INIT_FAILED 10334
+#define ER_DD_ABORTING_PARTIAL_UPGRADE 10335
+#define ER_DD_FRM_EXISTS_FOR_TABLE 10336
+#define ER_DD_CREATED_FOR_UPGRADE 10337
+#define ER_ERRMSG_CANT_FIND_FILE 10338
+#define ER_ERRMSG_LOADING_55_STYLE 10339
+#define ER_ERRMSG_MISSING_IN_FILE 10340
+#define ER_ERRMSG_OOM 10341
+#define ER_ERRMSG_CANT_READ 10342
+#define ER_TABLE_INCOMPATIBLE_DECIMAL_FIELD 10343
+#define ER_TABLE_INCOMPATIBLE_YEAR_FIELD 10344
+#define ER_INVALID_CHARSET_AND_DEFAULT_IS_MB 10345
+#define ER_TABLE_WRONG_KEY_DEFINITION 10346
+#define ER_CANT_OPEN_FRM_FILE 10347
+#define ER_CANT_READ_FRM_FILE 10348
+#define ER_TABLE_CREATED_WITH_DIFFERENT_VERSION 10349
+#define ER_VIEW_UNPARSABLE 10350
+#define ER_FILE_TYPE_UNKNOWN 10351
+#define ER_INVALID_INFO_IN_FRM 10352
+#define ER_CANT_OPEN_AND_LOCK_PRIVILEGE_TABLES 10353
+#define ER_AUDIT_PLUGIN_DOES_NOT_SUPPORT_AUDIT_AUTH_EVENTS 10354
+#define ER_AUDIT_PLUGIN_HAS_INVALID_DATA 10355
+#define ER_TZ_OOM_INITIALIZING_TIME_ZONES 10356
+#define ER_TZ_CANT_OPEN_AND_LOCK_TIME_ZONE_TABLE 10357
+#define ER_TZ_OOM_LOADING_LEAP_SECOND_TABLE 10358
+#define ER_TZ_TOO_MANY_LEAPS_IN_LEAP_SECOND_TABLE 10359
+#define ER_TZ_ERROR_LOADING_LEAP_SECOND_TABLE 10360
+#define ER_TZ_UNKNOWN_OR_ILLEGAL_DEFAULT_TIME_ZONE 10361
+#define ER_TZ_CANT_FIND_DESCRIPTION_FOR_TIME_ZONE 10362
+#define ER_TZ_CANT_FIND_DESCRIPTION_FOR_TIME_ZONE_ID 10363
+#define ER_TZ_TRANSITION_TYPE_TABLE_TYPE_TOO_LARGE 10364
+#define ER_TZ_TRANSITION_TYPE_TABLE_ABBREVIATIONS_EXCEED_SPACE 10365
+#define ER_TZ_TRANSITION_TYPE_TABLE_LOAD_ERROR 10366
+#define ER_TZ_TRANSITION_TABLE_TOO_MANY_TRANSITIONS 10367
+#define ER_TZ_TRANSITION_TABLE_BAD_TRANSITION_TYPE 10368
+#define ER_TZ_TRANSITION_TABLE_LOAD_ERROR 10369
+#define ER_TZ_NO_TRANSITION_TYPES_IN_TIME_ZONE 10370
+#define ER_TZ_OOM_LOADING_TIME_ZONE_DESCRIPTION 10371
+#define ER_TZ_CANT_BUILD_MKTIME_MAP 10372
+#define ER_TZ_OOM_WHILE_LOADING_TIME_ZONE 10373
+#define ER_TZ_OOM_WHILE_SETTING_TIME_ZONE 10374
+#define ER_SLAVE_SQL_THREAD_STOPPED_UNTIL_CONDITION_BAD 10375
+#define ER_SLAVE_SQL_THREAD_STOPPED_UNTIL_POSITION_REACHED 10376
+#define ER_SLAVE_SQL_THREAD_STOPPED_BEFORE_GTIDS_ALREADY_APPLIED 10377
+#define ER_SLAVE_SQL_THREAD_STOPPED_BEFORE_GTIDS_REACHED 10378
+#define ER_SLAVE_SQL_THREAD_STOPPED_AFTER_GTIDS_REACHED 10379
+#define ER_SLAVE_SQL_THREAD_STOPPED_GAP_TRX_PROCESSED 10380
+#define ER_GROUP_REPLICATION_PLUGIN_NOT_INSTALLED 10381
+#define ER_GTID_ALREADY_ADDED_BY_USER 10382
+#define ER_FAILED_TO_DELETE_FROM_GTID_EXECUTED_TABLE 10383
+#define ER_FAILED_TO_COMPRESS_GTID_EXECUTED_TABLE 10384
+#define ER_FAILED_TO_COMPRESS_GTID_EXECUTED_TABLE_OOM 10385
+#define ER_FAILED_TO_INIT_THREAD_ATTR_FOR_GTID_TABLE_COMPRESSION 10386
+#define ER_FAILED_TO_CREATE_GTID_TABLE_COMPRESSION_THREAD 10387
+#define ER_FAILED_TO_JOIN_GTID_TABLE_COMPRESSION_THREAD 10388
+#define ER_NPIPE_FAILED_TO_INIT_SECURITY_DESCRIPTOR 10389
+#define ER_NPIPE_FAILED_TO_SET_SECURITY_DESCRIPTOR 10390
+#define ER_NPIPE_PIPE_ALREADY_IN_USE 10391
+//#define OBSOLETE_ER_NDB_SLAVE_SAW_EPOCH_LOWER_THAN_PREVIOUS_ON_START 10392
+//#define OBSOLETE_ER_NDB_SLAVE_SAW_EPOCH_LOWER_THAN_PREVIOUS 10393
+//#define OBSOLETE_ER_NDB_SLAVE_SAW_ALREADY_COMMITTED_EPOCH 10394
+//#define OBSOLETE_ER_NDB_SLAVE_PREVIOUS_EPOCH_NOT_COMMITTED 10395
+//#define OBSOLETE_ER_NDB_SLAVE_MISSING_DATA_FOR_TIMESTAMP_COLUMN 10396
+//#define OBSOLETE_ER_NDB_SLAVE_LOGGING_EXCEPTIONS_TO 10397
+//#define OBSOLETE_ER_NDB_SLAVE_LOW_EPOCH_RESOLUTION 10398
+//#define OBSOLETE_ER_NDB_INFO_FOUND_UNEXPECTED_FIELD_TYPE 10399
+//#define OBSOLETE_ER_NDB_INFO_FAILED_TO_CREATE_NDBINFO 10400
+//#define OBSOLETE_ER_NDB_INFO_FAILED_TO_INIT_NDBINFO 10401
+//#define OBSOLETE_ER_NDB_CLUSTER_WRONG_NUMBER_OF_FUNCTION_ARGUMENTS 10402
+//#define OBSOLETE_ER_NDB_CLUSTER_SCHEMA_INFO 10403
+//#define OBSOLETE_ER_NDB_CLUSTER_GENERIC_MESSAGE 10404
+#define ER_RPL_CANT_OPEN_INFO_TABLE 10405
+#define ER_RPL_CANT_SCAN_INFO_TABLE 10406
+#define ER_RPL_CORRUPTED_INFO_TABLE 10407
+#define ER_RPL_CORRUPTED_KEYS_IN_INFO_TABLE 10408
+#define ER_RPL_WORKER_ID_IS 10409
+#define ER_RPL_INCONSISTENT_TIMESTAMPS_IN_TRX 10410
+#define ER_RPL_INCONSISTENT_SEQUENCE_NO_IN_TRX 10411
+#define ER_RPL_CHANNELS_REQUIRE_TABLES_AS_INFO_REPOSITORIES 10412
+#define ER_RPL_CHANNELS_REQUIRE_NON_ZERO_SERVER_ID 10413
+#define ER_RPL_REPO_SHOULD_BE_TABLE 10414
+#define ER_RPL_ERROR_CREATING_MASTER_INFO 10415
+#define ER_RPL_ERROR_CHANGING_MASTER_INFO_REPO_TYPE 10416
+#define ER_RPL_CHANGING_RELAY_LOG_INFO_REPO_TYPE_FAILED_DUE_TO_GAPS 10417
+#define ER_RPL_ERROR_CREATING_RELAY_LOG_INFO 10418
+#define ER_RPL_ERROR_CHANGING_RELAY_LOG_INFO_REPO_TYPE 10419
+#define ER_RPL_FAILED_TO_DELETE_FROM_SLAVE_WORKERS_INFO_REPOSITORY 10420
+#define ER_RPL_FAILED_TO_RESET_STATE_IN_SLAVE_INFO_REPOSITORY 10421
+#define ER_RPL_ERROR_CHECKING_REPOSITORY 10422
+#define ER_RPL_SLAVE_GENERIC_MESSAGE 10423
+#define ER_RPL_SLAVE_COULD_NOT_CREATE_CHANNEL_LIST 10424
+#define ER_RPL_MULTISOURCE_REQUIRES_TABLE_TYPE_REPOSITORIES 10425
+#define ER_RPL_SLAVE_FAILED_TO_INIT_A_MASTER_INFO_STRUCTURE 10426
+#define ER_RPL_SLAVE_FAILED_TO_INIT_MASTER_INFO_STRUCTURE 10427
+#define ER_RPL_SLAVE_FAILED_TO_CREATE_CHANNEL_FROM_MASTER_INFO 10428
+#define ER_RPL_FAILED_TO_CREATE_NEW_INFO_FILE 10429
+#define ER_RPL_FAILED_TO_CREATE_CACHE_FOR_INFO_FILE 10430
+#define ER_RPL_FAILED_TO_OPEN_INFO_FILE 10431
+#define ER_RPL_GTID_MEMORY_FINALLY_AVAILABLE 10432
+#define ER_SERVER_COST_UNKNOWN_COST_CONSTANT 10433
+#define ER_SERVER_COST_INVALID_COST_CONSTANT 10434
+#define ER_ENGINE_COST_UNKNOWN_COST_CONSTANT 10435
+#define ER_ENGINE_COST_UNKNOWN_STORAGE_ENGINE 10436
+#define ER_ENGINE_COST_INVALID_DEVICE_TYPE_FOR_SE 10437
+#define ER_ENGINE_COST_INVALID_CONST_CONSTANT_FOR_SE_AND_DEVICE 10438
+#define ER_SERVER_COST_FAILED_TO_READ 10439
+#define ER_ENGINE_COST_FAILED_TO_READ 10440
+#define ER_FAILED_TO_OPEN_COST_CONSTANT_TABLES 10441
+#define ER_RPL_UNSUPPORTED_UNIGNORABLE_EVENT_IN_STREAM 10442
+#define ER_RPL_GTID_LOG_EVENT_IN_STREAM 10443
+#define ER_RPL_UNEXPECTED_BEGIN_IN_STREAM 10444
+#define ER_RPL_UNEXPECTED_COMMIT_ROLLBACK_OR_XID_LOG_EVENT_IN_STREAM 10445
+#define ER_RPL_UNEXPECTED_XA_ROLLBACK_IN_STREAM 10446
+#define ER_EVENT_EXECUTION_FAILED_CANT_AUTHENTICATE_USER 10447
+#define ER_EVENT_EXECUTION_FAILED_USER_LOST_EVEN_PRIVILEGE 10448
+#define ER_EVENT_ERROR_DURING_COMPILATION 10449
+#define ER_EVENT_DROPPING 10450
+//#define OBSOLETE_ER_NDB_SCHEMA_GENERIC_MESSAGE 10451
+#define ER_RPL_INCOMPATIBLE_DECIMAL_IN_RBR 10452
+#define ER_INIT_ROOT_WITHOUT_PASSWORD 10453
+#define ER_INIT_GENERATING_TEMP_PASSWORD_FOR_ROOT 10454
+#define ER_INIT_CANT_OPEN_BOOTSTRAP_FILE 10455
+#define ER_INIT_BOOTSTRAP_COMPLETE 10456
+#define ER_INIT_DATADIR_NOT_EMPTY_WONT_INITIALIZE 10457
+#define ER_INIT_DATADIR_EXISTS_WONT_INITIALIZE 10458
+#define ER_INIT_DATADIR_EXISTS_AND_PATH_TOO_LONG_WONT_INITIALIZE 10459
+#define ER_INIT_DATADIR_EXISTS_AND_NOT_WRITABLE_WONT_INITIALIZE 10460
+#define ER_INIT_CREATING_DD 10461
+#define ER_RPL_BINLOG_STARTING_DUMP 10462
+#define ER_RPL_BINLOG_MASTER_SENDS_HEARTBEAT 10463
+#define ER_RPL_BINLOG_SKIPPING_REMAINING_HEARTBEAT_INFO 10464
+#define ER_RPL_BINLOG_MASTER_USES_CHECKSUM_AND_SLAVE_CANT 10465
+//#define OBSOLETE_ER_NDB_QUERY_FAILED 10466
+#define ER_KILLING_THREAD 10467
+#define ER_DETACHING_SESSION_LEFT_BY_PLUGIN 10468
+#define ER_CANT_DETACH_SESSION_LEFT_BY_PLUGIN 10469
+#define ER_DETACHED_SESSIONS_LEFT_BY_PLUGIN 10470
+#define ER_FAILED_TO_DECREMENT_NUMBER_OF_THREADS 10471
+#define ER_PLUGIN_DID_NOT_DEINITIALIZE_THREADS 10472
+#define ER_KILLED_THREADS_OF_PLUGIN 10473
+//#define OBSOLETE_ER_NDB_SLAVE_MAX_REPLICATED_EPOCH_UNKNOWN 10474
+//#define OBSOLETE_ER_NDB_SLAVE_MAX_REPLICATED_EPOCH_SET_TO 10475
+//#define OBSOLETE_ER_NDB_NODE_ID_AND_MANAGEMENT_SERVER_INFO 10476
+//#define OBSOLETE_ER_NDB_DISCONNECT_INFO 10477
+//#define OBSOLETE_ER_NDB_COLUMN_DEFAULTS_DIFFER 10478
+//#define OBSOLETE_ER_NDB_COLUMN_SHOULD_NOT_HAVE_NATIVE_DEFAULT 10479
+//#define OBSOLETE_ER_NDB_FIELD_INFO 10480
+//#define OBSOLETE_ER_NDB_COLUMN_INFO 10481
+//#define OBSOLETE_ER_NDB_OOM_IN_FIX_UNIQUE_INDEX_ATTR_ORDER 10482
+//#define OBSOLETE_ER_NDB_SLAVE_MALFORMED_EVENT_RECEIVED_ON_TABLE 10483
+//#define OBSOLETE_ER_NDB_SLAVE_CONFLICT_FUNCTION_REQUIRES_ROLE 10484
+//#define OBSOLETE_ER_NDB_SLAVE_CONFLICT_TRANSACTION_IDS 10485
+//#define OBSOLETE_ER_NDB_SLAVE_BINLOG_MISSING_INFO_FOR_CONFLICT_DETECTION 10486
+//#define OBSOLETE_ER_NDB_ERROR_IN_READAUTOINCREMENTVALUE 10487
+//#define OBSOLETE_ER_NDB_FOUND_UNCOMMITTED_AUTOCOMMIT 10488
+//#define OBSOLETE_ER_NDB_SLAVE_TOO_MANY_RETRIES 10489
+//#define OBSOLETE_ER_NDB_SLAVE_ERROR_IN_UPDATE_CREATE_INFO 10490
+//#define OBSOLETE_ER_NDB_SLAVE_CANT_ALLOCATE_TABLE_SHARE 10491
+//#define OBSOLETE_ER_NDB_BINLOG_ERROR_INFO_FROM_DA 10492
+//#define OBSOLETE_ER_NDB_BINLOG_CREATE_TABLE_EVENT 10493
+//#define OBSOLETE_ER_NDB_BINLOG_FAILED_CREATE_TABLE_EVENT_OPERATIONS 10494
+//#define OBSOLETE_ER_NDB_BINLOG_RENAME_EVENT 10495
+//#define OBSOLETE_ER_NDB_BINLOG_FAILED_CREATE_DURING_RENAME 10496
+//#define OBSOLETE_ER_NDB_UNEXPECTED_RENAME_TYPE 10497
+//#define OBSOLETE_ER_NDB_ERROR_IN_GET_AUTO_INCREMENT 10498
+//#define OBSOLETE_ER_NDB_CREATING_SHARE_IN_OPEN 10499
+//#define OBSOLETE_ER_NDB_TABLE_OPENED_READ_ONLY 10500
+//#define OBSOLETE_ER_NDB_INITIALIZE_GIVEN_CLUSTER_PLUGIN_DISABLED 10501
+//#define OBSOLETE_ER_NDB_BINLOG_FORMAT_CHANGED_FROM_STMT_TO_MIXED 10502
+//#define OBSOLETE_ER_NDB_TRAILING_SHARE_RELEASED_BY_CLOSE_CACHED_TABLES 10503
+//#define OBSOLETE_ER_NDB_SHARE_ALREADY_EXISTS 10504
+//#define OBSOLETE_ER_NDB_HANDLE_TRAILING_SHARE_INFO 10505
+//#define OBSOLETE_ER_NDB_CLUSTER_GET_SHARE_INFO 10506
+//#define OBSOLETE_ER_NDB_CLUSTER_REAL_FREE_SHARE_INFO 10507
+//#define OBSOLETE_ER_NDB_CLUSTER_REAL_FREE_SHARE_DROP_FAILED 10508
+//#define OBSOLETE_ER_NDB_CLUSTER_FREE_SHARE_INFO 10509
+//#define OBSOLETE_ER_NDB_CLUSTER_MARK_SHARE_DROPPED_INFO 10510
+//#define OBSOLETE_ER_NDB_CLUSTER_MARK_SHARE_DROPPED_DESTROYING_SHARE 10511
+//#define OBSOLETE_ER_NDB_CLUSTER_OOM_THD_NDB 10512
+//#define OBSOLETE_ER_NDB_BINLOG_NDB_TABLES_INITIALLY_READ_ONLY 10513
+//#define OBSOLETE_ER_NDB_UTIL_THREAD_OOM 10514
+//#define OBSOLETE_ER_NDB_ILLEGAL_VALUE_FOR_NDB_RECV_THREAD_CPU_MASK 10515
+//#define OBSOLETE_ER_NDB_TOO_MANY_CPUS_IN_NDB_RECV_THREAD_CPU_MASK 10516
+#define ER_DBUG_CHECK_SHARES_OPEN 10517
+#define ER_DBUG_CHECK_SHARES_INFO 10518
+#define ER_DBUG_CHECK_SHARES_DROPPED 10519
+#define ER_INVALID_OR_OLD_TABLE_OR_DB_NAME 10520
+#define ER_TC_RECOVERING_AFTER_CRASH_USING 10521
+#define ER_TC_CANT_AUTO_RECOVER_WITH_TC_HEURISTIC_RECOVER 10522
+#define ER_TC_BAD_MAGIC_IN_TC_LOG 10523
+#define ER_TC_NEED_N_SE_SUPPORTING_2PC_FOR_RECOVERY 10524
+#define ER_TC_RECOVERY_FAILED_THESE_ARE_YOUR_OPTIONS 10525
+#define ER_TC_HEURISTIC_RECOVERY_MODE 10526
+#define ER_TC_HEURISTIC_RECOVERY_FAILED 10527
+#define ER_TC_RESTART_WITHOUT_TC_HEURISTIC_RECOVER 10528
+#define ER_RPL_SLAVE_FAILED_TO_CREATE_OR_RECOVER_INFO_REPOSITORIES 10529
+#define ER_RPL_SLAVE_AUTO_POSITION_IS_1_AND_GTID_MODE_IS_OFF 10530
+#define ER_RPL_SLAVE_CANT_START_SLAVE_FOR_CHANNEL 10531
+#define ER_RPL_SLAVE_CANT_STOP_SLAVE_FOR_CHANNEL 10532
+#define ER_RPL_RECOVERY_NO_ROTATE_EVENT_FROM_MASTER 10533
+#define ER_RPL_RECOVERY_ERROR_READ_RELAY_LOG 10534
+//#define OBSOLETE_ER_RPL_RECOVERY_ERROR_FREEING_IO_CACHE 10535
+#define ER_RPL_RECOVERY_SKIPPED_GROUP_REPLICATION_CHANNEL 10536
+#define ER_RPL_RECOVERY_ERROR 10537
+#define ER_RPL_RECOVERY_IO_ERROR_READING_RELAY_LOG_INDEX 10538
+#define ER_RPL_RECOVERY_FILE_MASTER_POS_INFO 10539
+#define ER_RPL_RECOVERY_REPLICATE_SAME_SERVER_ID_REQUIRES_POSITION 10540
+#define ER_RPL_MTS_RECOVERY_STARTING_COORDINATOR 10541
+#define ER_RPL_MTS_RECOVERY_FAILED_TO_START_COORDINATOR 10542
+#define ER_RPL_MTS_AUTOMATIC_RECOVERY_FAILED 10543
+#define ER_RPL_MTS_RECOVERY_CANT_OPEN_RELAY_LOG 10544
+#define ER_RPL_MTS_RECOVERY_SUCCESSFUL 10545
+#define ER_RPL_SERVER_ID_MISSING 10546
+#define ER_RPL_CANT_CREATE_SLAVE_THREAD 10547
+#define ER_RPL_SLAVE_IO_THREAD_WAS_KILLED 10548
+#define ER_RPL_SLAVE_MASTER_UUID_HAS_CHANGED 10549
+#define ER_RPL_SLAVE_USES_CHECKSUM_AND_MASTER_PRE_50 10550
+#define ER_RPL_SLAVE_SECONDS_BEHIND_MASTER_DUBIOUS 10551
+#define ER_RPL_SLAVE_CANT_FLUSH_MASTER_INFO_FILE 10552
+#define ER_RPL_SLAVE_REPORT_HOST_TOO_LONG 10553
+#define ER_RPL_SLAVE_REPORT_USER_TOO_LONG 10554
+#define ER_RPL_SLAVE_REPORT_PASSWORD_TOO_LONG 10555
+#define ER_RPL_SLAVE_ERROR_RETRYING 10556
+#define ER_RPL_SLAVE_ERROR_READING_FROM_SERVER 10557
+#define ER_RPL_SLAVE_DUMP_THREAD_KILLED_BY_MASTER 10558
+#define ER_RPL_MTS_STATISTICS 10559
+#define ER_RPL_MTS_RECOVERY_COMPLETE 10560
+#define ER_RPL_SLAVE_CANT_INIT_RELAY_LOG_POSITION 10561
+#define ER_RPL_SLAVE_CONNECTED_TO_MASTER_REPLICATION_STARTED 10562
+#define ER_RPL_SLAVE_IO_THREAD_KILLED 10563
+#define ER_RPL_SLAVE_IO_THREAD_CANT_REGISTER_ON_MASTER 10564
+#define ER_RPL_SLAVE_FORCING_TO_RECONNECT_IO_THREAD 10565
+#define ER_RPL_SLAVE_ERROR_REQUESTING_BINLOG_DUMP 10566
+#define ER_RPL_LOG_ENTRY_EXCEEDS_SLAVE_MAX_ALLOWED_PACKET 10567
+#define ER_RPL_SLAVE_STOPPING_AS_MASTER_OOM 10568
+#define ER_RPL_SLAVE_IO_THREAD_ABORTED_WAITING_FOR_RELAY_LOG_SPACE 10569
+#define ER_RPL_SLAVE_IO_THREAD_EXITING 10570
+#define ER_RPL_SLAVE_CANT_INITIALIZE_SLAVE_WORKER 10571
+#define ER_RPL_MTS_GROUP_RECOVERY_RELAY_LOG_INFO_FOR_WORKER 10572
+#define ER_RPL_ERROR_LOOKING_FOR_LOG 10573
+#define ER_RPL_MTS_GROUP_RECOVERY_RELAY_LOG_INFO 10574
+#define ER_RPL_CANT_FIND_FOLLOWUP_FILE 10575
+#define ER_RPL_MTS_CHECKPOINT_PERIOD_DIFFERS_FROM_CNT 10576
+#define ER_RPL_SLAVE_WORKER_THREAD_CREATION_FAILED 10577
+#define ER_RPL_SLAVE_WORKER_THREAD_CREATION_FAILED_WITH_ERRNO 10578
+#define ER_RPL_SLAVE_FAILED_TO_INIT_PARTITIONS_HASH 10579
+//#define OBSOLETE_ER_RPL_SLAVE_NDB_TABLES_NOT_AVAILABLE 10580
+#define ER_RPL_SLAVE_SQL_THREAD_STARTING 10581
+#define ER_RPL_SLAVE_SKIP_COUNTER_EXECUTED 10582
+#define ER_RPL_SLAVE_ADDITIONAL_ERROR_INFO_FROM_DA 10583
+#define ER_RPL_SLAVE_ERROR_INFO_FROM_DA 10584
+#define ER_RPL_SLAVE_ERROR_LOADING_USER_DEFINED_LIBRARY 10585
+#define ER_RPL_SLAVE_ERROR_RUNNING_QUERY 10586
+#define ER_RPL_SLAVE_SQL_THREAD_EXITING 10587
+#define ER_RPL_SLAVE_READ_INVALID_EVENT_FROM_MASTER 10588
+#define ER_RPL_SLAVE_QUEUE_EVENT_FAILED_INVALID_CONFIGURATION 10589
+#define ER_RPL_SLAVE_IO_THREAD_DETECTED_UNEXPECTED_EVENT_SEQUENCE 10590
+#define ER_RPL_SLAVE_CANT_USE_CHARSET 10591
+#define ER_RPL_SLAVE_CONNECTED_TO_MASTER_REPLICATION_RESUMED 10592
+#define ER_RPL_SLAVE_NEXT_LOG_IS_ACTIVE 10593
+#define ER_RPL_SLAVE_NEXT_LOG_IS_INACTIVE 10594
+#define ER_RPL_SLAVE_SQL_THREAD_IO_ERROR_READING_EVENT 10595
+#define ER_RPL_SLAVE_ERROR_READING_RELAY_LOG_EVENTS 10596
+#define ER_SLAVE_CHANGE_MASTER_TO_EXECUTED 10597
+#define ER_RPL_SLAVE_NEW_MASTER_INFO_NEEDS_REPOS_TYPE_OTHER_THAN_FILE 10598
+#define ER_RPL_FAILED_TO_STAT_LOG_IN_INDEX 10599
+#define ER_RPL_LOG_NOT_FOUND_WHILE_COUNTING_RELAY_LOG_SPACE 10600
+#define ER_SLAVE_CANT_USE_TEMPDIR 10601
+#define ER_RPL_RELAY_LOG_NEEDS_FILE_NOT_DIRECTORY 10602
+#define ER_RPL_RELAY_LOG_INDEX_NEEDS_FILE_NOT_DIRECTORY 10603
+#define ER_RPL_PLEASE_USE_OPTION_RELAY_LOG 10604
+#define ER_RPL_OPEN_INDEX_FILE_FAILED 10605
+#define ER_RPL_CANT_INITIALIZE_GTID_SETS_IN_RLI_INIT_INFO 10606
+#define ER_RPL_CANT_OPEN_LOG_IN_RLI_INIT_INFO 10607
+#define ER_RPL_ERROR_WRITING_RELAY_LOG_CONFIGURATION 10608
+//#define OBSOLETE_ER_NDB_OOM_GET_NDB_BLOBS_VALUE 10609
+//#define OBSOLETE_ER_NDB_THREAD_TIMED_OUT 10610
+//#define OBSOLETE_ER_NDB_TABLE_IS_NOT_DISTRIBUTED 10611
+//#define OBSOLETE_ER_NDB_CREATING_TABLE 10612
+//#define OBSOLETE_ER_NDB_FLUSHING_TABLE_INFO 10613
+//#define OBSOLETE_ER_NDB_CLEANING_STRAY_TABLES 10614
+//#define OBSOLETE_ER_NDB_DISCOVERED_MISSING_DB 10615
+//#define OBSOLETE_ER_NDB_DISCOVERED_REMAINING_DB 10616
+//#define OBSOLETE_ER_NDB_CLUSTER_FIND_ALL_DBS_RETRY 10617
+//#define OBSOLETE_ER_NDB_CLUSTER_FIND_ALL_DBS_FAIL 10618
+//#define OBSOLETE_ER_NDB_SKIPPING_SETUP_TABLE 10619
+//#define OBSOLETE_ER_NDB_FAILED_TO_SET_UP_TABLE 10620
+//#define OBSOLETE_ER_NDB_MISSING_FRM_DISCOVERING 10621
+//#define OBSOLETE_ER_NDB_MISMATCH_IN_FRM_DISCOVERING 10622
+//#define OBSOLETE_ER_NDB_BINLOG_CLEANING_UP_SETUP_LEFTOVERS 10623
+//#define OBSOLETE_ER_NDB_WAITING_INFO 10624
+//#define OBSOLETE_ER_NDB_WAITING_INFO_WITH_MAP 10625
+//#define OBSOLETE_ER_NDB_TIMEOUT_WHILE_DISTRIBUTING 10626
+//#define OBSOLETE_ER_NDB_NOT_WAITING_FOR_DISTRIBUTING 10627
+//#define OBSOLETE_ER_NDB_DISTRIBUTED_INFO 10628
+//#define OBSOLETE_ER_NDB_DISTRIBUTION_COMPLETE 10629
+//#define OBSOLETE_ER_NDB_SCHEMA_DISTRIBUTION_FAILED 10630
+//#define OBSOLETE_ER_NDB_SCHEMA_DISTRIBUTION_REPORTS_SUBSCRIBE 10631
+//#define OBSOLETE_ER_NDB_SCHEMA_DISTRIBUTION_REPORTS_UNSUBSCRIBE 10632
+//#define OBSOLETE_ER_NDB_BINLOG_CANT_DISCOVER_TABLE_FROM_SCHEMA_EVENT 10633
+//#define OBSOLETE_ER_NDB_BINLOG_SIGNALLING_UNKNOWN_VALUE 10634
+//#define OBSOLETE_ER_NDB_BINLOG_REPLY_TO 10635
+//#define OBSOLETE_ER_NDB_BINLOG_CANT_RELEASE_SLOCK 10636
+//#define OBSOLETE_ER_NDB_CANT_FIND_TABLE 10637
+//#define OBSOLETE_ER_NDB_DISCARDING_EVENT_NO_OBJ 10638
+//#define OBSOLETE_ER_NDB_DISCARDING_EVENT_ID_VERSION_MISMATCH 10639
+//#define OBSOLETE_ER_NDB_CLEAR_SLOCK_INFO 10640
+//#define OBSOLETE_ER_NDB_BINLOG_SKIPPING_LOCAL_TABLE 10641
+//#define OBSOLETE_ER_NDB_BINLOG_ONLINE_ALTER_RENAME 10642
+//#define OBSOLETE_ER_NDB_BINLOG_CANT_REOPEN_SHADOW_TABLE 10643
+//#define OBSOLETE_ER_NDB_BINLOG_ONLINE_ALTER_RENAME_COMPLETE 10644
+//#define OBSOLETE_ER_NDB_BINLOG_SKIPPING_DROP_OF_LOCAL_TABLE 10645
+//#define OBSOLETE_ER_NDB_BINLOG_SKIPPING_RENAME_OF_LOCAL_TABLE 10646
+//#define OBSOLETE_ER_NDB_BINLOG_SKIPPING_DROP_OF_TABLES 10647
+//#define OBSOLETE_ER_NDB_BINLOG_GOT_DIST_PRIV_EVENT_FLUSHING_PRIVILEGES 10648
+//#define OBSOLETE_ER_NDB_BINLOG_GOT_SCHEMA_EVENT 10649
+//#define OBSOLETE_ER_NDB_BINLOG_SKIPPING_OLD_SCHEMA_OPERATION 10650
+//#define OBSOLETE_ER_NDB_CLUSTER_FAILURE 10651
+//#define OBSOLETE_ER_NDB_TABLES_INITIALLY_READ_ONLY_ON_RECONNECT 10652
+//#define OBSOLETE_ER_NDB_IGNORING_UNKNOWN_EVENT 10653
+//#define OBSOLETE_ER_NDB_BINLOG_OPENING_INDEX 10654
+//#define OBSOLETE_ER_NDB_BINLOG_CANT_LOCK_NDB_BINLOG_INDEX 10655
+//#define OBSOLETE_ER_NDB_BINLOG_INJECTING_RANDOM_WRITE_FAILURE 10656
+//#define OBSOLETE_ER_NDB_BINLOG_CANT_WRITE_TO_NDB_BINLOG_INDEX 10657
+//#define OBSOLETE_ER_NDB_BINLOG_WRITING_TO_NDB_BINLOG_INDEX 10658
+//#define OBSOLETE_ER_NDB_BINLOG_CANT_COMMIT_TO_NDB_BINLOG_INDEX 10659
+//#define OBSOLETE_ER_NDB_BINLOG_WRITE_INDEX_FAILED_AFTER_KILL 10660
+//#define OBSOLETE_ER_NDB_BINLOG_USING_SERVER_ID_0_SLAVES_WILL_NOT 10661
+//#define OBSOLETE_ER_NDB_SERVER_ID_RESERVED_OR_TOO_LARGE 10662
+//#define OBSOLETE_ER_NDB_BINLOG_REQUIRES_V2_ROW_EVENTS 10663
+//#define OBSOLETE_ER_NDB_BINLOG_STATUS_FORCING_FULL_USE_WRITE 10664
+//#define OBSOLETE_ER_NDB_BINLOG_GENERIC_MESSAGE 10665
+//#define OBSOLETE_ER_NDB_CONFLICT_GENERIC_MESSAGE 10666
+//#define OBSOLETE_ER_NDB_TRANS_DEPENDENCY_TRACKER_ERROR 10667
+//#define OBSOLETE_ER_NDB_CONFLICT_FN_PARSE_ERROR 10668
+//#define OBSOLETE_ER_NDB_CONFLICT_FN_SETUP_ERROR 10669
+//#define OBSOLETE_ER_NDB_BINLOG_FAILED_TO_GET_TABLE 10670
+//#define OBSOLETE_ER_NDB_BINLOG_NOT_LOGGING 10671
+//#define OBSOLETE_ER_NDB_BINLOG_CREATE_TABLE_EVENT_FAILED 10672
+//#define OBSOLETE_ER_NDB_BINLOG_CREATE_TABLE_EVENT_INFO 10673
+//#define OBSOLETE_ER_NDB_BINLOG_DISCOVER_TABLE_EVENT_INFO 10674
+//#define OBSOLETE_ER_NDB_BINLOG_BLOB_REQUIRES_PK 10675
+//#define OBSOLETE_ER_NDB_BINLOG_CANT_CREATE_EVENT_IN_DB 10676
+//#define OBSOLETE_ER_NDB_BINLOG_CANT_CREATE_EVENT_IN_DB_AND_CANT_DROP 10677
+//#define OBSOLETE_ER_NDB_BINLOG_CANT_CREATE_EVENT_IN_DB_DROPPED 10678
+//#define OBSOLETE_ER_NDB_BINLOG_DISCOVER_REUSING_OLD_EVENT_OPS 10679
+//#define OBSOLETE_ER_NDB_BINLOG_CREATING_NDBEVENTOPERATION_FAILED 10680
+//#define OBSOLETE_ER_NDB_BINLOG_CANT_CREATE_BLOB 10681
+//#define OBSOLETE_ER_NDB_BINLOG_NDBEVENT_EXECUTE_FAILED 10682
+//#define OBSOLETE_ER_NDB_CREATE_EVENT_OPS_LOGGING_INFO 10683
+//#define OBSOLETE_ER_NDB_BINLOG_CANT_DROP_EVENT_FROM_DB 10684
+//#define OBSOLETE_ER_NDB_TIMED_OUT_IN_DROP_TABLE 10685
+//#define OBSOLETE_ER_NDB_BINLOG_UNHANDLED_ERROR_FOR_TABLE 10686
+//#define OBSOLETE_ER_NDB_BINLOG_CLUSTER_FAILURE 10687
+//#define OBSOLETE_ER_NDB_BINLOG_UNKNOWN_NON_DATA_EVENT 10688
+//#define OBSOLETE_ER_NDB_BINLOG_INJECTOR_DISCARDING_ROW_EVENT_METADATA 10689
+//#define OBSOLETE_ER_NDB_REMAINING_OPEN_TABLES 10690
+//#define OBSOLETE_ER_NDB_REMAINING_OPEN_TABLE_INFO 10691
+//#define OBSOLETE_ER_NDB_COULD_NOT_GET_APPLY_STATUS_SHARE 10692
+//#define OBSOLETE_ER_NDB_BINLOG_SERVER_SHUTDOWN_DURING_NDB_CLUSTER_START 10693
+//#define OBSOLETE_ER_NDB_BINLOG_CLUSTER_RESTARTED_RESET_MASTER_SUGGESTED 10694
+//#define OBSOLETE_ER_NDB_BINLOG_CLUSTER_HAS_RECONNECTED 10695
+//#define OBSOLETE_ER_NDB_BINLOG_STARTING_LOG_AT_EPOCH 10696
+//#define OBSOLETE_ER_NDB_BINLOG_NDB_TABLES_WRITABLE 10697
+//#define OBSOLETE_ER_NDB_BINLOG_SHUTDOWN_DETECTED 10698
+//#define OBSOLETE_ER_NDB_BINLOG_LOST_SCHEMA_CONNECTION_WAITING 10699
+//#define OBSOLETE_ER_NDB_BINLOG_LOST_SCHEMA_CONNECTION_CONTINUING 10700
+//#define OBSOLETE_ER_NDB_BINLOG_ERROR_HANDLING_SCHEMA_EVENT 10701
+//#define OBSOLETE_ER_NDB_BINLOG_CANT_INJECT_APPLY_STATUS_WRITE_ROW 10702
+//#define OBSOLETE_ER_NDB_BINLOG_ERROR_DURING_GCI_ROLLBACK 10703
+//#define OBSOLETE_ER_NDB_BINLOG_ERROR_DURING_GCI_COMMIT 10704
+//#define OBSOLETE_ER_NDB_BINLOG_LATEST_TRX_IN_EPOCH_NOT_IN_BINLOG 10705
+//#define OBSOLETE_ER_NDB_BINLOG_RELEASING_EXTRA_SHARE_REFERENCES 10706
+//#define OBSOLETE_ER_NDB_BINLOG_REMAINING_OPEN_TABLES 10707
+//#define OBSOLETE_ER_NDB_BINLOG_REMAINING_OPEN_TABLE_INFO 10708
+#define ER_TREE_CORRUPT_PARENT_SHOULD_POINT_AT_PARENT 10709
+#define ER_TREE_CORRUPT_ROOT_SHOULD_BE_BLACK 10710
+#define ER_TREE_CORRUPT_2_CONSECUTIVE_REDS 10711
+#define ER_TREE_CORRUPT_RIGHT_IS_LEFT 10712
+#define ER_TREE_CORRUPT_INCORRECT_BLACK_COUNT 10713
+#define ER_WRONG_COUNT_FOR_ORIGIN 10714
+#define ER_WRONG_COUNT_FOR_KEY 10715
+#define ER_WRONG_COUNT_OF_ELEMENTS 10716
+#define ER_RPL_ERROR_READING_SLAVE_WORKER_CONFIGURATION 10717
+#define ER_RPL_ERROR_WRITING_SLAVE_WORKER_CONFIGURATION 10718
+#define ER_RPL_FAILED_TO_OPEN_RELAY_LOG 10719
+#define ER_RPL_WORKER_CANT_READ_RELAY_LOG 10720
+#define ER_RPL_WORKER_CANT_FIND_NEXT_RELAY_LOG 10721
+#define ER_RPL_MTS_SLAVE_COORDINATOR_HAS_WAITED 10722
+#define ER_BINLOG_FAILED_TO_WRITE_DROP_FOR_TEMP_TABLES 10723
+#define ER_BINLOG_OOM_WRITING_DELETE_WHILE_OPENING_HEAP_TABLE 10724
+#define ER_FAILED_TO_REPAIR_TABLE 10725
+#define ER_FAILED_TO_REMOVE_TEMP_TABLE 10726
+#define ER_SYSTEM_TABLE_NOT_TRANSACTIONAL 10727
+#define ER_RPL_ERROR_WRITING_MASTER_CONFIGURATION 10728
+#define ER_RPL_ERROR_READING_MASTER_CONFIGURATION 10729
+#define ER_RPL_SSL_INFO_IN_MASTER_INFO_IGNORED 10730
+#define ER_PLUGIN_FAILED_DEINITIALIZATION 10731
+#define ER_PLUGIN_HAS_NONZERO_REFCOUNT_AFTER_DEINITIALIZATION 10732
+#define ER_PLUGIN_SHUTTING_DOWN_PLUGIN 10733
+#define ER_PLUGIN_REGISTRATION_FAILED 10734
+#define ER_PLUGIN_CANT_OPEN_PLUGIN_TABLE 10735
+#define ER_PLUGIN_CANT_LOAD 10736
+#define ER_PLUGIN_LOAD_PARAMETER_TOO_LONG 10737
+#define ER_PLUGIN_FORCING_SHUTDOWN 10738
+#define ER_PLUGIN_HAS_NONZERO_REFCOUNT_AFTER_SHUTDOWN 10739
+#define ER_PLUGIN_UNKNOWN_VARIABLE_TYPE 10740
+#define ER_PLUGIN_VARIABLE_SET_READ_ONLY 10741
+#define ER_PLUGIN_VARIABLE_MISSING_NAME 10742
+#define ER_PLUGIN_VARIABLE_NOT_ALLOCATED_THREAD_LOCAL 10743
+#define ER_PLUGIN_OOM 10744
+#define ER_PLUGIN_BAD_OPTIONS 10745
+#define ER_PLUGIN_PARSING_OPTIONS_FAILED 10746
+#define ER_PLUGIN_DISABLED 10747
+#define ER_PLUGIN_HAS_CONFLICTING_SYSTEM_VARIABLES 10748
+#define ER_PLUGIN_CANT_SET_PERSISTENT_OPTIONS 10749
+#define ER_MY_NET_WRITE_FAILED_FALLING_BACK_ON_STDERR 10750
+#define ER_RETRYING_REPAIR_WITHOUT_QUICK 10751
+#define ER_RETRYING_REPAIR_WITH_KEYCACHE 10752
+#define ER_FOUND_ROWS_WHILE_REPAIRING 10753
+#define ER_ERROR_DURING_OPTIMIZE_TABLE 10754
+#define ER_ERROR_ENABLING_KEYS 10755
+#define ER_CHECKING_TABLE 10756
+#define ER_RECOVERING_TABLE 10757
+#define ER_CANT_CREATE_TABLE_SHARE_FROM_FRM 10758
+#define ER_CANT_LOCK_TABLE 10759
+#define ER_CANT_ALLOC_TABLE_OBJECT 10760
+#define ER_CANT_CREATE_HANDLER_OBJECT_FOR_TABLE 10761
+#define ER_CANT_SET_HANDLER_REFERENCE_FOR_TABLE 10762
+#define ER_CANT_LOCK_TABLESPACE 10763
+#define ER_CANT_UPGRADE_GENERATED_COLUMNS_TO_DD 10764
+#define ER_DD_ERROR_CREATING_ENTRY 10765
+#define ER_DD_CANT_FETCH_TABLE_DATA 10766
+#define ER_DD_CANT_FIX_SE_DATA 10767
+#define ER_DD_CANT_CREATE_SP 10768
+#define ER_CANT_OPEN_DB_OPT_USING_DEFAULT_CHARSET 10769
+#define ER_CANT_CREATE_CACHE_FOR_DB_OPT 10770
+#define ER_CANT_IDENTIFY_CHARSET_USING_DEFAULT 10771
+#define ER_DB_OPT_NOT_FOUND_USING_DEFAULT_CHARSET 10772
+#define ER_EVENT_CANT_GET_TIMEZONE_FROM_FIELD 10773
+#define ER_EVENT_CANT_FIND_TIMEZONE 10774
+#define ER_EVENT_CANT_GET_CHARSET 10775
+#define ER_EVENT_CANT_GET_COLLATION 10776
+#define ER_EVENT_CANT_OPEN_TABLE_MYSQL_EVENT 10777
+#define ER_CANT_PARSE_STORED_ROUTINE_BODY 10778
+#define ER_CANT_OPEN_TABLE_MYSQL_PROC 10779
+#define ER_CANT_READ_TABLE_MYSQL_PROC 10780
+#define ER_FILE_EXISTS_DURING_UPGRADE 10781
+#define ER_CANT_OPEN_DATADIR_AFTER_UPGRADE_FAILURE 10782
+#define ER_CANT_SET_PATH_FOR 10783
+#define ER_CANT_OPEN_DIR 10784
+//#define OBSOLETE_ER_NDB_CLUSTER_CONNECTION_POOL_NODEIDS 10785
+//#define OBSOLETE_ER_NDB_CANT_PARSE_NDB_CLUSTER_CONNECTION_POOL_NODEIDS 10786
+//#define OBSOLETE_ER_NDB_INVALID_CLUSTER_CONNECTION_POOL_NODEIDS 10787
+//#define OBSOLETE_ER_NDB_DUPLICATE_CLUSTER_CONNECTION_POOL_NODEIDS 10788
+//#define OBSOLETE_ER_NDB_POOL_SIZE_CLUSTER_CONNECTION_POOL_NODEIDS 10789
+//#define OBSOLETE_ER_NDB_NODEID_NOT_FIRST_CONNECTION_POOL_NODEIDS 10790
+//#define OBSOLETE_ER_NDB_USING_NODEID 10791
+//#define OBSOLETE_ER_NDB_CANT_ALLOC_GLOBAL_NDB_CLUSTER_CONNECTION 10792
+//#define OBSOLETE_ER_NDB_CANT_ALLOC_GLOBAL_NDB_OBJECT 10793
+//#define OBSOLETE_ER_NDB_USING_NODEID_LIST 10794
+//#define OBSOLETE_ER_NDB_CANT_ALLOC_NDB_CLUSTER_CONNECTION 10795
+//#define OBSOLETE_ER_NDB_STARTING_CONNECT_THREAD 10796
+//#define OBSOLETE_ER_NDB_NODE_INFO 10797
+//#define OBSOLETE_ER_NDB_CANT_START_CONNECT_THREAD 10798
+//#define OBSOLETE_ER_NDB_GENERIC_ERROR 10799
+//#define OBSOLETE_ER_NDB_CPU_MASK_TOO_SHORT 10800
+#define ER_EVENT_ERROR_CREATING_QUERY_TO_WRITE_TO_BINLOG 10801
+#define ER_EVENT_SCHEDULER_ERROR_LOADING_FROM_DB 10802
+#define ER_EVENT_SCHEDULER_ERROR_GETTING_EVENT_OBJECT 10803
+#define ER_EVENT_SCHEDULER_GOT_BAD_DATA_FROM_TABLE 10804
+#define ER_EVENT_CANT_GET_LOCK_FOR_DROPPING_EVENT 10805
+#define ER_EVENT_UNABLE_TO_DROP_EVENT 10806
+//#define OBSOLETE_ER_BINLOG_ATTACHING_THREAD_MEMORY_FINALLY_AVAILABLE 10807
+#define ER_BINLOG_CANT_RESIZE_CACHE 10808
+#define ER_BINLOG_FILE_BEING_READ_NOT_PURGED 10809
+#define ER_BINLOG_IO_ERROR_READING_HEADER 10810
+//#define OBSOLETE_ER_BINLOG_CANT_OPEN_LOG 10811
+//#define OBSOLETE_ER_BINLOG_CANT_CREATE_CACHE_FOR_LOG 10812
+#define ER_BINLOG_FILE_EXTENSION_NUMBER_EXHAUSTED 10813
+#define ER_BINLOG_FILE_NAME_TOO_LONG 10814
+#define ER_BINLOG_FILE_EXTENSION_NUMBER_RUNNING_LOW 10815
+#define ER_BINLOG_CANT_OPEN_FOR_LOGGING 10816
+#define ER_BINLOG_FAILED_TO_SYNC_INDEX_FILE 10817
+#define ER_BINLOG_ERROR_READING_GTIDS_FROM_RELAY_LOG 10818
+#define ER_BINLOG_EVENTS_READ_FROM_RELAY_LOG_INFO 10819
+#define ER_BINLOG_ERROR_READING_GTIDS_FROM_BINARY_LOG 10820
+#define ER_BINLOG_EVENTS_READ_FROM_BINLOG_INFO 10821
+#define ER_BINLOG_CANT_GENERATE_NEW_FILE_NAME 10822
+#define ER_BINLOG_FAILED_TO_SYNC_INDEX_FILE_IN_OPEN 10823
+#define ER_BINLOG_CANT_USE_FOR_LOGGING 10824
+#define ER_BINLOG_FAILED_TO_CLOSE_INDEX_FILE_WHILE_REBUILDING 10825
+#define ER_BINLOG_FAILED_TO_DELETE_INDEX_FILE_WHILE_REBUILDING 10826
+#define ER_BINLOG_FAILED_TO_RENAME_INDEX_FILE_WHILE_REBUILDING 10827
+#define ER_BINLOG_FAILED_TO_OPEN_INDEX_FILE_AFTER_REBUILDING 10828
+#define ER_BINLOG_CANT_APPEND_LOG_TO_TMP_INDEX 10829
+#define ER_BINLOG_CANT_LOCATE_OLD_BINLOG_OR_RELAY_LOG_FILES 10830
+#define ER_BINLOG_CANT_DELETE_FILE 10831
+#define ER_BINLOG_CANT_SET_TMP_INDEX_NAME 10832
+#define ER_BINLOG_FAILED_TO_OPEN_TEMPORARY_INDEX_FILE 10833
+//#define OBSOLETE_ER_BINLOG_ERROR_GETTING_NEXT_LOG_FROM_INDEX 10834
+#define ER_BINLOG_CANT_OPEN_TMP_INDEX 10835
+#define ER_BINLOG_CANT_COPY_INDEX_TO_TMP 10836
+#define ER_BINLOG_CANT_CLOSE_TMP_INDEX 10837
+#define ER_BINLOG_CANT_MOVE_TMP_TO_INDEX 10838
+#define ER_BINLOG_PURGE_LOGS_CALLED_WITH_FILE_NOT_IN_INDEX 10839
+#define ER_BINLOG_PURGE_LOGS_CANT_SYNC_INDEX_FILE 10840
+#define ER_BINLOG_PURGE_LOGS_CANT_COPY_TO_REGISTER_FILE 10841
+#define ER_BINLOG_PURGE_LOGS_CANT_FLUSH_REGISTER_FILE 10842
+#define ER_BINLOG_PURGE_LOGS_CANT_UPDATE_INDEX_FILE 10843
+#define ER_BINLOG_PURGE_LOGS_FAILED_TO_PURGE_LOG 10844
+#define ER_BINLOG_FAILED_TO_SET_PURGE_INDEX_FILE_NAME 10845
+#define ER_BINLOG_FAILED_TO_OPEN_REGISTER_FILE 10846
+#define ER_BINLOG_FAILED_TO_REINIT_REGISTER_FILE 10847
+#define ER_BINLOG_FAILED_TO_READ_REGISTER_FILE 10848
+#define ER_CANT_STAT_FILE 10849
+#define ER_BINLOG_CANT_DELETE_LOG_FILE_DOES_INDEX_MATCH_FILES 10850
+#define ER_BINLOG_CANT_DELETE_FILE_AND_READ_BINLOG_INDEX 10851
+#define ER_BINLOG_FAILED_TO_DELETE_LOG_FILE 10852
+#define ER_BINLOG_LOGGING_INCIDENT_TO_STOP_SLAVES 10853
+#define ER_BINLOG_CANT_FIND_LOG_IN_INDEX 10854
+#define ER_BINLOG_RECOVERING_AFTER_CRASH_USING 10855
+#define ER_BINLOG_CANT_OPEN_CRASHED_BINLOG 10856
+#define ER_BINLOG_CANT_TRIM_CRASHED_BINLOG 10857
+#define ER_BINLOG_CRASHED_BINLOG_TRIMMED 10858
+#define ER_BINLOG_CANT_CLEAR_IN_USE_FLAG_FOR_CRASHED_BINLOG 10859
+#define ER_BINLOG_FAILED_TO_RUN_AFTER_SYNC_HOOK 10860
+#define ER_TURNING_LOGGING_OFF_FOR_THE_DURATION 10861
+#define ER_BINLOG_FAILED_TO_RUN_AFTER_FLUSH_HOOK 10862
+#define ER_BINLOG_CRASH_RECOVERY_FAILED 10863
+#define ER_BINLOG_WARNING_SUPPRESSED 10864
+#define ER_NDB_LOG_ENTRY 10865
+#define ER_NDB_LOG_ENTRY_WITH_PREFIX 10866
+//#define OBSOLETE_ER_NDB_BINLOG_CANT_CREATE_PURGE_THD 10867
+#define ER_INNODB_UNKNOWN_COLLATION 10868
+#define ER_INNODB_INVALID_LOG_GROUP_HOME_DIR 10869
+#define ER_INNODB_INVALID_INNODB_UNDO_DIRECTORY 10870
+#define ER_INNODB_ILLEGAL_COLON_IN_POOL 10871
+#define ER_INNODB_INVALID_PAGE_SIZE 10872
+#define ER_INNODB_DIRTY_WATER_MARK_NOT_LOW 10873
+#define ER_INNODB_IO_CAPACITY_EXCEEDS_MAX 10874
+#define ER_INNODB_FILES_SAME 10875
+#define ER_INNODB_UNREGISTERED_TRX_ACTIVE 10876
+#define ER_INNODB_CLOSING_CONNECTION_ROLLS_BACK 10877
+#define ER_INNODB_TRX_XLATION_TABLE_OOM 10878
+#define ER_INNODB_CANT_FIND_INDEX_IN_INNODB_DD 10879
+#define ER_INNODB_INDEX_COLUMN_INFO_UNLIKE_MYSQLS 10880
+#define ER_INNODB_CANT_OPEN_TABLE 10881
+#define ER_INNODB_CANT_BUILD_INDEX_XLATION_TABLE_FOR 10882
+#define ER_INNODB_PK_NOT_IN_MYSQL 10883
+#define ER_INNODB_PK_ONLY_IN_MYSQL 10884
+#define ER_INNODB_CLUSTERED_INDEX_PRIVATE 10885
+#define ER_INNODB_PARTITION_TABLE_LOWERCASED 10886
+#define ER_ERRMSG_REPLACEMENT_DODGY 10887
+#define ER_ERRMSG_REPLACEMENTS_FAILED 10888
+#define ER_NPIPE_CANT_CREATE 10889
+#define ER_PARTITION_MOVE_CREATED_DUPLICATE_ROW_PLEASE_FIX 10890
+#define ER_AUDIT_CANT_ABORT_COMMAND 10891
+#define ER_AUDIT_CANT_ABORT_EVENT 10892
+#define ER_AUDIT_WARNING 10893
+//#define OBSOLETE_ER_NDB_NUMBER_OF_CHANNELS 10894
+//#define OBSOLETE_ER_NDB_SLAVE_PARALLEL_WORKERS 10895
+//#define OBSOLETE_ER_NDB_DISTRIBUTING_ERR 10896
+#define ER_RPL_SLAVE_INSECURE_CHANGE_MASTER 10897
+//#define OBSOLETE_ER_RPL_SLAVE_FLUSH_RELAY_LOGS_NOT_ALLOWED 10898
+#define ER_RPL_SLAVE_INCORRECT_CHANNEL 10899
+#define ER_FAILED_TO_FIND_DL_ENTRY 10900
+#define ER_FAILED_TO_OPEN_SHARED_LIBRARY 10901
+#define ER_THREAD_PRIORITY_IGNORED 10902
+#define ER_BINLOG_CACHE_SIZE_TOO_LARGE 10903
+#define ER_BINLOG_STMT_CACHE_SIZE_TOO_LARGE 10904
+#define ER_FAILED_TO_GENERATE_UNIQUE_LOGFILE 10905
+#define ER_FAILED_TO_READ_FILE 10906
+#define ER_FAILED_TO_WRITE_TO_FILE 10907
+#define ER_BINLOG_UNSAFE_MESSAGE_AND_STATEMENT 10908
+#define ER_FORCE_CLOSE_THREAD 10909
+#define ER_SERVER_SHUTDOWN_COMPLETE 10910
+#define ER_RPL_CANT_HAVE_SAME_BASENAME 10911
+#define ER_RPL_GTID_MODE_REQUIRES_ENFORCE_GTID_CONSISTENCY_ON 10912
+#define ER_WARN_NO_SERVERID_SPECIFIED 10913
+#define ER_ABORTING_USER_CONNECTION 10914
+#define ER_SQL_MODE_MERGED_WITH_STRICT_MODE 10915
+#define ER_GTID_PURGED_WAS_UPDATED 10916
+#define ER_GTID_EXECUTED_WAS_UPDATED 10917
+#define ER_DEPRECATE_MSG_WITH_REPLACEMENT 10918
+#define ER_TRG_CREATION_CTX_NOT_SET 10919
+#define ER_FILE_HAS_OLD_FORMAT 10920
+#define ER_VIEW_CREATION_CTX_NOT_SET 10921
+//#define OBSOLETE_ER_TABLE_NAME_CAUSES_TOO_LONG_PATH 10922
+#define ER_TABLE_UPGRADE_REQUIRED 10923
+#define ER_GET_ERRNO_FROM_STORAGE_ENGINE 10924
+#define ER_ACCESS_DENIED_ERROR_WITHOUT_PASSWORD 10925
+#define ER_ACCESS_DENIED_ERROR_WITH_PASSWORD 10926
+#define ER_ACCESS_DENIED_FOR_USER_ACCOUNT_LOCKED 10927
+#define ER_MUST_CHANGE_EXPIRED_PASSWORD 10928
+#define ER_SYSTEM_TABLES_NOT_SUPPORTED_BY_STORAGE_ENGINE 10929
+#define ER_FILESORT_TERMINATED 10930
+#define ER_SERVER_STARTUP_MSG 10931
+#define ER_FAILED_TO_FIND_LOCALE_NAME 10932
+#define ER_FAILED_TO_FIND_COLLATION_NAME 10933
+#define ER_SERVER_OUT_OF_RESOURCES 10934
+#define ER_SERVER_OUTOFMEMORY 10935
+#define ER_INVALID_COLLATION_FOR_CHARSET 10936
+#define ER_CANT_START_ERROR_LOG_SERVICE 10937
+#define ER_CREATING_NEW_UUID_FIRST_START 10938
+#define ER_FAILED_TO_GET_ABSOLUTE_PATH 10939
+#define ER_PERFSCHEMA_COMPONENTS_INFRASTRUCTURE_BOOTSTRAP 10940
+#define ER_PERFSCHEMA_COMPONENTS_INFRASTRUCTURE_SHUTDOWN 10941
+#define ER_DUP_FD_OPEN_FAILED 10942
+#define ER_SYSTEM_VIEW_INIT_FAILED 10943
+#define ER_RESOURCE_GROUP_POST_INIT_FAILED 10944
+#define ER_RESOURCE_GROUP_SUBSYSTEM_INIT_FAILED 10945
+#define ER_FAILED_START_MYSQLD_DAEMON 10946
+#define ER_CANNOT_CHANGE_TO_ROOT_DIR 10947
+#define ER_PERSISTENT_PRIVILEGES_BOOTSTRAP 10948
+#define ER_BASEDIR_SET_TO 10949
+#define ER_RPL_FILTER_ADD_WILD_DO_TABLE_FAILED 10950
+#define ER_RPL_FILTER_ADD_WILD_IGNORE_TABLE_FAILED 10951
+#define ER_PRIVILEGE_SYSTEM_INIT_FAILED 10952
+#define ER_CANNOT_SET_LOG_ERROR_SERVICES 10953
+#define ER_PERFSCHEMA_TABLES_INIT_FAILED 10954
+#define ER_TX_EXTRACTION_ALGORITHM_FOR_BINLOG_TX_DEPEDENCY_TRACKING 10955
+#define ER_INVALID_REPLICATION_TIMESTAMPS 10956
+#define ER_RPL_TIMESTAMPS_RETURNED_TO_NORMAL 10957
+#define ER_BINLOG_FILE_OPEN_FAILED 10958
+#define ER_BINLOG_EVENT_WRITE_TO_STMT_CACHE_FAILED 10959
+#define ER_SLAVE_RELAY_LOG_TRUNCATE_INFO 10960
+#define ER_SLAVE_RELAY_LOG_PURGE_FAILED 10961
+#define ER_RPL_SLAVE_FILTER_CREATE_FAILED 10962
+#define ER_RPL_SLAVE_GLOBAL_FILTERS_COPY_FAILED 10963
+#define ER_RPL_SLAVE_RESET_FILTER_OPTIONS 10964
+#define ER_MISSING_GRANT_SYSTEM_TABLE 10965
+#define ER_MISSING_ACL_SYSTEM_TABLE 10966
+#define ER_ANONYMOUS_AUTH_ID_NOT_ALLOWED_IN_MANDATORY_ROLES 10967
+#define ER_UNKNOWN_AUTH_ID_IN_MANDATORY_ROLE 10968
+#define ER_WRITE_ROW_TO_PARTITION_FAILED 10969
+#define ER_RESOURCE_GROUP_METADATA_UPDATE_SKIPPED 10970
+#define ER_FAILED_TO_PERSIST_RESOURCE_GROUP_METADATA 10971
+#define ER_FAILED_TO_DESERIALIZE_RESOURCE_GROUP 10972
+#define ER_FAILED_TO_UPDATE_RESOURCE_GROUP 10973
+#define ER_RESOURCE_GROUP_VALIDATION_FAILED 10974
+#define ER_FAILED_TO_ALLOCATE_MEMORY_FOR_RESOURCE_GROUP 10975
+#define ER_FAILED_TO_ALLOCATE_MEMORY_FOR_RESOURCE_GROUP_HASH 10976
+#define ER_FAILED_TO_ADD_RESOURCE_GROUP_TO_MAP 10977
+#define ER_RESOURCE_GROUP_IS_DISABLED 10978
+#define ER_FAILED_TO_APPLY_RESOURCE_GROUP_CONTROLLER 10979
+#define ER_FAILED_TO_ACQUIRE_LOCK_ON_RESOURCE_GROUP 10980
+#define ER_PFS_NOTIFICATION_FUNCTION_REGISTER_FAILED 10981
+#define ER_RES_GRP_SET_THR_AFFINITY_FAILED 10982
+#define ER_RES_GRP_SET_THR_AFFINITY_TO_CPUS_FAILED 10983
+#define ER_RES_GRP_THD_UNBIND_FROM_CPU_FAILED 10984
+#define ER_RES_GRP_SET_THREAD_PRIORITY_FAILED 10985
+#define ER_RES_GRP_FAILED_TO_DETERMINE_NICE_CAPABILITY 10986
+#define ER_RES_GRP_FAILED_TO_GET_THREAD_HANDLE 10987
+#define ER_RES_GRP_GET_THREAD_PRIO_NOT_SUPPORTED 10988
+#define ER_RES_GRP_FAILED_DETERMINE_CPU_COUNT 10989
+#define ER_RES_GRP_FEATURE_NOT_AVAILABLE 10990
+#define ER_RES_GRP_INVALID_THREAD_PRIORITY 10991
+#define ER_RES_GRP_SOLARIS_PROCESSOR_BIND_TO_CPUID_FAILED 10992
+#define ER_RES_GRP_SOLARIS_PROCESSOR_BIND_TO_THREAD_FAILED 10993
+#define ER_RES_GRP_SOLARIS_PROCESSOR_AFFINITY_FAILED 10994
+#define ER_DD_UPGRADE_RENAME_IDX_STATS_FILE_FAILED 10995
+#define ER_DD_UPGRADE_DD_OPEN_FAILED 10996
+#define ER_DD_UPGRADE_FAILED_TO_FETCH_TABLESPACES 10997
+#define ER_DD_UPGRADE_FAILED_TO_ACQUIRE_TABLESPACE 10998
+#define ER_DD_UPGRADE_FAILED_TO_RESOLVE_TABLESPACE_ENGINE 10999
+#define ER_FAILED_TO_CREATE_SDI_FOR_TABLESPACE 11000
+#define ER_FAILED_TO_STORE_SDI_FOR_TABLESPACE 11001
+#define ER_DD_UPGRADE_FAILED_TO_FETCH_TABLES 11002
+#define ER_DD_UPGRADE_DD_POPULATED 11003
+#define ER_DD_UPGRADE_INFO_FILE_OPEN_FAILED 11004
+#define ER_DD_UPGRADE_INFO_FILE_CLOSE_FAILED 11005
+#define ER_DD_UPGRADE_TABLESPACE_MIGRATION_FAILED 11006
+#define ER_DD_UPGRADE_FAILED_TO_CREATE_TABLE_STATS 11007
+#define ER_DD_UPGRADE_TABLE_STATS_MIGRATE_COMPLETED 11008
+#define ER_DD_UPGRADE_FAILED_TO_CREATE_INDEX_STATS 11009
+#define ER_DD_UPGRADE_INDEX_STATS_MIGRATE_COMPLETED 11010
+#define ER_DD_UPGRADE_FAILED_FIND_VALID_DATA_DIR 11011
+#define ER_DD_UPGRADE_START 11012
+#define ER_DD_UPGRADE_FAILED_INIT_DD_SE 11013
+#define ER_DD_UPGRADE_FOUND_PARTIALLY_UPGRADED_DD_ABORT 11014
+#define ER_DD_UPGRADE_FOUND_PARTIALLY_UPGRADED_DD_CONTINUE 11015
+#define ER_DD_UPGRADE_SE_LOGS_FAILED 11016
+#define ER_DD_UPGRADE_SDI_INFO_UPDATE_FAILED 11017
+#define ER_SKIP_UPDATING_METADATA_IN_SE_RO_MODE 11018
+#define ER_CREATED_SYSTEM_WITH_VERSION 11019
+#define ER_UNKNOWN_ERROR_DETECTED_IN_SE 11020
+#define ER_READ_LOG_EVENT_FAILED 11021
+#define ER_ROW_DATA_TOO_BIG_TO_WRITE_IN_BINLOG 11022
+#define ER_FAILED_TO_CONSTRUCT_DROP_EVENT_QUERY 11023
+#define ER_FAILED_TO_BINLOG_DROP_EVENT 11024
+#define ER_FAILED_TO_START_SLAVE_THREAD 11025
+#define ER_RPL_IO_THREAD_KILLED 11026
+#define ER_SLAVE_RECONNECT_FAILED 11027
+#define ER_SLAVE_KILLED_AFTER_RECONNECT 11028
+#define ER_SLAVE_NOT_STARTED_ON_SOME_CHANNELS 11029
+#define ER_FAILED_TO_ADD_RPL_FILTER 11030
+#define ER_PER_CHANNEL_RPL_FILTER_CONF_FOR_GRP_RPL 11031
+#define ER_RPL_FILTERS_NOT_ATTACHED_TO_CHANNEL 11032
+#define ER_FAILED_TO_BUILD_DO_AND_IGNORE_TABLE_HASHES 11033
+#define ER_CLONE_PLUGIN_NOT_LOADED_TRACE 11034
+#define ER_CLONE_HANDLER_EXIST_TRACE 11035
+#define ER_CLONE_CREATE_HANDLER_FAIL_TRACE 11036
+#define ER_CYCLE_TIMER_IS_NOT_AVAILABLE 11037
+#define ER_NANOSECOND_TIMER_IS_NOT_AVAILABLE 11038
+#define ER_MICROSECOND_TIMER_IS_NOT_AVAILABLE 11039
+#define ER_PFS_MALLOC_ARRAY_OVERFLOW 11040
+#define ER_PFS_MALLOC_ARRAY_OOM 11041
+#define ER_INNODB_FAILED_TO_FIND_IDX_WITH_KEY_NO 11042
+#define ER_INNODB_FAILED_TO_FIND_IDX 11043
+#define ER_INNODB_FAILED_TO_FIND_IDX_FROM_DICT_CACHE 11044
+#define ER_INNODB_ACTIVE_INDEX_CHANGE_FAILED 11045
+#define ER_INNODB_DIFF_IN_REF_LEN 11046
+#define ER_WRONG_TYPE_FOR_COLUMN_PREFIX_IDX_FLD 11047
+#define ER_INNODB_CANNOT_CREATE_TABLE 11048
+#define ER_INNODB_INTERNAL_INDEX 11049
+#define ER_INNODB_IDX_CNT_MORE_THAN_DEFINED_IN_MYSQL 11050
+#define ER_INNODB_IDX_CNT_FEWER_THAN_DEFINED_IN_MYSQL 11051
+#define ER_INNODB_IDX_COLUMN_CNT_DIFF 11052
+#define ER_INNODB_USE_MONITOR_GROUP_NAME 11053
+#define ER_INNODB_MONITOR_DEFAULT_VALUE_NOT_DEFINED 11054
+#define ER_INNODB_MONITOR_IS_ENABLED 11055
+#define ER_INNODB_INVALID_MONITOR_COUNTER_NAME 11056
+#define ER_WIN_LOAD_LIBRARY_FAILED 11057
+#define ER_PARTITION_HANDLER_ADMIN_MSG 11058
+#define ER_RPL_RLI_INIT_INFO_MSG 11059
+#define ER_DD_UPGRADE_TABLE_INTACT_ERROR 11060
+#define ER_SERVER_INIT_COMPILED_IN_COMMANDS 11061
+#define ER_MYISAM_CHECK_METHOD_ERROR 11062
+#define ER_MYISAM_CRASHED_ERROR 11063
+#define ER_WAITPID_FAILED 11064
+#define ER_FAILED_TO_FIND_MYSQLD_STATUS 11065
+#define ER_INNODB_ERROR_LOGGER_MSG 11066
+#define ER_INNODB_ERROR_LOGGER_FATAL_MSG 11067
+#define ER_DEPRECATED_SYNTAX_WITH_REPLACEMENT 11068
+#define ER_DEPRECATED_SYNTAX_NO_REPLACEMENT 11069
+#define ER_DEPRECATE_MSG_NO_REPLACEMENT 11070
+#define ER_LOG_PRINTF_MSG 11071
+#define ER_BINLOG_LOGGING_NOT_POSSIBLE 11072
+#define ER_FAILED_TO_SET_PERSISTED_OPTIONS 11073
+#define ER_COMPONENTS_FAILED_TO_ACQUIRE_SERVICE_IMPLEMENTATION 11074
+#define ER_RES_GRP_INVALID_VCPU_RANGE 11075
+#define ER_RES_GRP_INVALID_VCPU_ID 11076
+#define ER_ERROR_DURING_FLUSH_LOG_COMMIT_PHASE 11077
+#define ER_DROP_DATABASE_FAILED_RMDIR_MANUALLY 11078
+#define ER_EXPIRE_LOGS_DAYS_IGNORED 11079
+#define ER_BINLOG_MALFORMED_OR_OLD_RELAY_LOG 11080
+#define ER_DD_UPGRADE_VIEW_COLUMN_NAME_TOO_LONG 11081
+#define ER_TABLE_NEEDS_DUMP_UPGRADE 11082
+#define ER_DD_UPGRADE_FAILED_TO_UPDATE_VER_NO_IN_TABLESPACE 11083
+#define ER_KEYRING_MIGRATION_FAILED 11084
+#define ER_KEYRING_MIGRATION_SUCCESSFUL 11085
+#define ER_RESTART_RECEIVED_INFO 11086
+#define ER_LCTN_CHANGED 11087
+#define ER_DD_INITIALIZE 11088
+#define ER_DD_RESTART 11089
+#define ER_DD_UPGRADE 11090
+#define ER_DD_UPGRADE_OFF 11091
+#define ER_DD_UPGRADE_VERSION_NOT_SUPPORTED 11092
+#define ER_DD_UPGRADE_SCHEMA_UNAVAILABLE 11093
+#define ER_DD_MINOR_DOWNGRADE 11094
+#define ER_DD_MINOR_DOWNGRADE_VERSION_NOT_SUPPORTED 11095
+#define ER_DD_NO_VERSION_FOUND 11096
+#define ER_THREAD_POOL_NOT_SUPPORTED_ON_PLATFORM 11097
+#define ER_THREAD_POOL_SIZE_TOO_LOW 11098
+#define ER_THREAD_POOL_SIZE_TOO_HIGH 11099
+#define ER_THREAD_POOL_ALGORITHM_INVALID 11100
+#define ER_THREAD_POOL_INVALID_STALL_LIMIT 11101
+#define ER_THREAD_POOL_INVALID_PRIO_KICKUP_TIMER 11102
+#define ER_THREAD_POOL_MAX_UNUSED_THREADS_INVALID 11103
+#define ER_THREAD_POOL_CON_HANDLER_INIT_FAILED 11104
+#define ER_THREAD_POOL_INIT_FAILED 11105
+#define ER_THREAD_POOL_PLUGIN_STARTED 11106
+#define ER_THREAD_POOL_CANNOT_SET_THREAD_SPECIFIC_DATA 11107
+#define ER_THREAD_POOL_FAILED_TO_CREATE_CONNECT_HANDLER_THD 11108
+#define ER_THREAD_POOL_FAILED_TO_CREATE_THD_AND_AUTH_CONN 11109
+#define ER_THREAD_POOL_FAILED_PROCESS_CONNECT_EVENT 11110
+#define ER_THREAD_POOL_FAILED_TO_CREATE_POOL 11111
+#define ER_THREAD_POOL_RATE_LIMITED_ERROR_MSGS 11112
+#define ER_TRHEAD_POOL_LOW_LEVEL_INIT_FAILED 11113
+#define ER_THREAD_POOL_LOW_LEVEL_REARM_FAILED 11114
+#define ER_THREAD_POOL_BUFFER_TOO_SMALL 11115
+#define ER_MECAB_NOT_SUPPORTED 11116
+#define ER_MECAB_NOT_VERIFIED 11117
+#define ER_MECAB_CREATING_MODEL 11118
+#define ER_MECAB_FAILED_TO_CREATE_MODEL 11119
+#define ER_MECAB_FAILED_TO_CREATE_TRIGGER 11120
+#define ER_MECAB_UNSUPPORTED_CHARSET 11121
+#define ER_MECAB_CHARSET_LOADED 11122
+#define ER_MECAB_PARSE_FAILED 11123
+#define ER_MECAB_OOM_WHILE_PARSING_TEXT 11124
+#define ER_MECAB_CREATE_LATTICE_FAILED 11125
+#define ER_SEMISYNC_TRACE_ENTER_FUNC 11126
+#define ER_SEMISYNC_TRACE_EXIT_WITH_INT_EXIT_CODE 11127
+#define ER_SEMISYNC_TRACE_EXIT_WITH_BOOL_EXIT_CODE 11128
+#define ER_SEMISYNC_TRACE_EXIT 11129
+#define ER_SEMISYNC_RPL_INIT_FOR_TRX 11130
+#define ER_SEMISYNC_FAILED_TO_ALLOCATE_TRX_NODE 11131
+#define ER_SEMISYNC_BINLOG_WRITE_OUT_OF_ORDER 11132
+#define ER_SEMISYNC_INSERT_LOG_INFO_IN_ENTRY 11133
+#define ER_SEMISYNC_PROBE_LOG_INFO_IN_ENTRY 11134
+#define ER_SEMISYNC_CLEARED_ALL_ACTIVE_TRANSACTION_NODES 11135
+#define ER_SEMISYNC_CLEARED_ACTIVE_TRANSACTION_TILL_POS 11136
+#define ER_SEMISYNC_REPLY_MAGIC_NO_ERROR 11137
+#define ER_SEMISYNC_REPLY_PKT_LENGTH_TOO_SMALL 11138
+#define ER_SEMISYNC_REPLY_BINLOG_FILE_TOO_LARGE 11139
+#define ER_SEMISYNC_SERVER_REPLY 11140
+#define ER_SEMISYNC_FUNCTION_CALLED_TWICE 11141
+#define ER_SEMISYNC_RPL_ENABLED_ON_MASTER 11142
+#define ER_SEMISYNC_MASTER_OOM 11143
+#define ER_SEMISYNC_DISABLED_ON_MASTER 11144
+#define ER_SEMISYNC_FORCED_SHUTDOWN 11145
+#define ER_SEMISYNC_MASTER_GOT_REPLY_AT_POS 11146
+#define ER_SEMISYNC_MASTER_SIGNAL_ALL_WAITING_THREADS 11147
+#define ER_SEMISYNC_MASTER_TRX_WAIT_POS 11148
+#define ER_SEMISYNC_BINLOG_REPLY_IS_AHEAD 11149
+#define ER_SEMISYNC_MOVE_BACK_WAIT_POS 11150
+#define ER_SEMISYNC_INIT_WAIT_POS 11151
+#define ER_SEMISYNC_WAIT_TIME_FOR_BINLOG_SENT 11152
+#define ER_SEMISYNC_WAIT_FOR_BINLOG_TIMEDOUT 11153
+#define ER_SEMISYNC_WAIT_TIME_ASSESSMENT_FOR_COMMIT_TRX_FAILED 11154
+#define ER_SEMISYNC_RPL_SWITCHED_OFF 11155
+#define ER_SEMISYNC_RPL_SWITCHED_ON 11156
+#define ER_SEMISYNC_NO_SPACE_IN_THE_PKT 11157
+#define ER_SEMISYNC_SYNC_HEADER_UPDATE_INFO 11158
+#define ER_SEMISYNC_FAILED_TO_INSERT_TRX_NODE 11159
+#define ER_SEMISYNC_TRX_SKIPPED_AT_POS 11160
+#define ER_SEMISYNC_MASTER_FAILED_ON_NET_FLUSH 11161
+#define ER_SEMISYNC_RECEIVED_ACK_IS_SMALLER 11162
+#define ER_SEMISYNC_ADD_ACK_TO_SLOT 11163
+#define ER_SEMISYNC_UPDATE_EXISTING_SLAVE_ACK 11164
+#define ER_SEMISYNC_FAILED_TO_START_ACK_RECEIVER_THD 11165
+#define ER_SEMISYNC_STARTING_ACK_RECEIVER_THD 11166
+#define ER_SEMISYNC_FAILED_TO_WAIT_ON_DUMP_SOCKET 11167
+#define ER_SEMISYNC_STOPPING_ACK_RECEIVER_THREAD 11168
+#define ER_SEMISYNC_FAILED_REGISTER_SLAVE_TO_RECEIVER 11169
+#define ER_SEMISYNC_START_BINLOG_DUMP_TO_SLAVE 11170
+#define ER_SEMISYNC_STOP_BINLOG_DUMP_TO_SLAVE 11171
+#define ER_SEMISYNC_UNREGISTER_TRX_OBSERVER_FAILED 11172
+#define ER_SEMISYNC_UNREGISTER_BINLOG_STORAGE_OBSERVER_FAILED 11173
+#define ER_SEMISYNC_UNREGISTER_BINLOG_TRANSMIT_OBSERVER_FAILED 11174
+#define ER_SEMISYNC_UNREGISTERED_REPLICATOR 11175
+#define ER_SEMISYNC_SOCKET_FD_TOO_LARGE 11176
+#define ER_SEMISYNC_SLAVE_REPLY 11177
+#define ER_SEMISYNC_MISSING_MAGIC_NO_FOR_SEMISYNC_PKT 11178
+#define ER_SEMISYNC_SLAVE_START 11179
+#define ER_SEMISYNC_SLAVE_REPLY_WITH_BINLOG_INFO 11180
+#define ER_SEMISYNC_SLAVE_NET_FLUSH_REPLY_FAILED 11181
+#define ER_SEMISYNC_SLAVE_SEND_REPLY_FAILED 11182
+#define ER_SEMISYNC_EXECUTION_FAILED_ON_MASTER 11183
+#define ER_SEMISYNC_NOT_SUPPORTED_BY_MASTER 11184
+#define ER_SEMISYNC_SLAVE_SET_FAILED 11185
+#define ER_SEMISYNC_FAILED_TO_STOP_ACK_RECEIVER_THD 11186
+#define ER_FIREWALL_FAILED_TO_READ_FIREWALL_TABLES 11187
+#define ER_FIREWALL_FAILED_TO_REG_DYNAMIC_PRIVILEGES 11188
+#define ER_FIREWALL_RECORDING_STMT_WAS_TRUNCATED 11189
+#define ER_FIREWALL_RECORDING_STMT_WITHOUT_TEXT 11190
+#define ER_FIREWALL_SUSPICIOUS_STMT 11191
+#define ER_FIREWALL_ACCESS_DENIED 11192
+#define ER_FIREWALL_SKIPPED_UNKNOWN_USER_MODE 11193
+#define ER_FIREWALL_RELOADING_CACHE 11194
+#define ER_FIREWALL_RESET_FOR_USER 11195
+#define ER_FIREWALL_STATUS_FLUSHED 11196
+#define ER_KEYRING_LOGGER_ERROR_MSG 11197
+#define ER_AUDIT_LOG_FILTER_IS_NOT_INSTALLED 11198
+#define ER_AUDIT_LOG_SWITCHING_TO_INCLUDE_LIST 11199
+#define ER_AUDIT_LOG_CANNOT_SET_LOG_POLICY_WITH_OTHER_POLICIES 11200
+#define ER_AUDIT_LOG_ONLY_INCLUDE_LIST_USED 11201
+#define ER_AUDIT_LOG_INDEX_MAP_CANNOT_ACCESS_DIR 11202
+#define ER_AUDIT_LOG_WRITER_RENAME_FILE_FAILED 11203
+#define ER_AUDIT_LOG_WRITER_DEST_FILE_ALREADY_EXISTS 11204
+#define ER_AUDIT_LOG_WRITER_RENAME_FILE_FAILED_REMOVE_FILE_MANUALLY 11205
+#define ER_AUDIT_LOG_WRITER_INCOMPLETE_FILE_RENAMED 11206
+#define ER_AUDIT_LOG_WRITER_FAILED_TO_WRITE_TO_FILE 11207
+#define ER_AUDIT_LOG_EC_WRITER_FAILED_TO_INIT_ENCRYPTION 11208
+#define ER_AUDIT_LOG_EC_WRITER_FAILED_TO_INIT_COMPRESSION 11209
+#define ER_AUDIT_LOG_EC_WRITER_FAILED_TO_CREATE_FILE 11210
+#define ER_AUDIT_LOG_RENAME_LOG_FILE_BEFORE_FLUSH 11211
+#define ER_AUDIT_LOG_FILTER_RESULT_MSG 11212
+#define ER_AUDIT_LOG_JSON_READER_FAILED_TO_PARSE 11213
+#define ER_AUDIT_LOG_JSON_READER_BUF_TOO_SMALL 11214
+#define ER_AUDIT_LOG_JSON_READER_FAILED_TO_OPEN_FILE 11215
+#define ER_AUDIT_LOG_JSON_READER_FILE_PARSING_ERROR 11216
+#define ER_AUDIT_LOG_FILTER_INVALID_COLUMN_COUNT 11217
+#define ER_AUDIT_LOG_FILTER_INVALID_COLUMN_DEFINITION 11218
+#define ER_AUDIT_LOG_FILTER_FAILED_TO_STORE_TABLE_FLDS 11219
+#define ER_AUDIT_LOG_FILTER_FAILED_TO_UPDATE_TABLE 11220
+#define ER_AUDIT_LOG_FILTER_FAILED_TO_INSERT_INTO_TABLE 11221
+#define ER_AUDIT_LOG_FILTER_FAILED_TO_DELETE_FROM_TABLE 11222
+#define ER_AUDIT_LOG_FILTER_FAILED_TO_INIT_TABLE_FOR_READ 11223
+#define ER_AUDIT_LOG_FILTER_FAILED_TO_READ_TABLE 11224
+#define ER_AUDIT_LOG_FILTER_FAILED_TO_CLOSE_TABLE_AFTER_READING 11225
+#define ER_AUDIT_LOG_FILTER_USER_AND_HOST_CANNOT_BE_EMPTY 11226
+#define ER_AUDIT_LOG_FILTER_FLD_FILTERNAME_CANNOT_BE_EMPTY 11227
+#define ER_VALIDATE_PWD_DICT_FILE_NOT_SPECIFIED 11228
+#define ER_VALIDATE_PWD_DICT_FILE_NOT_LOADED 11229
+#define ER_VALIDATE_PWD_DICT_FILE_TOO_BIG 11230
+#define ER_VALIDATE_PWD_FAILED_TO_READ_DICT_FILE 11231
+#define ER_VALIDATE_PWD_FAILED_TO_GET_FLD_FROM_SECURITY_CTX 11232
+#define ER_VALIDATE_PWD_FAILED_TO_GET_SECURITY_CTX 11233
+#define ER_VALIDATE_PWD_LENGTH_CHANGED 11234
+#define ER_REWRITER_QUERY_ERROR_MSG 11235
+#define ER_REWRITER_QUERY_FAILED 11236
+#define ER_XPLUGIN_STARTUP_FAILED 11237
+//#define OBSOLETE_ER_XPLUGIN_SERVER_EXITING 11238
+//#define OBSOLETE_ER_XPLUGIN_SERVER_EXITED 11239
+#define ER_XPLUGIN_USING_SSL_CONF_FROM_SERVER 11240
+#define ER_XPLUGIN_USING_SSL_CONF_FROM_MYSQLX 11241
+#define ER_XPLUGIN_FAILED_TO_USE_SSL_CONF 11242
+#define ER_XPLUGIN_USING_SSL_FOR_TLS_CONNECTION 11243
+#define ER_XPLUGIN_REFERENCE_TO_SECURE_CONN_WITH_XPLUGIN 11244
+#define ER_XPLUGIN_ERROR_MSG 11245
+#define ER_SHA_PWD_FAILED_TO_PARSE_AUTH_STRING 11246
+#define ER_SHA_PWD_FAILED_TO_GENERATE_MULTI_ROUND_HASH 11247
+#define ER_SHA_PWD_AUTH_REQUIRES_RSA_OR_SSL 11248
+#define ER_SHA_PWD_RSA_KEY_TOO_LONG 11249
+#define ER_PLUGIN_COMMON_FAILED_TO_OPEN_FILTER_TABLES 11250
+#define ER_PLUGIN_COMMON_FAILED_TO_OPEN_TABLE 11251
+#define ER_AUTH_LDAP_ERROR_LOGGER_ERROR_MSG 11252
+#define ER_CONN_CONTROL_ERROR_MSG 11253
+#define ER_GRP_RPL_ERROR_MSG 11254
+#define ER_SHA_PWD_SALT_FOR_USER_CORRUPT 11255
+#define ER_SYS_VAR_COMPONENT_OOM 11256
+#define ER_SYS_VAR_COMPONENT_VARIABLE_SET_READ_ONLY 11257
+#define ER_SYS_VAR_COMPONENT_UNKNOWN_VARIABLE_TYPE 11258
+#define ER_SYS_VAR_COMPONENT_FAILED_TO_PARSE_VARIABLE_OPTIONS 11259
+#define ER_SYS_VAR_COMPONENT_FAILED_TO_MAKE_VARIABLE_PERSISTENT 11260
+#define ER_COMPONENT_FILTER_CONFUSED 11261
+#define ER_STOP_SLAVE_IO_THREAD_DISK_SPACE 11262
+#define ER_LOG_FILE_CANNOT_OPEN 11263
+//#define OBSOLETE_ER_UNABLE_TO_COLLECT_LOG_STATUS 11264
+//#define OBSOLETE_ER_DEPRECATED_UTF8_ALIAS 11265
+//#define OBSOLETE_ER_DEPRECATED_NATIONAL 11266
+//#define OBSOLETE_ER_SLAVE_POSSIBLY_DIVERGED_AFTER_DDL 11267
+#define ER_PERSIST_OPTION_STATUS 11268
+#define ER_NOT_IMPLEMENTED_GET_TABLESPACE_STATISTICS 11269
+//#define OBSOLETE_ER_UNABLE_TO_SET_OPTION 11270
+//#define OBSOLETE_ER_RESERVED_TABLESPACE_NAME 11271
+#define ER_SSL_FIPS_MODE_ERROR 11272
+#define ER_CONN_INIT_CONNECT_IGNORED 11273
+//#define OBSOLETE_ER_UNSUPPORTED_SQL_MODE 11274
+#define ER_REWRITER_OOM 11275
+#define ER_REWRITER_TABLE_MALFORMED_ERROR 11276
+#define ER_REWRITER_LOAD_FAILED 11277
+#define ER_REWRITER_READ_FAILED 11278
+#define ER_CONN_CONTROL_EVENT_COORDINATOR_INIT_FAILED 11279
+#define ER_CONN_CONTROL_STAT_CONN_DELAY_TRIGGERED_UPDATE_FAILED 11280
+#define ER_CONN_CONTROL_STAT_CONN_DELAY_TRIGGERED_RESET_FAILED 11281
+#define ER_CONN_CONTROL_INVALID_CONN_DELAY_TYPE 11282
+#define ER_CONN_CONTROL_DELAY_ACTION_INIT_FAILED 11283
+#define ER_CONN_CONTROL_FAILED_TO_SET_CONN_DELAY 11284
+#define ER_CONN_CONTROL_FAILED_TO_UPDATE_CONN_DELAY_HASH 11285
+#define ER_XPLUGIN_FORCE_STOP_CLIENT 11286
+#define ER_XPLUGIN_MAX_AUTH_ATTEMPTS_REACHED 11287
+#define ER_XPLUGIN_BUFFER_PAGE_ALLOC_FAILED 11288
+#define ER_XPLUGIN_DETECTED_HANGING_CLIENTS 11289
+#define ER_XPLUGIN_FAILED_TO_ACCEPT_CLIENT 11290
+#define ER_XPLUGIN_FAILED_TO_SCHEDULE_CLIENT 11291
+#define ER_XPLUGIN_FAILED_TO_PREPARE_IO_INTERFACES 11292
+#define ER_XPLUGIN_SRV_SESSION_INIT_THREAD_FAILED 11293
+#define ER_XPLUGIN_UNABLE_TO_USE_USER_SESSION_ACCOUNT 11294
+#define ER_XPLUGIN_REFERENCE_TO_USER_ACCOUNT_DOC_SECTION 11295
+#define ER_XPLUGIN_UNEXPECTED_EXCEPTION_DISPATCHING_CMD 11296
+#define ER_XPLUGIN_EXCEPTION_IN_TASK_SCHEDULER 11297
+#define ER_XPLUGIN_TASK_SCHEDULING_FAILED 11298
+#define ER_XPLUGIN_EXCEPTION_IN_EVENT_LOOP 11299
+#define ER_XPLUGIN_LISTENER_SETUP_FAILED 11300
+#define ER_XPLUING_NET_STARTUP_FAILED 11301
+#define ER_XPLUGIN_FAILED_AT_SSL_CONF 11302
+//#define OBSOLETE_ER_XPLUGIN_CLIENT_SSL_HANDSHAKE_FAILED 11303
+//#define OBSOLETE_ER_XPLUGIN_SSL_HANDSHAKE_WITH_SERVER_FAILED 11304
+#define ER_XPLUGIN_FAILED_TO_CREATE_SESSION_FOR_CONN 11305
+#define ER_XPLUGIN_FAILED_TO_INITIALIZE_SESSION 11306
+#define ER_XPLUGIN_MESSAGE_TOO_LONG 11307
+#define ER_XPLUGIN_UNINITIALIZED_MESSAGE 11308
+#define ER_XPLUGIN_FAILED_TO_SET_MIN_NUMBER_OF_WORKERS 11309
+#define ER_XPLUGIN_UNABLE_TO_ACCEPT_CONNECTION 11310
+#define ER_XPLUGIN_ALL_IO_INTERFACES_DISABLED 11311
+//#define OBSOLETE_ER_XPLUGIN_INVALID_MSG_DURING_CLIENT_INIT 11312
+//#define OBSOLETE_ER_XPLUGIN_CLOSING_CLIENTS_ON_SHUTDOWN 11313
+#define ER_XPLUGIN_ERROR_READING_SOCKET 11314
+#define ER_XPLUGIN_PEER_DISCONNECTED_WHILE_READING_MSG_BODY 11315
+#define ER_XPLUGIN_READ_FAILED_CLOSING_CONNECTION 11316
+//#define OBSOLETE_ER_XPLUGIN_INVALID_AUTH_METHOD 11317
+//#define OBSOLETE_ER_XPLUGIN_UNEXPECTED_MSG_DURING_AUTHENTICATION 11318
+//#define OBSOLETE_ER_XPLUGIN_ERROR_WRITING_TO_CLIENT 11319
+//#define OBSOLETE_ER_XPLUGIN_SCHEDULER_STARTED 11320
+//#define OBSOLETE_ER_XPLUGIN_SCHEDULER_STOPPED 11321
+#define ER_XPLUGIN_LISTENER_SYS_VARIABLE_ERROR 11322
+#define ER_XPLUGIN_LISTENER_STATUS_MSG 11323
+#define ER_XPLUGIN_RETRYING_BIND_ON_PORT 11324
+//#define OBSOLETE_ER_XPLUGIN_SHUTDOWN_TRIGGERED 11325
+//#define OBSOLETE_ER_XPLUGIN_USER_ACCOUNT_WITH_ALL_PERMISSIONS 11326
+#define ER_XPLUGIN_EXISTING_USER_ACCOUNT_WITH_INCOMPLETE_GRANTS 11327
+//#define OBSOLETE_ER_XPLUGIN_SERVER_STARTS_HANDLING_CONNECTIONS 11328
+//#define OBSOLETE_ER_XPLUGIN_SERVER_STOPPED_HANDLING_CONNECTIONS 11329
+//#define OBSOLETE_ER_XPLUGIN_FAILED_TO_INTERRUPT_SESSION 11330
+//#define OBSOLETE_ER_XPLUGIN_CLIENT_RELEASE_TRIGGERED 11331
+#define ER_XPLUGIN_IPv6_AVAILABLE 11332
+//#define OBSOLETE_ER_XPLUGIN_UNIX_SOCKET_NOT_CONFIGURED 11333
+#define ER_XPLUGIN_CLIENT_KILL_MSG 11334
+#define ER_XPLUGIN_FAILED_TO_GET_SECURITY_CTX 11335
+//#define OBSOLETE_ER_XPLUGIN_FAILED_TO_SWITCH_SECURITY_CTX_TO_ROOT 11336
+#define ER_XPLUGIN_FAILED_TO_CLOSE_SQL_SESSION 11337
+#define ER_XPLUGIN_FAILED_TO_EXECUTE_ADMIN_CMD 11338
+#define ER_XPLUGIN_EMPTY_ADMIN_CMD 11339
+#define ER_XPLUGIN_FAILED_TO_GET_SYS_VAR 11340
+#define ER_XPLUGIN_FAILED_TO_GET_CREATION_STMT 11341
+#define ER_XPLUGIN_FAILED_TO_GET_ENGINE_INFO 11342
+//#define OBSOLETE_ER_XPLUGIN_FAIL_TO_GET_RESULT_DATA 11343
+//#define OBSOLETE_ER_XPLUGIN_CAPABILITY_EXPIRED_PASSWORD 11344
+#define ER_XPLUGIN_FAILED_TO_SET_SO_REUSEADDR_FLAG 11345
+#define ER_XPLUGIN_FAILED_TO_OPEN_INTERNAL_SESSION 11346
+#define ER_XPLUGIN_FAILED_TO_SWITCH_CONTEXT 11347
+#define ER_XPLUGIN_FAILED_TO_UNREGISTER_UDF 11348
+//#define OBSOLETE_ER_XPLUGIN_GET_PEER_ADDRESS_FAILED 11349
+//#define OBSOLETE_ER_XPLUGIN_CAPABILITY_CLIENT_INTERACTIVE_FAILED 11350
+#define ER_XPLUGIN_FAILED_TO_RESET_IPV6_V6ONLY_FLAG 11351
+#define ER_KEYRING_INVALID_KEY_TYPE 11352
+#define ER_KEYRING_INVALID_KEY_LENGTH 11353
+#define ER_KEYRING_FAILED_TO_CREATE_KEYRING_DIR 11354
+#define ER_KEYRING_FILE_INIT_FAILED 11355
+#define ER_KEYRING_INTERNAL_EXCEPTION_FAILED_FILE_INIT 11356
+#define ER_KEYRING_FAILED_TO_GENERATE_KEY 11357
+#define ER_KEYRING_CHECK_KEY_FAILED_DUE_TO_INVALID_KEY 11358
+#define ER_KEYRING_CHECK_KEY_FAILED_DUE_TO_EMPTY_KEY_ID 11359
+#define ER_KEYRING_OPERATION_FAILED_DUE_TO_INTERNAL_ERROR 11360
+#define ER_KEYRING_INCORRECT_FILE 11361
+#define ER_KEYRING_FOUND_MALFORMED_BACKUP_FILE 11362
+#define ER_KEYRING_FAILED_TO_RESTORE_FROM_BACKUP_FILE 11363
+#define ER_KEYRING_FAILED_TO_FLUSH_KEYRING_TO_FILE 11364
+#define ER_KEYRING_FAILED_TO_GET_FILE_STAT 11365
+#define ER_KEYRING_FAILED_TO_REMOVE_FILE 11366
+#define ER_KEYRING_FAILED_TO_TRUNCATE_FILE 11367
+#define ER_KEYRING_UNKNOWN_ERROR 11368
+#define ER_KEYRING_FAILED_TO_SET_KEYRING_FILE_DATA 11369
+#define ER_KEYRING_FILE_IO_ERROR 11370
+#define ER_KEYRING_FAILED_TO_LOAD_KEYRING_CONTENT 11371
+#define ER_KEYRING_FAILED_TO_FLUSH_KEYS_TO_KEYRING 11372
+#define ER_KEYRING_FAILED_TO_FLUSH_KEYS_TO_KEYRING_BACKUP 11373
+#define ER_KEYRING_KEY_FETCH_FAILED_DUE_TO_EMPTY_KEY_ID 11374
+#define ER_KEYRING_FAILED_TO_REMOVE_KEY_DUE_TO_EMPTY_ID 11375
+#define ER_KEYRING_OKV_INCORRECT_KEY_VAULT_CONFIGURED 11376
+#define ER_KEYRING_OKV_INIT_FAILED_DUE_TO_INCORRECT_CONF 11377
+#define ER_KEYRING_OKV_INIT_FAILED_DUE_TO_INTERNAL_ERROR 11378
+#define ER_KEYRING_OKV_INVALID_KEY_TYPE 11379
+#define ER_KEYRING_OKV_INVALID_KEY_LENGTH_FOR_CIPHER 11380
+#define ER_KEYRING_OKV_FAILED_TO_GENERATE_KEY_DUE_TO_INTERNAL_ERROR 11381
+#define ER_KEYRING_OKV_FAILED_TO_FIND_SERVER_ENTRY 11382
+#define ER_KEYRING_OKV_FAILED_TO_FIND_STANDBY_SERVER_ENTRY 11383
+#define ER_KEYRING_OKV_FAILED_TO_PARSE_CONF_FILE 11384
+#define ER_KEYRING_OKV_FAILED_TO_LOAD_KEY_UID 11385
+#define ER_KEYRING_OKV_FAILED_TO_INIT_SSL_LAYER 11386
+#define ER_KEYRING_OKV_FAILED_TO_INIT_CLIENT 11387
+#define ER_KEYRING_OKV_CONNECTION_TO_SERVER_FAILED 11388
+#define ER_KEYRING_OKV_FAILED_TO_REMOVE_KEY 11389
+#define ER_KEYRING_OKV_FAILED_TO_ADD_ATTRIBUTE 11390
+#define ER_KEYRING_OKV_FAILED_TO_GENERATE_KEY 11391
+#define ER_KEYRING_OKV_FAILED_TO_STORE_KEY 11392
+#define ER_KEYRING_OKV_FAILED_TO_ACTIVATE_KEYS 11393
+#define ER_KEYRING_OKV_FAILED_TO_FETCH_KEY 11394
+#define ER_KEYRING_OKV_FAILED_TO_STORE_OR_GENERATE_KEY 11395
+#define ER_KEYRING_OKV_FAILED_TO_RETRIEVE_KEY_SIGNATURE 11396
+#define ER_KEYRING_OKV_FAILED_TO_RETRIEVE_KEY 11397
+#define ER_KEYRING_OKV_FAILED_TO_LOAD_SSL_TRUST_STORE 11398
+#define ER_KEYRING_OKV_FAILED_TO_SET_CERTIFICATE_FILE 11399
+#define ER_KEYRING_OKV_FAILED_TO_SET_KEY_FILE 11400
+#define ER_KEYRING_OKV_KEY_MISMATCH 11401
+#define ER_KEYRING_ENCRYPTED_FILE_INCORRECT_KEYRING_FILE 11402
+#define ER_KEYRING_ENCRYPTED_FILE_DECRYPTION_FAILED 11403
+#define ER_KEYRING_ENCRYPTED_FILE_FOUND_MALFORMED_BACKUP_FILE 11404
+#define ER_KEYRING_ENCRYPTED_FILE_FAILED_TO_RESTORE_KEYRING 11405
+#define ER_KEYRING_ENCRYPTED_FILE_FAILED_TO_FLUSH_KEYRING 11406
+#define ER_KEYRING_ENCRYPTED_FILE_ENCRYPTION_FAILED 11407
+#define ER_KEYRING_ENCRYPTED_FILE_INVALID_KEYRING_DIR 11408
+#define ER_KEYRING_ENCRYPTED_FILE_FAILED_TO_CREATE_KEYRING_DIR 11409
+#define ER_KEYRING_ENCRYPTED_FILE_PASSWORD_IS_INVALID 11410
+#define ER_KEYRING_ENCRYPTED_FILE_PASSWORD_IS_TOO_LONG 11411
+#define ER_KEYRING_ENCRYPTED_FILE_INIT_FAILURE 11412
+#define ER_KEYRING_ENCRYPTED_FILE_INIT_FAILED_DUE_TO_INTERNAL_ERROR 11413
+#define ER_KEYRING_ENCRYPTED_FILE_GEN_KEY_FAILED_DUE_TO_INTERNAL_ERROR 11414
+#define ER_KEYRING_AWS_FAILED_TO_SET_CMK_ID 11415
+#define ER_KEYRING_AWS_FAILED_TO_SET_REGION 11416
+#define ER_KEYRING_AWS_FAILED_TO_OPEN_CONF_FILE 11417
+#define ER_KEYRING_AWS_FAILED_TO_ACCESS_KEY_ID_FROM_CONF_FILE 11418
+#define ER_KEYRING_AWS_FAILED_TO_ACCESS_KEY_FROM_CONF_FILE 11419
+#define ER_KEYRING_AWS_INVALID_CONF_FILE_PATH 11420
+#define ER_KEYRING_AWS_INVALID_DATA_FILE_PATH 11421
+#define ER_KEYRING_AWS_FAILED_TO_ACCESS_OR_CREATE_KEYRING_DIR 11422
+#define ER_KEYRING_AWS_FAILED_TO_ACCESS_OR_CREATE_KEYRING_DATA_FILE 11423
+#define ER_KEYRING_AWS_FAILED_TO_INIT_DUE_TO_INTERNAL_ERROR 11424
+#define ER_KEYRING_AWS_FAILED_TO_ACCESS_DATA_FILE 11425
+#define ER_KEYRING_AWS_CMK_ID_NOT_SET 11426
+#define ER_KEYRING_AWS_FAILED_TO_GET_KMS_CREDENTIAL_FROM_CONF_FILE 11427
+#define ER_KEYRING_AWS_INIT_FAILURE 11428
+#define ER_KEYRING_AWS_FAILED_TO_INIT_DUE_TO_PLUGIN_INTERNAL_ERROR 11429
+#define ER_KEYRING_AWS_INVALID_KEY_LENGTH_FOR_CIPHER 11430
+#define ER_KEYRING_AWS_FAILED_TO_GENERATE_KEY_DUE_TO_INTERNAL_ERROR 11431
+#define ER_KEYRING_AWS_INCORRECT_FILE 11432
+#define ER_KEYRING_AWS_FOUND_MALFORMED_BACKUP_FILE 11433
+#define ER_KEYRING_AWS_FAILED_TO_RESTORE_FROM_BACKUP_FILE 11434
+#define ER_KEYRING_AWS_FAILED_TO_FLUSH_KEYRING_TO_FILE 11435
+#define ER_KEYRING_AWS_INCORRECT_REGION 11436
+#define ER_KEYRING_AWS_FAILED_TO_CONNECT_KMS 11437
+#define ER_KEYRING_AWS_FAILED_TO_GENERATE_NEW_KEY 11438
+#define ER_KEYRING_AWS_FAILED_TO_ENCRYPT_KEY 11439
+#define ER_KEYRING_AWS_FAILED_TO_RE_ENCRYPT_KEY 11440
+#define ER_KEYRING_AWS_FAILED_TO_DECRYPT_KEY 11441
+#define ER_KEYRING_AWS_FAILED_TO_ROTATE_CMK 11442
+#define ER_GRP_RPL_GTID_ALREADY_USED 11443
+#define ER_GRP_RPL_APPLIER_THD_KILLED 11444
+#define ER_GRP_RPL_EVENT_HANDLING_ERROR 11445
+#define ER_GRP_RPL_ERROR_GTID_EXECUTION_INFO 11446
+#define ER_GRP_RPL_CERTIFICATE_SIZE_ERROR 11447
+#define ER_GRP_RPL_CREATE_APPLIER_CACHE_ERROR 11448
+#define ER_GRP_RPL_UNBLOCK_WAITING_THD 11449
+#define ER_GRP_RPL_APPLIER_PIPELINE_NOT_DISPOSED 11450
+#define ER_GRP_RPL_APPLIER_THD_EXECUTION_ABORTED 11451
+#define ER_GRP_RPL_APPLIER_EXECUTION_FATAL_ERROR 11452
+#define ER_GRP_RPL_ERROR_STOPPING_CHANNELS 11453
+#define ER_GRP_RPL_ERROR_SENDING_SINGLE_PRIMARY_MSSG 11454
+#define ER_GRP_RPL_UPDATE_TRANS_SNAPSHOT_VER_ERROR 11455
+#define ER_GRP_RPL_SIDNO_FETCH_ERROR 11456
+#define ER_GRP_RPL_BROADCAST_COMMIT_TRANS_MSSG_FAILED 11457
+#define ER_GRP_RPL_GROUP_NAME_PARSE_ERROR 11458
+#define ER_GRP_RPL_ADD_GRPSID_TO_GRPGTIDSID_MAP_ERROR 11459
+#define ER_GRP_RPL_UPDATE_GRPGTID_EXECUTED_ERROR 11460
+#define ER_GRP_RPL_DONOR_TRANS_INFO_ERROR 11461
+#define ER_GRP_RPL_SERVER_CONN_ERROR 11462
+#define ER_GRP_RPL_ERROR_FETCHING_GTID_EXECUTED_SET 11463
+#define ER_GRP_RPL_ADD_GTID_TO_GRPGTID_EXECUTED_ERROR 11464
+#define ER_GRP_RPL_ERROR_FETCHING_GTID_SET 11465
+#define ER_GRP_RPL_ADD_RETRIEVED_SET_TO_GRP_GTID_EXECUTED_ERROR 11466
+#define ER_GRP_RPL_CERTIFICATION_INITIALIZATION_FAILURE 11467
+#define ER_GRP_RPL_UPDATE_LAST_CONFLICT_FREE_TRANS_ERROR 11468
+#define ER_GRP_RPL_UPDATE_TRANS_SNAPSHOT_REF_VER_ERROR 11469
+#define ER_GRP_RPL_FETCH_TRANS_SIDNO_ERROR 11470
+#define ER_GRP_RPL_ERROR_VERIFYING_SIDNO 11471
+#define ER_GRP_RPL_CANT_GENERATE_GTID 11472
+#define ER_GRP_RPL_INVALID_GTID_SET 11473
+#define ER_GRP_RPL_UPDATE_GTID_SET_ERROR 11474
+#define ER_GRP_RPL_RECEIVED_SET_MISSING_GTIDS 11475
+#define ER_GRP_RPL_SKIP_COMPUTATION_TRANS_COMMITTED 11476
+#define ER_GRP_RPL_NULL_PACKET 11477
+#define ER_GRP_RPL_CANT_READ_GTID 11478
+#define ER_GRP_RPL_PROCESS_GTID_SET_ERROR 11479
+#define ER_GRP_RPL_PROCESS_INTERSECTION_GTID_SET_ERROR 11480
+#define ER_GRP_RPL_SET_STABLE_TRANS_ERROR 11481
+#define ER_GRP_RPL_CANT_READ_GRP_GTID_EXTRACTED 11482
+#define ER_GRP_RPL_CANT_READ_WRITE_SET_ITEM 11483
+#define ER_GRP_RPL_INIT_CERTIFICATION_INFO_FAILURE 11484
+#define ER_GRP_RPL_CONFLICT_DETECTION_DISABLED 11485
+#define ER_GRP_RPL_MSG_DISCARDED 11486
+#define ER_GRP_RPL_MISSING_GRP_RPL_APPLIER 11487
+#define ER_GRP_RPL_CERTIFIER_MSSG_PROCESS_ERROR 11488
+#define ER_GRP_RPL_SRV_NOT_ONLINE 11489
+#define ER_GRP_RPL_SRV_ONLINE 11490
+#define ER_GRP_RPL_DISABLE_SRV_READ_MODE_RESTRICTED 11491
+#define ER_GRP_RPL_MEM_ONLINE 11492
+#define ER_GRP_RPL_MEM_UNREACHABLE 11493
+#define ER_GRP_RPL_MEM_REACHABLE 11494
+#define ER_GRP_RPL_SRV_BLOCKED 11495
+#define ER_GRP_RPL_SRV_BLOCKED_FOR_SECS 11496
+#define ER_GRP_RPL_CHANGE_GRP_MEM_NOT_PROCESSED 11497
+#define ER_GRP_RPL_MEMBER_CONTACT_RESTORED 11498
+#define ER_GRP_RPL_MEMBER_REMOVED 11499
+#define ER_GRP_RPL_PRIMARY_MEMBER_LEFT_GRP 11500
+#define ER_GRP_RPL_MEMBER_ADDED 11501
+#define ER_GRP_RPL_MEMBER_EXIT_PLUGIN_ERROR 11502
+#define ER_GRP_RPL_MEMBER_CHANGE 11503
+#define ER_GRP_RPL_MEMBER_LEFT_GRP 11504
+#define ER_GRP_RPL_MEMBER_EXPELLED 11505
+#define ER_GRP_RPL_SESSION_OPEN_FAILED 11506
+#define ER_GRP_RPL_NEW_PRIMARY_ELECTED 11507
+#define ER_GRP_RPL_DISABLE_READ_ONLY_FAILED 11508
+#define ER_GRP_RPL_ENABLE_READ_ONLY_FAILED 11509
+#define ER_GRP_RPL_SRV_PRIMARY_MEM 11510
+#define ER_GRP_RPL_SRV_SECONDARY_MEM 11511
+#define ER_GRP_RPL_NO_SUITABLE_PRIMARY_MEM 11512
+#define ER_GRP_RPL_SUPER_READ_ONLY_ACTIVATE_ERROR 11513
+#define ER_GRP_RPL_EXCEEDS_AUTO_INC_VALUE 11514
+#define ER_GRP_RPL_DATA_NOT_PROVIDED_BY_MEM 11515
+#define ER_GRP_RPL_MEMBER_ALREADY_EXISTS 11516
+#define ER_GRP_RPL_GRP_CHANGE_INFO_EXTRACT_ERROR 11517
+#define ER_GRP_RPL_GTID_EXECUTED_EXTRACT_ERROR 11518
+#define ER_GRP_RPL_GTID_SET_EXTRACT_ERROR 11519
+#define ER_GRP_RPL_START_FAILED 11520
+#define ER_GRP_RPL_MEMBER_VER_INCOMPATIBLE 11521
+#define ER_GRP_RPL_TRANS_NOT_PRESENT_IN_GRP 11522
+#define ER_GRP_RPL_TRANS_GREATER_THAN_GRP 11523
+#define ER_GRP_RPL_MEMBER_VERSION_LOWER_THAN_GRP 11524
+#define ER_GRP_RPL_LOCAL_GTID_SETS_PROCESS_ERROR 11525
+#define ER_GRP_RPL_MEMBER_TRANS_GREATER_THAN_GRP 11526
+#define ER_GRP_RPL_BLOCK_SIZE_DIFF_FROM_GRP 11527
+#define ER_GRP_RPL_TRANS_WRITE_SET_EXTRACT_DIFF_FROM_GRP 11528
+#define ER_GRP_RPL_MEMBER_CFG_INCOMPATIBLE_WITH_GRP_CFG 11529
+#define ER_GRP_RPL_MEMBER_STOP_RPL_CHANNELS_ERROR 11530
+#define ER_GRP_RPL_PURGE_APPLIER_LOGS 11531
+#define ER_GRP_RPL_RESET_APPLIER_MODULE_LOGS_ERROR 11532
+#define ER_GRP_RPL_APPLIER_THD_SETUP_ERROR 11533
+#define ER_GRP_RPL_APPLIER_THD_START_ERROR 11534
+#define ER_GRP_RPL_APPLIER_THD_STOP_ERROR 11535
+#define ER_GRP_RPL_FETCH_TRANS_DATA_FAILED 11536
+#define ER_GRP_RPL_SLAVE_IO_THD_PRIMARY_UNKNOWN 11537
+#define ER_GRP_RPL_SALVE_IO_THD_ON_SECONDARY_MEMBER 11538
+#define ER_GRP_RPL_SLAVE_SQL_THD_PRIMARY_UNKNOWN 11539
+#define ER_GRP_RPL_SLAVE_SQL_THD_ON_SECONDARY_MEMBER 11540
+#define ER_GRP_RPL_NEEDS_INNODB_TABLE 11541
+#define ER_GRP_RPL_PRIMARY_KEY_NOT_DEFINED 11542
+#define ER_GRP_RPL_FK_WITH_CASCADE_UNSUPPORTED 11543
+#define ER_GRP_RPL_AUTO_INC_RESET 11544
+#define ER_GRP_RPL_AUTO_INC_OFFSET_RESET 11545
+#define ER_GRP_RPL_AUTO_INC_SET 11546
+#define ER_GRP_RPL_AUTO_INC_OFFSET_SET 11547
+#define ER_GRP_RPL_FETCH_TRANS_CONTEXT_FAILED 11548
+#define ER_GRP_RPL_FETCH_FORMAT_DESC_LOG_EVENT_FAILED 11549
+#define ER_GRP_RPL_FETCH_TRANS_CONTEXT_LOG_EVENT_FAILED 11550
+#define ER_GRP_RPL_FETCH_SNAPSHOT_VERSION_FAILED 11551
+#define ER_GRP_RPL_FETCH_GTID_LOG_EVENT_FAILED 11552
+#define ER_GRP_RPL_UPDATE_SERV_CERTIFICATE_FAILED 11553
+#define ER_GRP_RPL_ADD_GTID_INFO_WITH_LOCAL_GTID_FAILED 11554
+#define ER_GRP_RPL_ADD_GTID_INFO_WITHOUT_LOCAL_GTID_FAILED 11555
+#define ER_GRP_RPL_NOTIFY_CERTIFICATION_OUTCOME_FAILED 11556
+#define ER_GRP_RPL_ADD_GTID_INFO_WITH_REMOTE_GTID_FAILED 11557
+#define ER_GRP_RPL_ADD_GTID_INFO_WITHOUT_REMOTE_GTID_FAILED 11558
+#define ER_GRP_RPL_FETCH_VIEW_CHANGE_LOG_EVENT_FAILED 11559
+#define ER_GRP_RPL_CONTACT_WITH_SRV_FAILED 11560
+#define ER_GRP_RPL_SRV_WAIT_TIME_OUT 11561
+#define ER_GRP_RPL_FETCH_LOG_EVENT_FAILED 11562
+#define ER_GRP_RPL_START_GRP_RPL_FAILED 11563
+#define ER_GRP_RPL_CONN_INTERNAL_PLUGIN_FAIL 11564
+#define ER_GRP_RPL_SUPER_READ_ON 11565
+#define ER_GRP_RPL_SUPER_READ_OFF 11566
+#define ER_GRP_RPL_KILLED_SESSION_ID 11567
+#define ER_GRP_RPL_KILLED_FAILED_ID 11568
+#define ER_GRP_RPL_INTERNAL_QUERY 11569
+#define ER_GRP_RPL_COPY_FROM_EMPTY_STRING 11570
+#define ER_GRP_RPL_QUERY_FAIL 11571
+#define ER_GRP_RPL_CREATE_SESSION_UNABLE 11572
+#define ER_GRP_RPL_MEMBER_NOT_FOUND 11573
+#define ER_GRP_RPL_MAXIMUM_CONNECTION_RETRIES_REACHED 11574
+#define ER_GRP_RPL_ALL_DONORS_LEFT_ABORT_RECOVERY 11575
+#define ER_GRP_RPL_ESTABLISH_RECOVERY_WITH_DONOR 11576
+#define ER_GRP_RPL_ESTABLISH_RECOVERY_WITH_ANOTHER_DONOR 11577
+#define ER_GRP_RPL_NO_VALID_DONOR 11578
+#define ER_GRP_RPL_CONFIG_RECOVERY 11579
+#define ER_GRP_RPL_ESTABLISHING_CONN_GRP_REC_DONOR 11580
+#define ER_GRP_RPL_CREATE_GRP_RPL_REC_CHANNEL 11581
+#define ER_GRP_RPL_DONOR_SERVER_CONN 11582
+#define ER_GRP_RPL_CHECK_STATUS_TABLE 11583
+#define ER_GRP_RPL_STARTING_GRP_REC 11584
+#define ER_GRP_RPL_DONOR_CONN_TERMINATION 11585
+#define ER_GRP_RPL_STOPPING_GRP_REC 11586
+#define ER_GRP_RPL_PURGE_REC 11587
+#define ER_GRP_RPL_UNABLE_TO_KILL_CONN_REC_DONOR_APPLIER 11588
+#define ER_GRP_RPL_UNABLE_TO_KILL_CONN_REC_DONOR_FAILOVER 11589
+#define ER_GRP_RPL_FAILED_TO_NOTIFY_GRP_MEMBERSHIP_EVENT 11590
+#define ER_GRP_RPL_FAILED_TO_BROADCAST_GRP_MEMBERSHIP_NOTIFICATION 11591
+#define ER_GRP_RPL_FAILED_TO_BROADCAST_MEMBER_STATUS_NOTIFICATION 11592
+#define ER_GRP_RPL_OOM_FAILED_TO_GENERATE_IDENTIFICATION_HASH 11593
+#define ER_GRP_RPL_WRITE_IDENT_HASH_BASE64_ENCODING_FAILED 11594
+#define ER_GRP_RPL_INVALID_BINLOG_FORMAT 11595
+#define ER_GRP_RPL_BINLOG_CHECKSUM_SET 11596
+#define ER_GRP_RPL_TRANS_WRITE_SET_EXTRACTION_NOT_SET 11597
+#define ER_GRP_RPL_UNSUPPORTED_TRANS_ISOLATION 11598
+#define ER_GRP_RPL_CANNOT_EXECUTE_TRANS_WHILE_STOPPING 11599
+#define ER_GRP_RPL_CANNOT_EXECUTE_TRANS_WHILE_RECOVERING 11600
+#define ER_GRP_RPL_CANNOT_EXECUTE_TRANS_IN_ERROR_STATE 11601
+#define ER_GRP_RPL_CANNOT_EXECUTE_TRANS_IN_OFFLINE_MODE 11602
+#define ER_GRP_RPL_MULTIPLE_CACHE_TYPE_NOT_SUPPORTED_FOR_SESSION 11603
+#define ER_GRP_RPL_FAILED_TO_REINIT_BINLOG_CACHE_FOR_READ 11604
+#define ER_GRP_RPL_FAILED_TO_CREATE_TRANS_CONTEXT 11605
+#define ER_GRP_RPL_FAILED_TO_EXTRACT_TRANS_WRITE_SET 11606
+#define ER_GRP_RPL_FAILED_TO_GATHER_TRANS_WRITE_SET 11607
+#define ER_GRP_RPL_TRANS_SIZE_EXCEEDS_LIMIT 11608
+//#define OBSOLETE_ER_GRP_RPL_REINIT_OF_INTERNAL_CACHE_FOR_READ_FAILED 11609
+//#define OBSOLETE_ER_GRP_RPL_APPENDING_DATA_TO_INTERNAL_CACHE_FAILED 11610
+#define ER_GRP_RPL_WRITE_TO_TRANSACTION_MESSAGE_FAILED 11611
+#define ER_GRP_RPL_FAILED_TO_REGISTER_TRANS_OUTCOME_NOTIFICTION 11612
+#define ER_GRP_RPL_MSG_TOO_LONG_BROADCASTING_TRANS_FAILED 11613
+#define ER_GRP_RPL_BROADCASTING_TRANS_TO_GRP_FAILED 11614
+#define ER_GRP_RPL_ERROR_WHILE_WAITING_FOR_CONFLICT_DETECTION 11615
+//#define OBSOLETE_ER_GRP_RPL_REINIT_OF_INTERNAL_CACHE_FOR_WRITE_FAILED 11616
+//#define OBSOLETE_ER_GRP_RPL_FAILED_TO_CREATE_COMMIT_CACHE 11617
+//#define OBSOLETE_ER_GRP_RPL_REINIT_OF_COMMIT_CACHE_FOR_WRITE_FAILED 11618
+#define ER_GRP_RPL_PREV_REC_SESSION_RUNNING 11619
+#define ER_GRP_RPL_FATAL_REC_PROCESS 11620
+#define ER_GRP_RPL_WHILE_STOPPING_REP_CHANNEL 11621
+#define ER_GRP_RPL_UNABLE_TO_EVALUATE_APPLIER_STATUS 11622
+#define ER_GRP_RPL_ONLY_ONE_SERVER_ALIVE 11623
+#define ER_GRP_RPL_CERTIFICATION_REC_PROCESS 11624
+#define ER_GRP_RPL_UNABLE_TO_ENSURE_EXECUTION_REC 11625
+#define ER_GRP_RPL_WHILE_SENDING_MSG_REC 11626
+#define ER_GRP_RPL_READ_UNABLE_FOR_SUPER_READ_ONLY 11627
+#define ER_GRP_RPL_READ_UNABLE_FOR_READ_ONLY_SUPER_READ_ONLY 11628
+#define ER_GRP_RPL_UNABLE_TO_RESET_SERVER_READ_MODE 11629
+#define ER_GRP_RPL_UNABLE_TO_CERTIFY_PLUGIN_TRANS 11630
+#define ER_GRP_RPL_UNBLOCK_CERTIFIED_TRANS 11631
+#define ER_GRP_RPL_SERVER_WORKING_AS_SECONDARY 11632
+#define ER_GRP_RPL_FAILED_TO_START_WITH_INVALID_SERVER_ID 11633
+#define ER_GRP_RPL_FORCE_MEMBERS_MUST_BE_EMPTY 11634
+#define ER_GRP_RPL_PLUGIN_STRUCT_INIT_NOT_POSSIBLE_ON_SERVER_START 11635
+#define ER_GRP_RPL_FAILED_TO_ENABLE_SUPER_READ_ONLY_MODE 11636
+#define ER_GRP_RPL_FAILED_TO_INIT_COMMUNICATION_ENGINE 11637
+#define ER_GRP_RPL_FAILED_TO_START_ON_SECONDARY_WITH_ASYNC_CHANNELS 11638
+#define ER_GRP_RPL_FAILED_TO_START_COMMUNICATION_ENGINE 11639
+#define ER_GRP_RPL_TIMEOUT_ON_VIEW_AFTER_JOINING_GRP 11640
+#define ER_GRP_RPL_FAILED_TO_CALL_GRP_COMMUNICATION_INTERFACE 11641
+#define ER_GRP_RPL_MEMBER_SERVER_UUID_IS_INCOMPATIBLE_WITH_GRP 11642
+#define ER_GRP_RPL_MEMBER_CONF_INFO 11643
+#define ER_GRP_RPL_FAILED_TO_CONFIRM_IF_SERVER_LEFT_GRP 11644
+#define ER_GRP_RPL_SERVER_IS_ALREADY_LEAVING 11645
+#define ER_GRP_RPL_SERVER_ALREADY_LEFT 11646
+#define ER_GRP_RPL_WAITING_FOR_VIEW_UPDATE 11647
+#define ER_GRP_RPL_TIMEOUT_RECEIVING_VIEW_CHANGE_ON_SHUTDOWN 11648
+#define ER_GRP_RPL_REQUESTING_NON_MEMBER_SERVER_TO_LEAVE 11649
+#define ER_GRP_RPL_IS_STOPPING 11650
+#define ER_GRP_RPL_IS_STOPPED 11651
+#define ER_GRP_RPL_FAILED_TO_ENABLE_READ_ONLY_MODE_ON_SHUTDOWN 11652
+#define ER_GRP_RPL_RECOVERY_MODULE_TERMINATION_TIMED_OUT_ON_SHUTDOWN 11653
+#define ER_GRP_RPL_APPLIER_TERMINATION_TIMED_OUT_ON_SHUTDOWN 11654
+#define ER_GRP_RPL_FAILED_TO_SHUTDOWN_REGISTRY_MODULE 11655
+#define ER_GRP_RPL_FAILED_TO_INIT_HANDLER 11656
+#define ER_GRP_RPL_FAILED_TO_REGISTER_SERVER_STATE_OBSERVER 11657
+#define ER_GRP_RPL_FAILED_TO_REGISTER_TRANS_STATE_OBSERVER 11658
+#define ER_GRP_RPL_FAILED_TO_REGISTER_BINLOG_STATE_OBSERVER 11659
+#define ER_GRP_RPL_FAILED_TO_START_ON_BOOT 11660
+#define ER_GRP_RPL_FAILED_TO_STOP_ON_PLUGIN_UNINSTALL 11661
+#define ER_GRP_RPL_FAILED_TO_UNREGISTER_SERVER_STATE_OBSERVER 11662
+#define ER_GRP_RPL_FAILED_TO_UNREGISTER_TRANS_STATE_OBSERVER 11663
+#define ER_GRP_RPL_FAILED_TO_UNREGISTER_BINLOG_STATE_OBSERVER 11664
+#define ER_GRP_RPL_ALL_OBSERVERS_UNREGISTERED 11665
+#define ER_GRP_RPL_FAILED_TO_PARSE_THE_GRP_NAME 11666
+#define ER_GRP_RPL_FAILED_TO_GENERATE_SIDNO_FOR_GRP 11667
+#define ER_GRP_RPL_APPLIER_NOT_STARTED_DUE_TO_RUNNING_PREV_SHUTDOWN 11668
+#define ER_GRP_RPL_FAILED_TO_INIT_APPLIER_MODULE 11669
+#define ER_GRP_RPL_APPLIER_INITIALIZED 11670
+#define ER_GRP_RPL_COMMUNICATION_SSL_CONF_INFO 11671
+#define ER_GRP_RPL_ABORTS_AS_SSL_NOT_SUPPORTED_BY_MYSQLD 11672
+#define ER_GRP_RPL_SSL_DISABLED 11673
+#define ER_GRP_RPL_UNABLE_TO_INIT_COMMUNICATION_ENGINE 11674
+#define ER_GRP_RPL_BINLOG_DISABLED 11675
+#define ER_GRP_RPL_GTID_MODE_OFF 11676
+#define ER_GRP_RPL_LOG_SLAVE_UPDATES_NOT_SET 11677
+#define ER_GRP_RPL_INVALID_TRANS_WRITE_SET_EXTRACTION_VALUE 11678
+#define ER_GRP_RPL_RELAY_LOG_INFO_REPO_MUST_BE_TABLE 11679
+#define ER_GRP_RPL_MASTER_INFO_REPO_MUST_BE_TABLE 11680
+#define ER_GRP_RPL_INCORRECT_TYPE_SET_FOR_PARALLEL_APPLIER 11681
+#define ER_GRP_RPL_SLAVE_PRESERVE_COMMIT_ORDER_NOT_SET 11682
+#define ER_GRP_RPL_SINGLE_PRIM_MODE_NOT_ALLOWED_WITH_UPDATE_EVERYWHERE 11683
+#define ER_GRP_RPL_MODULE_TERMINATE_ERROR 11684
+#define ER_GRP_RPL_GRP_NAME_OPTION_MANDATORY 11685
+#define ER_GRP_RPL_GRP_NAME_IS_TOO_LONG 11686
+#define ER_GRP_RPL_GRP_NAME_IS_NOT_VALID_UUID 11687
+#define ER_GRP_RPL_FLOW_CTRL_MIN_QUOTA_GREATER_THAN_MAX_QUOTA 11688
+#define ER_GRP_RPL_FLOW_CTRL_MIN_RECOVERY_QUOTA_GREATER_THAN_MAX_QUOTA 11689
+#define ER_GRP_RPL_FLOW_CTRL_MAX_QUOTA_SMALLER_THAN_MIN_QUOTAS 11690
+#define ER_GRP_RPL_INVALID_SSL_RECOVERY_STRING 11691
+#define ER_GRP_RPL_SUPPORTS_ONLY_ONE_FORCE_MEMBERS_SET 11692
+#define ER_GRP_RPL_FORCE_MEMBERS_SET_UPDATE_NOT_ALLOWED 11693
+#define ER_GRP_RPL_GRP_COMMUNICATION_INIT_WITH_CONF 11694
+#define ER_GRP_RPL_UNKNOWN_GRP_RPL_APPLIER_PIPELINE_REQUESTED 11695
+#define ER_GRP_RPL_FAILED_TO_BOOTSTRAP_EVENT_HANDLING_INFRASTRUCTURE 11696
+#define ER_GRP_RPL_APPLIER_HANDLER_NOT_INITIALIZED 11697
+#define ER_GRP_RPL_APPLIER_HANDLER_IS_IN_USE 11698
+#define ER_GRP_RPL_APPLIER_HANDLER_ROLE_IS_IN_USE 11699
+#define ER_GRP_RPL_FAILED_TO_INIT_APPLIER_HANDLER 11700
+#define ER_GRP_RPL_SQL_SERVICE_FAILED_TO_INIT_SESSION_THREAD 11701
+#define ER_GRP_RPL_SQL_SERVICE_COMM_SESSION_NOT_INITIALIZED 11702
+#define ER_GRP_RPL_SQL_SERVICE_SERVER_SESSION_KILLED 11703
+#define ER_GRP_RPL_SQL_SERVICE_FAILED_TO_RUN_SQL_QUERY 11704
+#define ER_GRP_RPL_SQL_SERVICE_SERVER_INTERNAL_FAILURE 11705
+#define ER_GRP_RPL_SQL_SERVICE_RETRIES_EXCEEDED_ON_SESSION_STATE 11706
+#define ER_GRP_RPL_SQL_SERVICE_FAILED_TO_FETCH_SECURITY_CTX 11707
+#define ER_GRP_RPL_SQL_SERVICE_SERVER_ACCESS_DENIED_FOR_USER 11708
+#define ER_GRP_RPL_SQL_SERVICE_MAX_CONN_ERROR_FROM_SERVER 11709
+#define ER_GRP_RPL_SQL_SERVICE_SERVER_ERROR_ON_CONN 11710
+#define ER_GRP_RPL_UNREACHABLE_MAJORITY_TIMEOUT_FOR_MEMBER 11711
+#define ER_GRP_RPL_SERVER_SET_TO_READ_ONLY_DUE_TO_ERRORS 11712
+#define ER_GRP_RPL_GMS_LISTENER_FAILED_TO_LOG_NOTIFICATION 11713
+#define ER_GRP_RPL_GRP_COMMUNICATION_ENG_INIT_FAILED 11714
+#define ER_GRP_RPL_SET_GRP_COMMUNICATION_ENG_LOGGER_FAILED 11715
+#define ER_GRP_RPL_DEBUG_OPTIONS 11716
+#define ER_GRP_RPL_INVALID_DEBUG_OPTIONS 11717
+#define ER_GRP_RPL_EXIT_GRP_GCS_ERROR 11718
+#define ER_GRP_RPL_GRP_MEMBER_OFFLINE 11719
+#define ER_GRP_RPL_GCS_INTERFACE_ERROR 11720
+#define ER_GRP_RPL_FORCE_MEMBER_VALUE_SET_ERROR 11721
+#define ER_GRP_RPL_FORCE_MEMBER_VALUE_SET 11722
+#define ER_GRP_RPL_FORCE_MEMBER_VALUE_TIME_OUT 11723
+#define ER_GRP_RPL_BROADCAST_COMMIT_MSSG_TOO_BIG 11724
+#define ER_GRP_RPL_SEND_STATS_ERROR 11725
+#define ER_GRP_RPL_MEMBER_STATS_INFO 11726
+#define ER_GRP_RPL_FLOW_CONTROL_STATS 11727
+#define ER_GRP_RPL_UNABLE_TO_CONVERT_PACKET_TO_EVENT 11728
+#define ER_GRP_RPL_PIPELINE_CREATE_FAILED 11729
+#define ER_GRP_RPL_PIPELINE_REINIT_FAILED_WRITE 11730
+#define ER_GRP_RPL_UNABLE_TO_CONVERT_EVENT_TO_PACKET 11731
+#define ER_GRP_RPL_PIPELINE_FLUSH_FAIL 11732
+#define ER_GRP_RPL_PIPELINE_REINIT_FAILED_READ 11733
+#define ER_GRP_RPL_STOP_REP_CHANNEL 11734
+#define ER_GRP_RPL_GCS_GR_ERROR_MSG 11735
+#define ER_GRP_RPL_SLAVE_IO_THREAD_UNBLOCKED 11736
+#define ER_GRP_RPL_SLAVE_IO_THREAD_ERROR_OUT 11737
+#define ER_GRP_RPL_SLAVE_APPLIER_THREAD_UNBLOCKED 11738
+#define ER_GRP_RPL_SLAVE_APPLIER_THREAD_ERROR_OUT 11739
+#define ER_LDAP_AUTH_FAILED_TO_CREATE_OR_GET_CONNECTION 11740
+#define ER_LDAP_AUTH_DEINIT_FAILED 11741
+#define ER_LDAP_AUTH_SKIPPING_USER_GROUP_SEARCH 11742
+#define ER_LDAP_AUTH_POOL_DISABLE_MAX_SIZE_ZERO 11743
+#define ER_LDAP_AUTH_FAILED_TO_CREATE_LDAP_OBJECT_CREATOR 11744
+#define ER_LDAP_AUTH_FAILED_TO_CREATE_LDAP_OBJECT 11745
+#define ER_LDAP_AUTH_TLS_CONF 11746
+#define ER_LDAP_AUTH_TLS_CONNECTION 11747
+#define ER_LDAP_AUTH_CONN_POOL_NOT_CREATED 11748
+#define ER_LDAP_AUTH_CONN_POOL_INITIALIZING 11749
+#define ER_LDAP_AUTH_CONN_POOL_DEINITIALIZING 11750
+#define ER_LDAP_AUTH_ZERO_MAX_POOL_SIZE_UNCHANGED 11751
+#define ER_LDAP_AUTH_POOL_REINITIALIZING 11752
+#define ER_LDAP_AUTH_FAILED_TO_WRITE_PACKET 11753
+#define ER_LDAP_AUTH_SETTING_USERNAME 11754
+#define ER_LDAP_AUTH_USER_AUTH_DATA 11755
+#define ER_LDAP_AUTH_INFO_FOR_USER 11756
+#define ER_LDAP_AUTH_USER_GROUP_SEARCH_INFO 11757
+#define ER_LDAP_AUTH_GRP_SEARCH_SPECIAL_HDL 11758
+#define ER_LDAP_AUTH_GRP_IS_FULL_DN 11759
+#define ER_LDAP_AUTH_USER_NOT_FOUND_IN_ANY_GRP 11760
+#define ER_LDAP_AUTH_USER_FOUND_IN_MANY_GRPS 11761
+#define ER_LDAP_AUTH_USER_HAS_MULTIPLE_GRP_NAMES 11762
+#define ER_LDAP_AUTH_SEARCHED_USER_GRP_NAME 11763
+#define ER_LDAP_AUTH_OBJECT_CREATE_TIMESTAMP 11764
+#define ER_LDAP_AUTH_CERTIFICATE_NAME 11765
+#define ER_LDAP_AUTH_FAILED_TO_POOL_DEINIT 11766
+#define ER_LDAP_AUTH_FAILED_TO_INITIALIZE_POOL_IN_RECONSTRUCTING 11767
+#define ER_LDAP_AUTH_FAILED_TO_INITIALIZE_POOL_IN_INIT_STATE 11768
+#define ER_LDAP_AUTH_FAILED_TO_INITIALIZE_POOL_IN_DEINIT_STATE 11769
+#define ER_LDAP_AUTH_FAILED_TO_DEINITIALIZE_POOL_IN_RECONSTRUCT_STATE 11770
+#define ER_LDAP_AUTH_FAILED_TO_DEINITIALIZE_NOT_READY_POOL 11771
+#define ER_LDAP_AUTH_FAILED_TO_GET_CONNECTION_AS_PLUGIN_NOT_READY 11772
+#define ER_LDAP_AUTH_CONNECTION_POOL_INIT_FAILED 11773
+#define ER_LDAP_AUTH_MAX_ALLOWED_CONNECTION_LIMIT_HIT 11774
+#define ER_LDAP_AUTH_MAX_POOL_SIZE_SET_FAILED 11775
+#define ER_LDAP_AUTH_PLUGIN_FAILED_TO_READ_PACKET 11776
+#define ER_LDAP_AUTH_CREATING_LDAP_CONNECTION 11777
+#define ER_LDAP_AUTH_GETTING_CONNECTION_FROM_POOL 11778
+#define ER_LDAP_AUTH_RETURNING_CONNECTION_TO_POOL 11779
+#define ER_LDAP_AUTH_SEARCH_USER_GROUP_ATTR_NOT_FOUND 11780
+#define ER_LDAP_AUTH_LDAP_INFO_NULL 11781
+#define ER_LDAP_AUTH_FREEING_CONNECTION 11782
+#define ER_LDAP_AUTH_CONNECTION_PUSHED_TO_POOL 11783
+#define ER_LDAP_AUTH_CONNECTION_CREATOR_ENTER 11784
+#define ER_LDAP_AUTH_STARTING_TLS 11785
+#define ER_LDAP_AUTH_CONNECTION_GET_LDAP_INFO_NULL 11786
+#define ER_LDAP_AUTH_DELETING_CONNECTION_KEY 11787
+#define ER_LDAP_AUTH_POOLED_CONNECTION_KEY 11788
+#define ER_LDAP_AUTH_CREATE_CONNECTION_KEY 11789
+#define ER_LDAP_AUTH_COMMUNICATION_HOST_INFO 11790
+#define ER_LDAP_AUTH_METHOD_TO_CLIENT 11791
+#define ER_LDAP_AUTH_SASL_REQUEST_FROM_CLIENT 11792
+#define ER_LDAP_AUTH_SASL_PROCESS_SASL 11793
+#define ER_LDAP_AUTH_SASL_BIND_SUCCESS_INFO 11794
+#define ER_LDAP_AUTH_STARTED_FOR_USER 11795
+#define ER_LDAP_AUTH_DISTINGUISHED_NAME 11796
+#define ER_LDAP_AUTH_INIT_FAILED 11797
+#define ER_LDAP_AUTH_OR_GROUP_RETRIEVAL_FAILED 11798
+#define ER_LDAP_AUTH_USER_GROUP_SEARCH_FAILED 11799
+#define ER_LDAP_AUTH_USER_BIND_FAILED 11800
+#define ER_LDAP_AUTH_POOL_GET_FAILED_TO_CREATE_CONNECTION 11801
+#define ER_LDAP_AUTH_FAILED_TO_CREATE_LDAP_CONNECTION 11802
+#define ER_LDAP_AUTH_FAILED_TO_ESTABLISH_TLS_CONNECTION 11803
+#define ER_LDAP_AUTH_FAILED_TO_SEARCH_DN 11804
+#define ER_LDAP_AUTH_CONNECTION_POOL_REINIT_ENTER 11805
+#define ER_SYSTEMD_NOTIFY_PATH_TOO_LONG 11806
+#define ER_SYSTEMD_NOTIFY_CONNECT_FAILED 11807
+#define ER_SYSTEMD_NOTIFY_WRITE_FAILED 11808
+#define ER_FOUND_MISSING_GTIDS 11809
+#define ER_PID_FILE_PRIV_DIRECTORY_INSECURE 11810
+#define ER_CANT_CHECK_PID_PATH 11811
+#define ER_VALIDATE_PWD_STATUS_VAR_REGISTRATION_FAILED 11812
+#define ER_VALIDATE_PWD_STATUS_VAR_UNREGISTRATION_FAILED 11813
+#define ER_VALIDATE_PWD_DICT_FILE_OPEN_FAILED 11814
+#define ER_VALIDATE_PWD_COULD_BE_NULL 11815
+#define ER_VALIDATE_PWD_STRING_CONV_TO_LOWERCASE_FAILED 11816
+#define ER_VALIDATE_PWD_STRING_CONV_TO_BUFFER_FAILED 11817
+#define ER_VALIDATE_PWD_STRING_HANDLER_MEM_ALLOCATION_FAILED 11818
+#define ER_VALIDATE_PWD_STRONG_POLICY_DICT_FILE_UNSPECIFIED 11819
+#define ER_VALIDATE_PWD_CONVERT_TO_BUFFER_FAILED 11820
+#define ER_VALIDATE_PWD_VARIABLE_REGISTRATION_FAILED 11821
+#define ER_VALIDATE_PWD_VARIABLE_UNREGISTRATION_FAILED 11822
+#define ER_KEYRING_MIGRATION_EXTRA_OPTIONS 11823
+//#define OBSOLETE_ER_INVALID_DEFAULT_UTF8MB4_COLLATION 11824
+#define ER_IB_MSG_0 11825
+#define ER_IB_MSG_1 11826
+#define ER_IB_MSG_2 11827
+#define ER_IB_MSG_3 11828
+#define ER_IB_MSG_4 11829
+#define ER_IB_MSG_5 11830
+#define ER_IB_MSG_6 11831
+#define ER_IB_MSG_7 11832
+#define ER_IB_MSG_8 11833
+#define ER_IB_MSG_9 11834
+#define ER_IB_MSG_10 11835
+#define ER_IB_MSG_11 11836
+#define ER_IB_MSG_12 11837
+#define ER_IB_MSG_13 11838
+#define ER_IB_MSG_14 11839
+#define ER_IB_MSG_15 11840
+#define ER_IB_MSG_16 11841
+#define ER_IB_MSG_17 11842
+#define ER_IB_MSG_18 11843
+#define ER_IB_MSG_19 11844
+#define ER_IB_MSG_20 11845
+#define ER_IB_MSG_21 11846
+#define ER_IB_MSG_22 11847
+#define ER_IB_MSG_23 11848
+#define ER_IB_MSG_24 11849
+#define ER_IB_MSG_25 11850
+#define ER_IB_MSG_26 11851
+#define ER_IB_MSG_27 11852
+#define ER_IB_MSG_28 11853
+#define ER_IB_MSG_29 11854
+#define ER_IB_MSG_30 11855
+#define ER_IB_MSG_31 11856
+#define ER_IB_MSG_32 11857
+#define ER_IB_MSG_33 11858
+#define ER_IB_MSG_34 11859
+#define ER_IB_MSG_35 11860
+#define ER_IB_MSG_36 11861
+#define ER_IB_MSG_37 11862
+#define ER_IB_MSG_38 11863
+#define ER_IB_MSG_39 11864
+#define ER_IB_MSG_40 11865
+#define ER_IB_MSG_41 11866
+#define ER_IB_MSG_42 11867
+#define ER_IB_MSG_43 11868
+#define ER_IB_MSG_44 11869
+#define ER_IB_MSG_45 11870
+#define ER_IB_MSG_46 11871
+#define ER_IB_MSG_47 11872
+#define ER_IB_MSG_48 11873
+#define ER_IB_MSG_49 11874
+#define ER_IB_MSG_50 11875
+#define ER_IB_MSG_51 11876
+#define ER_IB_MSG_52 11877
+#define ER_IB_MSG_53 11878
+#define ER_IB_MSG_54 11879
+#define ER_IB_MSG_55 11880
+#define ER_IB_MSG_56 11881
+#define ER_IB_MSG_57 11882
+#define ER_IB_MSG_58 11883
+#define ER_IB_MSG_59 11884
+#define ER_IB_MSG_60 11885
+#define ER_IB_MSG_61 11886
+#define ER_IB_MSG_62 11887
+#define ER_IB_MSG_63 11888
+#define ER_IB_MSG_64 11889
+#define ER_IB_MSG_65 11890
+#define ER_IB_MSG_66 11891
+#define ER_IB_MSG_67 11892
+#define ER_IB_MSG_68 11893
+#define ER_IB_MSG_69 11894
+#define ER_IB_MSG_70 11895
+#define ER_IB_MSG_71 11896
+#define ER_IB_MSG_72 11897
+#define ER_IB_MSG_73 11898
+#define ER_IB_MSG_74 11899
+#define ER_IB_MSG_75 11900
+#define ER_IB_MSG_76 11901
+#define ER_IB_MSG_77 11902
+#define ER_IB_MSG_78 11903
+#define ER_IB_MSG_79 11904
+#define ER_IB_MSG_80 11905
+#define ER_IB_MSG_81 11906
+#define ER_IB_MSG_82 11907
+#define ER_IB_MSG_83 11908
+#define ER_IB_MSG_84 11909
+#define ER_IB_MSG_85 11910
+#define ER_IB_MSG_86 11911
+//#define OBSOLETE_ER_IB_MSG_87 11912
+//#define OBSOLETE_ER_IB_MSG_88 11913
+//#define OBSOLETE_ER_IB_MSG_89 11914
+//#define OBSOLETE_ER_IB_MSG_90 11915
+//#define OBSOLETE_ER_IB_MSG_91 11916
+//#define OBSOLETE_ER_IB_MSG_92 11917
+//#define OBSOLETE_ER_IB_MSG_93 11918
+//#define OBSOLETE_ER_IB_MSG_94 11919
+#define ER_IB_MSG_95 11920
+#define ER_IB_MSG_96 11921
+#define ER_IB_MSG_97 11922
+#define ER_IB_MSG_98 11923
+#define ER_IB_MSG_99 11924
+#define ER_IB_MSG_100 11925
+#define ER_IB_MSG_101 11926
+#define ER_IB_MSG_102 11927
+#define ER_IB_MSG_103 11928
+#define ER_IB_MSG_104 11929
+#define ER_IB_MSG_105 11930
+#define ER_IB_MSG_106 11931
+#define ER_IB_MSG_107 11932
+#define ER_IB_MSG_108 11933
+#define ER_IB_MSG_109 11934
+#define ER_IB_MSG_110 11935
+#define ER_IB_MSG_111 11936
+#define ER_IB_MSG_112 11937
+//#define OBSOLETE_ER_IB_MSG_113 11938
+//#define OBSOLETE_ER_IB_MSG_114 11939
+//#define OBSOLETE_ER_IB_MSG_115 11940
+//#define OBSOLETE_ER_IB_MSG_116 11941
+//#define OBSOLETE_ER_IB_MSG_117 11942
+//#define OBSOLETE_ER_IB_MSG_118 11943
+#define ER_IB_MSG_119 11944
+#define ER_IB_MSG_120 11945
+#define ER_IB_MSG_121 11946
+#define ER_IB_MSG_122 11947
+#define ER_IB_MSG_123 11948
+#define ER_IB_MSG_124 11949
+#define ER_IB_MSG_125 11950
+#define ER_IB_MSG_126 11951
+#define ER_IB_MSG_127 11952
+#define ER_IB_MSG_128 11953
+#define ER_IB_MSG_129 11954
+#define ER_IB_MSG_130 11955
+#define ER_IB_MSG_131 11956
+#define ER_IB_MSG_132 11957
+#define ER_IB_MSG_133 11958
+#define ER_IB_MSG_134 11959
+#define ER_IB_MSG_135 11960
+#define ER_IB_MSG_136 11961
+#define ER_IB_MSG_137 11962
+#define ER_IB_MSG_138 11963
+#define ER_IB_MSG_139 11964
+#define ER_IB_MSG_140 11965
+#define ER_IB_MSG_141 11966
+#define ER_IB_MSG_142 11967
+#define ER_IB_MSG_143 11968
+#define ER_IB_MSG_144 11969
+#define ER_IB_MSG_145 11970
+#define ER_IB_MSG_146 11971
+#define ER_IB_MSG_147 11972
+#define ER_IB_MSG_148 11973
+#define ER_IB_CLONE_INTERNAL 11974
+#define ER_IB_CLONE_TIMEOUT 11975
+#define ER_IB_CLONE_STATUS_FILE 11976
+#define ER_IB_CLONE_SQL 11977
+#define ER_IB_CLONE_VALIDATE 11978
+#define ER_IB_CLONE_PUNCH_HOLE 11979
+#define ER_IB_CLONE_GTID_PERSIST 11980
+#define ER_IB_MSG_156 11981
+#define ER_IB_MSG_157 11982
+#define ER_IB_MSG_158 11983
+#define ER_IB_MSG_159 11984
+#define ER_IB_MSG_160 11985
+#define ER_IB_MSG_161 11986
+#define ER_IB_MSG_162 11987
+#define ER_IB_MSG_163 11988
+#define ER_IB_MSG_164 11989
+#define ER_IB_MSG_165 11990
+#define ER_IB_MSG_166 11991
+#define ER_IB_MSG_167 11992
+#define ER_IB_MSG_168 11993
+#define ER_IB_MSG_169 11994
+#define ER_IB_MSG_170 11995
+#define ER_IB_MSG_171 11996
+#define ER_IB_MSG_172 11997
+#define ER_IB_MSG_173 11998
+#define ER_IB_MSG_174 11999
+#define ER_IB_MSG_175 12000
+#define ER_IB_MSG_176 12001
+#define ER_IB_MSG_177 12002
+#define ER_IB_MSG_178 12003
+#define ER_IB_MSG_179 12004
+#define ER_IB_MSG_180 12005
+#define ER_IB_MSG_181 12006
+#define ER_IB_MSG_182 12007
+#define ER_IB_MSG_183 12008
+#define ER_IB_MSG_184 12009
+#define ER_IB_MSG_185 12010
+#define ER_IB_MSG_186 12011
+#define ER_IB_MSG_187 12012
+#define ER_IB_MSG_188 12013
+#define ER_IB_MSG_189 12014
+#define ER_IB_MSG_190 12015
+#define ER_IB_MSG_191 12016
+#define ER_IB_MSG_192 12017
+#define ER_IB_MSG_193 12018
+#define ER_IB_MSG_194 12019
+#define ER_IB_MSG_195 12020
+#define ER_IB_MSG_196 12021
+#define ER_IB_MSG_197 12022
+#define ER_IB_MSG_198 12023
+#define ER_IB_MSG_199 12024
+#define ER_IB_MSG_200 12025
+#define ER_IB_MSG_201 12026
+#define ER_IB_MSG_202 12027
+#define ER_IB_MSG_203 12028
+#define ER_IB_MSG_204 12029
+#define ER_IB_MSG_205 12030
+#define ER_IB_MSG_206 12031
+#define ER_IB_MSG_207 12032
+#define ER_IB_MSG_208 12033
+#define ER_IB_MSG_209 12034
+#define ER_IB_MSG_210 12035
+#define ER_IB_MSG_211 12036
+#define ER_IB_MSG_212 12037
+#define ER_IB_MSG_213 12038
+#define ER_IB_MSG_214 12039
+#define ER_IB_MSG_215 12040
+#define ER_IB_MSG_216 12041
+#define ER_IB_MSG_217 12042
+#define ER_IB_MSG_218 12043
+#define ER_IB_MSG_219 12044
+#define ER_IB_MSG_220 12045
+#define ER_IB_MSG_221 12046
+#define ER_IB_MSG_222 12047
+#define ER_IB_MSG_223 12048
+#define ER_IB_MSG_224 12049
+#define ER_IB_MSG_225 12050
+#define ER_IB_MSG_226 12051
+#define ER_IB_MSG_227 12052
+#define ER_IB_MSG_228 12053
+#define ER_IB_MSG_229 12054
+#define ER_IB_MSG_230 12055
+#define ER_IB_MSG_231 12056
+#define ER_IB_MSG_232 12057
+#define ER_IB_MSG_233 12058
+#define ER_IB_MSG_234 12059
+#define ER_IB_MSG_235 12060
+#define ER_IB_MSG_236 12061
+#define ER_IB_MSG_237 12062
+#define ER_IB_MSG_238 12063
+#define ER_IB_MSG_239 12064
+#define ER_IB_MSG_240 12065
+#define ER_IB_MSG_241 12066
+#define ER_IB_MSG_242 12067
+#define ER_IB_MSG_243 12068
+#define ER_IB_MSG_244 12069
+#define ER_IB_MSG_245 12070
+#define ER_IB_MSG_246 12071
+#define ER_IB_MSG_247 12072
+#define ER_IB_MSG_248 12073
+#define ER_IB_MSG_249 12074
+#define ER_IB_MSG_250 12075
+#define ER_IB_MSG_251 12076
+#define ER_IB_MSG_252 12077
+#define ER_IB_MSG_253 12078
+#define ER_IB_MSG_254 12079
+#define ER_IB_MSG_255 12080
+#define ER_IB_MSG_256 12081
+#define ER_IB_MSG_257 12082
+#define ER_IB_MSG_258 12083
+#define ER_IB_MSG_259 12084
+#define ER_IB_MSG_260 12085
+#define ER_IB_MSG_261 12086
+#define ER_IB_MSG_262 12087
+#define ER_IB_MSG_263 12088
+#define ER_IB_MSG_264 12089
+#define ER_IB_MSG_265 12090
+#define ER_IB_MSG_266 12091
+#define ER_IB_MSG_267 12092
+#define ER_IB_MSG_268 12093
+#define ER_IB_MSG_269 12094
+#define ER_IB_MSG_270 12095
+#define ER_IB_MSG_271 12096
+#define ER_IB_MSG_272 12097
+#define ER_IB_MSG_273 12098
+#define ER_IB_MSG_274 12099
+#define ER_IB_MSG_275 12100
+#define ER_IB_MSG_276 12101
+#define ER_IB_MSG_277 12102
+#define ER_IB_MSG_278 12103
+#define ER_IB_MSG_279 12104
+#define ER_IB_MSG_280 12105
+#define ER_IB_MSG_281 12106
+#define ER_IB_MSG_282 12107
+#define ER_IB_MSG_283 12108
+#define ER_IB_MSG_284 12109
+#define ER_IB_MSG_285 12110
+#define ER_IB_MSG_286 12111
+#define ER_IB_MSG_287 12112
+#define ER_IB_MSG_288 12113
+#define ER_IB_MSG_289 12114
+#define ER_IB_MSG_290 12115
+#define ER_IB_MSG_291 12116
+#define ER_IB_MSG_292 12117
+#define ER_IB_MSG_293 12118
+#define ER_IB_MSG_294 12119
+#define ER_IB_MSG_295 12120
+#define ER_IB_MSG_296 12121
+#define ER_IB_MSG_297 12122
+#define ER_IB_MSG_298 12123
+#define ER_IB_MSG_299 12124
+#define ER_IB_MSG_300 12125
+#define ER_IB_MSG_301 12126
+#define ER_IB_MSG_UNEXPECTED_FILE_EXISTS 12127
+#define ER_IB_MSG_303 12128
+#define ER_IB_MSG_304 12129
+#define ER_IB_MSG_305 12130
+#define ER_IB_MSG_306 12131
+#define ER_IB_MSG_307 12132
+#define ER_IB_MSG_308 12133
+#define ER_IB_MSG_309 12134
+#define ER_IB_MSG_310 12135
+#define ER_IB_MSG_311 12136
+#define ER_IB_MSG_312 12137
+#define ER_IB_MSG_313 12138
+#define ER_IB_MSG_314 12139
+#define ER_IB_MSG_315 12140
+#define ER_IB_MSG_316 12141
+#define ER_IB_MSG_317 12142
+#define ER_IB_MSG_318 12143
+#define ER_IB_MSG_319 12144
+#define ER_IB_MSG_320 12145
+#define ER_IB_MSG_321 12146
+#define ER_IB_MSG_322 12147
+#define ER_IB_MSG_323 12148
+#define ER_IB_MSG_324 12149
+#define ER_IB_MSG_325 12150
+#define ER_IB_MSG_326 12151
+#define ER_IB_MSG_327 12152
+#define ER_IB_MSG_328 12153
+#define ER_IB_MSG_329 12154
+#define ER_IB_MSG_330 12155
+#define ER_IB_MSG_331 12156
+#define ER_IB_MSG_332 12157
+#define ER_IB_MSG_333 12158
+#define ER_IB_MSG_334 12159
+#define ER_IB_MSG_335 12160
+#define ER_IB_MSG_336 12161
+#define ER_IB_MSG_337 12162
+#define ER_IB_MSG_338 12163
+#define ER_IB_MSG_339 12164
+#define ER_IB_MSG_340 12165
+#define ER_IB_MSG_341 12166
+#define ER_IB_MSG_342 12167
+#define ER_IB_MSG_343 12168
+#define ER_IB_MSG_344 12169
+#define ER_IB_MSG_345 12170
+#define ER_IB_MSG_346 12171
+#define ER_IB_MSG_347 12172
+#define ER_IB_MSG_348 12173
+#define ER_IB_MSG_349 12174
+#define ER_IB_MSG_350 12175
+//#define OBSOLETE_ER_IB_MSG_351 12176
+#define ER_IB_MSG_352 12177
+#define ER_IB_MSG_353 12178
+#define ER_IB_MSG_354 12179
+#define ER_IB_MSG_355 12180
+#define ER_IB_MSG_356 12181
+#define ER_IB_MSG_357 12182
+#define ER_IB_MSG_358 12183
+#define ER_IB_MSG_359 12184
+#define ER_IB_MSG_360 12185
+#define ER_IB_MSG_361 12186
+#define ER_IB_MSG_362 12187
+//#define OBSOLETE_ER_IB_MSG_363 12188
+#define ER_IB_MSG_364 12189
+#define ER_IB_MSG_365 12190
+#define ER_IB_MSG_366 12191
+#define ER_IB_MSG_367 12192
+#define ER_IB_MSG_368 12193
+#define ER_IB_MSG_369 12194
+#define ER_IB_MSG_370 12195
+#define ER_IB_MSG_371 12196
+#define ER_IB_MSG_372 12197
+#define ER_IB_MSG_373 12198
+#define ER_IB_MSG_374 12199
+#define ER_IB_MSG_375 12200
+#define ER_IB_MSG_376 12201
+#define ER_IB_MSG_377 12202
+#define ER_IB_MSG_378 12203
+#define ER_IB_MSG_379 12204
+#define ER_IB_MSG_380 12205
+#define ER_IB_MSG_381 12206
+#define ER_IB_MSG_382 12207
+#define ER_IB_MSG_383 12208
+#define ER_IB_MSG_384 12209
+#define ER_IB_MSG_385 12210
+#define ER_IB_MSG_386 12211
+#define ER_IB_MSG_387 12212
+#define ER_IB_MSG_388 12213
+#define ER_IB_MSG_389 12214
+#define ER_IB_MSG_390 12215
+#define ER_IB_MSG_391 12216
+#define ER_IB_MSG_392 12217
+#define ER_IB_MSG_393 12218
+#define ER_IB_MSG_394 12219
+#define ER_IB_MSG_395 12220
+#define ER_IB_MSG_396 12221
+#define ER_IB_MSG_397 12222
+#define ER_IB_MSG_398 12223
+#define ER_IB_MSG_399 12224
+//#define OBSOLETE_ER_IB_MSG_400 12225
+#define ER_IB_MSG_401 12226
+#define ER_IB_MSG_402 12227
+#define ER_IB_MSG_403 12228
+#define ER_IB_MSG_404 12229
+#define ER_IB_MSG_405 12230
+#define ER_IB_MSG_406 12231
+#define ER_IB_MSG_407 12232
+#define ER_IB_MSG_408 12233
+#define ER_IB_MSG_409 12234
+#define ER_IB_MSG_410 12235
+#define ER_IB_MSG_411 12236
+#define ER_IB_MSG_412 12237
+#define ER_IB_MSG_413 12238
+#define ER_IB_MSG_414 12239
+#define ER_IB_MSG_415 12240
+#define ER_IB_MSG_416 12241
+#define ER_IB_MSG_417 12242
+#define ER_IB_MSG_418 12243
+#define ER_IB_MSG_419 12244
+#define ER_IB_MSG_420 12245
+#define ER_IB_MSG_421 12246
+#define ER_IB_MSG_422 12247
+#define ER_IB_MSG_423 12248
+#define ER_IB_MSG_424 12249
+#define ER_IB_MSG_425 12250
+#define ER_IB_MSG_426 12251
+#define ER_IB_MSG_427 12252
+#define ER_IB_MSG_428 12253
+#define ER_IB_MSG_429 12254
+#define ER_IB_MSG_430 12255
+#define ER_IB_MSG_431 12256
+#define ER_IB_MSG_432 12257
+#define ER_IB_MSG_433 12258
+#define ER_IB_MSG_434 12259
+#define ER_IB_MSG_435 12260
+#define ER_IB_MSG_436 12261
+#define ER_IB_MSG_437 12262
+#define ER_IB_MSG_438 12263
+#define ER_IB_MSG_439 12264
+#define ER_IB_MSG_440 12265
+#define ER_IB_MSG_441 12266
+#define ER_IB_MSG_442 12267
+#define ER_IB_MSG_443 12268
+#define ER_IB_MSG_444 12269
+#define ER_IB_MSG_445 12270
+#define ER_IB_MSG_446 12271
+#define ER_IB_MSG_447 12272
+#define ER_IB_MSG_448 12273
+#define ER_IB_MSG_449 12274
+#define ER_IB_MSG_450 12275
+#define ER_IB_MSG_451 12276
+#define ER_IB_MSG_452 12277
+#define ER_IB_MSG_453 12278
+#define ER_IB_MSG_454 12279
+#define ER_IB_MSG_455 12280
+#define ER_IB_MSG_456 12281
+#define ER_IB_MSG_457 12282
+#define ER_IB_MSG_458 12283
+#define ER_IB_MSG_459 12284
+#define ER_IB_MSG_460 12285
+#define ER_IB_MSG_461 12286
+#define ER_IB_MSG_462 12287
+#define ER_IB_MSG_463 12288
+#define ER_IB_MSG_464 12289
+#define ER_IB_MSG_465 12290
+#define ER_IB_MSG_466 12291
+#define ER_IB_MSG_467 12292
+#define ER_IB_MSG_468 12293
+#define ER_IB_MSG_469 12294
+#define ER_IB_MSG_470 12295
+#define ER_IB_MSG_471 12296
+#define ER_IB_MSG_472 12297
+#define ER_IB_MSG_473 12298
+#define ER_IB_MSG_474 12299
+#define ER_IB_MSG_475 12300
+#define ER_IB_MSG_476 12301
+#define ER_IB_MSG_477 12302
+#define ER_IB_MSG_478 12303
+#define ER_IB_MSG_479 12304
+#define ER_IB_MSG_480 12305
+#define ER_IB_MSG_481 12306
+#define ER_IB_MSG_482 12307
+#define ER_IB_MSG_483 12308
+#define ER_IB_MSG_484 12309
+#define ER_IB_MSG_485 12310
+#define ER_IB_MSG_486 12311
+#define ER_IB_MSG_487 12312
+#define ER_IB_MSG_488 12313
+#define ER_IB_MSG_489 12314
+#define ER_IB_MSG_490 12315
+#define ER_IB_MSG_491 12316
+#define ER_IB_MSG_492 12317
+#define ER_IB_MSG_493 12318
+#define ER_IB_MSG_494 12319
+#define ER_IB_MSG_495 12320
+#define ER_IB_MSG_496 12321
+#define ER_IB_MSG_497 12322
+#define ER_IB_MSG_498 12323
+#define ER_IB_MSG_499 12324
+#define ER_IB_MSG_500 12325
+#define ER_IB_MSG_501 12326
+#define ER_IB_MSG_502 12327
+#define ER_IB_MSG_503 12328
+#define ER_IB_MSG_504 12329
+#define ER_IB_MSG_505 12330
+#define ER_IB_MSG_506 12331
+#define ER_IB_MSG_507 12332
+#define ER_IB_MSG_508 12333
+#define ER_IB_MSG_509 12334
+#define ER_IB_MSG_510 12335
+#define ER_IB_MSG_511 12336
+#define ER_IB_MSG_512 12337
+#define ER_IB_MSG_513 12338
+#define ER_IB_MSG_514 12339
+#define ER_IB_MSG_515 12340
+#define ER_IB_MSG_516 12341
+#define ER_IB_MSG_517 12342
+#define ER_IB_MSG_518 12343
+#define ER_IB_MSG_519 12344
+#define ER_IB_MSG_520 12345
+#define ER_IB_MSG_521 12346
+#define ER_IB_MSG_522 12347
+#define ER_IB_MSG_523 12348
+#define ER_IB_MSG_524 12349
+#define ER_IB_MSG_525 12350
+#define ER_IB_MSG_526 12351
+#define ER_IB_MSG_527 12352
+#define ER_IB_MSG_528 12353
+#define ER_IB_MSG_529 12354
+#define ER_IB_MSG_530 12355
+#define ER_IB_MSG_531 12356
+#define ER_IB_MSG_532 12357
+#define ER_IB_MSG_533 12358
+#define ER_IB_MSG_534 12359
+#define ER_IB_MSG_535 12360
+#define ER_IB_MSG_536 12361
+#define ER_IB_MSG_537 12362
+#define ER_IB_MSG_538 12363
+#define ER_IB_MSG_539 12364
+#define ER_IB_MSG_540 12365
+#define ER_IB_MSG_541 12366
+#define ER_IB_MSG_542 12367
+#define ER_IB_MSG_543 12368
+#define ER_IB_MSG_544 12369
+#define ER_IB_MSG_545 12370
+#define ER_IB_MSG_546 12371
+#define ER_IB_MSG_547 12372
+#define ER_IB_MSG_548 12373
+#define ER_IB_MSG_549 12374
+#define ER_IB_MSG_550 12375
+#define ER_IB_MSG_551 12376
+#define ER_IB_MSG_552 12377
+#define ER_IB_MSG_553 12378
+#define ER_IB_MSG_554 12379
+#define ER_IB_MSG_555 12380
+#define ER_IB_MSG_556 12381
+#define ER_IB_MSG_557 12382
+#define ER_IB_MSG_558 12383
+#define ER_IB_MSG_559 12384
+#define ER_IB_MSG_560 12385
+#define ER_IB_MSG_561 12386
+#define ER_IB_MSG_562 12387
+#define ER_IB_MSG_563 12388
+#define ER_IB_MSG_564 12389
+#define ER_IB_MSG_565 12390
+#define ER_IB_MSG_566 12391
+#define ER_IB_MSG_567 12392
+#define ER_IB_MSG_568 12393
+#define ER_IB_MSG_569 12394
+#define ER_IB_MSG_570 12395
+#define ER_IB_MSG_571 12396
+#define ER_IB_MSG_572 12397
+#define ER_IB_MSG_573 12398
+#define ER_IB_MSG_574 12399
+//#define OBSOLETE_ER_IB_MSG_575 12400
+//#define OBSOLETE_ER_IB_MSG_576 12401
+//#define OBSOLETE_ER_IB_MSG_577 12402
+#define ER_IB_MSG_578 12403
+#define ER_IB_MSG_579 12404
+#define ER_IB_MSG_580 12405
+#define ER_IB_MSG_581 12406
+#define ER_IB_MSG_582 12407
+#define ER_IB_MSG_583 12408
+#define ER_IB_MSG_584 12409
+#define ER_IB_MSG_585 12410
+#define ER_IB_MSG_586 12411
+#define ER_IB_MSG_587 12412
+#define ER_IB_MSG_588 12413
+#define ER_IB_MSG_589 12414
+#define ER_IB_MSG_590 12415
+#define ER_IB_MSG_591 12416
+#define ER_IB_MSG_592 12417
+#define ER_IB_MSG_593 12418
+#define ER_IB_MSG_594 12419
+#define ER_IB_MSG_595 12420
+#define ER_IB_MSG_596 12421
+#define ER_IB_MSG_597 12422
+#define ER_IB_MSG_598 12423
+#define ER_IB_MSG_599 12424
+#define ER_IB_MSG_600 12425
+#define ER_IB_MSG_601 12426
+#define ER_IB_MSG_602 12427
+#define ER_IB_MSG_603 12428
+#define ER_IB_MSG_604 12429
+#define ER_IB_MSG_605 12430
+#define ER_IB_MSG_606 12431
+#define ER_IB_MSG_607 12432
+#define ER_IB_MSG_608 12433
+#define ER_IB_MSG_609 12434
+#define ER_IB_MSG_610 12435
+#define ER_IB_MSG_611 12436
+#define ER_IB_MSG_612 12437
+#define ER_IB_MSG_613 12438
+#define ER_IB_MSG_614 12439
+#define ER_IB_MSG_615 12440
+#define ER_IB_MSG_616 12441
+#define ER_IB_MSG_617 12442
+#define ER_IB_MSG_618 12443
+#define ER_IB_MSG_619 12444
+#define ER_IB_MSG_620 12445
+#define ER_IB_MSG_621 12446
+#define ER_IB_MSG_622 12447
+#define ER_IB_MSG_623 12448
+#define ER_IB_MSG_624 12449
+#define ER_IB_MSG_625 12450
+#define ER_IB_MSG_626 12451
+#define ER_IB_MSG_627 12452
+#define ER_IB_MSG_628 12453
+#define ER_IB_MSG_629 12454
+#define ER_IB_MSG_630 12455
+#define ER_IB_MSG_631 12456
+#define ER_IB_MSG_632 12457
+#define ER_IB_MSG_633 12458
+#define ER_IB_MSG_634 12459
+#define ER_IB_MSG_635 12460
+#define ER_IB_MSG_636 12461
+#define ER_IB_MSG_637 12462
+#define ER_IB_MSG_638 12463
+#define ER_IB_MSG_639 12464
+#define ER_IB_MSG_640 12465
+#define ER_IB_MSG_641 12466
+#define ER_IB_MSG_642 12467
+#define ER_IB_MSG_643 12468
+#define ER_IB_MSG_644 12469
+#define ER_IB_MSG_645 12470
+#define ER_IB_MSG_646 12471
+#define ER_IB_MSG_647 12472
+#define ER_IB_MSG_648 12473
+#define ER_IB_MSG_649 12474
+#define ER_IB_MSG_650 12475
+#define ER_IB_MSG_651 12476
+#define ER_IB_MSG_652 12477
+#define ER_IB_MSG_DDL_LOG_DELETE_BY_ID_OK 12478
+#define ER_IB_MSG_654 12479
+#define ER_IB_MSG_655 12480
+#define ER_IB_MSG_656 12481
+#define ER_IB_MSG_657 12482
+#define ER_IB_MSG_658 12483
+#define ER_IB_MSG_659 12484
+#define ER_IB_MSG_660 12485
+#define ER_IB_MSG_661 12486
+#define ER_IB_MSG_662 12487
+#define ER_IB_MSG_663 12488
+//#define OBSOLETE_ER_IB_MSG_664 12489
+//#define OBSOLETE_ER_IB_MSG_665 12490
+//#define OBSOLETE_ER_IB_MSG_666 12491
+//#define OBSOLETE_ER_IB_MSG_667 12492
+//#define OBSOLETE_ER_IB_MSG_668 12493
+//#define OBSOLETE_ER_IB_MSG_669 12494
+//#define OBSOLETE_ER_IB_MSG_670 12495
+//#define OBSOLETE_ER_IB_MSG_671 12496
+//#define OBSOLETE_ER_IB_MSG_672 12497
+//#define OBSOLETE_ER_IB_MSG_673 12498
+//#define OBSOLETE_ER_IB_MSG_674 12499
+//#define OBSOLETE_ER_IB_MSG_675 12500
+//#define OBSOLETE_ER_IB_MSG_676 12501
+//#define OBSOLETE_ER_IB_MSG_677 12502
+//#define OBSOLETE_ER_IB_MSG_678 12503
+//#define OBSOLETE_ER_IB_MSG_679 12504
+//#define OBSOLETE_ER_IB_MSG_680 12505
+//#define OBSOLETE_ER_IB_MSG_681 12506
+//#define OBSOLETE_ER_IB_MSG_682 12507
+//#define OBSOLETE_ER_IB_MSG_683 12508
+//#define OBSOLETE_ER_IB_MSG_684 12509
+//#define OBSOLETE_ER_IB_MSG_685 12510
+//#define OBSOLETE_ER_IB_MSG_686 12511
+//#define OBSOLETE_ER_IB_MSG_687 12512
+//#define OBSOLETE_ER_IB_MSG_688 12513
+//#define OBSOLETE_ER_IB_MSG_689 12514
+//#define OBSOLETE_ER_IB_MSG_690 12515
+//#define OBSOLETE_ER_IB_MSG_691 12516
+//#define OBSOLETE_ER_IB_MSG_692 12517
+//#define OBSOLETE_ER_IB_MSG_693 12518
+#define ER_IB_MSG_694 12519
+#define ER_IB_MSG_695 12520
+#define ER_IB_MSG_696 12521
+#define ER_IB_MSG_697 12522
+#define ER_IB_MSG_698 12523
+#define ER_IB_MSG_699 12524
+#define ER_IB_MSG_700 12525
+#define ER_IB_MSG_701 12526
+//#define OBSOLETE_ER_IB_MSG_702 12527
+//#define OBSOLETE_ER_IB_MSG_703 12528
+#define ER_IB_MSG_704 12529
+#define ER_IB_MSG_705 12530
+#define ER_IB_MSG_706 12531
+#define ER_IB_MSG_707 12532
+#define ER_IB_MSG_708 12533
+#define ER_IB_MSG_709 12534
+#define ER_IB_MSG_710 12535
+#define ER_IB_MSG_711 12536
+#define ER_IB_MSG_712 12537
+#define ER_IB_MSG_713 12538
+#define ER_IB_MSG_714 12539
+#define ER_IB_MSG_715 12540
+#define ER_IB_MSG_716 12541
+#define ER_IB_MSG_717 12542
+#define ER_IB_MSG_718 12543
+#define ER_IB_MSG_719 12544
+#define ER_IB_MSG_720 12545
+#define ER_IB_MSG_721 12546
+#define ER_IB_MSG_722 12547
+#define ER_IB_MSG_723 12548
+#define ER_IB_MSG_724 12549
+#define ER_IB_MSG_725 12550
+#define ER_IB_MSG_726 12551
+#define ER_IB_MSG_727 12552
+#define ER_IB_MSG_728 12553
+#define ER_IB_MSG_729 12554
+#define ER_IB_MSG_730 12555
+#define ER_IB_MSG_731 12556
+#define ER_IB_MSG_732 12557
+#define ER_IB_MSG_733 12558
+#define ER_IB_MSG_734 12559
+#define ER_IB_MSG_735 12560
+#define ER_IB_MSG_736 12561
+#define ER_IB_MSG_737 12562
+#define ER_IB_MSG_738 12563
+#define ER_IB_MSG_739 12564
+#define ER_IB_MSG_740 12565
+#define ER_IB_MSG_741 12566
+#define ER_IB_MSG_742 12567
+#define ER_IB_MSG_743 12568
+#define ER_IB_MSG_744 12569
+#define ER_IB_MSG_745 12570
+#define ER_IB_MSG_746 12571
+#define ER_IB_MSG_747 12572
+#define ER_IB_MSG_748 12573
+#define ER_IB_MSG_749 12574
+#define ER_IB_MSG_750 12575
+#define ER_IB_MSG_751 12576
+#define ER_IB_MSG_752 12577
+#define ER_IB_MSG_753 12578
+#define ER_IB_MSG_754 12579
+#define ER_IB_MSG_755 12580
+#define ER_IB_MSG_756 12581
+#define ER_IB_MSG_757 12582
+#define ER_IB_MSG_758 12583
+#define ER_IB_MSG_759 12584
+#define ER_IB_MSG_760 12585
+#define ER_IB_MSG_761 12586
+#define ER_IB_MSG_762 12587
+#define ER_IB_MSG_763 12588
+#define ER_IB_MSG_764 12589
+#define ER_IB_MSG_765 12590
+#define ER_IB_MSG_766 12591
+#define ER_IB_MSG_767 12592
+#define ER_IB_MSG_768 12593
+#define ER_IB_MSG_769 12594
+#define ER_IB_MSG_770 12595
+#define ER_IB_MSG_771 12596
+#define ER_IB_MSG_772 12597
+#define ER_IB_MSG_773 12598
+#define ER_IB_MSG_774 12599
+#define ER_IB_MSG_775 12600
+#define ER_IB_MSG_776 12601
+#define ER_IB_MSG_777 12602
+#define ER_IB_MSG_778 12603
+#define ER_IB_MSG_779 12604
+#define ER_IB_MSG_780 12605
+#define ER_IB_MSG_781 12606
+#define ER_IB_MSG_782 12607
+#define ER_IB_MSG_783 12608
+#define ER_IB_MSG_784 12609
+#define ER_IB_MSG_785 12610
+#define ER_IB_MSG_786 12611
+#define ER_IB_MSG_787 12612
+#define ER_IB_MSG_788 12613
+#define ER_IB_MSG_789 12614
+#define ER_IB_MSG_790 12615
+#define ER_IB_MSG_791 12616
+#define ER_IB_MSG_792 12617
+#define ER_IB_MSG_793 12618
+#define ER_IB_MSG_794 12619
+#define ER_IB_MSG_795 12620
+#define ER_IB_MSG_796 12621
+#define ER_IB_MSG_797 12622
+#define ER_IB_MSG_798 12623
+#define ER_IB_MSG_799 12624
+#define ER_IB_MSG_800 12625
+#define ER_IB_MSG_801 12626
+#define ER_IB_MSG_802 12627
+#define ER_IB_MSG_803 12628
+#define ER_IB_MSG_804 12629
+#define ER_IB_MSG_805 12630
+#define ER_IB_MSG_806 12631
+#define ER_IB_MSG_807 12632
+#define ER_IB_MSG_808 12633
+#define ER_IB_MSG_809 12634
+#define ER_IB_MSG_810 12635
+#define ER_IB_MSG_811 12636
+#define ER_IB_MSG_812 12637
+#define ER_IB_MSG_813 12638
+#define ER_IB_MSG_814 12639
+#define ER_IB_MSG_815 12640
+#define ER_IB_MSG_816 12641
+#define ER_IB_MSG_817 12642
+#define ER_IB_MSG_818 12643
+#define ER_IB_MSG_819 12644
+#define ER_IB_MSG_820 12645
+#define ER_IB_MSG_821 12646
+#define ER_IB_MSG_822 12647
+#define ER_IB_MSG_823 12648
+#define ER_IB_MSG_824 12649
+#define ER_IB_MSG_825 12650
+#define ER_IB_MSG_826 12651
+#define ER_IB_MSG_827 12652
+#define ER_IB_MSG_828 12653
+#define ER_IB_MSG_829 12654
+#define ER_IB_MSG_830 12655
+#define ER_IB_MSG_831 12656
+#define ER_IB_MSG_832 12657
+#define ER_IB_MSG_833 12658
+#define ER_IB_MSG_834 12659
+#define ER_IB_MSG_835 12660
+#define ER_IB_MSG_836 12661
+#define ER_IB_MSG_837 12662
+#define ER_IB_MSG_838 12663
+#define ER_IB_MSG_839 12664
+#define ER_IB_MSG_840 12665
+#define ER_IB_MSG_841 12666
+#define ER_IB_MSG_842 12667
+#define ER_IB_MSG_843 12668
+#define ER_IB_MSG_844 12669
+#define ER_IB_MSG_845 12670
+#define ER_IB_MSG_846 12671
+#define ER_IB_MSG_847 12672
+#define ER_IB_MSG_848 12673
+#define ER_IB_MSG_849 12674
+#define ER_IB_MSG_850 12675
+#define ER_IB_MSG_851 12676
+#define ER_IB_MSG_852 12677
+#define ER_IB_MSG_853 12678
+#define ER_IB_MSG_854 12679
+#define ER_IB_MSG_855 12680
+#define ER_IB_MSG_856 12681
+#define ER_IB_MSG_857 12682
+#define ER_IB_MSG_858 12683
+#define ER_IB_MSG_859 12684
+#define ER_IB_MSG_860 12685
+#define ER_IB_MSG_861 12686
+#define ER_IB_MSG_862 12687
+#define ER_IB_MSG_863 12688
+#define ER_IB_MSG_864 12689
+#define ER_IB_MSG_865 12690
+#define ER_IB_MSG_866 12691
+#define ER_IB_MSG_867 12692
+#define ER_IB_MSG_868 12693
+#define ER_IB_MSG_869 12694
+#define ER_IB_MSG_870 12695
+#define ER_IB_MSG_871 12696
+#define ER_IB_MSG_872 12697
+#define ER_IB_MSG_873 12698
+#define ER_IB_MSG_874 12699
+#define ER_IB_MSG_875 12700
+#define ER_IB_MSG_876 12701
+#define ER_IB_MSG_877 12702
+#define ER_IB_MSG_878 12703
+#define ER_IB_MSG_879 12704
+#define ER_IB_MSG_880 12705
+#define ER_IB_MSG_881 12706
+#define ER_IB_MSG_882 12707
+#define ER_IB_MSG_883 12708
+#define ER_IB_MSG_884 12709
+#define ER_IB_MSG_885 12710
+#define ER_IB_MSG_886 12711
+#define ER_IB_MSG_887 12712
+#define ER_IB_MSG_888 12713
+#define ER_IB_MSG_889 12714
+#define ER_IB_MSG_890 12715
+#define ER_IB_MSG_891 12716
+#define ER_IB_MSG_892 12717
+#define ER_IB_MSG_893 12718
+#define ER_IB_MSG_894 12719
+#define ER_IB_MSG_895 12720
+#define ER_IB_MSG_896 12721
+#define ER_IB_MSG_897 12722
+#define ER_IB_MSG_898 12723
+#define ER_IB_MSG_899 12724
+#define ER_IB_MSG_900 12725
+#define ER_IB_MSG_901 12726
+#define ER_IB_MSG_902 12727
+#define ER_IB_MSG_903 12728
+#define ER_IB_MSG_904 12729
+#define ER_IB_MSG_905 12730
+#define ER_IB_MSG_906 12731
+#define ER_IB_MSG_907 12732
+#define ER_IB_MSG_908 12733
+#define ER_IB_MSG_909 12734
+#define ER_IB_MSG_910 12735
+#define ER_IB_MSG_911 12736
+#define ER_IB_MSG_912 12737
+#define ER_IB_MSG_913 12738
+#define ER_IB_MSG_914 12739
+#define ER_IB_MSG_915 12740
+#define ER_IB_MSG_916 12741
+#define ER_IB_MSG_917 12742
+#define ER_IB_MSG_918 12743
+#define ER_IB_MSG_919 12744
+#define ER_IB_MSG_920 12745
+#define ER_IB_MSG_921 12746
+#define ER_IB_MSG_922 12747
+#define ER_IB_MSG_923 12748
+#define ER_IB_MSG_924 12749
+#define ER_IB_MSG_925 12750
+#define ER_IB_MSG_926 12751
+#define ER_IB_MSG_927 12752
+#define ER_IB_MSG_928 12753
+#define ER_IB_MSG_929 12754
+#define ER_IB_MSG_930 12755
+#define ER_IB_MSG_931 12756
+#define ER_IB_MSG_932 12757
+#define ER_IB_MSG_933 12758
+#define ER_IB_MSG_934 12759
+#define ER_IB_MSG_935 12760
+#define ER_IB_MSG_936 12761
+#define ER_IB_MSG_937 12762
+#define ER_IB_MSG_938 12763
+#define ER_IB_MSG_939 12764
+#define ER_IB_MSG_940 12765
+#define ER_IB_MSG_941 12766
+#define ER_IB_MSG_942 12767
+#define ER_IB_MSG_943 12768
+#define ER_IB_MSG_944 12769
+#define ER_IB_MSG_945 12770
+#define ER_IB_MSG_946 12771
+#define ER_IB_MSG_947 12772
+#define ER_IB_MSG_948 12773
+#define ER_IB_MSG_949 12774
+#define ER_IB_MSG_950 12775
+#define ER_IB_MSG_951 12776
+#define ER_IB_MSG_952 12777
+#define ER_IB_MSG_953 12778
+#define ER_IB_MSG_954 12779
+#define ER_IB_MSG_955 12780
+#define ER_IB_MSG_956 12781
+#define ER_IB_MSG_957 12782
+#define ER_IB_MSG_958 12783
+#define ER_IB_MSG_959 12784
+#define ER_IB_MSG_960 12785
+#define ER_IB_MSG_961 12786
+#define ER_IB_MSG_962 12787
+#define ER_IB_MSG_963 12788
+#define ER_IB_MSG_964 12789
+#define ER_IB_MSG_965 12790
+#define ER_IB_MSG_966 12791
+#define ER_IB_MSG_967 12792
+#define ER_IB_MSG_968 12793
+#define ER_IB_MSG_969 12794
+#define ER_IB_MSG_970 12795
+#define ER_IB_MSG_971 12796
+#define ER_IB_MSG_972 12797
+#define ER_IB_MSG_973 12798
+#define ER_IB_MSG_974 12799
+#define ER_IB_MSG_975 12800
+#define ER_IB_MSG_976 12801
+#define ER_IB_MSG_977 12802
+#define ER_IB_MSG_978 12803
+#define ER_IB_MSG_979 12804
+#define ER_IB_MSG_980 12805
+#define ER_IB_MSG_981 12806
+#define ER_IB_MSG_982 12807
+#define ER_IB_MSG_983 12808
+#define ER_IB_MSG_984 12809
+#define ER_IB_MSG_985 12810
+#define ER_IB_MSG_986 12811
+#define ER_IB_MSG_987 12812
+#define ER_IB_MSG_988 12813
+#define ER_IB_MSG_989 12814
+#define ER_IB_MSG_990 12815
+#define ER_IB_MSG_991 12816
+#define ER_IB_MSG_992 12817
+#define ER_IB_MSG_993 12818
+#define ER_IB_MSG_994 12819
+#define ER_IB_MSG_995 12820
+#define ER_IB_MSG_996 12821
+#define ER_IB_MSG_997 12822
+#define ER_IB_MSG_998 12823
+#define ER_IB_MSG_999 12824
+#define ER_IB_MSG_1000 12825
+#define ER_IB_MSG_1001 12826
+#define ER_IB_MSG_1002 12827
+#define ER_IB_MSG_1003 12828
+#define ER_IB_MSG_1004 12829
+#define ER_IB_MSG_1005 12830
+#define ER_IB_MSG_1006 12831
+#define ER_IB_MSG_1007 12832
+#define ER_IB_MSG_1008 12833
+#define ER_IB_MSG_1009 12834
+#define ER_IB_MSG_1010 12835
+#define ER_IB_MSG_1011 12836
+#define ER_IB_MSG_1012 12837
+#define ER_IB_MSG_1013 12838
+#define ER_IB_MSG_1014 12839
+#define ER_IB_MSG_1015 12840
+#define ER_IB_MSG_1016 12841
+#define ER_IB_MSG_1017 12842
+#define ER_IB_MSG_1018 12843
+#define ER_IB_MSG_1019 12844
+#define ER_IB_MSG_1020 12845
+#define ER_IB_MSG_1021 12846
+#define ER_IB_MSG_1022 12847
+#define ER_IB_MSG_1023 12848
+#define ER_IB_MSG_1024 12849
+#define ER_IB_MSG_1025 12850
+#define ER_IB_MSG_1026 12851
+#define ER_IB_MSG_1027 12852
+#define ER_IB_MSG_1028 12853
+#define ER_IB_MSG_1029 12854
+#define ER_IB_MSG_1030 12855
+#define ER_IB_MSG_1031 12856
+#define ER_IB_MSG_1032 12857
+#define ER_IB_MSG_1033 12858
+#define ER_IB_MSG_1034 12859
+#define ER_IB_MSG_1035 12860
+#define ER_IB_MSG_1036 12861
+#define ER_IB_MSG_1037 12862
+#define ER_IB_MSG_1038 12863
+#define ER_IB_MSG_1039 12864
+#define ER_IB_MSG_1040 12865
+#define ER_IB_MSG_1041 12866
+#define ER_IB_MSG_1042 12867
+#define ER_IB_MSG_1043 12868
+#define ER_IB_MSG_1044 12869
+#define ER_IB_MSG_1045 12870
+#define ER_IB_MSG_1046 12871
+#define ER_IB_MSG_1047 12872
+#define ER_IB_MSG_1048 12873
+#define ER_IB_MSG_1049 12874
+//#define OBSOLETE_ER_IB_MSG_1050 12875
+#define ER_IB_MSG_1051 12876
+#define ER_IB_MSG_1052 12877
+#define ER_IB_MSG_1053 12878
+#define ER_IB_MSG_1054 12879
+#define ER_IB_MSG_1055 12880
+#define ER_IB_MSG_1056 12881
+#define ER_IB_MSG_1057 12882
+#define ER_IB_MSG_1058 12883
+#define ER_IB_MSG_1059 12884
+#define ER_IB_MSG_1060 12885
+#define ER_IB_MSG_1061 12886
+#define ER_IB_MSG_1062 12887
+#define ER_IB_MSG_1063 12888
+#define ER_IB_MSG_1064 12889
+#define ER_IB_MSG_1065 12890
+#define ER_IB_MSG_1066 12891
+#define ER_IB_MSG_1067 12892
+#define ER_IB_MSG_1068 12893
+#define ER_IB_MSG_1069 12894
+#define ER_IB_MSG_1070 12895
+#define ER_IB_MSG_1071 12896
+#define ER_IB_MSG_1072 12897
+#define ER_IB_MSG_1073 12898
+#define ER_IB_MSG_1074 12899
+#define ER_IB_MSG_1075 12900
+#define ER_IB_MSG_1076 12901
+#define ER_IB_MSG_1077 12902
+#define ER_IB_MSG_1078 12903
+#define ER_IB_MSG_1079 12904
+#define ER_IB_MSG_1080 12905
+#define ER_IB_MSG_1081 12906
+#define ER_IB_MSG_1082 12907
+#define ER_IB_MSG_1083 12908
+#define ER_IB_MSG_1084 12909
+#define ER_IB_MSG_1085 12910
+#define ER_IB_MSG_1086 12911
+#define ER_IB_MSG_1087 12912
+#define ER_IB_MSG_1088 12913
+#define ER_IB_MSG_1089 12914
+#define ER_IB_MSG_1090 12915
+#define ER_IB_MSG_1091 12916
+#define ER_IB_MSG_1092 12917
+#define ER_IB_MSG_1093 12918
+#define ER_IB_MSG_1094 12919
+#define ER_IB_MSG_1095 12920
+#define ER_IB_MSG_1096 12921
+#define ER_IB_MSG_1097 12922
+#define ER_IB_MSG_1098 12923
+#define ER_IB_MSG_1099 12924
+#define ER_IB_MSG_1100 12925
+#define ER_IB_MSG_1101 12926
+#define ER_IB_MSG_1102 12927
+#define ER_IB_MSG_1103 12928
+#define ER_IB_MSG_1104 12929
+#define ER_IB_MSG_1105 12930
+#define ER_IB_MSG_1106 12931
+#define ER_IB_MSG_1107 12932
+#define ER_IB_MSG_1108 12933
+#define ER_IB_MSG_1109 12934
+#define ER_IB_MSG_1110 12935
+#define ER_IB_MSG_1111 12936
+#define ER_IB_MSG_1112 12937
+#define ER_IB_MSG_1113 12938
+#define ER_IB_MSG_1114 12939
+#define ER_IB_MSG_1115 12940
+#define ER_IB_MSG_1116 12941
+#define ER_IB_MSG_1117 12942
+#define ER_IB_MSG_1118 12943
+#define ER_IB_MSG_1119 12944
+#define ER_IB_MSG_1120 12945
+#define ER_IB_MSG_1121 12946
+#define ER_IB_MSG_1122 12947
+#define ER_IB_MSG_1123 12948
+#define ER_IB_MSG_1124 12949
+#define ER_IB_MSG_1125 12950
+#define ER_IB_MSG_1126 12951
+#define ER_IB_MSG_1127 12952
+#define ER_IB_MSG_1128 12953
+#define ER_IB_MSG_1129 12954
+#define ER_IB_MSG_1130 12955
+#define ER_IB_MSG_1131 12956
+#define ER_IB_MSG_1132 12957
+#define ER_IB_MSG_1133 12958
+#define ER_IB_MSG_1134 12959
+#define ER_IB_MSG_1135 12960
+#define ER_IB_MSG_1136 12961
+#define ER_IB_MSG_1137 12962
+#define ER_IB_MSG_1138 12963
+#define ER_IB_MSG_1139 12964
+#define ER_IB_MSG_1140 12965
+#define ER_IB_MSG_1141 12966
+#define ER_IB_MSG_1142 12967
+#define ER_IB_MSG_1143 12968
+#define ER_IB_MSG_1144 12969
+#define ER_IB_MSG_1145 12970
+#define ER_IB_MSG_1146 12971
+#define ER_IB_MSG_1147 12972
+#define ER_IB_MSG_1148 12973
+#define ER_IB_MSG_1149 12974
+#define ER_IB_MSG_1150 12975
+#define ER_IB_MSG_1151 12976
+#define ER_IB_MSG_1152 12977
+#define ER_IB_MSG_1153 12978
+#define ER_IB_MSG_1154 12979
+#define ER_IB_MSG_1155 12980
+#define ER_IB_MSG_1156 12981
+#define ER_IB_MSG_1157 12982
+#define ER_IB_MSG_1158 12983
+#define ER_IB_MSG_1159 12984
+#define ER_IB_MSG_1160 12985
+#define ER_IB_MSG_1161 12986
+#define ER_IB_MSG_1162 12987
+#define ER_IB_MSG_1163 12988
+#define ER_IB_MSG_1164 12989
+#define ER_IB_MSG_1165 12990
+#define ER_IB_MSG_1166 12991
+#define ER_IB_MSG_1167 12992
+#define ER_IB_MSG_1168 12993
+#define ER_IB_MSG_1169 12994
+#define ER_IB_MSG_1170 12995
+#define ER_IB_MSG_1171 12996
+#define ER_IB_MSG_1172 12997
+#define ER_IB_MSG_1173 12998
+#define ER_IB_MSG_1174 12999
+#define ER_IB_MSG_1175 13000
+#define ER_IB_MSG_1176 13001
+#define ER_IB_MSG_1177 13002
+#define ER_IB_MSG_1178 13003
+#define ER_IB_MSG_1179 13004
+#define ER_IB_MSG_1180 13005
+#define ER_IB_MSG_1181 13006
+#define ER_IB_MSG_1182 13007
+#define ER_IB_MSG_1183 13008
+#define ER_IB_MSG_1184 13009
+#define ER_IB_MSG_1185 13010
+#define ER_IB_MSG_1186 13011
+#define ER_IB_MSG_1187 13012
+#define ER_IB_MSG_1188 13013
+#define ER_IB_MSG_1189 13014
+#define ER_IB_MSG_1190 13015
+#define ER_IB_MSG_1191 13016
+#define ER_IB_MSG_1192 13017
+#define ER_IB_MSG_1193 13018
+#define ER_IB_MSG_1194 13019
+#define ER_IB_MSG_1195 13020
+#define ER_IB_MSG_1196 13021
+#define ER_IB_MSG_1197 13022
+#define ER_IB_MSG_1198 13023
+#define ER_IB_MSG_1199 13024
+#define ER_IB_MSG_1200 13025
+#define ER_IB_MSG_1201 13026
+#define ER_IB_MSG_1202 13027
+#define ER_IB_MSG_1203 13028
+#define ER_IB_MSG_1204 13029
+#define ER_IB_MSG_1205 13030
+#define ER_IB_MSG_1206 13031
+#define ER_IB_MSG_1207 13032
+#define ER_IB_MSG_1208 13033
+#define ER_IB_MSG_1209 13034
+#define ER_IB_MSG_1210 13035
+#define ER_IB_MSG_1211 13036
+#define ER_IB_MSG_1212 13037
+#define ER_IB_MSG_1213 13038
+#define ER_IB_MSG_1214 13039
+#define ER_IB_MSG_1215 13040
+#define ER_IB_MSG_1216 13041
+#define ER_IB_MSG_1217 13042
+#define ER_IB_MSG_1218 13043
+#define ER_IB_MSG_1219 13044
+#define ER_IB_MSG_1220 13045
+#define ER_IB_MSG_1221 13046
+#define ER_IB_MSG_1222 13047
+#define ER_IB_MSG_1223 13048
+#define ER_IB_MSG_1224 13049
+#define ER_IB_MSG_1225 13050
+#define ER_IB_MSG_1226 13051
+#define ER_IB_MSG_1227 13052
+#define ER_IB_MSG_1228 13053
+#define ER_IB_MSG_1229 13054
+//#define OBSOLETE_ER_IB_MSG_1230 13055
+#define ER_IB_MSG_1231 13056
+#define ER_IB_MSG_1232 13057
+#define ER_IB_MSG_1233 13058
+#define ER_IB_MSG_1234 13059
+#define ER_IB_MSG_1235 13060
+#define ER_IB_MSG_1236 13061
+#define ER_IB_MSG_1237 13062
+#define ER_IB_MSG_1238 13063
+#define ER_IB_MSG_1239 13064
+#define ER_IB_MSG_1240 13065
+#define ER_IB_MSG_1241 13066
+#define ER_IB_MSG_1242 13067
+#define ER_IB_MSG_1243 13068
+#define ER_IB_MSG_1244 13069
+#define ER_IB_MSG_1245 13070
+#define ER_IB_MSG_1246 13071
+#define ER_IB_MSG_1247 13072
+#define ER_IB_MSG_1248 13073
+#define ER_IB_MSG_1249 13074
+#define ER_IB_MSG_1250 13075
+#define ER_IB_MSG_1251 13076
+#define ER_IB_MSG_1252 13077
+#define ER_IB_MSG_1253 13078
+//#define OBSOLETE_ER_IB_MSG_1254 13079
+#define ER_IB_MSG_1255 13080
+#define ER_IB_MSG_1256 13081
+#define ER_IB_MSG_1257 13082
+#define ER_IB_MSG_1258 13083
+#define ER_IB_MSG_1259 13084
+#define ER_IB_MSG_1260 13085
+#define ER_IB_MSG_1261 13086
+#define ER_IB_MSG_1262 13087
+#define ER_IB_MSG_1263 13088
+#define ER_IB_MSG_1264 13089
+#define ER_IB_MSG_1265 13090
+#define ER_IB_MSG_1266 13091
+#define ER_IB_MSG_1267 13092
+#define ER_IB_MSG_1268 13093
+#define ER_IB_MSG_1269 13094
+#define ER_IB_MSG_1270 13095
+#define ER_RPL_SLAVE_SQL_THREAD_STOP_CMD_EXEC_TIMEOUT 13096
+#define ER_RPL_SLAVE_IO_THREAD_STOP_CMD_EXEC_TIMEOUT 13097
+#define ER_RPL_GTID_UNSAFE_STMT_ON_NON_TRANS_TABLE 13098
+#define ER_RPL_GTID_UNSAFE_STMT_CREATE_SELECT 13099
+//#define OBSOLETE_ER_RPL_GTID_UNSAFE_STMT_ON_TEMPORARY_TABLE 13100
+#define ER_BINLOG_ROW_VALUE_OPTION_IGNORED 13101
+#define ER_BINLOG_USE_V1_ROW_EVENTS_IGNORED 13102
+#define ER_BINLOG_ROW_VALUE_OPTION_USED_ONLY_FOR_AFTER_IMAGES 13103
+#define ER_CONNECTION_ABORTED 13104
+#define ER_NORMAL_SERVER_SHUTDOWN 13105
+#define ER_KEYRING_MIGRATE_FAILED 13106
+#define ER_GRP_RPL_LOWER_CASE_TABLE_NAMES_DIFF_FROM_GRP 13107
+#define ER_OOM_SAVE_GTIDS 13108
+#define ER_LCTN_NOT_FOUND 13109
+//#define OBSOLETE_ER_REGEXP_INVALID_CAPTURE_GROUP_NAME 13110
+#define ER_COMPONENT_FILTER_WRONG_VALUE 13111
+#define ER_XPLUGIN_FAILED_TO_STOP_SERVICES 13112
+#define ER_INCONSISTENT_ERROR 13113
+#define ER_SERVER_MASTER_FATAL_ERROR_READING_BINLOG 13114
+#define ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE 13115
+#define ER_SLAVE_CREATE_EVENT_FAILURE 13116
+#define ER_SLAVE_FATAL_ERROR 13117
+#define ER_SLAVE_HEARTBEAT_FAILURE 13118
+#define ER_SLAVE_INCIDENT 13119
+#define ER_SLAVE_MASTER_COM_FAILURE 13120
+#define ER_SLAVE_RELAY_LOG_READ_FAILURE 13121
+#define ER_SLAVE_RELAY_LOG_WRITE_FAILURE 13122
+#define ER_SERVER_SLAVE_MI_INIT_REPOSITORY 13123
+#define ER_SERVER_SLAVE_RLI_INIT_REPOSITORY 13124
+#define ER_SERVER_NET_PACKET_TOO_LARGE 13125
+#define ER_SERVER_NO_SYSTEM_TABLE_ACCESS 13126
+#define ER_SERVER_UNKNOWN_ERROR 13127
+#define ER_SERVER_UNKNOWN_SYSTEM_VARIABLE 13128
+#define ER_SERVER_NO_SESSION_TO_SEND_TO 13129
+#define ER_SERVER_NEW_ABORTING_CONNECTION 13130
+#define ER_SERVER_OUT_OF_SORTMEMORY 13131
+#define ER_SERVER_RECORD_FILE_FULL 13132
+#define ER_SERVER_DISK_FULL_NOWAIT 13133
+#define ER_SERVER_HANDLER_ERROR 13134
+#define ER_SERVER_NOT_FORM_FILE 13135
+#define ER_SERVER_CANT_OPEN_FILE 13136
+#define ER_SERVER_FILE_NOT_FOUND 13137
+#define ER_SERVER_FILE_USED 13138
+#define ER_SERVER_CANNOT_LOAD_FROM_TABLE_V2 13139
+#define ER_ERROR_INFO_FROM_DA 13140
+#define ER_SERVER_TABLE_CHECK_FAILED 13141
+#define ER_SERVER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE_V2 13142
+#define ER_SERVER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2 13143
+#define ER_SERVER_ACL_TABLE_ERROR 13144
+#define ER_SERVER_SLAVE_INIT_QUERY_FAILED 13145
+#define ER_SERVER_SLAVE_CONVERSION_FAILED 13146
+#define ER_SERVER_SLAVE_IGNORED_TABLE 13147
+#define ER_CANT_REPLICATE_ANONYMOUS_WITH_AUTO_POSITION 13148
+#define ER_CANT_REPLICATE_ANONYMOUS_WITH_GTID_MODE_ON 13149
+#define ER_CANT_REPLICATE_GTID_WITH_GTID_MODE_OFF 13150
+#define ER_SERVER_TEST_MESSAGE 13151
+#define ER_AUDIT_LOG_JSON_FILTER_PARSING_ERROR 13152
+#define ER_AUDIT_LOG_JSON_FILTERING_NOT_ENABLED 13153
+#define ER_PLUGIN_FAILED_TO_OPEN_TABLES 13154
+#define ER_PLUGIN_FAILED_TO_OPEN_TABLE 13155
+#define ER_AUDIT_LOG_JSON_FILTER_NAME_CANNOT_BE_EMPTY 13156
+#define ER_AUDIT_LOG_USER_NAME_INVALID_CHARACTER 13157
+#define ER_AUDIT_LOG_UDF_INSUFFICIENT_PRIVILEGE 13158
+#define ER_AUDIT_LOG_NO_KEYRING_PLUGIN_INSTALLED 13159
+#define ER_AUDIT_LOG_HOST_NAME_INVALID_CHARACTER 13160
+#define ER_AUDIT_LOG_ENCRYPTION_PASSWORD_HAS_NOT_BEEN_SET 13161
+#define ER_AUDIT_LOG_COULD_NOT_CREATE_AES_KEY 13162
+#define ER_AUDIT_LOG_ENCRYPTION_PASSWORD_CANNOT_BE_FETCHED 13163
+#define ER_COULD_NOT_REINITIALIZE_AUDIT_LOG_FILTERS 13164
+#define ER_AUDIT_LOG_JSON_USER_NAME_CANNOT_BE_EMPTY 13165
+#define ER_AUDIT_LOG_USER_FIRST_CHARACTER_MUST_BE_ALPHANUMERIC 13166
+#define ER_AUDIT_LOG_JSON_FILTER_DOES_NOT_EXIST 13167
+#define ER_IB_MSG_1271 13168
+#define ER_STARTING_INIT 13169
+#define ER_ENDING_INIT 13170
+#define ER_IB_MSG_1272 13171
+#define ER_SERVER_SHUTDOWN_INFO 13172
+#define ER_GRP_RPL_PLUGIN_ABORT 13173
+//#define OBSOLETE_ER_REGEXP_INVALID_FLAG 13174
+//#define OBSOLETE_ER_XA_REPLICATION_FILTERS 13175
+//#define OBSOLETE_ER_UPDATE_GTID_PURGED_WITH_GR 13176
+#define ER_AUDIT_LOG_TABLE_DEFINITION_NOT_UPDATED 13177
+#define ER_DD_INITIALIZE_SQL_ERROR 13178
+#define ER_NO_PATH_FOR_SHARED_LIBRARY 13179
+#define ER_UDF_ALREADY_EXISTS 13180
+#define ER_SET_EVENT_FAILED 13181
+#define ER_FAILED_TO_ALLOCATE_SSL_BIO 13182
+#define ER_IB_MSG_1273 13183
+#define ER_PID_FILEPATH_LOCATIONS_INACCESSIBLE 13184
+#define ER_UNKNOWN_VARIABLE_IN_PERSISTED_CONFIG_FILE 13185
+#define ER_FAILED_TO_HANDLE_DEFAULTS_FILE 13186
+#define ER_DUPLICATE_SYS_VAR 13187
+#define ER_FAILED_TO_INIT_SYS_VAR 13188
+#define ER_SYS_VAR_NOT_FOUND 13189
+#define ER_IB_MSG_1274 13190
+#define ER_IB_MSG_1275 13191
+//#define OBSOLETE_ER_TARGET_TS_UNENCRYPTED 13192
+#define ER_IB_MSG_WAIT_FOR_ENCRYPT_THREAD 13193
+#define ER_IB_MSG_1277 13194
+#define ER_IB_MSG_NO_ENCRYPT_PROGRESS_FOUND 13195
+#define ER_IB_MSG_RESUME_OP_FOR_SPACE 13196
+#define ER_IB_MSG_1280 13197
+#define ER_IB_MSG_1281 13198
+#define ER_IB_MSG_1282 13199
+#define ER_IB_MSG_1283 13200
+#define ER_IB_MSG_1284 13201
+#define ER_CANT_SET_ERROR_SUPPRESSION_LIST_FROM_COMMAND_LINE 13202
+#define ER_INVALID_VALUE_OF_BIND_ADDRESSES 13203
+#define ER_RELAY_LOG_SPACE_LIMIT_DISABLED 13204
+#define ER_GRP_RPL_ERROR_GTID_SET_EXTRACTION 13205
+#define ER_GRP_RPL_MISSING_GRP_RPL_ACTION_COORDINATOR 13206
+#define ER_GRP_RPL_JOIN_WHEN_GROUP_ACTION_RUNNING 13207
+#define ER_GRP_RPL_JOINER_EXIT_WHEN_GROUP_ACTION_RUNNING 13208
+#define ER_GRP_RPL_CHANNEL_THREAD_WHEN_GROUP_ACTION_RUNNING 13209
+#define ER_GRP_RPL_APPOINTED_PRIMARY_NOT_PRESENT 13210
+#define ER_GRP_RPL_ERROR_ON_MESSAGE_SENDING 13211
+#define ER_GRP_RPL_CONFIGURATION_ACTION_ERROR 13212
+#define ER_GRP_RPL_CONFIGURATION_ACTION_LOCAL_TERMINATION 13213
+#define ER_GRP_RPL_CONFIGURATION_ACTION_START 13214
+#define ER_GRP_RPL_CONFIGURATION_ACTION_END 13215
+#define ER_GRP_RPL_CONFIGURATION_ACTION_KILLED_ERROR 13216
+#define ER_GRP_RPL_PRIMARY_ELECTION_PROCESS_ERROR 13217
+#define ER_GRP_RPL_PRIMARY_ELECTION_STOP_ERROR 13218
+#define ER_GRP_RPL_NO_STAGE_SERVICE 13219
+#define ER_GRP_RPL_UDF_REGISTER_ERROR 13220
+#define ER_GRP_RPL_UDF_UNREGISTER_ERROR 13221
+#define ER_GRP_RPL_UDF_REGISTER_SERVICE_ERROR 13222
+#define ER_GRP_RPL_SERVER_UDF_ERROR 13223
+//#define OBSOLETE_ER_CURRENT_PASSWORD_NOT_REQUIRED 13224
+//#define OBSOLETE_ER_INCORRECT_CURRENT_PASSWORD 13225
+//#define OBSOLETE_ER_MISSING_CURRENT_PASSWORD 13226
+#define ER_SERVER_WRONG_VALUE_FOR_VAR 13227
+#define ER_COULD_NOT_CREATE_WINDOWS_REGISTRY_KEY 13228
+#define ER_SERVER_GTID_UNSAFE_CREATE_DROP_TEMP_TABLE_IN_TRX_IN_SBR 13229
+//#define OBSOLETE_ER_SECONDARY_ENGINE 13230
+//#define OBSOLETE_ER_SECONDARY_ENGINE_DDL 13231
+//#define OBSOLETE_ER_NO_SESSION_TEMP 13232
+#define ER_XPLUGIN_FAILED_TO_SWITCH_SECURITY_CTX 13233
+#define ER_RPL_GTID_UNSAFE_ALTER_ADD_COL_WITH_DEFAULT_EXPRESSION 13234
+#define ER_UPGRADE_PARSE_ERROR 13235
+#define ER_DATA_DIRECTORY_UNUSABLE 13236
+#define ER_LDAP_AUTH_USER_GROUP_SEARCH_ROOT_BIND 13237
+#define ER_PLUGIN_INSTALL_ERROR 13238
+#define ER_PLUGIN_UNINSTALL_ERROR 13239
+#define ER_SHARED_TABLESPACE_USED_BY_PARTITIONED_TABLE 13240
+#define ER_UNKNOWN_TABLESPACE_TYPE 13241
+#define ER_WARN_DEPRECATED_UTF8_ALIAS_OPTION 13242
+#define ER_WARN_DEPRECATED_UTF8MB3_CHARSET_OPTION 13243
+#define ER_WARN_DEPRECATED_UTF8MB3_COLLATION_OPTION 13244
+#define ER_SSL_MEMORY_INSTRUMENTATION_INIT_FAILED 13245
+#define ER_IB_MSG_MADV_DONTDUMP_UNSUPPORTED 13246
+#define ER_IB_MSG_MADVISE_FAILED 13247
+//#define OBSOLETE_ER_COLUMN_CHANGE_SIZE 13248
+#define ER_WARN_REMOVED_SQL_MODE 13249
+#define ER_IB_MSG_FAILED_TO_ALLOCATE_WAIT 13250
+#define ER_IB_MSG_NUM_POOLS 13251
+#define ER_IB_MSG_USING_UNDO_SPACE 13252
+#define ER_IB_MSG_FAIL_TO_SAVE_SPACE_STATE 13253
+#define ER_IB_MSG_MAX_UNDO_SPACES_REACHED 13254
+#define ER_IB_MSG_ERROR_OPENING_NEW_UNDO_SPACE 13255
+#define ER_IB_MSG_FAILED_SDI_Z_BUF_ERROR 13256
+#define ER_IB_MSG_FAILED_SDI_Z_MEM_ERROR 13257
+#define ER_IB_MSG_SDI_Z_STREAM_ERROR 13258
+#define ER_IB_MSG_SDI_Z_UNKNOWN_ERROR 13259
+#define ER_IB_MSG_FOUND_WRONG_UNDO_SPACE 13260
+#define ER_IB_MSG_NOT_END_WITH_IBU 13261
+#define ER_IB_MSG_UNDO_TRUNC_EMPTY_FILE 13262
+#define ER_IB_MSG_UNDO_TRUNC_BEFOR_DD_UPDATE 13263
+#define ER_IB_MSG_UNDO_TRUNC_BEFORE_UNDO_LOGGING 13264
+#define ER_IB_MSG_UNDO_TRUNK_BEFORE_RSEG 13265
+#define ER_IB_MSG_FAILED_TO_FINISH_TRUNCATE 13266
+#define ER_IB_MSG_DEPRECATED_INNODB_UNDO_TABLESPACES 13267
+#define ER_IB_MSG_DIR_DOES_NOT_EXIST 13268
+#define ER_IB_MSG_LOCK_FREE_HASH_USAGE_STATS 13269
+#define ER_CLONE_DONOR_TRACE 13270
+#define ER_CLONE_PROTOCOL_TRACE 13271
+#define ER_CLONE_CLIENT_TRACE 13272
+#define ER_CLONE_SERVER_TRACE 13273
+#define ER_THREAD_POOL_PFS_TABLES_INIT_FAILED 13274
+#define ER_THREAD_POOL_PFS_TABLES_ADD_FAILED 13275
+#define ER_CANT_SET_DATA_DIR 13276
+#define ER_INNODB_INVALID_INNODB_UNDO_DIRECTORY_LOCATION 13277
+#define ER_SERVER_RPL_ENCRYPTION_FAILED_TO_FETCH_KEY 13278
+#define ER_SERVER_RPL_ENCRYPTION_KEY_NOT_FOUND 13279
+#define ER_SERVER_RPL_ENCRYPTION_KEYRING_INVALID_KEY 13280
+#define ER_SERVER_RPL_ENCRYPTION_HEADER_ERROR 13281
+#define ER_SERVER_RPL_ENCRYPTION_FAILED_TO_ROTATE_LOGS 13282
+#define ER_SERVER_RPL_ENCRYPTION_KEY_EXISTS_UNEXPECTED 13283
+#define ER_SERVER_RPL_ENCRYPTION_FAILED_TO_GENERATE_KEY 13284
+#define ER_SERVER_RPL_ENCRYPTION_FAILED_TO_STORE_KEY 13285
+#define ER_SERVER_RPL_ENCRYPTION_FAILED_TO_REMOVE_KEY 13286
+#define ER_SERVER_RPL_ENCRYPTION_MASTER_KEY_RECOVERY_FAILED 13287
+#define ER_SERVER_RPL_ENCRYPTION_UNABLE_TO_INITIALIZE 13288
+#define ER_SERVER_RPL_ENCRYPTION_UNABLE_TO_ROTATE_MASTER_KEY_AT_STARTUP 13289
+#define ER_SERVER_RPL_ENCRYPTION_IGNORE_ROTATE_MASTER_KEY_AT_STARTUP 13290
+#define ER_INVALID_ADMIN_ADDRESS 13291
+#define ER_SERVER_STARTUP_ADMIN_INTERFACE 13292
+#define ER_CANT_CREATE_ADMIN_THREAD 13293
+#define ER_WARNING_RETAIN_CURRENT_PASSWORD_CLAUSE_VOID 13294
+#define ER_WARNING_DISCARD_OLD_PASSWORD_CLAUSE_VOID 13295
+//#define OBSOLETE_ER_SECOND_PASSWORD_CANNOT_BE_EMPTY 13296
+//#define OBSOLETE_ER_PASSWORD_CANNOT_BE_RETAINED_ON_PLUGIN_CHANGE 13297
+//#define OBSOLETE_ER_CURRENT_PASSWORD_CANNOT_BE_RETAINED 13298
+#define ER_WARNING_AUTHCACHE_INVALID_USER_ATTRIBUTES 13299
+#define ER_MYSQL_NATIVE_PASSWORD_SECOND_PASSWORD_USED_INFORMATION 13300
+#define ER_SHA256_PASSWORD_SECOND_PASSWORD_USED_INFORMATION 13301
+#define ER_CACHING_SHA2_PASSWORD_SECOND_PASSWORD_USED_INFORMATION 13302
+#define ER_GRP_RPL_SEND_TRX_PREPARED_MESSAGE_FAILED 13303
+#define ER_GRP_RPL_RELEASE_COMMIT_AFTER_GROUP_PREPARE_FAILED 13304
+#define ER_GRP_RPL_TRX_ALREADY_EXISTS_ON_TCM_ON_AFTER_CERTIFICATION 13305
+#define ER_GRP_RPL_FAILED_TO_INSERT_TRX_ON_TCM_ON_AFTER_CERTIFICATION 13306
+#define ER_GRP_RPL_REGISTER_TRX_TO_WAIT_FOR_GROUP_PREPARE_FAILED 13307
+#define ER_GRP_RPL_TRX_WAIT_FOR_GROUP_PREPARE_FAILED 13308
+#define ER_GRP_RPL_TRX_DOES_NOT_EXIST_ON_TCM_ON_HANDLE_REMOTE_PREPARE 13309
+#define ER_GRP_RPL_RELEASE_BEGIN_TRX_AFTER_DEPENDENCIES_COMMIT_FAILED 13310
+#define ER_GRP_RPL_REGISTER_TRX_TO_WAIT_FOR_DEPENDENCIES_FAILED 13311
+#define ER_GRP_RPL_WAIT_FOR_DEPENDENCIES_FAILED 13312
+#define ER_GRP_RPL_REGISTER_TRX_TO_WAIT_FOR_SYNC_BEFORE_EXECUTION_FAILED 13313
+#define ER_GRP_RPL_SEND_TRX_SYNC_BEFORE_EXECUTION_FAILED 13314
+#define ER_GRP_RPL_TRX_WAIT_FOR_SYNC_BEFORE_EXECUTION_FAILED 13315
+#define ER_GRP_RPL_RELEASE_BEGIN_TRX_AFTER_WAIT_FOR_SYNC_BEFORE_EXEC 13316
+#define ER_GRP_RPL_TRX_WAIT_FOR_GROUP_GTID_EXECUTED 13317
+//#define OBSOLETE_ER_UNIT_NOT_FOUND 13318
+//#define OBSOLETE_ER_GEOMETRY_IN_UNKNOWN_LENGTH_UNIT 13319
+#define ER_WARN_PROPERTY_STRING_PARSE_FAILED 13320
+#define ER_INVALID_PROPERTY_KEY 13321
+#define ER_GRP_RPL_GTID_SET_EXTRACT_ERROR_DURING_RECOVERY 13322
+#define ER_SERVER_RPL_ENCRYPTION_FAILED_TO_ENCRYPT 13323
+#define ER_CANNOT_GET_SERVER_VERSION_FROM_TABLESPACE_HEADER 13324
+#define ER_CANNOT_SET_SERVER_VERSION_IN_TABLESPACE_HEADER 13325
+#define ER_SERVER_UPGRADE_VERSION_NOT_SUPPORTED 13326
+#define ER_SERVER_UPGRADE_FROM_VERSION 13327
+#define ER_GRP_RPL_ERROR_ON_CERT_DB_INSTALL 13328
+#define ER_GRP_RPL_FORCE_MEMBERS_WHEN_LEAVING 13329
+#define ER_TRG_WRONG_ORDER 13330
+//#define OBSOLETE_ER_SECONDARY_ENGINE_PLUGIN 13331
+#define ER_LDAP_AUTH_GRP_SEARCH_NOT_SPECIAL_HDL 13332
+#define ER_LDAP_AUTH_GRP_USER_OBJECT_HAS_GROUP_INFO 13333
+#define ER_LDAP_AUTH_GRP_INFO_FOUND_IN_MANY_OBJECTS 13334
+#define ER_LDAP_AUTH_GRP_INCORRECT_ATTRIBUTE 13335
+#define ER_LDAP_AUTH_GRP_NULL_ATTRIBUTE_VALUE 13336
+#define ER_LDAP_AUTH_GRP_DN_PARSING_FAILED 13337
+#define ER_LDAP_AUTH_GRP_OBJECT_HAS_USER_INFO 13338
+#define ER_LDAP_AUTH_LDAPS 13339
+#define ER_LDAP_MAPPING_GET_USER_PROXY 13340
+#define ER_LDAP_MAPPING_USER_DONT_BELONG_GROUP 13341
+#define ER_LDAP_MAPPING_INFO 13342
+#define ER_LDAP_MAPPING_EMPTY_MAPPING 13343
+#define ER_LDAP_MAPPING_PROCESS_MAPPING 13344
+#define ER_LDAP_MAPPING_CHECK_DELIMI_QUOTE 13345
+#define ER_LDAP_MAPPING_PROCESS_DELIMITER 13346
+#define ER_LDAP_MAPPING_PROCESS_DELIMITER_EQUAL_NOT_FOUND 13347
+#define ER_LDAP_MAPPING_PROCESS_DELIMITER_TRY_COMMA 13348
+#define ER_LDAP_MAPPING_PROCESS_DELIMITER_COMMA_NOT_FOUND 13349
+#define ER_LDAP_MAPPING_NO_SEPEARATOR_END_OF_GROUP 13350
+#define ER_LDAP_MAPPING_GETTING_NEXT_MAPPING 13351
+#define ER_LDAP_MAPPING_PARSING_CURRENT_STATE 13352
+#define ER_LDAP_MAPPING_PARSING_MAPPING_INFO 13353
+#define ER_LDAP_MAPPING_PARSING_ERROR 13354
+#define ER_LDAP_MAPPING_TRIMMING_SPACES 13355
+#define ER_LDAP_MAPPING_IS_QUOTE 13356
+#define ER_LDAP_MAPPING_NON_DESIRED_STATE 13357
+#define ER_INVALID_NAMED_PIPE_FULL_ACCESS_GROUP 13358
+#define ER_PREPARE_FOR_SECONDARY_ENGINE 13359
+#define ER_SERVER_WARN_DEPRECATED 13360
+#define ER_AUTH_ID_WITH_SYSTEM_USER_PRIV_IN_MANDATORY_ROLES 13361
+#define ER_SERVER_BINLOG_MASTER_KEY_RECOVERY_OUT_OF_COMBINATION 13362
+#define ER_SERVER_BINLOG_MASTER_KEY_ROTATION_FAIL_TO_CLEANUP_AUX_KEY 13363
+//#define OBSOLETE_ER_CANNOT_GRANT_SYSTEM_PRIV_TO_MANDATORY_ROLE 13364
+//#define OBSOLETE_ER_PARTIAL_REVOKE_AND_DB_GRANT_BOTH_EXISTS 13365
+//#define OBSOLETE_ER_DB_ACCESS_DENIED 13366
+//#define OBSOLETE_ER_PARTIAL_REVOKES_EXIST 13367
+#define ER_TURNING_ON_PARTIAL_REVOKES 13368
+#define ER_WARN_PARTIAL_REVOKE_AND_DB_GRANT 13369
+#define ER_WARN_INCORRECT_PRIVILEGE_FOR_DB_RESTRICTIONS 13370
+#define ER_WARN_INVALID_DB_RESTRICTIONS 13371
+#define ER_GRP_RPL_INVALID_COMMUNICATION_PROTOCOL 13372
+#define ER_GRP_RPL_STARTED_AUTO_REJOIN 13373
+#define ER_GRP_RPL_TIMEOUT_RECEIVED_VC_ON_REJOIN 13374
+#define ER_GRP_RPL_FINISHED_AUTO_REJOIN 13375
+#define ER_GRP_RPL_DEFAULT_TABLE_ENCRYPTION_DIFF_FROM_GRP 13376
+#define ER_SERVER_UPGRADE_OFF 13377
+#define ER_SERVER_UPGRADE_SKIP 13378
+#define ER_SERVER_UPGRADE_PENDING 13379
+#define ER_SERVER_UPGRADE_FAILED 13380
+#define ER_SERVER_UPGRADE_STATUS 13381
+#define ER_SERVER_UPGRADE_REPAIR_REQUIRED 13382
+#define ER_SERVER_UPGRADE_REPAIR_STATUS 13383
+#define ER_SERVER_UPGRADE_INFO_FILE 13384
+#define ER_SERVER_UPGRADE_SYS_SCHEMA 13385
+#define ER_SERVER_UPGRADE_MYSQL_TABLES 13386
+#define ER_SERVER_UPGRADE_SYSTEM_TABLES 13387
+#define ER_SERVER_UPGRADE_EMPTY_SYS 13388
+#define ER_SERVER_UPGRADE_NO_SYS_VERSION 13389
+#define ER_SERVER_UPGRADE_SYS_VERSION_EMPTY 13390
+#define ER_SERVER_UPGRADE_SYS_SCHEMA_OUTDATED 13391
+#define ER_SERVER_UPGRADE_SYS_SCHEMA_UP_TO_DATE 13392
+#define ER_SERVER_UPGRADE_SYS_SCHEMA_OBJECT_COUNT 13393
+#define ER_SERVER_UPGRADE_CHECKING_DB 13394
+#define ER_IB_MSG_DDL_LOG_DELETE_BY_ID_TMCT 13395
+#define ER_IB_MSG_POST_RECOVER_DDL_LOG_RECOVER 13396
+#define ER_IB_MSG_POST_RECOVER_POST_TS_ENCRYPT 13397
+#define ER_IB_MSG_DDL_LOG_FAIL_POST_DDL 13398
+#define ER_SERVER_BINLOG_UNSAFE_SYSTEM_FUNCTION 13399
+#define ER_SERVER_UPGRADE_HELP_TABLE_STATUS 13400
+#define ER_GRP_RPL_SRV_GTID_WAIT_ERROR 13401
+#define ER_GRP_DELAYED_VCLE_LOGGING 13402
+//#define OBSOLETE_ER_CANNOT_GRANT_ROLES_TO_ANONYMOUS_USER 13403
+#define ER_BINLOG_UNABLE_TO_ROTATE_GTID_TABLE_READONLY 13404
+#define ER_NETWORK_NAMESPACES_NOT_SUPPORTED 13405
+#define ER_UNKNOWN_NETWORK_NAMESPACE 13406
+#define ER_NETWORK_NAMESPACE_NOT_ALLOWED_FOR_WILDCARD_ADDRESS 13407
+#define ER_SETNS_FAILED 13408
+#define ER_WILDCARD_NOT_ALLOWED_FOR_MULTIADDRESS_BIND 13409
+#define ER_NETWORK_NAMESPACE_FILE_PATH_TOO_LONG 13410
+#define ER_IB_MSG_TOO_LONG_PATH 13411
+#define ER_IB_RECV_FIRST_REC_GROUP_INVALID 13412
+#define ER_DD_UPGRADE_COMPLETED 13413
+#define ER_SSL_SERVER_CERT_VERIFY_FAILED 13414
+#define ER_PERSIST_OPTION_USER_TRUNCATED 13415
+#define ER_PERSIST_OPTION_HOST_TRUNCATED 13416
+#define ER_NET_WAIT_ERROR 13417
+#define ER_IB_MSG_1285 13418
+#define ER_IB_MSG_CLOCK_MONOTONIC_UNSUPPORTED 13419
+#define ER_IB_MSG_CLOCK_GETTIME_FAILED 13420
+#define ER_PLUGIN_NOT_EARLY_DUP 13421
+#define ER_PLUGIN_NO_INSTALL_DUP 13422
+#define ER_WARN_DEPRECATED_SQL_CALC_FOUND_ROWS 13423
+#define ER_WARN_DEPRECATED_FOUND_ROWS 13424
+#define ER_BINLOG_UNSAFE_DEFAULT_EXPRESSION_IN_SUBSTATEMENT 13425
+#define ER_GRP_RPL_MEMBER_VER_READ_COMPATIBLE 13426
+#define ER_LOCK_ORDER_INIT_FAILED 13427
+#define ER_AUDIT_LOG_KEYRING_ID_TIMESTAMP_VALUE_IS_INVALID 13428
+#define ER_AUDIT_LOG_FILE_NAME_TIMESTAMP_VALUE_IS_MISSING_OR_INVALID 13429
+#define ER_AUDIT_LOG_FILE_NAME_DOES_NOT_HAVE_REQUIRED_FORMAT 13430
+#define ER_AUDIT_LOG_FILE_NAME_KEYRING_ID_VALUE_IS_MISSING 13431
+#define ER_AUDIT_LOG_FILE_HAS_BEEN_SUCCESSFULLY_PROCESSED 13432
+#define ER_AUDIT_LOG_COULD_NOT_OPEN_FILE_FOR_READING 13433
+#define ER_AUDIT_LOG_INVALID_FILE_CONTENT 13434
+#define ER_AUDIT_LOG_CANNOT_READ_PASSWORD 13435
+#define ER_AUDIT_LOG_CANNOT_STORE_PASSWORD 13436
+#define ER_AUDIT_LOG_CANNOT_REMOVE_PASSWORD 13437
+#define ER_AUDIT_LOG_PASSWORD_HAS_BEEN_COPIED 13438
+//#define OBSOLETE_ER_AUDIT_LOG_INSUFFICIENT_PRIVILEGE 13439
+//#define OBSOLETE_ER_WRONG_MVI_VALUE 13440
+//#define OBSOLETE_ER_WARN_FUNC_INDEX_NOT_APPLICABLE 13441
+//#define OBSOLETE_ER_EXCEEDED_MV_KEYS_NUM 13442
+//#define OBSOLETE_ER_EXCEEDED_MV_KEYS_SPACE 13443
+//#define OBSOLETE_ER_FUNCTIONAL_INDEX_DATA_IS_TOO_LONG 13444
+//#define OBSOLETE_ER_INVALID_JSON_VALUE_FOR_FUNC_INDEX 13445
+//#define OBSOLETE_ER_JSON_VALUE_OUT_OF_RANGE_FOR_FUNC_INDEX 13446
+#define ER_LDAP_EMPTY_USERDN_PASSWORD 13447
+//#define OBSOLETE_ER_GROUPING_ON_TIMESTAMP_IN_DST 13448
+#define ER_ACL_WRONG_OR_MISSING_ACL_TABLES_LOG 13449
+#define ER_LOCK_ORDER_FAILED_WRITE_FILE 13450
+#define ER_LOCK_ORDER_FAILED_READ_FILE 13451
+#define ER_LOCK_ORDER_MESSAGE 13452
+#define ER_LOCK_ORDER_DEPENDENCIES_SYNTAX 13453
+#define ER_LOCK_ORDER_SCANNER_SYNTAX 13454
+#define ER_DATA_DIRECTORY_UNUSABLE_DELETABLE 13455
+#define ER_IB_MSG_BTREE_LEVEL_LIMIT_EXCEEDED 13456
+#define ER_IB_CLONE_START_STOP 13457
+#define ER_IB_CLONE_OPERATION 13458
+#define ER_IB_CLONE_RESTART 13459
+#define ER_IB_CLONE_USER_DATA 13460
+#define ER_IB_CLONE_NON_INNODB_TABLE 13461
+#define ER_CLONE_SHUTDOWN_TRACE 13462
+#define ER_GRP_RPL_GTID_PURGED_EXTRACT_ERROR 13463
+#define ER_GRP_RPL_CLONE_PROCESS_PREPARE_ERROR 13464
+#define ER_GRP_RPL_CLONE_PROCESS_EXEC_ERROR 13465
+#define ER_GRP_RPL_RECOVERY_EVAL_ERROR 13466
+#define ER_GRP_RPL_NO_POSSIBLE_RECOVERY 13467
+#define ER_GRP_RPL_CANT_KILL_THREAD 13468
+#define ER_GRP_RPL_RECOVERY_STRAT_CLONE_THRESHOLD 13469
+#define ER_GRP_RPL_RECOVERY_STRAT_CLONE_PURGED 13470
+#define ER_GRP_RPL_RECOVERY_STRAT_CHOICE 13471
+#define ER_GRP_RPL_RECOVERY_STRAT_FALLBACK 13472
+#define ER_GRP_RPL_RECOVERY_STRAT_NO_FALLBACK 13473
+#define ER_GRP_RPL_SLAVE_THREAD_ERROR_ON_CLONE 13474
+#define ER_UNKNOWN_TABLE_IN_UPGRADE 13475
+#define ER_IDENT_CAUSES_TOO_LONG_PATH_IN_UPGRADE 13476
+#define ER_XA_CANT_CREATE_MDL_BACKUP 13477
+#define ER_AUDIT_LOG_SUPER_PRIVILEGE_REQUIRED 13478
+#define ER_AUDIT_LOG_UDF_INVALID_ARGUMENT_TYPE 13479
+#define ER_AUDIT_LOG_UDF_INVALID_ARGUMENT_COUNT 13480
+#define ER_AUDIT_LOG_HAS_NOT_BEEN_INSTALLED 13481
+#define ER_AUDIT_LOG_UDF_READ_INVALID_MAX_ARRAY_LENGTH_ARG_TYPE 13482
+#define ER_LOG_CANNOT_WRITE_EXTENDED 13483
+#define ER_UPGRADE_WITH_PARTITIONED_TABLES_REJECTED 13484
+static const int obsolete_error_count = 454;
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/mysys_err.h b/contrib/libs/libmysql_r/include/mysys_err.h
new file mode 100644
index 0000000000..0b4ca377e8
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/mysys_err.h
@@ -0,0 +1,156 @@
+/* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef _mysys_err_h
+#define _mysys_err_h
+
+/**
+ @file include/mysys_err.h
+*/
+
+#define GLOBERRS \
+ (EE_ERROR_LAST - EE_ERROR_FIRST + 1) /* Nr of global errors \
+ */
+#define EE(X) (globerrs[(X)-EE_ERROR_FIRST])
+
+extern const char *globerrs[]; /* my_error_messages is here */
+
+/* Error message numbers in global map */
+/*
+ Do not add error numbers before EE_ERROR_FIRST.
+ If necessary to add lower numbers, change EE_ERROR_FIRST accordingly.
+
+ We start with error 1 to not confuse peoples with 'error 0'
+*/
+
+#define EE_ERROR_FIRST 1 /*Copy first error nr.*/
+#define EE_CANTCREATEFILE 1
+#define EE_READ 2
+#define EE_WRITE 3
+#define EE_BADCLOSE 4
+#define EE_OUTOFMEMORY 5
+#define EE_DELETE 6
+#define EE_LINK 7
+#define EE_EOFERR 9
+#define EE_CANTLOCK 10
+#define EE_CANTUNLOCK 11
+#define EE_DIR 12
+#define EE_STAT 13
+#define EE_CANT_CHSIZE 14
+#define EE_CANT_OPEN_STREAM 15
+#define EE_GETWD 16
+#define EE_SETWD 17
+#define EE_LINK_WARNING 18
+#define EE_OPEN_WARNING 19
+#define EE_DISK_FULL 20
+#define EE_CANT_MKDIR 21
+#define EE_UNKNOWN_CHARSET 22
+#define EE_OUT_OF_FILERESOURCES 23
+#define EE_CANT_READLINK 24
+#define EE_CANT_SYMLINK 25
+#define EE_REALPATH 26
+#define EE_SYNC 27
+#define EE_UNKNOWN_COLLATION 28
+#define EE_FILENOTFOUND 29
+#define EE_FILE_NOT_CLOSED 30
+#define EE_CHANGE_OWNERSHIP 31
+#define EE_CHANGE_PERMISSIONS 32
+#define EE_CANT_SEEK 33
+#define EE_CAPACITY_EXCEEDED 34
+#define EE_DISK_FULL_WITH_RETRY_MSG 35
+#define EE_FAILED_TO_CREATE_TIMER 36
+#define EE_FAILED_TO_DELETE_TIMER 37
+#define EE_FAILED_TO_CREATE_TIMER_QUEUE 38
+#define EE_FAILED_TO_START_TIMER_NOTIFY_THREAD 39
+#define EE_FAILED_TO_CREATE_TIMER_NOTIFY_THREAD_INTERRUPT_EVENT 40
+#define EE_EXITING_TIMER_NOTIFY_THREAD 41
+#define EE_WIN_LIBRARY_LOAD_FAILED 42
+#define EE_WIN_RUN_TIME_ERROR_CHECK 43
+#define EE_FAILED_TO_DETERMINE_LARGE_PAGE_SIZE 44
+#define EE_FAILED_TO_KILL_ALL_THREADS 45
+#define EE_FAILED_TO_CREATE_IO_COMPLETION_PORT 46
+#define EE_FAILED_TO_OPEN_DEFAULTS_FILE 47
+#define EE_FAILED_TO_HANDLE_DEFAULTS_FILE 48
+#define EE_WRONG_DIRECTIVE_IN_CONFIG_FILE 49
+#define EE_SKIPPING_DIRECTIVE_DUE_TO_MAX_INCLUDE_RECURSION 50
+#define EE_INCORRECT_GRP_DEFINITION_IN_CONFIG_FILE 51
+#define EE_OPTION_WITHOUT_GRP_IN_CONFIG_FILE 52
+#define EE_CONFIG_FILE_PERMISSION_ERROR 53
+#define EE_IGNORE_WORLD_WRITABLE_CONFIG_FILE 54
+#define EE_USING_DISABLED_OPTION 55
+#define EE_USING_DISABLED_SHORT_OPTION 56
+#define EE_USING_PASSWORD_ON_CLI_IS_INSECURE 57
+#define EE_UNKNOWN_SUFFIX_FOR_VARIABLE 58
+#define EE_SSL_ERROR_FROM_FILE 59
+#define EE_SSL_ERROR 60
+#define EE_NET_SEND_ERROR_IN_BOOTSTRAP 61
+#define EE_PACKETS_OUT_OF_ORDER 62
+#define EE_UNKNOWN_PROTOCOL_OPTION 63
+#define EE_FAILED_TO_LOCATE_SERVER_PUBLIC_KEY 64
+#define EE_PUBLIC_KEY_NOT_IN_PEM_FORMAT 65
+#define EE_DEBUG_INFO 66
+#define EE_UNKNOWN_VARIABLE 67
+#define EE_UNKNOWN_OPTION 68
+#define EE_UNKNOWN_SHORT_OPTION 69
+#define EE_OPTION_WITHOUT_ARGUMENT 70
+#define EE_OPTION_REQUIRES_ARGUMENT 71
+#define EE_SHORT_OPTION_REQUIRES_ARGUMENT 72
+#define EE_OPTION_IGNORED_DUE_TO_INVALID_VALUE 73
+#define EE_OPTION_WITH_EMPTY_VALUE 74
+#define EE_FAILED_TO_ASSIGN_MAX_VALUE_TO_OPTION 75
+#define EE_INCORRECT_BOOLEAN_VALUE_FOR_OPTION 76
+#define EE_FAILED_TO_SET_OPTION_VALUE 77
+#define EE_INCORRECT_INT_VALUE_FOR_OPTION 78
+#define EE_INCORRECT_UINT_VALUE_FOR_OPTION 79
+#define EE_ADJUSTED_SIGNED_VALUE_FOR_OPTION 80
+#define EE_ADJUSTED_UNSIGNED_VALUE_FOR_OPTION 81
+#define EE_ADJUSTED_ULONGLONG_VALUE_FOR_OPTION 82
+#define EE_ADJUSTED_DOUBLE_VALUE_FOR_OPTION 83
+#define EE_INVALID_DECIMAL_VALUE_FOR_OPTION 84
+#define EE_COLLATION_PARSER_ERROR 85
+#define EE_FAILED_TO_RESET_BEFORE_PRIMARY_IGNORABLE_CHAR 86
+#define EE_FAILED_TO_RESET_BEFORE_TERTIARY_IGNORABLE_CHAR 87
+#define EE_SHIFT_CHAR_OUT_OF_RANGE 88
+#define EE_RESET_CHAR_OUT_OF_RANGE 89
+#define EE_UNKNOWN_LDML_TAG 90
+#define EE_FAILED_TO_RESET_BEFORE_SECONDARY_IGNORABLE_CHAR 91
+#define EE_ERROR_LAST 91 /* Copy last error nr */
+/* Add error numbers before EE_ERROR_LAST and change it accordingly. */
+
+/* Exit codes for option processing. When exiting from server use the
+ MYSQLD_*EXIT codes defined in sql_const.h */
+
+#define EXIT_UNSPECIFIED_ERROR 1
+#define EXIT_UNKNOWN_OPTION 2
+#define EXIT_AMBIGUOUS_OPTION 3
+#define EXIT_NO_ARGUMENT_ALLOWED 4
+#define EXIT_ARGUMENT_REQUIRED 5
+#define EXIT_VAR_PREFIX_NOT_UNIQUE 6
+#define EXIT_UNKNOWN_VARIABLE 7
+#define EXIT_OUT_OF_MEMORY 8
+#define EXIT_UNKNOWN_SUFFIX 9
+#define EXIT_NO_PTR_TO_VARIABLE 10
+#define EXIT_CANNOT_CONNECT_TO_SERVICE 11
+#define EXIT_OPTION_DISABLED 12
+#define EXIT_ARGUMENT_INVALID 13
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/pfs_file_provider.h b/contrib/libs/libmysql_r/include/pfs_file_provider.h
new file mode 100644
index 0000000000..9feb2e0433
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/pfs_file_provider.h
@@ -0,0 +1,93 @@
+/* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef PFS_FILE_PROVIDER_H
+#define PFS_FILE_PROVIDER_H
+
+/**
+ @file include/pfs_file_provider.h
+ Performance schema instrumentation (declarations).
+*/
+
+#include <sys/types.h>
+
+#include "my_psi_config.h"
+
+#ifdef HAVE_PSI_FILE_INTERFACE
+#ifdef MYSQL_SERVER
+#ifndef MYSQL_DYNAMIC_PLUGIN
+#ifndef WITH_LOCK_ORDER
+
+#include <stddef.h>
+
+#include "my_inttypes.h"
+#include "my_io.h"
+#include "my_macros.h"
+#include "mysql/psi/psi_file.h"
+
+#define PSI_FILE_CALL(M) pfs_##M##_v1
+
+void pfs_register_file_v1(const char *category, PSI_file_info_v1 *info,
+ int count);
+
+void pfs_create_file_v1(PSI_file_key key, const char *name, File file);
+
+PSI_file_locker *pfs_get_thread_file_name_locker_v1(
+ PSI_file_locker_state *state, PSI_file_key key, PSI_file_operation op,
+ const char *name, const void *identity);
+
+PSI_file_locker *pfs_get_thread_file_stream_locker_v1(
+ PSI_file_locker_state *state, PSI_file *file, PSI_file_operation op);
+
+PSI_file_locker *pfs_get_thread_file_descriptor_locker_v1(
+ PSI_file_locker_state *state, File file, PSI_file_operation op);
+
+void pfs_start_file_open_wait_v1(PSI_file_locker *locker, const char *src_file,
+ uint src_line);
+
+PSI_file *pfs_end_file_open_wait_v1(PSI_file_locker *locker, void *result);
+
+void pfs_end_file_open_wait_and_bind_to_descriptor_v1(PSI_file_locker *locker,
+ File file);
+
+void pfs_end_temp_file_open_wait_and_bind_to_descriptor_v1(
+ PSI_file_locker *locker, File file, const char *filename);
+
+void pfs_start_file_wait_v1(PSI_file_locker *locker, size_t count,
+ const char *src_file, uint src_line);
+
+void pfs_end_file_wait_v1(PSI_file_locker *locker, size_t byte_count);
+
+void pfs_start_file_close_wait_v1(PSI_file_locker *locker, const char *src_file,
+ uint src_line);
+
+void pfs_end_file_close_wait_v1(PSI_file_locker *locker, int rc);
+
+void pfs_end_file_rename_wait_v1(PSI_file_locker *locker, const char *old_name,
+ const char *new_name, int rc);
+
+#endif /* WITH_LOCK_ORDER */
+#endif /* MYSQL_DYNAMIC_PLUGIN */
+#endif /* MYSQL_SERVER */
+#endif /* HAVE_PSI_FILE_INTERFACE */
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/pfs_socket_provider.h b/contrib/libs/libmysql_r/include/pfs_socket_provider.h
new file mode 100644
index 0000000000..0b3999c601
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/pfs_socket_provider.h
@@ -0,0 +1,80 @@
+/* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef PFS_SOCKET_PROVIDER_H
+#define PFS_SOCKET_PROVIDER_H
+
+/**
+ @file include/pfs_socket_provider.h
+ Performance schema instrumentation (declarations).
+*/
+
+#include "my_config.h"
+
+#include "my_psi_config.h"
+
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+#ifdef MYSQL_SERVER
+#ifndef MYSQL_DYNAMIC_PLUGIN
+#ifndef WITH_LOCK_ORDER
+
+#include <stddef.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#include <sys/types.h>
+
+#include "my_io.h"
+#include "my_macros.h"
+#include "mysql/psi/psi_socket.h"
+
+#define PSI_SOCKET_CALL(M) pfs_##M##_v1
+
+void pfs_register_socket_v1(const char *category, PSI_socket_info_v1 *info,
+ int count);
+
+PSI_socket *pfs_init_socket_v1(PSI_socket_key key, const my_socket *fd,
+ const struct sockaddr *addr, socklen_t addr_len);
+
+void pfs_destroy_socket_v1(PSI_socket *socket);
+
+PSI_socket_locker *pfs_start_socket_wait_v1(PSI_socket_locker_state *state,
+ PSI_socket *socket,
+ PSI_socket_operation op,
+ size_t count, const char *src_file,
+ uint src_line);
+
+void pfs_end_socket_wait_v1(PSI_socket_locker *locker, size_t byte_count);
+
+void pfs_set_socket_state_v1(PSI_socket *socket, PSI_socket_state state);
+
+void pfs_set_socket_info_v1(PSI_socket *socket, const my_socket *fd,
+ const struct sockaddr *addr, socklen_t addr_len);
+
+void pfs_set_socket_thread_owner_v1(PSI_socket *socket);
+
+#endif /* WITH_LOCK_ORDER */
+#endif /* MYSQL_DYNAMIC_PLUGIN */
+#endif /* MYSQL_SERVER */
+#endif /* HAVE_PSI_SOCKET_INTERFACE */
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/pfs_stage_provider.h b/contrib/libs/libmysql_r/include/pfs_stage_provider.h
new file mode 100644
index 0000000000..d365ca3b7a
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/pfs_stage_provider.h
@@ -0,0 +1,57 @@
+/* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef PFS_STAGE_PROVIDER_H
+#define PFS_STAGE_PROVIDER_H
+
+/**
+ @file include/pfs_stage_provider.h
+ Performance schema instrumentation (declarations).
+*/
+
+#include "my_psi_config.h" // IWYU pragma: keep
+
+#ifdef HAVE_PSI_STAGE_INTERFACE
+#ifdef MYSQL_SERVER
+#ifndef MYSQL_DYNAMIC_PLUGIN
+#ifndef WITH_LOCK_ORDER
+
+#include "my_macros.h"
+#include "mysql/psi/psi_stage.h"
+
+#define PSI_STAGE_CALL(M) pfs_##M##_v1
+
+void pfs_register_stage_v1(const char *category, PSI_stage_info_v1 **info_array,
+ int count);
+
+PSI_stage_progress_v1 *pfs_start_stage_v1(PSI_stage_key key,
+ const char *src_file, int src_line);
+PSI_stage_progress_v1 *pfs_get_current_stage_progress_v1();
+
+void pfs_end_stage_v1();
+
+#endif /* WITH_LOCK_ORDER */
+#endif /* MYSQL_DYNAMIC_PLUGIN */
+#endif /* MYSQL_SERVER */
+#endif /* HAVE_PSI_STAGE_INTERFACE */
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/pfs_statement_provider.h b/contrib/libs/libmysql_r/include/pfs_statement_provider.h
new file mode 100644
index 0000000000..dc4a4fa053
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/pfs_statement_provider.h
@@ -0,0 +1,125 @@
+/* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef PFS_STATEMENT_PROVIDER_H
+#define PFS_STATEMENT_PROVIDER_H
+
+/**
+ @file include/pfs_statement_provider.h
+ Performance schema instrumentation (declarations).
+*/
+
+#include <sys/types.h>
+
+#include "my_psi_config.h"
+
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+#ifdef MYSQL_SERVER
+#ifndef MYSQL_DYNAMIC_PLUGIN
+#ifndef WITH_LOCK_ORDER
+
+#include "my_inttypes.h"
+#include "my_macros.h"
+#include "mysql/psi/psi_statement.h"
+#error #include "sql/sql_digest.h"
+
+struct PSI_digest_locker;
+struct sql_digest_storage;
+
+#define PSI_STATEMENT_CALL(M) pfs_##M##_v2
+#define PSI_DIGEST_CALL(M) pfs_##M##_v2
+
+void pfs_register_statement_v2(const char *category, PSI_statement_info *info,
+ int count);
+
+PSI_statement_locker *pfs_get_thread_statement_locker_v2(
+ PSI_statement_locker_state *state, PSI_statement_key key,
+ const void *charset, PSI_sp_share *sp_share);
+
+PSI_statement_locker *pfs_refine_statement_v2(PSI_statement_locker *locker,
+ PSI_statement_key key);
+
+void pfs_start_statement_v2(PSI_statement_locker *locker, const char *db,
+ uint db_len, const char *src_file, uint src_line);
+
+void pfs_set_statement_text_v2(PSI_statement_locker *locker, const char *text,
+ uint text_len);
+
+void pfs_set_statement_query_id_v2(PSI_statement_locker *locker,
+ ulonglong count);
+
+void pfs_set_statement_lock_time_v2(PSI_statement_locker *locker,
+ ulonglong count);
+
+void pfs_set_statement_rows_sent_v2(PSI_statement_locker *locker,
+ ulonglong count);
+
+void pfs_set_statement_rows_examined_v2(PSI_statement_locker *locker,
+ ulonglong count);
+
+void pfs_inc_statement_created_tmp_disk_tables_v2(PSI_statement_locker *locker,
+ ulong count);
+
+void pfs_inc_statement_created_tmp_tables_v2(PSI_statement_locker *locker,
+ ulong count);
+
+void pfs_inc_statement_select_full_join_v2(PSI_statement_locker *locker,
+ ulong count);
+
+void pfs_inc_statement_select_full_range_join_v2(PSI_statement_locker *locker,
+ ulong count);
+
+void pfs_inc_statement_select_range_v2(PSI_statement_locker *locker,
+ ulong count);
+
+void pfs_inc_statement_select_range_check_v2(PSI_statement_locker *locker,
+ ulong count);
+
+void pfs_inc_statement_select_scan_v2(PSI_statement_locker *locker,
+ ulong count);
+
+void pfs_inc_statement_sort_merge_passes_v2(PSI_statement_locker *locker,
+ ulong count);
+
+void pfs_inc_statement_sort_range_v2(PSI_statement_locker *locker, ulong count);
+
+void pfs_inc_statement_sort_rows_v2(PSI_statement_locker *locker, ulong count);
+
+void pfs_inc_statement_sort_scan_v2(PSI_statement_locker *locker, ulong count);
+
+void pfs_set_statement_no_index_used_v2(PSI_statement_locker *locker);
+
+void pfs_set_statement_no_good_index_used_v2(PSI_statement_locker *locker);
+
+void pfs_end_statement_v2(PSI_statement_locker *locker, void *stmt_da);
+
+PSI_digest_locker *pfs_digest_start_v2(PSI_statement_locker *locker);
+
+void pfs_digest_end_v2(PSI_digest_locker *locker,
+ const sql_digest_storage *digest);
+
+#endif /* WITH_LOCK_ORDER */
+#endif /* MYSQL_DYNAMIC_PLUGIN */
+#endif /* MYSQL_SERVER */
+#endif /* HAVE_PSI_STATEMENT_INTERFACE */
+
+#endif
diff --git a/contrib/libs/libmysql_r/include/prealloced_array.h b/contrib/libs/libmysql_r/include/prealloced_array.h
new file mode 100644
index 0000000000..af27ea0624
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/prealloced_array.h
@@ -0,0 +1,571 @@
+/* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef PREALLOCED_ARRAY_INCLUDED
+#define PREALLOCED_ARRAY_INCLUDED
+
+/**
+ @file include/prealloced_array.h
+*/
+
+#include <stddef.h>
+#include <algorithm>
+#include <new>
+#include <type_traits>
+#include <utility>
+
+#include "my_compiler.h"
+#include "my_dbug.h"
+#include "my_inttypes.h"
+#include "my_sys.h"
+#include "mysql/psi/psi_memory.h"
+#include "mysql/service_mysql_alloc.h"
+
+/**
+ A typesafe replacement for DYNAMIC_ARRAY. We do our own memory management,
+ and pre-allocate space for a number of elements. The purpose is to
+ pre-allocate enough elements to cover normal use cases, thus saving
+ malloc()/free() overhead.
+ If we run out of space, we use malloc to allocate more space.
+
+ The interface is chosen to be similar to std::vector.
+ We keep the std::vector property that storage is contiguous.
+
+ @remark
+ Unlike DYNAMIC_ARRAY, elements are properly copied
+ (rather than memcpy()d) if the underlying array needs to be expanded.
+
+ @remark
+ Depending on Has_trivial_destructor, we destroy objects which are
+ removed from the array (including when the array object itself is destroyed).
+
+ @tparam Element_type The type of the elements of the container.
+ Elements must be copyable or movable.
+ @tparam Prealloc Number of elements to pre-allocate.
+ */
+template <typename Element_type, size_t Prealloc>
+class Prealloced_array {
+ /**
+ Is Element_type trivially destructible? If it is, we don't destroy
+ elements when they are removed from the array or when the array is
+ destroyed.
+ */
+ static constexpr bool Has_trivial_destructor =
+ std::is_trivially_destructible<Element_type>::value;
+
+ /**
+ Casts the raw buffer to the proper Element_type.
+ We use a raw buffer rather than Element_type[] in order to avoid having
+ CTORs/DTORs invoked by the C++ runtime.
+ */
+ Element_type *cast_rawbuff() {
+ return static_cast<Element_type *>(static_cast<void *>(m_buff));
+ }
+
+ public:
+ /// Initial capacity of the array.
+ static const size_t initial_capacity = Prealloc;
+
+ /// Standard typedefs.
+ typedef Element_type value_type;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+
+ typedef Element_type *iterator;
+ typedef const Element_type *const_iterator;
+
+ explicit Prealloced_array(PSI_memory_key psi_key)
+ : m_size(0),
+ m_capacity(Prealloc),
+ m_array_ptr(cast_rawbuff()),
+ m_psi_key(psi_key) {
+ static_assert(Prealloc != 0, "We do not want a zero-size array.");
+ }
+
+ /**
+ Initializes (parts of) the array with default values.
+ Using 'Prealloc' for initial_size makes this similar to a raw C array.
+ */
+ Prealloced_array(PSI_memory_key psi_key, size_t initial_size)
+ : m_size(0),
+ m_capacity(Prealloc),
+ m_array_ptr(cast_rawbuff()),
+ m_psi_key(psi_key) {
+ static_assert(Prealloc != 0, "We do not want a zero-size array.");
+
+ if (initial_size > Prealloc) {
+ // We avoid using reserve() since it requires Element_type to be copyable.
+ void *mem =
+ my_malloc(m_psi_key, initial_size * element_size(), MYF(MY_WME));
+ if (!mem) return;
+ m_array_ptr = static_cast<Element_type *>(mem);
+ m_capacity = initial_size;
+ }
+ for (size_t ix = 0; ix < initial_size; ++ix) {
+ Element_type *p = &m_array_ptr[m_size++];
+ ::new (p) Element_type();
+ }
+ }
+
+ /**
+ An object instance "owns" its array, so we do deep copy here.
+ */
+ Prealloced_array(const Prealloced_array &that)
+ : m_size(0),
+ m_capacity(Prealloc),
+ m_array_ptr(cast_rawbuff()),
+ m_psi_key(that.m_psi_key) {
+ if (this->reserve(that.capacity())) return;
+ for (const Element_type *p = that.begin(); p != that.end(); ++p)
+ this->push_back(*p);
+ }
+
+ /**
+ Range constructor.
+
+ Constructs a container with as many elements as the range [first,last),
+ with each element constructed from its corresponding element in that range,
+ in the same order.
+ */
+ Prealloced_array(PSI_memory_key psi_key, const_iterator first,
+ const_iterator last)
+ : m_size(0),
+ m_capacity(Prealloc),
+ m_array_ptr(cast_rawbuff()),
+ m_psi_key(psi_key) {
+ if (this->reserve(last - first)) return;
+ for (; first != last; ++first) push_back(*first);
+ }
+
+ /**
+ Copies all the elements from 'that' into this container.
+ Any objects in this container are destroyed first.
+ */
+ Prealloced_array &operator=(const Prealloced_array &that) {
+ this->clear();
+ if (this->reserve(that.capacity())) return *this;
+ for (const Element_type *p = that.begin(); p != that.end(); ++p)
+ this->push_back(*p);
+ return *this;
+ }
+
+ /**
+ Runs DTOR on all elements if needed.
+ Deallocates array if we exceeded the Preallocated amount.
+ */
+ ~Prealloced_array() {
+ if (!Has_trivial_destructor) {
+ clear();
+ }
+ if (m_array_ptr != cast_rawbuff()) my_free(m_array_ptr);
+ }
+
+ size_t capacity() const { return m_capacity; }
+ size_t element_size() const { return sizeof(Element_type); }
+ bool empty() const { return m_size == 0; }
+ size_t size() const { return m_size; }
+
+ Element_type &at(size_t n) {
+ DBUG_ASSERT(n < size());
+ return m_array_ptr[n];
+ }
+
+ const Element_type &at(size_t n) const {
+ DBUG_ASSERT(n < size());
+ return m_array_ptr[n];
+ }
+
+ Element_type &operator[](size_t n) { return at(n); }
+ const Element_type &operator[](size_t n) const { return at(n); }
+
+ Element_type &back() { return at(size() - 1); }
+ const Element_type &back() const { return at(size() - 1); }
+
+ Element_type &front() { return at(0); }
+ const Element_type &front() const { return at(0); }
+
+ /**
+ begin : Returns a pointer to the first element in the array.
+ end : Returns a pointer to the past-the-end element in the array.
+ */
+ iterator begin() { return m_array_ptr; }
+ iterator end() { return m_array_ptr + size(); }
+ const_iterator begin() const { return m_array_ptr; }
+ const_iterator end() const { return m_array_ptr + size(); }
+ /// Returns a constant pointer to the first element in the array.
+ const_iterator cbegin() const { return begin(); }
+ /// Returns a constant pointer to the past-the-end element in the array.
+ const_iterator cend() const { return end(); }
+
+ /**
+ Assigns a value to an arbitrary element, even where n >= size().
+ The array is extended with default values if necessary.
+ @retval true if out-of-memory, false otherwise.
+ */
+ bool assign_at(size_t n, const value_type &val) {
+ if (n < size()) {
+ at(n) = val;
+ return false;
+ }
+ if (reserve(n + 1)) return true;
+ resize(n);
+ return push_back(val);
+ }
+
+ /**
+ Reserves space for array elements.
+ Copies (or moves, if possible) over existing elements, in case we
+ are re-expanding the array.
+
+ @param n number of elements.
+ @retval true if out-of-memory, false otherwise.
+ */
+ bool reserve(size_t n) {
+ if (n <= m_capacity) return false;
+
+ void *mem = my_malloc(m_psi_key, n * element_size(), MYF(MY_WME));
+ if (!mem) return true;
+ Element_type *new_array = static_cast<Element_type *>(mem);
+
+ // Move all the existing elements into the new array.
+ for (size_t ix = 0; ix < m_size; ++ix) {
+ Element_type *new_p = &new_array[ix];
+ Element_type &old_p = m_array_ptr[ix];
+ ::new (new_p) Element_type(std::move(old_p)); // Move into new location.
+ if (!Has_trivial_destructor)
+ old_p.~Element_type(); // Destroy the old element.
+ }
+
+ if (m_array_ptr != cast_rawbuff()) my_free(m_array_ptr);
+
+ // Forget the old array;
+ m_array_ptr = new_array;
+ m_capacity = n;
+ return false;
+ }
+
+ /**
+ Copies an element into the back of the array.
+ Complexity: Constant (amortized time, reallocation may happen).
+ @return true if out-of-memory, false otherwise
+ */
+ bool push_back(const Element_type &element) { return emplace_back(element); }
+
+ /**
+ Copies (or moves, if possible) an element into the back of the array.
+ Complexity: Constant (amortized time, reallocation may happen).
+ @return true if out-of-memory, false otherwise
+ */
+ bool push_back(Element_type &&element) {
+ return emplace_back(std::move(element));
+ }
+
+ /**
+ Constructs an element at the back of the array.
+ Complexity: Constant (amortized time, reallocation may happen).
+ @return true if out-of-memory, false otherwise
+ */
+ template <typename... Args>
+ bool emplace_back(Args &&... args) {
+ const size_t expansion_factor = 2;
+ if (m_size == m_capacity && reserve(m_capacity * expansion_factor))
+ return true;
+ Element_type *p = &m_array_ptr[m_size++];
+ ::new (p) Element_type(std::forward<Args>(args)...);
+ return false;
+ }
+
+ /**
+ Removes the last element in the array, effectively reducing the
+ container size by one. This destroys the removed element.
+ */
+ void pop_back() {
+ DBUG_ASSERT(!empty());
+ if (!Has_trivial_destructor) back().~Element_type();
+ m_size -= 1;
+ }
+
+ /**
+ The array is extended by inserting a new element before the element at the
+ specified position.
+
+ This is generally an inefficient operation, since we need to copy
+ elements to make a new "hole" in the array.
+
+ We use std::rotate to move objects, hence Element_type must be
+ move-assignable and move-constructible.
+
+ @return an iterator pointing to the inserted value
+ */
+ iterator insert(const_iterator position, const value_type &val) {
+ return emplace(position, val);
+ }
+
+ /**
+ The array is extended by inserting a new element before the element at the
+ specified position. The element is moved into the array, if possible.
+
+ This is generally an inefficient operation, since we need to copy
+ elements to make a new "hole" in the array.
+
+ We use std::rotate to move objects, hence Element_type must be
+ move-assignable and move-constructible.
+
+ @return an iterator pointing to the inserted value
+ */
+ iterator insert(const_iterator position, value_type &&val) {
+ return emplace(position, std::move(val));
+ }
+
+ /**
+ The array is extended by inserting a new element before the element at the
+ specified position. The element is constructed in-place.
+
+ This is generally an inefficient operation, since we need to copy
+ elements to make a new "hole" in the array.
+
+ We use std::rotate to move objects, hence Element_type must be
+ move-assignable and move-constructible.
+
+ @return an iterator pointing to the inserted value
+ */
+ template <typename... Args>
+ iterator emplace(const_iterator position, Args &&... args) {
+ const difference_type n = position - begin();
+ emplace_back(std::forward<Args>(args)...);
+ std::rotate(begin() + n, end() - 1, end());
+ return begin() + n;
+ }
+
+ /**
+ Similar to std::set<>::insert()
+ Extends the array by inserting a new element, but only if it cannot be found
+ in the array already.
+
+ Assumes that the array is sorted with std::less<Element_type>
+ Insertion using this function will maintain order.
+
+ @retval A pair, with its member pair::first set an iterator pointing to
+ either the newly inserted element, or to the equivalent element
+ already in the array. The pair::second element is set to true if
+ the new element was inserted, or false if an equivalent element
+ already existed.
+ */
+ std::pair<iterator, bool> insert_unique(const value_type &val) {
+ std::pair<iterator, iterator> p = std::equal_range(begin(), end(), val);
+ // p.first == p.second means we did not find it.
+ if (p.first == p.second) return std::make_pair(insert(p.first, val), true);
+ return std::make_pair(p.first, false);
+ }
+
+ /**
+ Similar to std::set<>::erase()
+ Removes a single element from the array by value.
+ The removed element is destroyed.
+ This effectively reduces the container size by one.
+
+ This is generally an inefficient operation, since we need to copy
+ elements to fill the "hole" in the array.
+
+ Assumes that the array is sorted with std::less<Element_type>.
+
+ @retval number of elements removed, 0 or 1.
+ */
+ size_type erase_unique(const value_type &val) {
+ std::pair<iterator, iterator> p = std::equal_range(begin(), end(), val);
+ if (p.first == p.second) return 0; // Not found
+ erase(p.first);
+ return 1;
+ }
+
+ /**
+ Similar to std::set<>::count()
+
+ @note Assumes that array is maintained with insert_unique/erase_unique.
+
+ @retval 1 if element is found, 0 otherwise.
+ */
+ size_type count_unique(const value_type &val) const {
+ return std::binary_search(begin(), end(), val);
+ }
+
+ /**
+ Removes a single element from the array.
+ The removed element is destroyed.
+ This effectively reduces the container size by one.
+
+ This is generally an inefficient operation, since we need to move
+ or copy elements to fill the "hole" in the array.
+
+ We use std::move to move objects, hence Element_type must be
+ move-assignable.
+ */
+ iterator erase(const_iterator position) {
+ DBUG_ASSERT(position != end());
+ return erase(position - begin());
+ }
+
+ /**
+ Removes a single element from the array.
+ */
+ iterator erase(size_t ix) {
+ DBUG_ASSERT(ix < size());
+ iterator pos = begin() + ix;
+ if (pos + 1 != end()) std::move(pos + 1, end(), pos);
+ pop_back();
+ return pos;
+ }
+
+ /**
+ Removes tail elements from the array.
+ The removed elements are destroyed.
+ This effectively reduces the containers size by 'end() - first'.
+ */
+ void erase_at_end(const_iterator first) {
+ const_iterator last = cend();
+ const difference_type diff = last - first;
+ if (!Has_trivial_destructor) {
+ for (; first != last; ++first) first->~Element_type();
+ }
+ m_size -= diff;
+ }
+
+ /**
+ Removes a range of elements from the array.
+ The removed elements are destroyed.
+ This effectively reduces the containers size by 'last - first'.
+
+ This is generally an inefficient operation, since we need to move
+ or copy elements to fill the "hole" in the array.
+
+ We use std::move to move objects, hence Element_type must be
+ move-assignable.
+ */
+ iterator erase(const_iterator first, const_iterator last) {
+ /*
+ std::move() wants non-const input iterators, otherwise it cannot move and
+ must always copy the elements. Convert first and last from const_iterator
+ to iterator.
+ */
+ iterator start = begin() + (first - cbegin());
+ iterator stop = begin() + (last - cbegin());
+ if (first != last) erase_at_end(std::move(stop, end(), start));
+ return start;
+ }
+
+ /**
+ Exchanges the content of the container by the content of rhs, which
+ is another vector object of the same type. Sizes may differ.
+
+ We use std::swap to do the operation.
+ */
+ void swap(Prealloced_array &rhs) {
+ // Just swap pointers if both arrays have done malloc.
+ if (m_array_ptr != cast_rawbuff() &&
+ rhs.m_array_ptr != rhs.cast_rawbuff()) {
+ std::swap(m_size, rhs.m_size);
+ std::swap(m_capacity, rhs.m_capacity);
+ std::swap(m_array_ptr, rhs.m_array_ptr);
+ std::swap(m_psi_key, rhs.m_psi_key);
+ return;
+ }
+ std::swap(*this, rhs);
+ }
+
+ /**
+ Requests the container to reduce its capacity to fit its size.
+ */
+ void shrink_to_fit() {
+ // Cannot shrink the pre-allocated array.
+ if (m_array_ptr == cast_rawbuff()) return;
+ // No point in swapping.
+ if (size() == capacity()) return;
+ Prealloced_array tmp(m_psi_key, begin(), end());
+ if (size() <= Prealloc) {
+ /*
+ The elements fit in the pre-allocated array. Destruct the
+ heap-allocated array in this, and copy the elements into the
+ pre-allocated array.
+ */
+ this->~Prealloced_array();
+ new (this) Prealloced_array(tmp.m_psi_key, tmp.begin(), tmp.end());
+ } else {
+ // Both this and tmp have a heap-allocated array. Swap pointers.
+ swap(tmp);
+ }
+ }
+
+ /**
+ Resizes the container so that it contains n elements.
+
+ If n is smaller than the current container size, the content is
+ reduced to its first n elements, removing those beyond (and
+ destroying them).
+
+ If n is greater than the current container size, the content is
+ expanded by inserting at the end as many elements as needed to
+ reach a size of n. If val is specified, the new elements are
+ initialized as copies of val, otherwise, they are
+ value-initialized.
+
+ If n is also greater than the current container capacity, an automatic
+ reallocation of the allocated storage space takes place.
+
+ Notice that this function changes the actual content of the
+ container by inserting or erasing elements from it.
+ */
+ void resize(size_t n, const Element_type &val = Element_type()) {
+ if (n == m_size) return;
+ if (n > m_size) {
+ if (!reserve(n)) {
+ while (n != m_size) push_back(val);
+ }
+ return;
+ }
+ if (!Has_trivial_destructor) {
+ while (n != m_size) pop_back();
+ }
+ m_size = n;
+ }
+
+ /**
+ Removes (and destroys) all elements.
+ Does not change capacity.
+ */
+ void clear() {
+ if (!Has_trivial_destructor) {
+ for (Element_type *p = begin(); p != end(); ++p)
+ p->~Element_type(); // Destroy discarded element.
+ }
+ m_size = 0;
+ }
+
+ private:
+ size_t m_size;
+ size_t m_capacity;
+ // This buffer must be properly aligned.
+ alignas(Element_type) char m_buff[Prealloc * sizeof(Element_type)];
+ Element_type *m_array_ptr;
+ PSI_memory_key m_psi_key;
+};
+
+#endif // PREALLOCED_ARRAY_INCLUDED
diff --git a/contrib/libs/libmysql_r/include/print_version.h b/contrib/libs/libmysql_r/include/print_version.h
new file mode 100644
index 0000000000..0078a76d6c
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/print_version.h
@@ -0,0 +1,76 @@
+/* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef _print_version_h_
+#define _print_version_h_
+
+#ifdef __cplusplus
+#include <string>
+
+extern "C" {
+#endif /* __cplusplus */
+/**
+ @file include/print_version.h
+*/
+
+/**
+ This function prints a standard version string. Should be used by
+ all utilities.
+*/
+
+void print_version();
+
+/**
+ This function prints a standard version string, with '-debug' added
+ to the name of the executable. Used by utilties that have an
+ explicit need to state that they have been compiled in debug mode.
+*/
+
+void print_version_debug();
+
+/**
+ This function prints a version string with the released version
+ supplied by the caller. Used by the server process which needs to
+ print if it is compiled with debug, ASAN, UBSAN or running with
+ Valgrind.
+
+ @param[in] version Null-terminated release version string
+*/
+
+void print_explicit_version(const char *version);
+
+#ifdef __cplusplus
+/**
+ This function builds a version string, with the program name
+ supplied by the caller. Used by MEB and other utilities that want to
+ present themselves under their own name.
+
+ @param[in] progname Program name C++ string.
+
+ @param[out] destination Output buffer.
+
+*/
+
+void build_version(const std::string &progname, std::string *destination);
+} /* extern "C" */
+#endif /* __cplusplus */
+#endif /* _print_version_h_ */
diff --git a/contrib/libs/libmysql_r/include/sha1.h b/contrib/libs/libmysql_r/include/sha1.h
new file mode 100644
index 0000000000..de68064b17
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/sha1.h
@@ -0,0 +1,52 @@
+#ifndef SHA1_INCLUDED
+#define SHA1_INCLUDED
+
+/* Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+/**
+ @file include/sha1.h
+*/
+
+#include <stddef.h>
+
+#include "my_compiler.h"
+#include "my_config.h"
+#include "my_inttypes.h"
+#include "my_macros.h"
+
+#define SHA1_HASH_SIZE 20 /* Hash size in bytes */
+
+void compute_sha1_hash(uint8 *digest, const char *buf, size_t len)
+#if defined(HAVE_VISIBILITY_HIDDEN)
+ MY_ATTRIBUTE((visibility("hidden")))
+#endif
+ ;
+void compute_sha1_hash_multi(uint8 *digest, const char *buf1, int len1,
+ const char *buf2, int len2)
+#if defined(HAVE_VISIBILITY_HIDDEN)
+ MY_ATTRIBUTE((visibility("hidden")))
+#endif
+ ;
+
+#endif /* SHA1_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/sha2.h b/contrib/libs/libmysql_r/include/sha2.h
new file mode 100644
index 0000000000..f6668e537e
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/sha2.h
@@ -0,0 +1,58 @@
+/* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef included_sha2_h
+#define included_sha2_h
+
+/**
+ @file include/sha2.h
+*/
+
+#if defined(HAVE_OPENSSL)
+
+#include <openssl/evp.h>
+#include <stddef.h>
+
+#if !defined(HAVE_WOLFSSL)
+#include <openssl/sha.h>
+#endif // !defined(HAVE_WOLFSSL)
+
+#if defined(HAVE_WOLFSSL) && defined(__cplusplus)
+extern "C" {
+#endif // defined(HAVE_WOLFSSL) && defined(__cplusplus)
+
+#define GEN_OPENSSL_EVP_SHA2_BRIDGE(size) \
+ unsigned char *SHA_EVP##size(const unsigned char *input_ptr, \
+ size_t input_length, \
+ char unsigned *output_ptr);
+GEN_OPENSSL_EVP_SHA2_BRIDGE(512)
+GEN_OPENSSL_EVP_SHA2_BRIDGE(384)
+GEN_OPENSSL_EVP_SHA2_BRIDGE(256)
+GEN_OPENSSL_EVP_SHA2_BRIDGE(224)
+#undef GEN_OPENSSL_EVP_SHA2_BRIDGE
+
+#if defined(HAVE_WOLFSSL) && defined(__cplusplus)
+}
+#endif // defined(HAVE_WOLFSSL) && defined(__cplusplus)
+
+#endif /* HAVE_OPENSSL */
+#endif /* included_sha2_h */
diff --git a/contrib/libs/libmysql_r/include/sql_chars.h b/contrib/libs/libmysql_r/include/sql_chars.h
new file mode 100644
index 0000000000..c7634fbdfa
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/sql_chars.h
@@ -0,0 +1,97 @@
+/*
+ Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/*
+ Char classes for lexical scanners
+*/
+
+#ifndef SQL_LEX_CHARS_INCLUDED
+#define SQL_LEX_CHARS_INCLUDED
+
+#include "my_compiler.h"
+#include "my_inttypes.h"
+#include "my_macros.h"
+
+struct CHARSET_INFO;
+
+enum MY_ATTRIBUTE((__packed__)) my_lex_states {
+ MY_LEX_START,
+ MY_LEX_CHAR,
+ MY_LEX_IDENT,
+ MY_LEX_IDENT_SEP,
+ MY_LEX_IDENT_START,
+ MY_LEX_REAL,
+ MY_LEX_HEX_NUMBER,
+ MY_LEX_BIN_NUMBER,
+ MY_LEX_CMP_OP,
+ MY_LEX_LONG_CMP_OP,
+ MY_LEX_STRING,
+ MY_LEX_COMMENT,
+ MY_LEX_END,
+ MY_LEX_NUMBER_IDENT,
+ MY_LEX_INT_OR_REAL,
+ MY_LEX_REAL_OR_POINT,
+ MY_LEX_BOOL,
+ MY_LEX_EOL,
+ MY_LEX_LONG_COMMENT,
+ MY_LEX_END_LONG_COMMENT,
+ MY_LEX_SEMICOLON,
+ MY_LEX_SET_VAR,
+ MY_LEX_USER_END,
+ MY_LEX_HOSTNAME,
+ MY_LEX_SKIP,
+ MY_LEX_USER_VARIABLE_DELIMITER,
+ MY_LEX_SYSTEM_VAR,
+ MY_LEX_IDENT_OR_KEYWORD,
+ MY_LEX_IDENT_OR_HEX,
+ MY_LEX_IDENT_OR_BIN,
+ MY_LEX_IDENT_OR_NCHAR,
+ MY_LEX_STRING_OR_DELIMITER
+};
+
+enum MY_ATTRIBUTE((__packed__)) hint_lex_char_classes {
+ HINT_CHR_ASTERISK, // [*]
+ HINT_CHR_AT, // [@]
+ HINT_CHR_BACKQUOTE, // [`]
+ HINT_CHR_CHAR, // default state
+ HINT_CHR_DIGIT, // [[:digit:]]
+ HINT_CHR_DOUBLEQUOTE, // ["]
+ HINT_CHR_EOF, // pseudo-class
+ HINT_CHR_IDENT, // [_$[:alpha:]]
+ HINT_CHR_MB, // multibyte character
+ HINT_CHR_NL, // \n
+ HINT_CHR_QUOTE, // [']
+ HINT_CHR_SLASH, // [/]
+ HINT_CHR_SPACE // [[:space:]] excluding \n
+};
+
+struct lex_state_maps_st {
+ enum my_lex_states main_map[256];
+ enum hint_lex_char_classes hint_map[256];
+};
+
+typedef struct lex_state_maps_st lex_state_maps_st;
+
+bool init_state_maps(CHARSET_INFO *cs);
+
+#endif /* SQL_LEX_CHARS_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/sql_common.h b/contrib/libs/libmysql_r/include/sql_common.h
new file mode 100644
index 0000000000..48c0b21689
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/sql_common.h
@@ -0,0 +1,251 @@
+#ifndef SQL_COMMON_INCLUDED
+#define SQL_COMMON_INCLUDED
+
+/* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#define SQL_COMMON_INCLUDED
+
+/**
+ @file include/sql_common.h
+*/
+
+#include <mysql.h>
+#include <stddef.h>
+#include <sys/types.h>
+
+#include "errmsg.h"
+#include "my_command.h"
+#include "my_compiler.h"
+#include "my_inttypes.h"
+#include "my_list.h"
+#include "mysql_com.h"
+
+struct MEM_ROOT;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern const char *unknown_sqlstate;
+extern const char *cant_connect_sqlstate;
+extern const char *not_error_sqlstate;
+
+/*
+ Free all memory allocated in MYSQL handle except the
+ current options.
+*/
+void mysql_close_free(MYSQL *mysql);
+
+/*
+ Clear connection options stored in MYSQL handle and
+ free memory used by them.
+*/
+void mysql_close_free_options(MYSQL *mysql);
+
+/**
+ The structure is used to hold the state change information
+ received from the server. LIST functions are used for manipulation
+ of the members of the structure.
+*/
+struct STATE_INFO_NODE {
+ /** head_node->data is a LEX_STRING which contains the variable name. */
+ LIST *head_node;
+ LIST *current_node;
+};
+
+/**
+ Store the change info received from the server in an array of linked lists
+ with STATE_INFO_NODE elements (one per state type).
+*/
+struct STATE_INFO {
+ /** Array of STATE_NODE_INFO elements (one per state type). */
+ STATE_INFO_NODE info_list[SESSION_TRACK_END + 1];
+};
+
+/*
+ Access to MYSQL::extension member.
+
+ Note: functions mysql_extension_{init,free}() are defined
+ in client.c.
+*/
+
+struct st_mysql_trace_info;
+
+struct MYSQL_EXTENSION {
+ struct st_mysql_trace_info *trace_data;
+ STATE_INFO state_change;
+ /* Struct to track the state of asynchronous operations */
+ struct MYSQL_ASYNC *mysql_async_context;
+};
+
+/* "Constructor/destructor" for MYSQL extension structure. */
+MYSQL_EXTENSION *mysql_extension_init(MYSQL *);
+void mysql_extension_free(MYSQL_EXTENSION *);
+
+/*
+ Note: Allocated extension structure is freed in mysql_close_free()
+ called by mysql_close().
+*/
+#define MYSQL_EXTENSION_PTR(H) \
+ ((MYSQL_EXTENSION *)((H)->extension \
+ ? (H)->extension \
+ : ((H)->extension = mysql_extension_init(H))))
+
+#define ASYNC_DATA(M) \
+ (NULL != (M) ? (MYSQL_EXTENSION_PTR(M)->mysql_async_context) : NULL)
+
+struct st_mysql_options_extention {
+ char *plugin_dir;
+ char *default_auth;
+ char *ssl_crl; /* PEM CRL file */
+ char *ssl_crlpath; /* PEM directory of CRL-s? */
+ struct My_hash *connection_attributes;
+ char *server_public_key_path;
+ size_t connection_attributes_length;
+ bool enable_cleartext_plugin;
+ bool get_server_public_key; /* Former ssl_enforce */
+ char *tls_version; /* TLS version option */
+ long ssl_ctx_flags; /* SSL ctx options flag */
+ unsigned int ssl_mode;
+ unsigned int retry_count;
+ unsigned int ssl_fips_mode; /* SSL fips mode for enforced encryption.*/
+ char *tls_ciphersuites;
+};
+
+struct MYSQL_METHODS {
+ bool (*read_query_result)(MYSQL *mysql);
+ bool (*advanced_command)(MYSQL *mysql, enum enum_server_command command,
+ const unsigned char *header, size_t header_length,
+ const unsigned char *arg, size_t arg_length,
+ bool skip_check, MYSQL_STMT *stmt);
+ MYSQL_DATA *(*read_rows)(MYSQL *mysql, MYSQL_FIELD *mysql_fields,
+ unsigned int fields);
+ MYSQL_RES *(*use_result)(MYSQL *mysql);
+ void (*fetch_lengths)(unsigned long *to, MYSQL_ROW column,
+ unsigned int field_count);
+ void (*flush_use_result)(MYSQL *mysql, bool flush_all_results);
+ int (*read_change_user_result)(MYSQL *mysql);
+#if !defined(MYSQL_SERVER)
+ MYSQL_FIELD *(*list_fields)(MYSQL *mysql);
+ bool (*read_prepare_result)(MYSQL *mysql, MYSQL_STMT *stmt);
+ int (*stmt_execute)(MYSQL_STMT *stmt);
+ int (*read_binary_rows)(MYSQL_STMT *stmt);
+ int (*unbuffered_fetch)(MYSQL *mysql, char **row);
+ const char *(*read_statistics)(MYSQL *mysql);
+ bool (*next_result)(MYSQL *mysql);
+ int (*read_rows_from_cursor)(MYSQL_STMT *stmt);
+ void (*free_rows)(MYSQL_DATA *cur);
+#endif
+ enum net_async_status (*read_query_result_nonblocking)(MYSQL *mysql);
+ enum net_async_status (*advanced_command_nonblocking)(
+ MYSQL *mysql, enum enum_server_command command,
+ const unsigned char *header, unsigned long header_length,
+ const unsigned char *arg, unsigned long arg_length, bool skip_check,
+ MYSQL_STMT *stmt, bool *error);
+ enum net_async_status (*read_rows_nonblocking)(MYSQL *mysql,
+ MYSQL_FIELD *mysql_fields,
+ unsigned int fields,
+ MYSQL_DATA **result);
+ enum net_async_status (*flush_use_result_nonblocking)(MYSQL *mysql,
+ bool flush_all_results);
+ enum net_async_status (*next_result_nonblocking)(MYSQL *mysql);
+ enum net_async_status (*read_change_user_result_nonblocking)(MYSQL *mysql,
+ ulong *res);
+};
+
+#define simple_command(mysql, command, arg, length, skip_check) \
+ ((mysql)->methods \
+ ? (*(mysql)->methods->advanced_command)(mysql, command, 0, 0, arg, \
+ length, skip_check, NULL) \
+ : (set_mysql_error(mysql, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate), \
+ 1))
+#define simple_command_nonblocking(mysql, command, arg, length, skip_check, \
+ error) \
+ (*(mysql)->methods->advanced_command_nonblocking)( \
+ mysql, command, 0, 0, arg, length, skip_check, NULL, error)
+
+#define stmt_command(mysql, command, arg, length, stmt) \
+ ((mysql)->methods \
+ ? (*(mysql)->methods->advanced_command)(mysql, command, 0, 0, arg, \
+ length, 1, stmt) \
+ : (set_mysql_error(mysql, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate), \
+ 1))
+
+extern CHARSET_INFO *default_client_charset_info;
+MYSQL_FIELD *unpack_fields(MYSQL *mysql, MYSQL_ROWS *data, MEM_ROOT *alloc,
+ uint fields, bool default_value,
+ uint server_capabilities);
+MYSQL_FIELD *cli_read_metadata_ex(MYSQL *mysql, MEM_ROOT *alloc,
+ unsigned long field_count,
+ unsigned int fields);
+MYSQL_FIELD *cli_read_metadata(MYSQL *mysql, unsigned long field_count,
+ unsigned int fields);
+void free_rows(MYSQL_DATA *cur);
+void free_old_query(MYSQL *mysql);
+void end_server(MYSQL *mysql);
+bool mysql_reconnect(MYSQL *mysql);
+void mysql_read_default_options(struct st_mysql_options *options,
+ const char *filename, const char *group);
+bool cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
+ const unsigned char *header, size_t header_length,
+ const unsigned char *arg, size_t arg_length,
+ bool skip_check, MYSQL_STMT *stmt);
+unsigned long cli_safe_read(MYSQL *mysql, bool *is_data_packet);
+enum net_async_status cli_safe_read_nonblocking(MYSQL *mysql,
+ bool *is_data_packet,
+ ulong *res);
+unsigned long cli_safe_read_with_ok(MYSQL *mysql, bool parse_ok,
+ bool *is_data_packet);
+void net_clear_error(NET *net);
+void set_stmt_errmsg(MYSQL_STMT *stmt, NET *net);
+void set_stmt_error(MYSQL_STMT *stmt, int errcode, const char *sqlstate,
+ const char *err);
+void set_mysql_error(MYSQL *mysql, int errcode, const char *sqlstate);
+void set_mysql_extended_error(MYSQL *mysql, int errcode, const char *sqlstate,
+ const char *format, ...)
+ MY_ATTRIBUTE((format(printf, 4, 5)));
+
+/* client side of the pluggable authentication */
+struct MYSQL_PLUGIN_VIO_INFO;
+
+void mpvio_info(MYSQL_VIO vio, MYSQL_PLUGIN_VIO_INFO *info);
+int run_plugin_auth(MYSQL *mysql, char *data, uint data_len,
+ const char *data_plugin, const char *db);
+int mysql_client_plugin_init();
+void mysql_client_plugin_deinit();
+
+struct st_mysql_client_plugin;
+
+extern struct st_mysql_client_plugin *mysql_client_builtins[];
+uchar *send_client_connect_attrs(MYSQL *mysql, uchar *buf);
+extern bool libmysql_cleartext_plugin_enabled;
+int is_file_or_dir_world_writable(const char *filepath);
+void read_ok_ex(MYSQL *mysql, unsigned long len);
+
+#ifdef __cplusplus
+}
+#endif
+
+#define protocol_41(A) ((A)->server_capabilities & CLIENT_PROTOCOL_41)
+
+#endif /* SQL_COMMON_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/sql_string.h b/contrib/libs/libmysql_r/include/sql_string.h
new file mode 100644
index 0000000000..396183be7c
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/sql_string.h
@@ -0,0 +1,640 @@
+#ifndef SQL_STRING_INCLUDED
+#define SQL_STRING_INCLUDED
+
+/* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/sql_string.h
+ Our own string classes, used pervasively throughout the executor.
+ See in particular the comment on String before you use anything from here.
+*/
+
+#include <string.h>
+#include <sys/types.h>
+#include <new>
+#include <string>
+
+#include "lex_string.h"
+#include "m_ctype.h" // my_convert
+#include "m_string.h" // LEX_CSTRING
+#include "memory_debugging.h"
+#include "my_alloc.h"
+#include "my_compiler.h"
+#include "my_dbug.h"
+#include "my_inttypes.h"
+#include "mysql/mysql_lex_string.h" // LEX_STRING
+#include "mysql/psi/psi_base.h"
+#include "mysql/psi/psi_memory.h"
+#include "mysql/service_mysql_alloc.h" // my_free
+
+struct MEM_ROOT;
+
+#ifdef MYSQL_SERVER
+extern PSI_memory_key key_memory_String_value;
+#define STRING_PSI_MEMORY_KEY key_memory_String_value
+#else
+#define STRING_PSI_MEMORY_KEY PSI_NOT_INSTRUMENTED
+#endif
+
+/**
+ A wrapper class for null-terminated constant strings.
+ Constructors make sure that the position of the '\0' terminating byte
+ in m_str is always in sync with m_length.
+
+ This class must stay as small as possible as we often
+ pass it and its descendants (such as Name_string) into functions
+ using call-by-value evaluation.
+
+ Don't add new members or virual methods into this class!
+*/
+class Simple_cstring {
+ private:
+ const char *m_str;
+ size_t m_length;
+
+ public:
+ /**
+ Initialize from a C string whose length is already known.
+ */
+ void set(const char *str_arg, size_t length_arg) {
+ // NULL is allowed only with length==0
+ DBUG_ASSERT(str_arg || length_arg == 0);
+ // For non-NULL, make sure length_arg is in sync with '\0' terminator.
+ DBUG_ASSERT(!str_arg || str_arg[length_arg] == '\0');
+ m_str = str_arg;
+ m_length = length_arg;
+ }
+ Simple_cstring() { set(NULL, 0); }
+ Simple_cstring(const char *str_arg, size_t length_arg) {
+ set(str_arg, length_arg);
+ }
+ Simple_cstring(const LEX_STRING arg) { set(arg.str, arg.length); }
+ void reset() { set(NULL, 0); }
+ /**
+ Set to a null-terminated string.
+ */
+ void set(const char *str) { set(str, str ? strlen(str) : 0); }
+ /**
+ Return string buffer.
+ */
+ const char *ptr() const { return m_str; }
+ /**
+ Check if m_ptr is set.
+ */
+ bool is_set() const { return m_str != NULL; }
+ /**
+ Return name length.
+ */
+ size_t length() const { return m_length; }
+ /**
+ Compare to another Simple_cstring.
+ */
+ bool eq_bin(const Simple_cstring other) const {
+ return m_length == other.m_length &&
+ memcmp(m_str, other.m_str, m_length) == 0;
+ }
+ /**
+ Copy to the given buffer
+ */
+ void strcpy(char *buff) const {
+ memcpy(buff, m_str, m_length);
+ buff[m_length] = '\0';
+ }
+};
+
+class String;
+
+struct CHARSET_INFO;
+struct IO_CACHE;
+
+int sortcmp(const String *a, const String *b, const CHARSET_INFO *cs);
+String *copy_if_not_alloced(String *to, String *from, size_t from_length);
+inline size_t copy_and_convert(char *to, size_t to_length,
+ const CHARSET_INFO *to_cs, const char *from,
+ size_t from_length, const CHARSET_INFO *from_cs,
+ uint *errors) {
+ return my_convert(to, to_length, to_cs, from, from_length, from_cs, errors);
+}
+size_t well_formed_copy_nchars(const CHARSET_INFO *to_cs, char *to,
+ size_t to_length, const CHARSET_INFO *from_cs,
+ const char *from, size_t from_length,
+ size_t nchars,
+ const char **well_formed_error_pos,
+ const char **cannot_convert_error_pos,
+ const char **from_end_pos);
+size_t convert_to_printable(char *to, size_t to_len, const char *from,
+ size_t from_len, const CHARSET_INFO *from_cs,
+ size_t nbytes = 0);
+
+size_t bin_to_hex_str(char *to, size_t to_len, char *from, size_t from_len);
+
+/**
+ Using this class is fraught with peril, and you need to be very careful
+ when doing so. In particular, copy construction and assignment does not
+ do a deep _nor_ a shallow copy; instead, it makes a _reference_ to the
+ original string that will be invalid as soon as that string goes out of scope.
+ (Move constructiong and assignment is safe, though.) In general, it is
+ probably better not to use this class at all if you can avoid it.
+*/
+class String {
+ char *m_ptr;
+ size_t m_length;
+ const CHARSET_INFO *m_charset;
+ uint32
+ m_alloced_length; // should be size_t, but kept uint32 for size reasons
+ bool m_is_alloced;
+
+ public:
+ String()
+ : m_ptr(NULL),
+ m_length(0),
+ m_charset(&my_charset_bin),
+ m_alloced_length(0),
+ m_is_alloced(false) {}
+ explicit String(size_t length_arg)
+ : m_ptr(NULL),
+ m_length(0),
+ m_charset(&my_charset_bin),
+ m_alloced_length(0),
+ m_is_alloced(false) {
+ (void)real_alloc(length_arg);
+ }
+ String(const char *str, const CHARSET_INFO *cs)
+ : m_ptr(const_cast<char *>(str)),
+ m_length(strlen(str)),
+ m_charset(cs),
+ m_alloced_length(0),
+ m_is_alloced(false) {}
+ String(const char *str, size_t len, const CHARSET_INFO *cs)
+ : m_ptr(const_cast<char *>(str)),
+ m_length(len),
+ m_charset(cs),
+ m_alloced_length(0),
+ m_is_alloced(false) {}
+ String(char *str, size_t len, const CHARSET_INFO *cs)
+ : m_ptr(str),
+ m_length(len),
+ m_charset(cs),
+ m_alloced_length(static_cast<uint32>(len)),
+ m_is_alloced(false) {}
+ String(const String &str)
+ : m_ptr(str.m_ptr),
+ m_length(str.m_length),
+ m_charset(str.m_charset),
+ m_alloced_length(static_cast<uint32>(str.m_alloced_length)),
+ m_is_alloced(false) {}
+ String(String &&str) noexcept
+ : m_ptr(str.m_ptr),
+ m_length(str.m_length),
+ m_charset(str.m_charset),
+ m_alloced_length(str.m_alloced_length),
+ m_is_alloced(str.m_is_alloced) {
+ str.m_is_alloced = false;
+ }
+ static void *operator new(size_t size, MEM_ROOT *mem_root,
+ const std::nothrow_t &arg MY_ATTRIBUTE((unused)) =
+ std::nothrow) noexcept {
+ return mem_root->Alloc(size);
+ }
+ static void operator delete(void *ptr_arg, size_t size) {
+ (void)ptr_arg;
+ (void)size;
+ TRASH(ptr_arg, size);
+ }
+
+ static void operator delete(
+ void *, MEM_ROOT *, const std::nothrow_t &)noexcept { /* never called */
+ }
+
+ ~String() { mem_free(); }
+
+ void set_charset(const CHARSET_INFO *charset_arg) { m_charset = charset_arg; }
+ const CHARSET_INFO *charset() const { return m_charset; }
+ size_t length() const { return m_length; }
+ size_t alloced_length() const { return m_alloced_length; }
+ const char &operator[](size_t i) const { return m_ptr[i]; }
+ char &operator[](size_t i) { return m_ptr[i]; }
+ void length(size_t len) { m_length = len; }
+ bool is_empty() const { return (m_length == 0); }
+ void mark_as_const() { m_alloced_length = 0; }
+ /* Returns a pointer to data, may not include NULL terminating character. */
+ const char *ptr() const { return m_ptr; }
+ char *ptr() { return m_ptr; }
+ char *c_ptr() {
+ DBUG_ASSERT(!m_is_alloced || !m_ptr || !m_alloced_length ||
+ (m_alloced_length >= (m_length + 1)));
+
+ /*
+ Should be safe, but in case valgrind complains on this line, it means
+ there is a misuse of c_ptr(). Please prefer <ptr(), length()> instead.
+ */
+ if (!m_ptr || m_ptr[m_length]) (void)mem_realloc(m_length);
+ return m_ptr;
+ }
+ char *c_ptr_quick() {
+ if (m_ptr && m_length < m_alloced_length) m_ptr[m_length] = 0;
+ return m_ptr;
+ }
+ char *c_ptr_safe() {
+ if (m_ptr && m_length < m_alloced_length)
+ m_ptr[m_length] = 0;
+ else
+ (void)mem_realloc(m_length);
+ return m_ptr;
+ }
+ LEX_STRING lex_string() { return {m_ptr, length()}; }
+
+ LEX_CSTRING lex_cstring() const {
+ LEX_CSTRING lex_cstring = {ptr(), length()};
+ return lex_cstring;
+ }
+
+ void set(String &str, size_t offset, size_t arg_length) {
+ DBUG_ASSERT(&str != this);
+ mem_free();
+ m_ptr = str.ptr() + offset;
+ m_length = arg_length;
+ m_is_alloced = false;
+ if (str.m_alloced_length)
+ m_alloced_length = str.m_alloced_length - static_cast<uint32>(offset);
+ else
+ m_alloced_length = 0;
+ m_charset = str.m_charset;
+ }
+
+ /**
+ Points the internal buffer to the supplied one. The old buffer is freed.
+ @param str Pointer to the new buffer.
+ @param arg_length Length of the new buffer in characters, excluding any
+ null character.
+ @param cs Character set to use for interpreting string data.
+ @note The new buffer will not be null terminated.
+ */
+ void set(char *str, size_t arg_length, const CHARSET_INFO *cs) {
+ mem_free();
+ m_ptr = str;
+ m_length = m_alloced_length = static_cast<uint32>(arg_length);
+ m_is_alloced = false;
+ m_charset = cs;
+ }
+ void set(const char *str, size_t arg_length, const CHARSET_INFO *cs) {
+ mem_free();
+ m_ptr = const_cast<char *>(str);
+ m_length = arg_length;
+ m_alloced_length = 0;
+ m_is_alloced = false;
+ m_charset = cs;
+ }
+ bool set_ascii(const char *str, size_t arg_length);
+ void set_quick(char *str, size_t arg_length, const CHARSET_INFO *cs) {
+ if (!m_is_alloced) {
+ m_ptr = str;
+ m_length = arg_length;
+ m_alloced_length = static_cast<uint32>(arg_length);
+ }
+ m_charset = cs;
+ }
+ bool set_int(longlong num, bool unsigned_flag, const CHARSET_INFO *cs);
+ bool set(longlong num, const CHARSET_INFO *cs) {
+ return set_int(num, false, cs);
+ }
+ bool set(ulonglong num, const CHARSET_INFO *cs) {
+ return set_int((longlong)num, true, cs);
+ }
+ bool set_real(double num, uint decimals, const CHARSET_INFO *cs);
+
+ /*
+ PMG 2004.11.12
+ This is a method that works the same as perl's "chop". It simply
+ drops the last byte of a string. This is useful in the case
+ of the federated storage handler where I'm building a unknown
+ number, list of values and fields to be used in a sql insert
+ statement to be run on the remote server, and have a comma after each.
+ When the list is complete, I "chop" off the trailing comma
+
+ ex.
+ String stringobj;
+ stringobj.append("VALUES ('foo', 'fi', 'fo',");
+ stringobj.chop();
+ stringobj.append(")");
+
+ In this case, the value of string was:
+
+ VALUES ('foo', 'fi', 'fo',
+ VALUES ('foo', 'fi', 'fo'
+ VALUES ('foo', 'fi', 'fo')
+
+ This is not safe to call when the string ends in a multi-byte character!
+ */
+ void chop() {
+ m_length--;
+ m_ptr[m_length] = '\0';
+ }
+
+ void mem_claim() {
+ if (m_is_alloced) {
+ my_claim(m_ptr);
+ }
+ }
+
+ void mem_free() {
+ if (m_is_alloced) {
+ m_is_alloced = false;
+ m_alloced_length = 0;
+ my_free(m_ptr);
+ m_ptr = NULL;
+ m_length = 0; /* Safety */
+ }
+ }
+
+ bool alloc(size_t arg_length) {
+ if (arg_length < m_alloced_length) return false;
+ return real_alloc(arg_length);
+ }
+ bool real_alloc(size_t arg_length); // Empties old string
+ bool mem_realloc(size_t arg_length, bool force_on_heap = false);
+
+ private:
+ size_t next_realloc_exp_size(size_t sz);
+ bool mem_realloc_exp(size_t arg_length);
+
+ public:
+ // Shrink the buffer, but only if it is allocated on the heap.
+ void shrink(size_t arg_length) {
+ if (!is_alloced()) return;
+ if (arg_length < m_alloced_length) {
+ char *new_ptr;
+ if (!(new_ptr = static_cast<char *>(my_realloc(
+ STRING_PSI_MEMORY_KEY, m_ptr, arg_length, MYF(0))))) {
+ m_alloced_length = 0;
+ real_alloc(arg_length);
+ } else {
+ m_ptr = new_ptr;
+ m_alloced_length = static_cast<uint32>(arg_length);
+ }
+ }
+ }
+ bool is_alloced() const { return m_is_alloced; }
+ String &operator=(const String &s) {
+ if (&s != this) {
+ /*
+ It is forbidden to do assignments like
+ some_string = substring_of_that_string
+ */
+ DBUG_ASSERT(!s.uses_buffer_owned_by(this));
+ mem_free();
+ m_ptr = s.m_ptr;
+ m_length = s.m_length;
+ m_alloced_length = s.m_alloced_length;
+ m_charset = s.m_charset;
+ m_is_alloced = false;
+ }
+ return *this;
+ }
+ String &operator=(String &&s) noexcept {
+ if (&s != this) {
+ /*
+ It is forbidden to do assignments like
+ some_string = substring_of_that_string
+ */
+ DBUG_ASSERT(!s.uses_buffer_owned_by(this));
+ mem_free();
+ m_ptr = s.m_ptr;
+ m_length = s.m_length;
+ m_alloced_length = s.m_alloced_length;
+ m_charset = s.m_charset;
+ // This is the primary difference between move and copy.
+ m_is_alloced = s.m_is_alloced;
+ s.m_is_alloced = false;
+ }
+ return *this;
+ }
+ /**
+ Takeover the buffer owned by another string.
+ "this" becames the owner of the buffer and
+ is further responsible to free it.
+ The string "s" is detouched from the buffer (cleared).
+
+ @param s - a String object to steal buffer from.
+ */
+ void takeover(String &s) {
+ DBUG_ASSERT(this != &s);
+ // Make sure buffers of the two Strings do not overlap
+ DBUG_ASSERT(!s.uses_buffer_owned_by(this));
+ mem_free();
+ m_ptr = s.m_ptr;
+ m_length = s.m_length;
+ m_alloced_length = s.m_alloced_length;
+ m_is_alloced = s.m_is_alloced;
+ m_charset = s.m_charset;
+ s.m_ptr = NULL;
+ s.m_alloced_length = 0;
+ s.m_length = 0;
+ s.m_is_alloced = false;
+ }
+
+ bool copy(); // Alloc string if not alloced
+ bool copy(const String &s); // Allocate new string
+ // Allocate new string
+ bool copy(const char *s, size_t arg_length, const CHARSET_INFO *cs);
+ static bool needs_conversion(size_t arg_length, const CHARSET_INFO *cs_from,
+ const CHARSET_INFO *cs_to, size_t *offset);
+ static bool needs_conversion_on_storage(size_t arg_length,
+ const CHARSET_INFO *cs_from,
+ const CHARSET_INFO *cs_to);
+ bool copy_aligned(const char *s, size_t arg_length, size_t offset,
+ const CHARSET_INFO *cs);
+ bool set_or_copy_aligned(const char *s, size_t arg_length,
+ const CHARSET_INFO *cs);
+ bool copy(const char *s, size_t arg_length, const CHARSET_INFO *csfrom,
+ const CHARSET_INFO *csto, uint *errors);
+ bool append(const String &s);
+ bool append(const char *s);
+ bool append(LEX_STRING *ls) { return append(ls->str, ls->length); }
+ bool append(Simple_cstring str) { return append(str.ptr(), str.length()); }
+ bool append(const char *s, size_t arg_length);
+ bool append(const char *s, size_t arg_length, const CHARSET_INFO *cs);
+ bool append_ulonglong(ulonglong val);
+ bool append_longlong(longlong val);
+ bool append(IO_CACHE *file, size_t arg_length);
+ bool append_with_prefill(const char *s, size_t arg_length, size_t full_length,
+ char fill_char);
+ bool append_parenthesized(long nr, int radix = 10);
+ /**
+ Search for a substring.
+
+ @param search substring to search for
+ @param offset starting point, bytes from the start of the string
+
+ @return byte offset to the substring from the start of this string
+ @retval -1 if the substring is not found starting from the offset
+ */
+ int strstr(const String &search, size_t offset = 0) const;
+ /**
+ Reverse search for a substring.
+
+ @param search substring to search for
+ @param offset starting point, bytes from the start of the string
+
+ @return byte offset to the substring from the start of this string
+ @retval -1 if the substring is not found starting from the offset
+ */
+ int strrstr(const String &search, size_t offset = 0) const;
+ /**
+ * Returns substring of given characters lenght, starting at given character
+ * offset. Note that parameter indexes are character indexes and not byte
+ * indexes.
+ */
+ String substr(int offset, int count) const;
+
+ bool replace(size_t offset, size_t arg_length, const char *to, size_t length);
+ bool replace(size_t offset, size_t arg_length, const String &to);
+ bool append(char chr) {
+ if (m_length < m_alloced_length) {
+ m_ptr[m_length++] = chr;
+ } else {
+ if (mem_realloc_exp(m_length + 1)) return 1;
+ m_ptr[m_length++] = chr;
+ }
+ return 0;
+ }
+ bool fill(size_t max_length, char fill);
+ void strip_sp();
+ friend int sortcmp(const String *a, const String *b, const CHARSET_INFO *cs);
+ friend int stringcmp(const String *a, const String *b);
+ friend String *copy_if_not_alloced(String *to, String *from,
+ size_t from_length);
+ size_t numchars() const;
+ size_t charpos(size_t i, size_t offset = 0) const;
+
+ int reserve(size_t space_needed) {
+ return mem_realloc(m_length + space_needed);
+ }
+ int reserve(size_t space_needed, size_t grow_by);
+
+ /* Inline (general) functions used by the protocol functions */
+
+ char *prep_append(size_t arg_length, size_t step_alloc) {
+ size_t new_length = arg_length + m_length;
+ if (new_length > m_alloced_length) {
+ if (mem_realloc(new_length + step_alloc)) return NULL;
+ }
+ size_t old_length = m_length;
+ m_length += arg_length;
+ return m_ptr + old_length; /* Area to use */
+ }
+
+ bool append(const char *s, size_t arg_length, size_t step_alloc) {
+ size_t new_length = arg_length + m_length;
+ if (new_length > m_alloced_length &&
+ mem_realloc_exp(new_length + step_alloc))
+ return true;
+ memcpy(m_ptr + m_length, s, arg_length);
+ m_length += arg_length;
+ return false;
+ }
+ void print(String *print) const;
+
+ /* Swap two string objects. Efficient way to exchange data without memcpy. */
+ void swap(String &s) noexcept;
+
+ bool uses_buffer_owned_by(const String *s) const {
+ return (s->m_is_alloced && m_ptr >= s->m_ptr &&
+ m_ptr < s->m_ptr + s->m_length);
+ }
+ bool is_ascii() const {
+ if (length() == 0) return true;
+ if (charset()->mbminlen > 1) return false;
+ for (const char *c = ptr(), *end = c + length(); c < end; c++) {
+ if (!my_isascii(*c)) return false;
+ }
+ return true;
+ }
+ /**
+ Make a zero-terminated copy of our value,allocated in the specified MEM_ROOT
+
+ @param root MEM_ROOT to allocate the result
+
+ @return allocated string or NULL
+ */
+ char *dup(MEM_ROOT *root) const;
+};
+
+static inline void swap(String &a, String &b) noexcept { a.swap(b); }
+
+static inline std::string to_string(const String &str) {
+ return std::string(str.ptr(), str.length());
+}
+
+/**
+ String class wrapper with a preallocated buffer of size buff_sz
+
+ This class allows to replace sequences of:
+ char buff[12345];
+ String str(buff, sizeof(buff));
+ str.length(0);
+ with a simple equivalent declaration:
+ StringBuffer<12345> str;
+*/
+
+template <size_t buff_sz>
+class StringBuffer : public String {
+ char buff[buff_sz];
+
+ public:
+ StringBuffer() : String(buff, buff_sz, &my_charset_bin) { length(0); }
+ explicit StringBuffer(const CHARSET_INFO *cs) : String(buff, buff_sz, cs) {
+ length(0);
+ }
+ StringBuffer(const char *str, size_t length, const CHARSET_INFO *cs)
+ : String(buff, buff_sz, cs) {
+ set(str, length, cs);
+ }
+};
+
+static inline bool check_if_only_end_space(const CHARSET_INFO *cs,
+ const char *str, const char *end) {
+ return str + cs->cset->scan(cs, str, end, MY_SEQ_SPACES) == end;
+}
+
+inline LEX_CSTRING to_lex_cstring(const LEX_STRING &s) {
+ LEX_CSTRING cstr = {s.str, s.length};
+ return cstr;
+}
+
+inline LEX_STRING to_lex_string(const LEX_CSTRING &s) {
+ LEX_STRING str = {const_cast<char *>(s.str), s.length};
+ return str;
+}
+
+inline LEX_CSTRING to_lex_cstring(const char *s) {
+ LEX_CSTRING cstr = {s, s != NULL ? strlen(s) : 0};
+ return cstr;
+}
+
+bool validate_string(const CHARSET_INFO *cs, const char *str, size_t length,
+ size_t *valid_length, bool *length_error);
+
+bool append_escaped(String *to_str, const String *from_str);
+
+#endif /* SQL_STRING_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/template_utils.h b/contrib/libs/libmysql_r/include/template_utils.h
new file mode 100644
index 0000000000..527af8a141
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/template_utils.h
@@ -0,0 +1,147 @@
+/* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef TEMPLATE_UTILS_INCLUDED
+#define TEMPLATE_UTILS_INCLUDED
+
+#include <stddef.h>
+
+#include "my_dbug.h"
+
+/**
+ @file include/template_utils.h
+*/
+
+/**
+ Clears a container, but deletes all objects that the elements point to first.
+ @tparam Container_type Container of pointers.
+ */
+template <typename Container_type>
+void delete_container_pointers(Container_type &container) {
+ typename Container_type::iterator it1 = container.begin();
+ typename Container_type::iterator it2 = container.end();
+ for (; it1 != it2; ++it1) {
+ delete (*it1);
+ }
+ container.clear();
+}
+
+/**
+ Clears a container, but frees all objects that the elements point to first.
+ @tparam Container_type Container of pointers.
+ */
+template <typename Container_type>
+void my_free_container_pointers(Container_type &container) {
+ typename Container_type::iterator it1 = container.begin();
+ typename Container_type::iterator it2 = container.end();
+ for (; it1 != it2; ++it1) {
+ my_free(*it1);
+ }
+ container.clear();
+}
+
+/**
+ Casts from one pointer type, to another, without using
+ reinterpret_cast or C-style cast:
+ foo *f; bar *b= pointer_cast<bar*>(f);
+ This avoids having to do:
+ foo *f; bar *b= static_cast<bar*>(static_cast<void*>(f));
+ */
+template <typename T>
+inline T pointer_cast(void *p) {
+ return static_cast<T>(p);
+}
+
+template <typename T>
+inline const T pointer_cast(const void *p) {
+ return static_cast<T>(p);
+}
+
+/**
+ Casts from one pointer type to another in a type hierarchy.
+ In debug mode, we verify the cast is indeed legal.
+
+ @tparam Target The descendent type, must be a pointer type.
+ @tparam Source The parent type.
+
+ @param arg The pointer to be down-cast.
+
+ @return A pointer of type Target.
+*/
+template <typename Target, typename Source>
+inline Target down_cast(Source *arg) {
+ DBUG_ASSERT(NULL != dynamic_cast<Target>(arg));
+ return static_cast<Target>(arg);
+}
+
+/**
+ Casts from one reference type to another in a type hierarchy.
+ In debug mode, we verify the cast is indeed legal.
+
+ @tparam Target The descendent type, must be a reference type.
+ @tparam Source The parent type.
+
+ @param arg The reference to be down-cast.
+
+ @return A reference of type Target.
+*/
+template <typename Target, typename Source>
+inline Target down_cast(Source &arg) {
+ // We still use the pointer version of dynamic_cast, as the
+ // reference-accepting version throws exceptions, and we don't want to deal
+ // with that.
+ DBUG_ASSERT(dynamic_cast<typename std::remove_reference<Target>::type *>(
+ &arg) != nullptr);
+ return static_cast<Target>(arg);
+}
+
+/**
+ Sometimes the compiler insists that types be the same and does not do any
+ implicit conversion. For example:
+ Derived1 *a;
+ Derived2 *b; // Derived1 and 2 are children classes of Base
+ Base *x= cond ? a : b; // Error, need to force a cast.
+
+ Use:
+ Base *x= cond ? implicit_cast<Base*>(a) : implicit_cast<Base*>(b);
+ static_cast would work too, but would be less safe (allows any
+ pointer-to-pointer conversion, not only up-casts).
+*/
+template <typename To>
+inline To implicit_cast(To x) {
+ return x;
+}
+
+/**
+ Utility to allow returning values from functions which can fail
+ (until we have std::optional).
+ */
+template <class VALUE_TYPE>
+struct ReturnValueOrError {
+ /** Value returned from function in the normal case. */
+ VALUE_TYPE value;
+
+ /** True if an error occured. */
+ bool error;
+};
+
+#endif // TEMPLATE_UTILS_INCLUDED
diff --git a/contrib/libs/libmysql_r/include/thr_cond.h b/contrib/libs/libmysql_r/include/thr_cond.h
new file mode 100644
index 0000000000..ef177a21fb
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/thr_cond.h
@@ -0,0 +1,166 @@
+#ifndef THR_COND_INCLUDED
+#define THR_COND_INCLUDED
+
+/* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/thr_cond.h
+ MySQL condition variable implementation.
+
+ There are three "layers":
+ 1) native_cond_*()
+ Functions that map directly down to OS primitives.
+ Windows - ConditionVariable
+ Other OSes - pthread
+ 2) my_cond_*()
+ Functions that use SAFE_MUTEX (default for debug).
+ Otherwise native_cond_*() is used.
+ 3) mysql_cond*()
+ Functions that include Performance Schema instrumentation.
+ See include/mysql/psi/mysql_thread.h
+*/
+
+#include <stddef.h>
+#include <sys/types.h>
+#ifdef _WIN32
+#include <time.h>
+#include "my_systime.h"
+#endif
+
+#include "my_macros.h"
+#include "my_thread.h"
+#include "mysql/components/services/thr_cond_bits.h"
+#include "thr_mutex.h"
+
+#ifdef _WIN32
+/**
+ Convert abstime to milliseconds
+*/
+
+static DWORD get_milliseconds(const struct timespec *abstime) {
+ /*
+ Convert timespec to millis and subtract current time.
+ my_getsystime() returns time in 100 ns units.
+ */
+ ulonglong future = abstime->tv_sec * 1000 + abstime->tv_nsec / 1000000;
+ ulonglong now = my_getsystime() / 10000;
+ /* Don't allow the timeout to be negative. */
+ if (future < now) return 0;
+ return (DWORD)(future - now);
+}
+#endif /* _WIN32 */
+
+static inline int native_cond_init(native_cond_t *cond) {
+#ifdef _WIN32
+ InitializeConditionVariable(cond);
+ return 0;
+#else
+ /* pthread_condattr_t is not used in MySQL */
+ return pthread_cond_init(cond, NULL);
+#endif
+}
+
+static inline int native_cond_destroy(
+ native_cond_t *cond MY_ATTRIBUTE((unused))) {
+#ifdef _WIN32
+ return 0; /* no destroy function */
+#else
+ return pthread_cond_destroy(cond);
+#endif
+}
+
+static inline int native_cond_timedwait(native_cond_t *cond,
+ native_mutex_t *mutex,
+ const struct timespec *abstime) {
+#ifdef _WIN32
+ DWORD timeout = get_milliseconds(abstime);
+ if (!SleepConditionVariableCS(cond, mutex, timeout)) return ETIMEDOUT;
+ return 0;
+#else
+ return pthread_cond_timedwait(cond, mutex, abstime);
+#endif
+}
+
+static inline int native_cond_wait(native_cond_t *cond, native_mutex_t *mutex) {
+#ifdef _WIN32
+ if (!SleepConditionVariableCS(cond, mutex, INFINITE)) return ETIMEDOUT;
+ return 0;
+#else
+ return pthread_cond_wait(cond, mutex);
+#endif
+}
+
+static inline int native_cond_signal(native_cond_t *cond) {
+#ifdef _WIN32
+ WakeConditionVariable(cond);
+ return 0;
+#else
+ return pthread_cond_signal(cond);
+#endif
+}
+
+static inline int native_cond_broadcast(native_cond_t *cond) {
+#ifdef _WIN32
+ WakeAllConditionVariable(cond);
+ return 0;
+#else
+ return pthread_cond_broadcast(cond);
+#endif
+}
+
+#ifdef SAFE_MUTEX
+int safe_cond_wait(native_cond_t *cond, safe_mutex_t *mp, const char *file,
+ uint line);
+int safe_cond_timedwait(native_cond_t *cond, safe_mutex_t *mp,
+ const struct timespec *abstime, const char *file,
+ uint line);
+#endif
+
+static inline int my_cond_timedwait(native_cond_t *cond, my_mutex_t *mp,
+ const struct timespec *abstime
+#ifdef SAFE_MUTEX
+ ,
+ const char *file, uint line
+#endif
+) {
+#ifdef SAFE_MUTEX
+ return safe_cond_timedwait(cond, mp->m_u.m_safe_ptr, abstime, file, line);
+#else
+ return native_cond_timedwait(cond, &mp->m_u.m_native, abstime);
+#endif
+}
+
+static inline int my_cond_wait(native_cond_t *cond, my_mutex_t *mp
+#ifdef SAFE_MUTEX
+ ,
+ const char *file, uint line
+#endif
+) {
+#ifdef SAFE_MUTEX
+ return safe_cond_wait(cond, mp->m_u.m_safe_ptr, file, line);
+#else
+ return native_cond_wait(cond, &mp->m_u.m_native);
+#endif
+}
+
+#endif /* THR_COND_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/thr_lock.h b/contrib/libs/libmysql_r/include/thr_lock.h
new file mode 100644
index 0000000000..8965e65294
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/thr_lock.h
@@ -0,0 +1,178 @@
+/* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/* For use with thr_lock:s */
+
+/**
+ @file include/thr_lock.h
+*/
+
+#ifndef _thr_lock_h
+#define _thr_lock_h
+
+#include <sys/types.h>
+
+#include "my_inttypes.h"
+#include "my_list.h"
+#include "my_thread_local.h"
+#include "mysql/psi/mysql_cond.h"
+#include "mysql/psi/mysql_mutex.h"
+
+extern mysql_mutex_t THR_LOCK_lock;
+
+struct THR_LOCK;
+
+extern ulong locks_immediate, locks_waited;
+
+/*
+ Important: if a new lock type is added, a matching lock description
+ must be added to sql_test.cc's lock_descriptions array.
+*/
+enum thr_lock_type {
+ TL_IGNORE = -1,
+ TL_UNLOCK, /* UNLOCK ANY LOCK */
+ /*
+ Parser only! At open_tables() becomes TL_READ or
+ TL_READ_NO_INSERT depending on the binary log format
+ (SBR/RBR) and on the table category (log table).
+ Used for tables that are read by statements which
+ modify tables.
+ */
+ TL_READ_DEFAULT,
+ TL_READ, /* Read lock */
+ TL_READ_WITH_SHARED_LOCKS,
+ /* High prior. than TL_WRITE. Allow concurrent insert */
+ TL_READ_HIGH_PRIORITY,
+ /* READ, Don't allow concurrent insert */
+ TL_READ_NO_INSERT,
+ /*
+ Write lock, but allow other threads to read / write.
+ Used by BDB tables in MySQL to mark that someone is
+ reading/writing to the table.
+ */
+ TL_WRITE_ALLOW_WRITE,
+ /*
+ parser only! Late bound low_priority_flag.
+ At open_tables() becomes thd->insert_lock_default.
+ */
+ TL_WRITE_CONCURRENT_DEFAULT,
+ /*
+ WRITE lock used by concurrent insert. Will allow
+ READ, if one could use concurrent insert on table.
+ */
+ TL_WRITE_CONCURRENT_INSERT,
+ /*
+ parser only! Late bound low_priority flag.
+ At open_tables() becomes thd->update_lock_default.
+ */
+ TL_WRITE_DEFAULT,
+ /* WRITE lock that has lower priority than TL_READ */
+ TL_WRITE_LOW_PRIORITY,
+ /* Normal WRITE lock */
+ TL_WRITE,
+ /* Abort new lock request with an error */
+ TL_WRITE_ONLY
+};
+
+enum thr_locked_row_action { THR_DEFAULT, THR_WAIT, THR_NOWAIT, THR_SKIP };
+
+struct Lock_descriptor {
+ thr_lock_type type{TL_UNLOCK};
+ thr_locked_row_action action{THR_DEFAULT};
+};
+
+enum enum_thr_lock_result {
+ THR_LOCK_SUCCESS = 0,
+ THR_LOCK_ABORTED = 1,
+ THR_LOCK_WAIT_TIMEOUT = 2,
+ THR_LOCK_DEADLOCK = 3
+};
+
+extern ulong max_write_lock_count;
+extern enum thr_lock_type thr_upgraded_concurrent_insert_lock;
+
+/*
+ A description of the thread which owns the lock. The address
+ of an instance of this structure is used to uniquely identify the thread.
+*/
+
+struct THR_LOCK_INFO {
+ my_thread_id thread_id;
+ mysql_cond_t *suspend;
+};
+
+struct THR_LOCK_DATA {
+ THR_LOCK_INFO *owner{nullptr};
+ THR_LOCK_DATA *next{nullptr}, **prev{nullptr};
+ THR_LOCK *lock{nullptr};
+ mysql_cond_t *cond{nullptr};
+ thr_lock_type type{TL_IGNORE};
+ void *status_param{nullptr}; /* Param to status functions */
+ void *debug_print_param{nullptr};
+ struct PSI_table *m_psi{nullptr};
+};
+
+struct st_lock_list {
+ THR_LOCK_DATA *data{nullptr}, **last{nullptr};
+};
+
+struct THR_LOCK {
+ LIST list;
+ mysql_mutex_t mutex;
+ struct st_lock_list read_wait;
+ struct st_lock_list read;
+ struct st_lock_list write_wait;
+ struct st_lock_list write;
+ /* write_lock_count is incremented for write locks and reset on read locks */
+ ulong write_lock_count{0};
+ uint read_no_write_count{0};
+ void (*get_status)(void *, int){0}; /* When one gets a lock */
+ void (*copy_status)(void *, void *){0};
+ void (*update_status)(void *){0}; /* Before release of write */
+ void (*restore_status)(void *){0}; /* Before release of read */
+ bool (*check_status)(void *){0};
+};
+
+extern LIST *thr_lock_thread_list;
+
+void thr_lock_info_init(THR_LOCK_INFO *info, my_thread_id thread_id,
+ mysql_cond_t *suspend);
+void thr_lock_init(THR_LOCK *lock);
+void thr_lock_delete(THR_LOCK *lock);
+void thr_lock_data_init(THR_LOCK *lock, THR_LOCK_DATA *data,
+ void *status_param);
+enum enum_thr_lock_result thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner,
+ enum thr_lock_type lock_type,
+ ulong lock_wait_timeout);
+void thr_unlock(THR_LOCK_DATA *data);
+enum enum_thr_lock_result thr_multi_lock(THR_LOCK_DATA **data, uint count,
+ THR_LOCK_INFO *owner,
+ ulong lock_wait_timeout);
+void thr_multi_unlock(THR_LOCK_DATA **data, uint count);
+void thr_lock_merge_status(THR_LOCK_DATA **data, uint count);
+void thr_abort_locks_for_thread(THR_LOCK *lock, my_thread_id thread);
+void thr_print_locks(void); /* For debugging */
+void thr_downgrade_write_lock(THR_LOCK_DATA *data,
+ enum thr_lock_type new_lock_type);
+void thr_set_lock_wait_callback(void (*before_wait)(void),
+ void (*after_wait)(void));
+#endif /* _thr_lock_h */
diff --git a/contrib/libs/libmysql_r/include/thr_mutex.h b/contrib/libs/libmysql_r/include/thr_mutex.h
new file mode 100644
index 0000000000..f52c5c5ba2
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/thr_mutex.h
@@ -0,0 +1,241 @@
+#ifndef THR_MUTEX_INCLUDED
+#define THR_MUTEX_INCLUDED
+
+/* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/thr_mutex.h
+ MySQL mutex implementation.
+
+ There are three "layers":
+ 1) native_mutex_*()
+ Functions that map directly down to OS primitives.
+ Windows - CriticalSection
+ Other OSes - pthread
+ 2) my_mutex_*()
+ Functions that implement SAFE_MUTEX (default for debug),
+ Otherwise native_mutex_*() is used.
+ 3) mysql_mutex_*()
+ Functions that include Performance Schema instrumentation.
+ See include/mysql/psi/mysql_thread.h
+*/
+
+#include <stddef.h>
+#include <sys/types.h>
+
+#include "my_dbug.h"
+#include "my_inttypes.h"
+#include "my_macros.h"
+#include "my_thread.h"
+
+/*
+ The following are part of the services ABI:
+ - native_mutex_t
+ - my_mutex_t
+*/
+#include "mysql/components/services/thr_mutex_bits.h"
+
+/* Define mutex types, see my_thr_init.c */
+#define MY_MUTEX_INIT_SLOW NULL
+
+/* Can be set in /usr/include/pthread.h */
+#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
+extern native_mutexattr_t my_fast_mutexattr;
+#define MY_MUTEX_INIT_FAST &my_fast_mutexattr
+#else
+#define MY_MUTEX_INIT_FAST NULL
+#endif
+
+/* Can be set in /usr/include/pthread.h */
+#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
+extern native_mutexattr_t my_errorcheck_mutexattr;
+#define MY_MUTEX_INIT_ERRCHK &my_errorcheck_mutexattr
+#else
+#define MY_MUTEX_INIT_ERRCHK NULL
+#endif
+
+static inline int native_mutex_init(native_mutex_t *mutex,
+ const native_mutexattr_t *attr
+ MY_ATTRIBUTE((unused))) {
+#ifdef _WIN32
+ InitializeCriticalSection(mutex);
+ return 0;
+#else
+ return pthread_mutex_init(mutex, attr);
+#endif
+}
+
+static inline int native_mutex_lock(native_mutex_t *mutex) {
+#ifdef _WIN32
+ EnterCriticalSection(mutex);
+ return 0;
+#else
+ return pthread_mutex_lock(mutex);
+#endif
+}
+
+static inline int native_mutex_trylock(native_mutex_t *mutex) {
+#ifdef _WIN32
+ if (TryEnterCriticalSection(mutex)) {
+ /* Don't allow recursive lock */
+ if (mutex->RecursionCount > 1) {
+ LeaveCriticalSection(mutex);
+ return EBUSY;
+ }
+ return 0;
+ }
+ return EBUSY;
+#else
+ return pthread_mutex_trylock(mutex);
+#endif
+}
+
+static inline int native_mutex_unlock(native_mutex_t *mutex) {
+#ifdef _WIN32
+ LeaveCriticalSection(mutex);
+ return 0;
+#else
+ return pthread_mutex_unlock(mutex);
+#endif
+}
+
+static inline int native_mutex_destroy(native_mutex_t *mutex) {
+#ifdef _WIN32
+ DeleteCriticalSection(mutex);
+ return 0;
+#else
+ return pthread_mutex_destroy(mutex);
+#endif
+}
+
+#ifdef SAFE_MUTEX
+/* safe_mutex adds checking to mutex for easier debugging */
+struct safe_mutex_t {
+ native_mutex_t global, mutex;
+ const char *file;
+ uint line, count;
+ my_thread_t thread;
+};
+
+void safe_mutex_global_init();
+int safe_mutex_init(safe_mutex_t *mp, const native_mutexattr_t *attr,
+ const char *file, uint line);
+int safe_mutex_lock(safe_mutex_t *mp, bool try_lock, const char *file,
+ uint line);
+int safe_mutex_unlock(safe_mutex_t *mp, const char *file, uint line);
+int safe_mutex_destroy(safe_mutex_t *mp, const char *file, uint line);
+
+static inline void safe_mutex_assert_owner(safe_mutex_t *mp) {
+ DBUG_ASSERT(mp != NULL);
+ native_mutex_lock(&mp->global);
+ DBUG_ASSERT(mp->count > 0 && my_thread_equal(my_thread_self(), mp->thread));
+ native_mutex_unlock(&mp->global);
+}
+
+static inline void safe_mutex_assert_not_owner(safe_mutex_t *mp) {
+ DBUG_ASSERT(mp != NULL);
+ native_mutex_lock(&mp->global);
+ DBUG_ASSERT(!mp->count || !my_thread_equal(my_thread_self(), mp->thread));
+ native_mutex_unlock(&mp->global);
+}
+#endif /* SAFE_MUTEX */
+
+static inline int my_mutex_init(my_mutex_t *mp, const native_mutexattr_t *attr
+#ifdef SAFE_MUTEX
+ ,
+ const char *file, uint line
+#endif
+) {
+#ifdef SAFE_MUTEX
+ DBUG_ASSERT(mp != NULL);
+ mp->m_u.m_safe_ptr = (safe_mutex_t *)malloc(sizeof(safe_mutex_t));
+ return safe_mutex_init(mp->m_u.m_safe_ptr, attr, file, line);
+#else
+ return native_mutex_init(&mp->m_u.m_native, attr);
+#endif
+}
+
+static inline int my_mutex_lock(my_mutex_t *mp
+#ifdef SAFE_MUTEX
+ ,
+ const char *file, uint line
+#endif
+) {
+#ifdef SAFE_MUTEX
+ DBUG_ASSERT(mp != NULL);
+ DBUG_ASSERT(mp->m_u.m_safe_ptr != NULL);
+ return safe_mutex_lock(mp->m_u.m_safe_ptr, false, file, line);
+#else
+ return native_mutex_lock(&mp->m_u.m_native);
+#endif
+}
+
+static inline int my_mutex_trylock(my_mutex_t *mp
+#ifdef SAFE_MUTEX
+ ,
+ const char *file, uint line
+#endif
+) {
+#ifdef SAFE_MUTEX
+ DBUG_ASSERT(mp != NULL);
+ DBUG_ASSERT(mp->m_u.m_safe_ptr != NULL);
+ return safe_mutex_lock(mp->m_u.m_safe_ptr, true, file, line);
+#else
+ return native_mutex_trylock(&mp->m_u.m_native);
+#endif
+}
+
+static inline int my_mutex_unlock(my_mutex_t *mp
+#ifdef SAFE_MUTEX
+ ,
+ const char *file, uint line
+#endif
+) {
+#ifdef SAFE_MUTEX
+ DBUG_ASSERT(mp != NULL);
+ DBUG_ASSERT(mp->m_u.m_safe_ptr != NULL);
+ return safe_mutex_unlock(mp->m_u.m_safe_ptr, file, line);
+#else
+ return native_mutex_unlock(&mp->m_u.m_native);
+#endif
+}
+
+static inline int my_mutex_destroy(my_mutex_t *mp
+#ifdef SAFE_MUTEX
+ ,
+ const char *file, uint line
+#endif
+) {
+#ifdef SAFE_MUTEX
+ DBUG_ASSERT(mp != NULL);
+ DBUG_ASSERT(mp->m_u.m_safe_ptr != NULL);
+ int rc = safe_mutex_destroy(mp->m_u.m_safe_ptr, file, line);
+ free(mp->m_u.m_safe_ptr);
+ mp->m_u.m_safe_ptr = NULL;
+ return rc;
+#else
+ return native_mutex_destroy(&mp->m_u.m_native);
+#endif
+}
+
+#endif /* THR_MUTEX_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/thr_rwlock.h b/contrib/libs/libmysql_r/include/thr_rwlock.h
new file mode 100644
index 0000000000..6251303d48
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/thr_rwlock.h
@@ -0,0 +1,148 @@
+#ifndef THR_RWLOCK_INCLUDED
+#define THR_RWLOCK_INCLUDED
+
+/* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/thr_rwlock.h
+ MySQL rwlock implementation.
+
+ There are two "layers":
+ 1) native_rw_*()
+ Functions that map directly down to OS primitives.
+ Windows - SRWLock
+ Other OSes - pthread
+ 2) mysql_rw*()
+ Functions that include Performance Schema instrumentation.
+ See include/mysql/psi/mysql_thread.h
+
+ This file also includes rw_pr_*(), which implements a special
+ version of rwlocks that prefer readers. The P_S version of these
+ are mysql_prlock_*() - see include/mysql/psi/mysql_thread.h
+*/
+
+#include <stddef.h>
+#include <sys/types.h>
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
+#include "my_dbug.h"
+#include "my_inttypes.h"
+#include "my_macros.h"
+#include "my_thread.h"
+#include "mysql/components/services/thr_rwlock_bits.h"
+#include "thr_cond.h"
+#include "thr_mutex.h"
+
+static inline int native_rw_init(native_rw_lock_t *rwp) {
+#ifdef _WIN32
+ InitializeSRWLock(&rwp->srwlock);
+ rwp->have_exclusive_srwlock = false;
+ return 0;
+#else
+ /* pthread_rwlockattr_t is not used in MySQL */
+ return pthread_rwlock_init(rwp, NULL);
+#endif
+}
+
+static inline int native_rw_destroy(
+ native_rw_lock_t *rwp MY_ATTRIBUTE((unused))) {
+#ifdef _WIN32
+ return 0; /* no destroy function */
+#else
+ return pthread_rwlock_destroy(rwp);
+#endif
+}
+
+static inline int native_rw_rdlock(native_rw_lock_t *rwp) {
+#ifdef _WIN32
+ AcquireSRWLockShared(&rwp->srwlock);
+ return 0;
+#else
+ return pthread_rwlock_rdlock(rwp);
+#endif
+}
+
+static inline int native_rw_tryrdlock(native_rw_lock_t *rwp) {
+#ifdef _WIN32
+ if (!TryAcquireSRWLockShared(&rwp->srwlock)) return EBUSY;
+ return 0;
+#else
+ return pthread_rwlock_tryrdlock(rwp);
+#endif
+}
+
+static inline int native_rw_wrlock(native_rw_lock_t *rwp) {
+#ifdef _WIN32
+ AcquireSRWLockExclusive(&rwp->srwlock);
+ rwp->have_exclusive_srwlock = true;
+ return 0;
+#else
+ return pthread_rwlock_wrlock(rwp);
+#endif
+}
+
+static inline int native_rw_trywrlock(native_rw_lock_t *rwp) {
+#ifdef _WIN32
+ if (!TryAcquireSRWLockExclusive(&rwp->srwlock)) return EBUSY;
+ rwp->have_exclusive_srwlock = true;
+ return 0;
+#else
+ return pthread_rwlock_trywrlock(rwp);
+#endif
+}
+
+static inline int native_rw_unlock(native_rw_lock_t *rwp) {
+#ifdef _WIN32
+ if (rwp->have_exclusive_srwlock) {
+ rwp->have_exclusive_srwlock = false;
+ ReleaseSRWLockExclusive(&rwp->srwlock);
+ } else
+ ReleaseSRWLockShared(&rwp->srwlock);
+ return 0;
+#else
+ return pthread_rwlock_unlock(rwp);
+#endif
+}
+
+extern int rw_pr_init(rw_pr_lock_t *);
+extern int rw_pr_rdlock(rw_pr_lock_t *);
+extern int rw_pr_wrlock(rw_pr_lock_t *);
+extern int rw_pr_unlock(rw_pr_lock_t *);
+extern int rw_pr_destroy(rw_pr_lock_t *);
+
+#ifdef SAFE_MUTEX
+static inline void rw_pr_lock_assert_write_owner(const rw_pr_lock_t *rwlock) {
+ DBUG_ASSERT(rwlock->active_writer &&
+ my_thread_equal(my_thread_self(), rwlock->writer_thread));
+}
+
+static inline void rw_pr_lock_assert_not_write_owner(
+ const rw_pr_lock_t *rwlock) {
+ DBUG_ASSERT(!rwlock->active_writer ||
+ !my_thread_equal(my_thread_self(), rwlock->writer_thread));
+}
+#endif
+
+#endif /* THR_RWLOCK_INCLUDED */
diff --git a/contrib/libs/libmysql_r/include/typelib.h b/contrib/libs/libmysql_r/include/typelib.h
new file mode 100644
index 0000000000..39d8834ab4
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/typelib.h
@@ -0,0 +1,67 @@
+/* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef _typelib_h
+#define _typelib_h
+
+/**
+ @file include/typelib.h
+*/
+
+#include "my_inttypes.h"
+
+struct MEM_ROOT;
+
+struct TYPELIB { /* Different types saved here */
+ size_t count{0}; /* How many types */
+ const char *name{nullptr}; /* Name of typelib */
+ const char **type_names{nullptr};
+ unsigned int *type_lengths{nullptr};
+};
+
+extern my_ulonglong find_typeset(const char *x, TYPELIB *typelib,
+ int *error_position);
+extern int find_type_or_exit(const char *x, TYPELIB *typelib,
+ const char *option);
+#define FIND_TYPE_BASIC 0
+/** makes @c find_type() require the whole name, no prefix */
+#define FIND_TYPE_NO_PREFIX (1 << 0)
+/** always implicitely on, so unused, but old code may pass it */
+#define FIND_TYPE_NO_OVERWRITE (1 << 1)
+/** makes @c find_type() accept a number */
+#define FIND_TYPE_ALLOW_NUMBER (1 << 2)
+/** makes @c find_type() treat ',' as terminator */
+#define FIND_TYPE_COMMA_TERM (1 << 3)
+
+extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags);
+extern void make_type(char *to, unsigned int nr, TYPELIB *typelib);
+extern const char *get_type(TYPELIB *typelib, unsigned int nr);
+extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from);
+
+extern TYPELIB sql_protocol_typelib;
+
+my_ulonglong find_set_from_flags(const TYPELIB *lib, size_t default_name,
+ my_ulonglong cur_set, my_ulonglong default_set,
+ const char *str, unsigned int length,
+ const char **err_pos, unsigned int *err_len);
+
+#endif /* _typelib_h */
diff --git a/contrib/libs/libmysql_r/include/violite.h b/contrib/libs/libmysql_r/include/violite.h
new file mode 100644
index 0000000000..b0c5c6958b
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/violite.h
@@ -0,0 +1,460 @@
+/* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License, version 2.0, for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file include/violite.h
+ Vio Lite.
+ Purpose: include file for Vio that will work with C and C++.
+*/
+
+#ifndef vio_violite_h_
+#define vio_violite_h_
+
+#include "my_config.h"
+
+#include <stddef.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#include <sys/types.h>
+
+#include <string>
+
+#include "my_inttypes.h"
+#include "my_psi_config.h" // IWYU pragma: keep
+#include "mysql/components/services/my_io_bits.h"
+#include "mysql/components/services/my_thread_bits.h"
+#include "mysql/components/services/mysql_socket_bits.h"
+
+struct Vio;
+
+/* Simple vio interface in C; The functions are implemented in violite.c */
+
+#if !defined(_WIN32) && !defined(HAVE_KQUEUE) && !defined(__SUNPRO_CC)
+#define USE_PPOLL_IN_VIO
+#endif
+
+#if defined(__cplusplus) && defined(USE_PPOLL_IN_VIO)
+#include <signal.h>
+#include <atomic>
+#elif defined(__cplusplus) && defined(HAVE_KQUEUE)
+#include <sys/event.h>
+#include <atomic>
+#endif
+
+#ifdef HAVE_PSI_INTERFACE
+void init_vio_psi_keys();
+#endif
+
+#ifndef MYSQL_VIO
+struct Vio;
+
+typedef Vio Vio;
+#define MYSQL_VIO Vio *
+#endif
+
+enum enum_vio_type : int {
+ /**
+ Type of the connection is unknown.
+ */
+ NO_VIO_TYPE = 0,
+ /**
+ Used in case of TCP/IP connections.
+ */
+ VIO_TYPE_TCPIP = 1,
+ /**
+ Used for Unix Domain socket connections. Unix only.
+ */
+ VIO_TYPE_SOCKET = 2,
+ /**
+ Used for named pipe connections. Windows only.
+ */
+ VIO_TYPE_NAMEDPIPE = 3,
+ /**
+ Used in case of SSL connections.
+ */
+ VIO_TYPE_SSL = 4,
+ /**
+ Used for shared memory connections. Windows only.
+ */
+ VIO_TYPE_SHARED_MEMORY = 5,
+ /**
+ Used internally by the prepared statements
+ */
+ VIO_TYPE_LOCAL = 6,
+ /**
+ Implicitly used by plugins that doesn't support any other VIO_TYPE.
+ */
+ VIO_TYPE_PLUGIN = 7,
+
+ FIRST_VIO_TYPE = VIO_TYPE_TCPIP,
+ /*
+ If a new type is added, please update LAST_VIO_TYPE. In addition, please
+ change get_vio_type_name() in vio/vio.c to return correct name for it.
+ */
+ LAST_VIO_TYPE = VIO_TYPE_PLUGIN
+};
+
+/**
+ Convert a vio type to a printable string.
+ @param vio_type the type
+ @param[out] str the string
+ @param[out] len the string length
+*/
+void get_vio_type_name(enum enum_vio_type vio_type, const char **str, int *len);
+
+/**
+ VIO I/O events.
+*/
+enum enum_vio_io_event {
+ VIO_IO_EVENT_READ,
+ VIO_IO_EVENT_WRITE,
+ VIO_IO_EVENT_CONNECT
+};
+
+#define VIO_SOCKET_ERROR ((size_t)-1)
+#define VIO_SOCKET_WANT_READ ((size_t)-2)
+#define VIO_SOCKET_WANT_WRITE ((size_t)-3)
+
+#define VIO_LOCALHOST 1 /* a localhost connection */
+#define VIO_BUFFERED_READ 2 /* use buffered read */
+#define VIO_READ_BUFFER_SIZE 16384 /* size of read buffer */
+#define OPENSSL_ERROR_LENGTH 512 /* Openssl error code max length */
+
+MYSQL_VIO vio_new(my_socket sd, enum enum_vio_type type, uint flags);
+MYSQL_VIO mysql_socket_vio_new(MYSQL_SOCKET mysql_socket,
+ enum enum_vio_type type, uint flags);
+
+#ifdef _WIN32
+MYSQL_VIO vio_new_win32pipe(HANDLE hPipe);
+MYSQL_VIO vio_new_win32shared_memory(HANDLE handle_file_map, HANDLE handle_map,
+ HANDLE event_server_wrote,
+ HANDLE event_server_read,
+ HANDLE event_client_wrote,
+ HANDLE event_client_read,
+ HANDLE event_conn_closed);
+#else
+#define HANDLE void *
+#endif /* _WIN32 */
+
+void vio_delete(MYSQL_VIO vio);
+int vio_shutdown(MYSQL_VIO vio);
+bool vio_reset(MYSQL_VIO vio, enum enum_vio_type type, my_socket sd, void *ssl,
+ uint flags);
+bool vio_is_blocking(Vio *vio);
+int vio_set_blocking(Vio *vio, bool set_blocking_mode);
+int vio_set_blocking_flag(Vio *vio, bool set_blocking_flag);
+size_t vio_read(MYSQL_VIO vio, uchar *buf, size_t size);
+size_t vio_read_buff(MYSQL_VIO vio, uchar *buf, size_t size);
+size_t vio_write(MYSQL_VIO vio, const uchar *buf, size_t size);
+/* setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible */
+int vio_fastsend(MYSQL_VIO vio);
+/* setsockopt SO_KEEPALIVE at SOL_SOCKET level, when possible */
+int vio_keepalive(MYSQL_VIO vio, bool onoff);
+/* Whenever we should retry the last read/write operation. */
+bool vio_should_retry(MYSQL_VIO vio);
+/* Check that operation was timed out */
+bool vio_was_timeout(MYSQL_VIO vio);
+/* Short text description of the socket for those, who are curious.. */
+#define VIO_DESCRIPTION_SIZE 30 /* size of description */
+void vio_description(MYSQL_VIO vio, char *buf);
+/* Return the type of the connection */
+enum enum_vio_type vio_type(const MYSQL_VIO vio);
+/* Return last error number */
+int vio_errno(MYSQL_VIO vio);
+/* Get socket number */
+my_socket vio_fd(MYSQL_VIO vio);
+/* Remote peer's address and name in text form */
+bool vio_peer_addr(MYSQL_VIO vio, char *buf, uint16 *port, size_t buflen);
+/* Wait for an I/O event notification. */
+int vio_io_wait(MYSQL_VIO vio, enum enum_vio_io_event event, int timeout);
+bool vio_is_connected(MYSQL_VIO vio);
+#ifndef DBUG_OFF
+ssize_t vio_pending(MYSQL_VIO vio);
+#endif
+/* Set timeout for a network operation. */
+int vio_timeout(MYSQL_VIO vio, uint which, int timeout_sec);
+/* Connect to a peer. */
+bool vio_socket_connect(MYSQL_VIO vio, struct sockaddr *addr, socklen_t len,
+ bool nonblocking, int timeout);
+
+bool vio_get_normalized_ip_string(const struct sockaddr *addr,
+ size_t addr_length, char *ip_string,
+ size_t ip_string_size);
+
+bool vio_is_no_name_error(int err_code);
+
+int vio_getnameinfo(const struct sockaddr *sa, char *hostname,
+ size_t hostname_size, char *port, size_t port_size,
+ int flags);
+
+#if defined(HAVE_OPENSSL)
+extern "C" {
+#include <openssl/opensslv.h>
+}
+#if OPENSSL_VERSION_NUMBER < 0x0090700f
+#define DES_cblock des_cblock
+#define DES_key_schedule des_key_schedule
+#define DES_set_key_unchecked(k, ks) des_set_key_unchecked((k), *(ks))
+#define DES_ede3_cbc_encrypt(i, o, l, k1, k2, k3, iv, e) \
+ des_ede3_cbc_encrypt((i), (o), (l), *(k1), *(k2), *(k3), (iv), (e))
+#endif
+
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+#define HAVE_OPENSSL11 1
+#endif // OPENSSL_VERSION_NUMBER
+
+/* apple deprecated openssl in MacOSX Lion */
+#ifdef __APPLE__
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+
+#define HEADER_DES_LOCL_H dummy_something
+#ifndef WOLFSSL_MYSQL_COMPATIBLE
+#define WOLFSSL_MYSQL_COMPATIBLE
+#endif
+/* Set wolfSSL to use same type as MySQL do for socket handles */
+typedef my_socket WOLFSSL_SOCKET_T;
+#define WOLFSSL_SOCKET_T_DEFINED
+
+// clang-format off
+#include <wolfssl_fix_namespace_pollution_pre.h>
+#include <openssl/err.h>
+#include <openssl/ssl.h>
+#include <wolfssl_fix_namespace_pollution.h>
+// clang-format on
+
+enum enum_ssl_init_error {
+ SSL_INITERR_NOERROR = 0,
+ SSL_INITERR_CERT,
+ SSL_INITERR_KEY,
+ SSL_INITERR_NOMATCH,
+ SSL_INITERR_BAD_PATHS,
+ SSL_INITERR_CIPHERS,
+ SSL_INITERR_MEMFAIL,
+ SSL_INITERR_NO_USABLE_CTX,
+ SSL_INITERR_DHFAIL,
+ SSL_TLS_VERSION_INVALID,
+ SSL_FIPS_MODE_INVALID,
+ SSL_FIPS_MODE_FAILED,
+ SSL_INITERR_LASTERR
+};
+const char *sslGetErrString(enum enum_ssl_init_error err);
+
+struct st_VioSSLFd {
+ SSL_CTX *ssl_context;
+};
+
+int sslaccept(struct st_VioSSLFd *, MYSQL_VIO, long timeout,
+ unsigned long *errptr);
+int sslconnect(struct st_VioSSLFd *, MYSQL_VIO, long timeout,
+ unsigned long *errptr, SSL **ssl);
+
+struct st_VioSSLFd *new_VioSSLConnectorFd(
+ const char *key_file, const char *cert_file, const char *ca_file,
+ const char *ca_path, const char *cipher, const char *ciphersuites,
+ enum enum_ssl_init_error *error, const char *crl_file, const char *crl_path,
+ const long ssl_ctx_flags);
+
+long process_tls_version(const char *tls_version);
+
+int set_fips_mode(const uint fips_mode, char *err_string);
+
+uint get_fips_mode();
+
+struct st_VioSSLFd *new_VioSSLAcceptorFd(
+ const char *key_file, const char *cert_file, const char *ca_file,
+ const char *ca_path, const char *cipher, const char *ciphersuites,
+ enum enum_ssl_init_error *error, const char *crl_file, const char *crl_path,
+ const long ssl_ctx_flags);
+void free_vio_ssl_acceptor_fd(struct st_VioSSLFd *fd);
+
+void vio_ssl_end();
+
+#endif /* HAVE_OPENSSL */
+
+void ssl_start(void);
+void vio_end(void);
+
+#if !defined(DONT_MAP_VIO)
+#define vio_delete(vio) (vio)->viodelete(vio)
+#define vio_errno(vio) (vio)->vioerrno(vio)
+#define vio_read(vio, buf, size) ((vio)->read)(vio, buf, size)
+#define vio_write(vio, buf, size) ((vio)->write)(vio, buf, size)
+#define vio_fastsend(vio) (vio)->fastsend(vio)
+#define vio_keepalive(vio, set_keep_alive) \
+ (vio)->viokeepalive(vio, set_keep_alive)
+#define vio_should_retry(vio) (vio)->should_retry(vio)
+#define vio_was_timeout(vio) (vio)->was_timeout(vio)
+#define vio_shutdown(vio) ((vio)->vioshutdown)(vio)
+#define vio_peer_addr(vio, buf, prt, buflen) \
+ (vio)->peer_addr(vio, buf, prt, buflen)
+#define vio_io_wait(vio, event, timeout) (vio)->io_wait(vio, event, timeout)
+#define vio_is_connected(vio) (vio)->is_connected(vio)
+#define vio_is_blocking(vio) (vio)->is_blocking(vio)
+#define vio_set_blocking(vio, val) (vio)->set_blocking(vio, val)
+#define vio_set_blocking_flag(vio, val) (vio)->set_blocking_flag(vio, val)
+#endif /* !defined(DONT_MAP_VIO) */
+
+/* This enumerator is used in parser - should be always visible */
+enum SSL_type {
+ SSL_TYPE_NOT_SPECIFIED = -1,
+ SSL_TYPE_NONE,
+ SSL_TYPE_ANY,
+ SSL_TYPE_X509,
+ SSL_TYPE_SPECIFIED
+};
+
+/*
+ This structure is for every connection on both sides.
+ Note that it has a non-default move assignment operator, so if adding more
+ members, you'll need to update operator=.
+*/
+struct Vio {
+ MYSQL_SOCKET mysql_socket; /* Instrumented socket */
+ bool localhost = {false}; /* Are we from localhost? */
+ enum_vio_type type = {NO_VIO_TYPE}; /* Type of connection */
+
+ int read_timeout = {-1}; /* Timeout value (ms) for read ops. */
+ int write_timeout = {-1}; /* Timeout value (ms) for write ops. */
+ int retry_count = {1}; /* Retry count */
+ bool inactive = {false}; /* Connection has been shutdown */
+
+ struct sockaddr_storage local; /* Local internet address */
+ struct sockaddr_storage remote; /* Remote internet address */
+ size_t addrLen = {0}; /* Length of remote address */
+ char *read_buffer = {nullptr}; /* buffer for vio_read_buff */
+ char *read_pos = {nullptr}; /* start of unfetched data in the
+ read buffer */
+ char *read_end = {nullptr}; /* end of unfetched data */
+
+#ifdef USE_PPOLL_IN_VIO
+ my_thread_t thread_id = {0}; // Thread PID
+ sigset_t signal_mask; // Signal mask
+ /*
+ Flag to indicate whether we are in poll or shutdown.
+ A true value of flag indicates either the socket
+ has called shutdown or it is sleeping on a poll call.
+ False value of this flag means that the socket is
+ not sleeping on a poll call.
+ This flag provides synchronization between two threads
+ one entering vio_io_wait and another entering vio_shutdown
+ for the same socket. If the other thread is waiting on poll
+ sleep, it wakes up the thread by sending a signal via
+ pthread_kill. Also it ensures that no other thread enters in
+ to a poll call if it's socket has undergone shutdown.
+
+ */
+ std::atomic_flag poll_shutdown_flag = ATOMIC_FLAG_INIT;
+#elif defined HAVE_KQUEUE
+ int kq_fd = {-1};
+ std::atomic_flag kevent_wakeup_flag = ATOMIC_FLAG_INIT;
+#endif
+
+#ifdef HAVE_SETNS
+ /**
+ Socket network namespace.
+ */
+ char network_namespace[256];
+#endif
+ /*
+ VIO vtable interface to be implemented by VIO's like SSL, Socket,
+ Named Pipe, etc.
+ */
+
+ /*
+ viodelete is responsible for cleaning up the VIO object by freeing
+ internal buffers, closing descriptors, handles.
+ */
+ void (*viodelete)(MYSQL_VIO) = {nullptr};
+ int (*vioerrno)(MYSQL_VIO) = {nullptr};
+ size_t (*read)(MYSQL_VIO, uchar *, size_t) = {nullptr};
+ size_t (*write)(MYSQL_VIO, const uchar *, size_t) = {nullptr};
+ int (*timeout)(MYSQL_VIO, uint, bool) = {nullptr};
+ int (*viokeepalive)(MYSQL_VIO, bool) = {nullptr};
+ int (*fastsend)(MYSQL_VIO) = {nullptr};
+ bool (*peer_addr)(MYSQL_VIO, char *, uint16 *, size_t) = {nullptr};
+ void (*in_addr)(MYSQL_VIO, struct sockaddr_storage *) = {nullptr};
+ bool (*should_retry)(MYSQL_VIO) = {nullptr};
+ bool (*was_timeout)(MYSQL_VIO) = {nullptr};
+ /*
+ vioshutdown is resposnible to shutdown/close the channel, so that no
+ further communications can take place, however any related buffers,
+ descriptors, handles can remain valid after a shutdown.
+ */
+ int (*vioshutdown)(MYSQL_VIO) = {nullptr};
+ bool (*is_connected)(MYSQL_VIO) = {nullptr};
+ bool (*has_data)(MYSQL_VIO) = {nullptr};
+ int (*io_wait)(MYSQL_VIO, enum enum_vio_io_event, int) = {nullptr};
+ bool (*connect)(MYSQL_VIO, struct sockaddr *, socklen_t, int) = {nullptr};
+#ifdef _WIN32
+#ifdef __clang__
+ OVERLAPPED overlapped = {0, 0, {{0, 0}}, nullptr};
+#else
+ // MSVC, at least up to 2015, gives an internal error on the above.
+ OVERLAPPED overlapped = {0};
+#endif
+ HANDLE hPipe{nullptr};
+#endif
+#ifdef HAVE_OPENSSL
+ void *ssl_arg = {nullptr};
+#endif
+#if defined(_WIN32)
+ HANDLE handle_file_map = {nullptr};
+ char *handle_map = {nullptr};
+ HANDLE event_server_wrote = {nullptr};
+ HANDLE event_server_read = {nullptr};
+ HANDLE event_client_wrote = {nullptr};
+ HANDLE event_client_read = {nullptr};
+ HANDLE event_conn_closed = {nullptr};
+ size_t shared_memory_remain = {0};
+ char *shared_memory_pos = {nullptr};
+
+#endif /* _WIN32 */
+ bool (*is_blocking)(Vio *vio) = {nullptr};
+ int (*set_blocking)(Vio *vio, bool val) = {nullptr};
+ int (*set_blocking_flag)(Vio *vio, bool val) = {nullptr};
+ /* Indicates whether socket or SSL based communication is blocking or not. */
+ bool is_blocking_flag = {true};
+
+ private:
+ friend Vio *internal_vio_create(uint flags);
+ friend void internal_vio_delete(Vio *vio);
+ friend bool vio_reset(Vio *vio, enum_vio_type type, my_socket sd, void *ssl,
+ uint flags);
+
+ explicit Vio(uint flags);
+ ~Vio();
+
+ public:
+ Vio(const Vio &) = delete;
+ Vio &operator=(const Vio &) = delete;
+ Vio &operator=(Vio &&vio);
+};
+
+#ifdef HAVE_OPENSSL
+#define SSL_handle SSL *
+#else
+#define SSL_handle void *
+#endif
+
+#endif /* vio_violite_h_ */
diff --git a/contrib/libs/libmysql_r/include/wolfssl_fix_namespace_pollution.h b/contrib/libs/libmysql_r/include/wolfssl_fix_namespace_pollution.h
new file mode 100644
index 0000000000..5de26bc87e
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/wolfssl_fix_namespace_pollution.h
@@ -0,0 +1,64 @@
+/* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License, version 2.0,
+as published by the Free Software Foundation.
+
+This program is also distributed with certain software (including
+but not limited to OpenSSL) that is licensed under separate terms,
+as designated in a particular file or component or in included license
+documentation. The authors of MySQL hereby grant you an additional
+permission to link the program and your derivative works with the
+separately licensed software that they have included with MySQL.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License, version 2.0, for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ The WolfSSL library does #define certain global symbol that pollute the
+ C namespace.
+ This file is to be included after the wolf headers to fix this.
+*/
+#ifndef WOLFSSL_FIX_NAMESPACE_POLLUTION_H
+#define WOLFSSL_FIX_NAMESPACE_POLLUTION_H 1
+
+#ifdef HAVE_WOLFSSL
+
+#if defined(_WIN32)
+/* defined in wolfssl's io.h. Replaces all mentions of the word close */
+#if defined(close)
+#undef close
+#endif
+
+/*
+ Defined in wolfssl's io.h.
+ Conflict with the same constants defined in mysql
+ Keep in sync with my_io.h
+*/
+#if defined(SOCKET_EWOULDBLOCK)
+#undef SOCKET_EWOULDBLOCK
+#define SOCKET_EWOULDBLOCK WSAEWOULDBLOCK
+#endif
+#if defined(SOCKET_EAGAIN)
+#undef SOCKET_EAGAIN
+#define SOCKET_EAGAIN WSAEINPROGRESS
+#endif
+#if defined(SOCKET_ECONNRESET)
+#undef SOCKET_ECONNRESET
+#define SOCKET_ECONNRESET WSAECONNRESET
+#endif
+#if defined(SOCKET_EINTR)
+#undef SOCKET_EINTR
+#define SOCKET_EINTR WSAEINTR
+#endif
+
+#endif /* _WIN32 */
+#endif /* HAVE_WOLFSSL */
+
+#endif /* WOLFSSL_FIX_NAMESPACE_POLLUTION_H */
diff --git a/contrib/libs/libmysql_r/include/wolfssl_fix_namespace_pollution_pre.h b/contrib/libs/libmysql_r/include/wolfssl_fix_namespace_pollution_pre.h
new file mode 100644
index 0000000000..ff39405403
--- /dev/null
+++ b/contrib/libs/libmysql_r/include/wolfssl_fix_namespace_pollution_pre.h
@@ -0,0 +1,55 @@
+/* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License, version 2.0,
+as published by the Free Software Foundation.
+
+This program is also distributed with certain software (including
+but not limited to OpenSSL) that is licensed under separate terms,
+as designated in a particular file or component or in included license
+documentation. The authors of MySQL hereby grant you an additional
+permission to link the program and your derivative works with the
+separately licensed software that they have included with MySQL.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License, version 2.0, for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ The WolfSSL library does #define certain global symbol that pollute the
+ C namespace.
+ This file is to be included before the wolf headers to fix this.
+*/
+#ifndef WOLFSSL_FIX_NAMESPACE_POLLUTION_PRE_H
+#define WOLFSSL_FIX_NAMESPACE_POLLUTION_PRE_H 1
+
+#ifdef HAVE_WOLFSSL
+
+#if defined(_WIN32)
+/*
+ Defined in wolfssl's io.h.
+ Conflict with the same constants defined in mysql
+ Keep in sync with my_io.h
+*/
+#if defined(SOCKET_EWOULDBLOCK)
+#undef SOCKET_EWOULDBLOCK
+#endif
+#if defined(SOCKET_EAGAIN)
+#undef SOCKET_EAGAIN
+#endif
+#if defined(SOCKET_ECONNRESET)
+#define SOCKET_ECONNRESET WSAECONNRESET
+#endif
+#if defined(SOCKET_EINTR)
+#define SOCKET_EINTR WSAEINTR
+#endif
+
+#endif /* _WIN32 */
+#endif /* HAVE_WOLFSSL */
+
+#endif /* WOLFSSL_FIX_NAMESPACE_POLLUTION_PRE_H */