summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/hash.h4
-rw-r--r--include/ilist.h4
-rw-r--r--include/json_lib.h7
-rw-r--r--include/mariadb_capi_rename.h2
-rw-r--r--include/my_alloc.h7
-rw-r--r--include/my_bitmap.h14
-rw-r--r--include/my_dbug.h12
-rw-r--r--include/my_dir.h4
-rw-r--r--include/my_sys.h45
-rw-r--r--include/mysql.h14
-rw-r--r--include/mysql/plugin.h2
-rw-r--r--include/mysql/plugin_audit.h.pp26
-rw-r--r--include/mysql/plugin_auth.h.pp26
-rw-r--r--include/mysql/plugin_data_type.h.pp26
-rw-r--r--include/mysql/plugin_encryption.h.pp26
-rw-r--r--include/mysql/plugin_ftparser.h.pp26
-rw-r--r--include/mysql/plugin_function.h.pp26
-rw-r--r--include/mysql/plugin_password_validation.h5
-rw-r--r--include/mysql/plugin_password_validation.h.pp29
-rw-r--r--include/mysql/psi/psi_abi_v1.h.pp2
-rw-r--r--include/mysql/psi/psi_abi_v2.h.pp2
-rw-r--r--include/mysql/psi/psi_base.h7
-rw-r--r--include/mysql/psi/psi_memory.h7
-rw-r--r--include/mysql/service_sql.h115
-rw-r--r--include/mysql/services.h1
-rw-r--r--include/providers/bzlib.h126
-rw-r--r--include/providers/lz4.h63
-rw-r--r--include/providers/lzma.h102
-rw-r--r--include/providers/lzo/lzo1x.h62
-rw-r--r--include/providers/snappy-c.h75
-rw-r--r--include/service_versions.h7
-rw-r--r--include/sql_common.h2
32 files changed, 816 insertions, 60 deletions
diff --git a/include/hash.h b/include/hash.h
index 00ffca503fc..c0a846ac120 100644
--- a/include/hash.h
+++ b/include/hash.h
@@ -64,8 +64,8 @@ typedef struct st_hash {
typedef uint HASH_SEARCH_STATE;
#define my_hash_init(A,B,C,D,E,F,G,H,I) my_hash_init2(A,B,0,C,D,E,F,G,0,H,I)
-my_bool my_hash_init2(PSI_memory_key psi_key, HASH *hash, uint growth_size,
- CHARSET_INFO *charset, ulong default_array_elements,
+my_bool my_hash_init2(PSI_memory_key psi_key, HASH *hash, size_t growth_size,
+ CHARSET_INFO *charset, size_t default_array_elements,
size_t key_offset, size_t key_length,
my_hash_get_key get_key, my_hash_function hash_function,
void (*free_element)(void*), uint flags);
diff --git a/include/ilist.h b/include/ilist.h
index 45c0bbf7d2c..265f0e2d57e 100644
--- a/include/ilist.h
+++ b/include/ilist.h
@@ -107,6 +107,10 @@ public:
}
reference operator*() noexcept { return *static_cast<pointer>(node_); }
+ const_reference operator*() const noexcept
+ {
+ return *static_cast<pointer>(node_);
+ }
pointer operator->() noexcept { return static_cast<pointer>(node_); }
friend bool operator==(const Iterator &lhs, const Iterator &rhs) noexcept
diff --git a/include/json_lib.h b/include/json_lib.h
index e570e2a9d17..ea7f102fd02 100644
--- a/include/json_lib.h
+++ b/include/json_lib.h
@@ -1,6 +1,8 @@
#ifndef JSON_LIB_INCLUDED
#define JSON_LIB_INCLUDED
+#include <my_sys.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -172,7 +174,7 @@ enum json_states {
enum json_value_types
{
- JSON_VALUE_UNINITALIZED=0,
+ JSON_VALUE_UNINITIALIZED=0,
JSON_VALUE_OBJECT=1,
JSON_VALUE_ARRAY=2,
JSON_VALUE_STRING=3,
@@ -432,6 +434,9 @@ int json_locate_key(const char *js, const char *js_end,
const char **key_start, const char **key_end,
int *comma_pos);
+int json_normalize(DYNAMIC_STRING *result,
+ const char *s, size_t size, CHARSET_INFO *cs);
+
#ifdef __cplusplus
}
#endif
diff --git a/include/mariadb_capi_rename.h b/include/mariadb_capi_rename.h
index 616a9142fe6..58e16fdc0c0 100644
--- a/include/mariadb_capi_rename.h
+++ b/include/mariadb_capi_rename.h
@@ -22,7 +22,7 @@
#ifndef MARIADB_CAPI_RENAME_INCLUDED
#define MARIADB_CAPI_RENAME_INCLUDED
-#if !defined(EMBEDDED_LIBRARY)
+#if !defined(EMBEDDED_LIBRARY) && !defined(MYSQL_DYNAMIC_PLUGIN)
#define MARIADB_ADD_PREFIX(_SYMBOL) server_##_SYMBOL
#define mysql_real_connect MARIADB_ADD_PREFIX(mysql_real_connect)
diff --git a/include/my_alloc.h b/include/my_alloc.h
index 181f637c093..944dcb6e1bd 100644
--- a/include/my_alloc.h
+++ b/include/my_alloc.h
@@ -20,7 +20,7 @@
#ifndef _my_alloc_h
#define _my_alloc_h
-#include <mysql/psi/psi_memory.h>
+#include "mysql/psi/psi_base.h"
#define ALLOC_MAX_BLOCK_TO_DROP 4096
#define ALLOC_MAX_BLOCK_USAGE_BEFORE_DROP 10
@@ -50,11 +50,12 @@ typedef struct st_mem_root
first free block in queue test counter (if it exceed
MAX_BLOCK_USAGE_BEFORE_DROP block will be dropped in 'used' list)
*/
- unsigned int first_block_usage;
+ unsigned short first_block_usage;
+ unsigned short flags;
void (*error_handler)(void);
- PSI_memory_key m_psi_key;
+ PSI_memory_key psi_key;
} MEM_ROOT;
#ifdef __cplusplus
diff --git a/include/my_bitmap.h b/include/my_bitmap.h
index f19254404c1..f88a6fe8d9d 100644
--- a/include/my_bitmap.h
+++ b/include/my_bitmap.h
@@ -28,12 +28,6 @@ typedef struct st_bitmap
{
my_bitmap_map *bitmap;
my_bitmap_map *last_word_ptr;
- /*
- 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;
my_bitmap_map last_word_mask;
uint32 n_bits; /* number of bits occupied by the above */
} MY_BITMAP;
@@ -42,15 +36,11 @@ typedef struct st_bitmap
extern "C" {
#endif
-/* compatibility functions */
-#define bitmap_init(A,B,C,D) my_bitmap_init(A,B,C,D)
-#define bitmap_free(A) my_bitmap_free(A)
/* Reset memory. Faster then doing a full bzero */
#define my_bitmap_clear(A) ((A)->bitmap= 0)
extern void create_last_word_mask(MY_BITMAP *map);
-extern my_bool my_bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits,
- my_bool thread_safe);
+extern my_bool my_bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits);
extern my_bool bitmap_is_clear_all(const MY_BITMAP *map);
extern my_bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size);
extern my_bool bitmap_is_set_all(const MY_BITMAP *map);
@@ -82,8 +72,6 @@ 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)
diff --git a/include/my_dbug.h b/include/my_dbug.h
index b4b16d653b5..02caadbff48 100644
--- a/include/my_dbug.h
+++ b/include/my_dbug.h
@@ -104,10 +104,9 @@ extern int (*dbug_sanity)(void);
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_IF(keyword) _db_keyword_(0, (keyword), 1)
+
#define DBUG_PUSH_EMPTY if (_dbug_on_) { DBUG_PUSH(""); }
#define DBUG_POP_EMPTY if (_dbug_on_) { DBUG_POP(); }
#define DBUG_PUSH(a1) _db_push_ (a1)
@@ -174,8 +173,7 @@ extern void _db_suicide_(void);
#define DBUG_PRINT(keyword, arglist) do { } 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_IF(keyword) 0
#define DBUG_PRINT(keyword,arglist) do { } while(0)
#define DBUG_PUSH_EMPTY do { } while(0)
#define DBUG_POP_EMPTY do { } while(0)
@@ -201,7 +199,7 @@ extern void _db_suicide_(void);
#define DBUG_CRASH_ENTER(func)
#define DBUG_CRASH_RETURN(val) do { return(val); } while(0)
#define DBUG_CRASH_VOID_RETURN do { return; } while(0)
-#define DBUG_SUICIDE() do { } while(0)
+#define DBUG_SUICIDE() ((void) 0)
#ifdef DBUG_ASSERT_AS_PRINTF
extern void (*my_dbug_assert_failed)(const char *assert_expr, const char* file, unsigned long line);
diff --git a/include/my_dir.h b/include/my_dir.h
index 930d54ca72f..12cf5db149d 100644
--- a/include/my_dir.h
+++ b/include/my_dir.h
@@ -94,13 +94,13 @@ typedef struct fileinfo
typedef struct st_my_dir /* Struct returned from my_dir */
{
/*
- These members are just copies of parts of DYNAMIC_ARRAY structure,
+ These members are just copies of parts of DYNAMIC_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_of_files;
+ size_t number_of_files;
} MY_DIR;
extern MY_DIR *my_dir(const char *path,myf MyFlags);
diff --git a/include/my_sys.h b/include/my_sys.h
index 0a6e6088067..0f49077b6d0 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -94,6 +94,7 @@ C_MODE_START
#define MY_SYNC_DIR 32768U /* my_create/delete/rename: sync directory */
#define MY_SYNC_FILESIZE 65536U /* my_sync(): safe sync when file is extended */
#define MY_THREAD_SPECIFIC 0x10000U /* my_malloc(): thread specific */
+#define MY_ROOT_USE_MPROTECT 0x20000U /* init_alloc_root: read only segments */
/* Tree that should delete things automatically */
#define MY_TREE_WITH_DELETE 0x40000U
@@ -284,6 +285,7 @@ extern my_bool my_disable_async_io,
extern my_bool my_disable_sync, my_disable_copystat_in_redel;
extern char wild_many,wild_one,wild_prefix;
extern const char *charsets_dir;
+extern size_t my_system_page_size;
enum cache_type
{
@@ -343,9 +345,9 @@ typedef void (*FREE_FUNC)(void *);
typedef struct st_dynamic_array
{
uchar *buffer;
- uint elements,max_element;
- uint alloc_increment;
- uint size_of_element;
+ size_t elements, max_element;
+ size_t alloc_increment;
+ size_t size_of_element;
PSI_memory_key m_psi_key;
myf malloc_flags;
} DYNAMIC_ARRAY;
@@ -354,7 +356,7 @@ typedef struct st_my_tmpdir
{
DYNAMIC_ARRAY full_list;
char **list;
- uint cur, max;
+ size_t cur, max;
mysql_mutex_t mutex;
} MY_TMPDIR;
@@ -834,18 +836,18 @@ File create_temp_file(char *to, const char *dir, const char *pfx,
#define my_init_dynamic_array(A,B,C,D,E,F) init_dynamic_array2(A,B,C,NULL,D,E,F)
#define my_init_dynamic_array2(A,B,C,D,E,F,G) init_dynamic_array2(A,B,C,D,E,F,G)
extern my_bool init_dynamic_array2(PSI_memory_key psi_key, DYNAMIC_ARRAY *array,
- uint element_size, void *init_buffer,
- uint init_alloc, uint alloc_increment,
+ size_t element_size, void *init_buffer,
+ size_t init_alloc, size_t alloc_increment,
myf my_flags);
extern my_bool insert_dynamic(DYNAMIC_ARRAY *array, const void* element);
extern void *alloc_dynamic(DYNAMIC_ARRAY *array);
extern void *pop_dynamic(DYNAMIC_ARRAY*);
extern my_bool set_dynamic(DYNAMIC_ARRAY *array, const void *element,
- uint array_index);
-extern my_bool allocate_dynamic(DYNAMIC_ARRAY *array, uint max_elements);
-extern void get_dynamic(DYNAMIC_ARRAY *array, void *element, uint array_index);
+ size_t array_index);
+extern my_bool allocate_dynamic(DYNAMIC_ARRAY *array, size_t max_elements);
+extern void get_dynamic(DYNAMIC_ARRAY *array, void *element, size_t array_index);
extern void delete_dynamic(DYNAMIC_ARRAY *array);
-extern void delete_dynamic_element(DYNAMIC_ARRAY *array, uint array_index);
+extern void delete_dynamic_element(DYNAMIC_ARRAY *array, size_t array_index);
extern void delete_dynamic_with_callback(DYNAMIC_ARRAY *array, FREE_FUNC f);
extern void freeze_size(DYNAMIC_ARRAY *array);
extern int get_index_dynamic(DYNAMIC_ARRAY *array, void *element);
@@ -887,7 +889,6 @@ extern void my_free_lock(void *ptr);
#define my_free_lock(A) my_free((A))
#endif
#define alloc_root_inited(A) ((A)->min_malloc != 0)
-#define ALLOC_ROOT_MIN_BLOCK_SIZE (MALLOC_OVERHEAD + sizeof(USED_MEM) + 8)
#define clear_alloc_root(A) do { (A)->free= (A)->used= (A)->pre_alloc= 0; (A)->min_malloc=0;} while(0)
extern void init_alloc_root(PSI_memory_key key, MEM_ROOT *mem_root,
size_t block_size, size_t pre_alloc_size,
@@ -898,6 +899,7 @@ extern void free_root(MEM_ROOT *root, myf MyFLAGS);
extern void set_prealloc_root(MEM_ROOT *root, char *ptr);
extern void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size,
size_t prealloc_size);
+extern void protect_root(MEM_ROOT *root, int prot);
extern char *strdup_root(MEM_ROOT *root,const char *str);
static inline char *safe_strdup_root(MEM_ROOT *root, const char *str)
{
@@ -1031,15 +1033,28 @@ int my_getpagesize(void);
int my_msync(int, void *, size_t, int);
#define MY_UUID_SIZE 16
-#define MY_UUID_STRING_LENGTH (8+1+4+1+4+1+4+1+12)
-#define MY_UUID_ORACLE_STRING_LENGTH (8+4+4+4+12)
+#define MY_UUID_BARE_STRING_LENGTH (8+4+4+4+12)
+#define MY_UUID_SEPARATORS 4
+#define MY_UUID_STRING_LENGTH (MY_UUID_BARE_STRING_LENGTH + MY_UUID_SEPARATORS)
void my_uuid_init(ulong seed1, ulong seed2);
void my_uuid(uchar *guid);
-void my_uuid2str(const uchar *guid, char *s);
-void my_uuid2str_oracle(const uchar *guid, char *s);
void my_uuid_end(void);
+static inline void my_uuid2str(const uchar *guid, char *s, int with_separators)
+{
+ int i;
+ int mask= with_separators ? ((1 << 3) | (1 << 5) | (1 << 7) | (1 << 9)) : 0;
+ for (i=0; i < MY_UUID_SIZE; i++, mask >>= 1)
+ {
+ *s++= _dig_vec_lower[guid[i] >>4];
+ *s++= _dig_vec_lower[guid[i] & 15];
+ if (mask & 1)
+ *s++= '-';
+ }
+}
+
+
const char *my_dlerror(const char *dlpath);
/* character sets */
diff --git a/include/mysql.h b/include/mysql.h
index 5088d800f87..46ddc4b9ed9 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -141,6 +141,8 @@ typedef unsigned long long my_ulonglong;
#define ER_WRONG_FK_OPTION_FOR_VIRTUAL_COLUMN ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN
#define ER_UNSUPPORTED_ACTION_ON_VIRTUAL_COLUMN ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN
#define ER_UNSUPPORTED_ENGINE_FOR_VIRTUAL_COLUMNS ER_UNSUPPORTED_ENGINE_FOR_GENERATED_COLUMNS
+#define ER_KEY_COLUMN_DOES_NOT_EXITS ER_KEY_COLUMN_DOES_NOT_EXIST
+#define ER_DROP_PARTITION_NON_EXISTENT ER_PARTITION_DOES_NOT_EXIST
typedef struct st_mysql_rows {
struct st_mysql_rows *next; /* list of rows */
@@ -323,7 +325,15 @@ typedef struct st_mysql_res {
} MYSQL_RES;
-#if !defined(MYSQL_SERVER) && !defined(MYSQL_CLIENT)
+/*
+ We should not define MYSQL_CLIENT when the mysql.h is included
+ by the server or server plugins.
+ Now it is important only for the SQL service to work so we rely on
+ the MYSQL_SERVICE_SQL to check we're compiling the server/plugin
+ related file.
+*/
+
+#if !defined(MYSQL_SERVICE_SQL) && !defined(MYSQL_CLIENT)
#define MYSQL_CLIENT
#endif
@@ -355,7 +365,7 @@ typedef struct st_mysql_parameters
*/
#define MYSQL_WAIT_TIMEOUT 8
-#if !defined(MYSQL_SERVER) && !defined(EMBEDDED_LIBRARY)
+#if !defined(MYSQL_SERVICE_SQL)
#define max_allowed_packet (*mysql_get_parameters()->p_max_allowed_packet)
#define net_buffer_length (*mysql_get_parameters()->p_net_buffer_length)
#endif
diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h
index cc0943e4382..6ef0afb980b 100644
--- a/include/mysql/plugin.h
+++ b/include/mysql/plugin.h
@@ -77,7 +77,7 @@ typedef struct st_mysql_xid MYSQL_XID;
#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0104
/* MariaDB plugin interface version */
-#define MARIA_PLUGIN_INTERFACE_VERSION 0x010e
+#define MARIA_PLUGIN_INTERFACE_VERSION 0x010f
/*
The allowable types of plugins
diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp
index 2e0cdff4b50..d1e9580a053 100644
--- a/include/mysql/plugin_audit.h.pp
+++ b/include/mysql/plugin_audit.h.pp
@@ -464,6 +464,32 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_end);
}
+extern "C" {
+extern struct sql_service_st {
+ MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
+ MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql);
+ MYSQL *(STDCALL *mysql_real_connect_func)(MYSQL *mysql, const char *host,
+ const char *user, const char *passwd, const char *db, unsigned int port,
+ const char *unix_socket, unsigned long clientflag);
+ unsigned int(STDCALL *mysql_errno_func)(MYSQL *mysql);
+ const char *(STDCALL *mysql_error_func)(MYSQL *mysql);
+ int (STDCALL *mysql_real_query_func)(MYSQL *mysql, const char *q,
+ unsigned long length);
+ my_ulonglong (STDCALL *mysql_affected_rows_func)(MYSQL *mysql);
+ my_ulonglong (STDCALL *mysql_num_rows_func)(MYSQL_RES *res);
+ MYSQL_RES *(STDCALL *mysql_store_result_func)(MYSQL *mysql);
+ void (STDCALL *mysql_free_result_func)(MYSQL_RES *result);
+ MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
+ void (STDCALL *mysql_close_func)(MYSQL *mysql);
+ int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option,
+ const void *arg);
+ unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
+ unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
+} *sql_service;
+MYSQL *mysql_real_connect_local(MYSQL *mysql);
+}
}
struct st_mysql_xid {
long formatID;
diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp
index 464c5514acb..2c89bc47de3 100644
--- a/include/mysql/plugin_auth.h.pp
+++ b/include/mysql/plugin_auth.h.pp
@@ -464,6 +464,32 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_end);
}
+extern "C" {
+extern struct sql_service_st {
+ MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
+ MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql);
+ MYSQL *(STDCALL *mysql_real_connect_func)(MYSQL *mysql, const char *host,
+ const char *user, const char *passwd, const char *db, unsigned int port,
+ const char *unix_socket, unsigned long clientflag);
+ unsigned int(STDCALL *mysql_errno_func)(MYSQL *mysql);
+ const char *(STDCALL *mysql_error_func)(MYSQL *mysql);
+ int (STDCALL *mysql_real_query_func)(MYSQL *mysql, const char *q,
+ unsigned long length);
+ my_ulonglong (STDCALL *mysql_affected_rows_func)(MYSQL *mysql);
+ my_ulonglong (STDCALL *mysql_num_rows_func)(MYSQL_RES *res);
+ MYSQL_RES *(STDCALL *mysql_store_result_func)(MYSQL *mysql);
+ void (STDCALL *mysql_free_result_func)(MYSQL_RES *result);
+ MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
+ void (STDCALL *mysql_close_func)(MYSQL *mysql);
+ int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option,
+ const void *arg);
+ unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
+ unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
+} *sql_service;
+MYSQL *mysql_real_connect_local(MYSQL *mysql);
+}
}
struct st_mysql_xid {
long formatID;
diff --git a/include/mysql/plugin_data_type.h.pp b/include/mysql/plugin_data_type.h.pp
index cb256e00cd7..bd4ef6af15f 100644
--- a/include/mysql/plugin_data_type.h.pp
+++ b/include/mysql/plugin_data_type.h.pp
@@ -464,6 +464,32 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_end);
}
+extern "C" {
+extern struct sql_service_st {
+ MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
+ MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql);
+ MYSQL *(STDCALL *mysql_real_connect_func)(MYSQL *mysql, const char *host,
+ const char *user, const char *passwd, const char *db, unsigned int port,
+ const char *unix_socket, unsigned long clientflag);
+ unsigned int(STDCALL *mysql_errno_func)(MYSQL *mysql);
+ const char *(STDCALL *mysql_error_func)(MYSQL *mysql);
+ int (STDCALL *mysql_real_query_func)(MYSQL *mysql, const char *q,
+ unsigned long length);
+ my_ulonglong (STDCALL *mysql_affected_rows_func)(MYSQL *mysql);
+ my_ulonglong (STDCALL *mysql_num_rows_func)(MYSQL_RES *res);
+ MYSQL_RES *(STDCALL *mysql_store_result_func)(MYSQL *mysql);
+ void (STDCALL *mysql_free_result_func)(MYSQL_RES *result);
+ MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
+ void (STDCALL *mysql_close_func)(MYSQL *mysql);
+ int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option,
+ const void *arg);
+ unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
+ unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
+} *sql_service;
+MYSQL *mysql_real_connect_local(MYSQL *mysql);
+}
}
struct st_mysql_xid {
long formatID;
diff --git a/include/mysql/plugin_encryption.h.pp b/include/mysql/plugin_encryption.h.pp
index 11cd622861c..96100d3791b 100644
--- a/include/mysql/plugin_encryption.h.pp
+++ b/include/mysql/plugin_encryption.h.pp
@@ -464,6 +464,32 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_end);
}
+extern "C" {
+extern struct sql_service_st {
+ MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
+ MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql);
+ MYSQL *(STDCALL *mysql_real_connect_func)(MYSQL *mysql, const char *host,
+ const char *user, const char *passwd, const char *db, unsigned int port,
+ const char *unix_socket, unsigned long clientflag);
+ unsigned int(STDCALL *mysql_errno_func)(MYSQL *mysql);
+ const char *(STDCALL *mysql_error_func)(MYSQL *mysql);
+ int (STDCALL *mysql_real_query_func)(MYSQL *mysql, const char *q,
+ unsigned long length);
+ my_ulonglong (STDCALL *mysql_affected_rows_func)(MYSQL *mysql);
+ my_ulonglong (STDCALL *mysql_num_rows_func)(MYSQL_RES *res);
+ MYSQL_RES *(STDCALL *mysql_store_result_func)(MYSQL *mysql);
+ void (STDCALL *mysql_free_result_func)(MYSQL_RES *result);
+ MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
+ void (STDCALL *mysql_close_func)(MYSQL *mysql);
+ int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option,
+ const void *arg);
+ unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
+ unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
+} *sql_service;
+MYSQL *mysql_real_connect_local(MYSQL *mysql);
+}
}
struct st_mysql_xid {
long formatID;
diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp
index 9a798627518..4760e31c4bd 100644
--- a/include/mysql/plugin_ftparser.h.pp
+++ b/include/mysql/plugin_ftparser.h.pp
@@ -464,6 +464,32 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_end);
}
+extern "C" {
+extern struct sql_service_st {
+ MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
+ MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql);
+ MYSQL *(STDCALL *mysql_real_connect_func)(MYSQL *mysql, const char *host,
+ const char *user, const char *passwd, const char *db, unsigned int port,
+ const char *unix_socket, unsigned long clientflag);
+ unsigned int(STDCALL *mysql_errno_func)(MYSQL *mysql);
+ const char *(STDCALL *mysql_error_func)(MYSQL *mysql);
+ int (STDCALL *mysql_real_query_func)(MYSQL *mysql, const char *q,
+ unsigned long length);
+ my_ulonglong (STDCALL *mysql_affected_rows_func)(MYSQL *mysql);
+ my_ulonglong (STDCALL *mysql_num_rows_func)(MYSQL_RES *res);
+ MYSQL_RES *(STDCALL *mysql_store_result_func)(MYSQL *mysql);
+ void (STDCALL *mysql_free_result_func)(MYSQL_RES *result);
+ MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
+ void (STDCALL *mysql_close_func)(MYSQL *mysql);
+ int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option,
+ const void *arg);
+ unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
+ unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
+} *sql_service;
+MYSQL *mysql_real_connect_local(MYSQL *mysql);
+}
}
struct st_mysql_xid {
long formatID;
diff --git a/include/mysql/plugin_function.h.pp b/include/mysql/plugin_function.h.pp
index 4b2a0fc7082..5c1f34d8184 100644
--- a/include/mysql/plugin_function.h.pp
+++ b/include/mysql/plugin_function.h.pp
@@ -464,6 +464,32 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_end);
}
+extern "C" {
+extern struct sql_service_st {
+ MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
+ MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql);
+ MYSQL *(STDCALL *mysql_real_connect_func)(MYSQL *mysql, const char *host,
+ const char *user, const char *passwd, const char *db, unsigned int port,
+ const char *unix_socket, unsigned long clientflag);
+ unsigned int(STDCALL *mysql_errno_func)(MYSQL *mysql);
+ const char *(STDCALL *mysql_error_func)(MYSQL *mysql);
+ int (STDCALL *mysql_real_query_func)(MYSQL *mysql, const char *q,
+ unsigned long length);
+ my_ulonglong (STDCALL *mysql_affected_rows_func)(MYSQL *mysql);
+ my_ulonglong (STDCALL *mysql_num_rows_func)(MYSQL_RES *res);
+ MYSQL_RES *(STDCALL *mysql_store_result_func)(MYSQL *mysql);
+ void (STDCALL *mysql_free_result_func)(MYSQL_RES *result);
+ MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
+ void (STDCALL *mysql_close_func)(MYSQL *mysql);
+ int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option,
+ const void *arg);
+ unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
+ unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
+} *sql_service;
+MYSQL *mysql_real_connect_local(MYSQL *mysql);
+}
}
struct st_mysql_xid {
long formatID;
diff --git a/include/mysql/plugin_password_validation.h b/include/mysql/plugin_password_validation.h
index 23d2c884012..94d6c63967f 100644
--- a/include/mysql/plugin_password_validation.h
+++ b/include/mysql/plugin_password_validation.h
@@ -30,7 +30,7 @@
extern "C" {
#endif
-#define MariaDB_PASSWORD_VALIDATION_INTERFACE_VERSION 0x0100
+#define MariaDB_PASSWORD_VALIDATION_INTERFACE_VERSION 0x0101
/**
Password validation plugin descriptor
@@ -43,7 +43,8 @@ struct st_mariadb_password_validation
and return 0 if the password has passed the validation.
*/
int (*validate_password)(const MYSQL_CONST_LEX_STRING *username,
- const MYSQL_CONST_LEX_STRING *password);
+ const MYSQL_CONST_LEX_STRING *password,
+ const MYSQL_CONST_LEX_STRING *hostname);
};
#ifdef __cplusplus
diff --git a/include/mysql/plugin_password_validation.h.pp b/include/mysql/plugin_password_validation.h.pp
index eae776a753b..a56a177b8fa 100644
--- a/include/mysql/plugin_password_validation.h.pp
+++ b/include/mysql/plugin_password_validation.h.pp
@@ -464,6 +464,32 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_end);
}
+extern "C" {
+extern struct sql_service_st {
+ MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
+ MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql);
+ MYSQL *(STDCALL *mysql_real_connect_func)(MYSQL *mysql, const char *host,
+ const char *user, const char *passwd, const char *db, unsigned int port,
+ const char *unix_socket, unsigned long clientflag);
+ unsigned int(STDCALL *mysql_errno_func)(MYSQL *mysql);
+ const char *(STDCALL *mysql_error_func)(MYSQL *mysql);
+ int (STDCALL *mysql_real_query_func)(MYSQL *mysql, const char *q,
+ unsigned long length);
+ my_ulonglong (STDCALL *mysql_affected_rows_func)(MYSQL *mysql);
+ my_ulonglong (STDCALL *mysql_num_rows_func)(MYSQL_RES *res);
+ MYSQL_RES *(STDCALL *mysql_store_result_func)(MYSQL *mysql);
+ void (STDCALL *mysql_free_result_func)(MYSQL_RES *result);
+ MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
+ void (STDCALL *mysql_close_func)(MYSQL *mysql);
+ int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option,
+ const void *arg);
+ unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
+ unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
+} *sql_service;
+MYSQL *mysql_real_connect_local(MYSQL *mysql);
+}
}
struct st_mysql_xid {
long formatID;
@@ -629,6 +655,7 @@ struct st_mariadb_password_validation
{
int interface_version;
int (*validate_password)(const MYSQL_CONST_LEX_STRING *username,
- const MYSQL_CONST_LEX_STRING *password);
+ const MYSQL_CONST_LEX_STRING *password,
+ const MYSQL_CONST_LEX_STRING *hostname);
};
}
diff --git a/include/mysql/psi/psi_abi_v1.h.pp b/include/mysql/psi/psi_abi_v1.h.pp
index 2dc27e09ca4..ca0d0206cb9 100644
--- a/include/mysql/psi/psi_abi_v1.h.pp
+++ b/include/mysql/psi/psi_abi_v1.h.pp
@@ -1,8 +1,8 @@
extern "C" {
+typedef unsigned int PSI_memory_key;
}
extern "C" {
struct PSI_thread;
-typedef unsigned int PSI_memory_key;
struct PSI_memory_info_v1
{
PSI_memory_key *m_key;
diff --git a/include/mysql/psi/psi_abi_v2.h.pp b/include/mysql/psi/psi_abi_v2.h.pp
index a670e53a8b7..9188954885f 100644
--- a/include/mysql/psi/psi_abi_v2.h.pp
+++ b/include/mysql/psi/psi_abi_v2.h.pp
@@ -1,8 +1,8 @@
extern "C" {
+typedef unsigned int PSI_memory_key;
}
extern "C" {
struct PSI_thread;
-typedef unsigned int PSI_memory_key;
struct PSI_memory_info_v2
{
int placeholder;
diff --git a/include/mysql/psi/psi_base.h b/include/mysql/psi/psi_base.h
index 592aaf58fef..c04f817b2c1 100644
--- a/include/mysql/psi/psi_base.h
+++ b/include/mysql/psi/psi_base.h
@@ -170,6 +170,13 @@ extern "C" {
/** @} */
+/**
+ 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;
+
#ifdef __cplusplus
}
#endif
diff --git a/include/mysql/psi/psi_memory.h b/include/mysql/psi/psi_memory.h
index 4f5215d1808..21a86a36368 100644
--- a/include/mysql/psi/psi_memory.h
+++ b/include/mysql/psi/psi_memory.h
@@ -53,13 +53,6 @@ extern "C" {
struct PSI_thread;
-/**
- 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;
-
#ifdef HAVE_PSI_1
/**
diff --git a/include/mysql/service_sql.h b/include/mysql/service_sql.h
new file mode 100644
index 00000000000..be9dcad669e
--- /dev/null
+++ b/include/mysql/service_sql.h
@@ -0,0 +1,115 @@
+/* Copyright (C) 2021 MariaDB Corporation
+
+ 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 Street, Fifth Floor, Boston, MA 02111-1301 USA */
+
+#ifndef MYSQL_SERVICE_SQL
+#define MYSQL_SERVICE_SQL
+
+#ifndef MYSQL_ABI_CHECK
+#include <mysql.h>
+#endif
+
+/**
+ @file
+ SQL service
+
+ Interface for plugins to execute SQL queries on the local server.
+
+ Functions of the service are the 'server-limited' client library:
+ mysql_init
+ mysql_real_connect_local
+ mysql_real_connect
+ mysql_errno
+ mysql_error
+ mysql_real_query
+ mysql_affected_rows
+ mysql_num_rows
+ mysql_store_result
+ mysql_free_result
+ mysql_fetch_row
+ mysql_close
+*/
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern struct sql_service_st {
+ MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
+ MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql);
+ MYSQL *(STDCALL *mysql_real_connect_func)(MYSQL *mysql, const char *host,
+ const char *user, const char *passwd, const char *db, unsigned int port,
+ const char *unix_socket, unsigned long clientflag);
+ unsigned int(STDCALL *mysql_errno_func)(MYSQL *mysql);
+ const char *(STDCALL *mysql_error_func)(MYSQL *mysql);
+ int (STDCALL *mysql_real_query_func)(MYSQL *mysql, const char *q,
+ unsigned long length);
+ my_ulonglong (STDCALL *mysql_affected_rows_func)(MYSQL *mysql);
+ my_ulonglong (STDCALL *mysql_num_rows_func)(MYSQL_RES *res);
+ MYSQL_RES *(STDCALL *mysql_store_result_func)(MYSQL *mysql);
+ void (STDCALL *mysql_free_result_func)(MYSQL_RES *result);
+ MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
+ void (STDCALL *mysql_close_func)(MYSQL *mysql);
+ int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option,
+ const void *arg);
+ unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
+ unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
+ int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
+} *sql_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define mysql_init(M) sql_service->mysql_init_func(M)
+#define mysql_real_connect_local(M) sql_service->mysql_real_connect_local_func(M)
+#define mysql_real_connect(M,H,U,PW,D,P,S,F) sql_service->mysql_real_connect_func(M,H,U,PW,D,P,S,F)
+#define mysql_errno(M) sql_service->mysql_errno_func(M)
+#define mysql_error(M) sql_service->mysql_error_func(M)
+#define mysql_real_query sql_service->mysql_real_query_func
+#define mysql_affected_rows(M) sql_service->mysql_affected_rows_func(M)
+#define mysql_num_rows(R) sql_service->mysql_num_rows_func(R)
+#define mysql_store_result(M) sql_service->mysql_store_result_func(M)
+#define mysql_free_result(R) sql_service->mysql_free_result_func(R)
+#define mysql_fetch_row(R) sql_service->mysql_fetch_row_func(R)
+#define mysql_close(M) sql_service->mysql_close_func(M)
+#define mysql_options(M,O,V) sql_service->mysql_options_func(M,O,V)
+#define mysql_fetch_lengths(R) sql_service->mysql_fetch_lengths_func(R)
+#define mysql_set_character_set(M,C) sql_service->mysql_set_character_set_func(M,C)
+#define mysql_num_fields(R) sql_service->mysql_num_fields_func(R)
+#define mysql_select_db(M,D) sql_service->mysql_select_db_func(M,D)
+
+#else
+
+/*
+ Establishes the connection to the 'local' server that started the plugin.
+ Like the mysql_real_connect() does for the remote server.
+ The established connection has no user/host associated to it,
+ neither it has the current db, so the queries should have
+ database/table name specified.
+*/
+MYSQL *mysql_real_connect_local(MYSQL *mysql);
+
+/* The rest of the function declarations mest be taken from the mysql.h */
+
+#endif /*MYSQL_DYNAMIC_PLUGIN*/
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*MYSQL_SERVICE_SQL */
+
+
diff --git a/include/mysql/services.h b/include/mysql/services.h
index 2c3a0ae421b..94f7bb3b2da 100644
--- a/include/mysql/services.h
+++ b/include/mysql/services.h
@@ -41,6 +41,7 @@ extern "C" {
#include <mysql/service_thd_wait.h>
#include <mysql/service_json.h>
/*#include <mysql/service_wsrep.h>*/
+#include <mysql/service_sql.h>
#ifdef __cplusplus
}
diff --git a/include/providers/bzlib.h b/include/providers/bzlib.h
new file mode 100644
index 00000000000..b48c940bdbc
--- /dev/null
+++ b/include/providers/bzlib.h
@@ -0,0 +1,126 @@
+/**
+ @file bzlib.h
+ This service provides dynamic access to BZip2.
+*/
+
+#ifndef BZIP2_INCLUDED
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdbool.h>
+#endif
+
+#ifndef MYSQL_DYNAMIC_PLUGIN
+#define provider_service_bzip2 provider_service_bzip2_static
+#endif
+
+#ifndef BZ_RUN
+#define BZ_RUN 0
+#define BZ_FINISH 2
+
+#define BZ_OK 0
+#define BZ_RUN_OK 1
+#define BZ_FINISH_OK 3
+#define BZ_STREAM_END 4
+
+typedef struct
+{
+ char *next_in;
+ unsigned int avail_in;
+ unsigned int total_in_lo32;
+ unsigned int total_in_hi32;
+
+ char *next_out;
+ unsigned int avail_out;
+ unsigned int total_out_lo32;
+ unsigned int total_out_hi32;
+
+ void *state;
+
+ void *(*bzalloc)(void *, int, int);
+ void (*bzfree)(void *, void *);
+ void *opaque;
+} bz_stream;
+
+#define BZ2_bzBuffToBuffCompress(...) provider_service_bzip2->BZ2_bzBuffToBuffCompress_ptr (__VA_ARGS__)
+#define BZ2_bzBuffToBuffDecompress(...) provider_service_bzip2->BZ2_bzBuffToBuffDecompress_ptr (__VA_ARGS__)
+#define BZ2_bzCompress(...) provider_service_bzip2->BZ2_bzCompress_ptr (__VA_ARGS__)
+#define BZ2_bzCompressEnd(...) provider_service_bzip2->BZ2_bzCompressEnd_ptr (__VA_ARGS__)
+#define BZ2_bzCompressInit(...) provider_service_bzip2->BZ2_bzCompressInit_ptr (__VA_ARGS__)
+#define BZ2_bzDecompress(...) provider_service_bzip2->BZ2_bzDecompress_ptr (__VA_ARGS__)
+#define BZ2_bzDecompressEnd(...) provider_service_bzip2->BZ2_bzDecompressEnd_ptr (__VA_ARGS__)
+#define BZ2_bzDecompressInit(...) provider_service_bzip2->BZ2_bzDecompressInit_ptr (__VA_ARGS__)
+#endif
+
+#define DEFINE_BZ2_bzBuffToBuffCompress(NAME) NAME( \
+ char *dest, \
+ unsigned int *destLen, \
+ char *source, \
+ unsigned int sourceLen, \
+ int blockSize100k, \
+ int verbosity, \
+ int workFactor \
+)
+
+#define DEFINE_BZ2_bzBuffToBuffDecompress(NAME) NAME( \
+ char *dest, \
+ unsigned int *destLen, \
+ char *source, \
+ unsigned int sourceLen, \
+ int small, \
+ int verbosity \
+)
+
+#define DEFINE_BZ2_bzCompress(NAME) NAME( \
+ bz_stream *strm, \
+ int action \
+)
+
+#define DEFINE_BZ2_bzCompressEnd(NAME) NAME( \
+ bz_stream *strm \
+)
+
+#define DEFINE_BZ2_bzCompressInit(NAME) NAME( \
+ bz_stream *strm, \
+ int blockSize100k, \
+ int verbosity, \
+ int workFactor \
+)
+
+#define DEFINE_BZ2_bzDecompress(NAME) NAME( \
+ bz_stream *strm \
+)
+
+#define DEFINE_BZ2_bzDecompressEnd(NAME) NAME( \
+ bz_stream *strm \
+)
+
+#define DEFINE_BZ2_bzDecompressInit(NAME) NAME( \
+ bz_stream *strm, \
+ int verbosity, \
+ int small \
+)
+
+struct provider_service_bzip2_st{
+ int DEFINE_BZ2_bzBuffToBuffCompress((*BZ2_bzBuffToBuffCompress_ptr));
+ int DEFINE_BZ2_bzBuffToBuffDecompress((*BZ2_bzBuffToBuffDecompress_ptr));
+ int DEFINE_BZ2_bzCompress((*BZ2_bzCompress_ptr));
+ int DEFINE_BZ2_bzCompressEnd((*BZ2_bzCompressEnd_ptr));
+ int DEFINE_BZ2_bzCompressInit((*BZ2_bzCompressInit_ptr));
+ int DEFINE_BZ2_bzDecompress((*BZ2_bzDecompress_ptr));
+ int DEFINE_BZ2_bzDecompressEnd((*BZ2_bzDecompressEnd_ptr));
+ int DEFINE_BZ2_bzDecompressInit((*BZ2_bzDecompressInit_ptr));
+
+ bool is_loaded;
+};
+
+extern struct provider_service_bzip2_st *provider_service_bzip2;
+
+#ifdef __cplusplus
+}
+#endif
+
+#define BZIP2_INCLUDED
+#endif
diff --git a/include/providers/lz4.h b/include/providers/lz4.h
new file mode 100644
index 00000000000..4ac6b2c8f0d
--- /dev/null
+++ b/include/providers/lz4.h
@@ -0,0 +1,63 @@
+/**
+ @file lz4.h
+ This service provides dynamic access to LZ4.
+*/
+
+#ifndef LZ4_INCLUDED
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#endif
+
+#ifndef MYSQL_DYNAMIC_PLUGIN
+#define provider_service_lz4 provider_service_lz4_static
+#endif
+
+#ifndef LZ4_VERSION_NUMBER
+#define LZ4_MAX_INPUT_SIZE 0x7E000000
+
+#define LZ4_compressBound(...) provider_service_lz4->LZ4_compressBound_ptr (__VA_ARGS__)
+#define LZ4_compress_default(...) provider_service_lz4->LZ4_compress_default_ptr (__VA_ARGS__)
+#define LZ4_decompress_safe(...) provider_service_lz4->LZ4_decompress_safe_ptr (__VA_ARGS__)
+#endif
+
+#define DEFINE_LZ4_compressBound(NAME) NAME( \
+ int inputSize \
+)
+
+#define DEFINE_LZ4_compress_default(NAME) NAME( \
+ const char *src, \
+ char *dst, \
+ int srcSize, \
+ int dstCapacity \
+)
+
+#define DEFINE_LZ4_decompress_safe(NAME) NAME( \
+ const char *src, \
+ char *dst, \
+ int compressedSize, \
+ int dstCapacity \
+)
+
+struct provider_service_lz4_st
+{
+ int DEFINE_LZ4_compressBound((*LZ4_compressBound_ptr));
+ int DEFINE_LZ4_compress_default((*LZ4_compress_default_ptr));
+ int DEFINE_LZ4_decompress_safe((*LZ4_decompress_safe_ptr));
+
+ bool is_loaded;
+};
+
+extern struct provider_service_lz4_st *provider_service_lz4;
+
+#ifdef __cplusplus
+}
+#endif
+
+#define LZ4_INCLUDED
+#endif
diff --git a/include/providers/lzma.h b/include/providers/lzma.h
new file mode 100644
index 00000000000..8125bb8cb04
--- /dev/null
+++ b/include/providers/lzma.h
@@ -0,0 +1,102 @@
+/**
+ @file lzma.h
+ This service provides dynamic access to LZMA.
+*/
+
+#ifndef LZMA_INCLUDED
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdbool.h>
+#include <stdint.h>
+#include <stddef.h>
+#endif
+
+#ifndef MYSQL_DYNAMIC_PLUGIN
+#define provider_service_lzma provider_service_lzma_static
+#endif
+
+#ifndef LZMA_VERSION
+typedef enum
+{
+ LZMA_OK = 0,
+ LZMA_STREAM_END = 1,
+ LZMA_NO_CHECK = 2,
+ LZMA_UNSUPPORTED_CHECK = 3,
+ LZMA_GET_CHECK = 4,
+ LZMA_MEM_ERROR = 5,
+ LZMA_MEMLIMIT_ERROR = 6,
+ LZMA_FORMAT_ERROR = 7,
+ LZMA_OPTIONS_ERROR = 8,
+ LZMA_DATA_ERROR = 9,
+ LZMA_BUF_ERROR = 10,
+ LZMA_PROG_ERROR = 11,
+} lzma_ret;
+
+typedef struct
+{
+ void *(*alloc)(void *opaque, size_t nmemb, size_t size);
+ void (*free)(void *opaque, void *ptr);
+ void *opaque;
+} lzma_allocator;
+
+typedef enum
+{
+ LZMA_CHECK_NONE = 0,
+ LZMA_CHECK_CRC32 = 1,
+ LZMA_CHECK_CRC64 = 4,
+ LZMA_CHECK_SHA256 = 10
+} lzma_check;
+
+#define lzma_stream_buffer_decode(...) provider_service_lzma->lzma_stream_buffer_decode_ptr (__VA_ARGS__)
+#define lzma_easy_buffer_encode(...) provider_service_lzma->lzma_easy_buffer_encode_ptr (__VA_ARGS__)
+#elif LZMA_VERSION < 50010030
+#define lzma_maybe_const
+#endif
+
+#ifndef lzma_maybe_const
+#define lzma_maybe_const const
+#endif
+
+#define DEFINE_lzma_stream_buffer_decode(NAME) NAME( \
+ uint64_t *memlimit, \
+ uint32_t flags, \
+ lzma_maybe_const lzma_allocator *allocator, \
+ const uint8_t *in, \
+ size_t *in_pos, \
+ size_t in_size, \
+ uint8_t *out, \
+ size_t *out_pos, \
+ size_t out_size \
+)
+
+#define DEFINE_lzma_easy_buffer_encode(NAME) NAME( \
+ uint32_t preset, \
+ lzma_check check, \
+ lzma_maybe_const lzma_allocator *allocator, \
+ const uint8_t *in, \
+ size_t in_size, \
+ uint8_t *out, \
+ size_t *out_pos, \
+ size_t out_size \
+)
+
+struct provider_service_lzma_st
+{
+ lzma_ret DEFINE_lzma_stream_buffer_decode((*lzma_stream_buffer_decode_ptr));
+ lzma_ret DEFINE_lzma_easy_buffer_encode((*lzma_easy_buffer_encode_ptr));
+
+ bool is_loaded;
+};
+
+extern struct provider_service_lzma_st *provider_service_lzma;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#define LZMA_INCLUDED
+#endif
diff --git a/include/providers/lzo/lzo1x.h b/include/providers/lzo/lzo1x.h
new file mode 100644
index 00000000000..93d1461f9cb
--- /dev/null
+++ b/include/providers/lzo/lzo1x.h
@@ -0,0 +1,62 @@
+/**
+ @file lzo/lzo1x.h
+ This service provides dynamic access to LZO.
+*/
+
+#ifndef LZO_INCLUDED
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdbool.h>
+#endif
+
+#ifndef MYSQL_DYNAMIC_PLUGIN
+#define provider_service_lzo provider_service_lzo_static
+#endif
+
+#ifndef LZO_E_OK
+#define LZO_E_OK 0
+#define LZO_E_INTERNAL_ERROR (-99)
+
+#define LZO1X_1_15_MEM_COMPRESS ((unsigned int) (32768L * ((unsigned) sizeof(unsigned char *))))
+
+typedef size_t lzo_uint;
+
+#define lzo1x_1_15_compress(...) provider_service_lzo->lzo1x_1_15_compress_ptr (__VA_ARGS__)
+#define lzo1x_decompress_safe(...) provider_service_lzo->lzo1x_decompress_safe_ptr (__VA_ARGS__)
+#endif
+
+#define DEFINE_lzo1x_1_15_compress(NAME) NAME( \
+ const unsigned char *src, \
+ lzo_uint src_len, \
+ unsigned char *dst, \
+ lzo_uint *dst_len, \
+ void *wrkmem \
+)
+
+#define DEFINE_lzo1x_decompress_safe(NAME) NAME( \
+ const unsigned char *src, \
+ lzo_uint src_len, \
+ unsigned char *dst, \
+ lzo_uint *dst_len, \
+ void *wrkmem \
+)
+
+struct provider_service_lzo_st
+{
+ int DEFINE_lzo1x_1_15_compress((*lzo1x_1_15_compress_ptr));
+ int DEFINE_lzo1x_decompress_safe((*lzo1x_decompress_safe_ptr));
+
+ bool is_loaded;
+};
+
+extern struct provider_service_lzo_st *provider_service_lzo;
+
+#ifdef __cplusplus
+}
+#endif
+
+#define LZO_INCLUDED
+#endif
diff --git a/include/providers/snappy-c.h b/include/providers/snappy-c.h
new file mode 100644
index 00000000000..afc6aef274c
--- /dev/null
+++ b/include/providers/snappy-c.h
@@ -0,0 +1,75 @@
+/**
+ @file snappy-c.h
+ This service provides dynamic access to Snappy as a C header.
+*/
+
+#ifndef SNAPPY_C_INCLUDED
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef MYSQL_ABI_CHECK
+#include <stddef.h>
+#include <stdbool.h>
+#endif
+
+#ifndef MYSQL_DYNAMIC_PLUGIN
+#define provider_service_snappy provider_service_snappy_static
+#endif
+
+#ifndef SNAPPY_C
+typedef enum
+{
+ SNAPPY_OK = 0,
+ SNAPPY_INVALID_INPUT = 1,
+ SNAPPY_BUFFER_TOO_SMALL = 2
+} snappy_status;
+
+#define snappy_max_compressed_length(...) provider_service_snappy->snappy_max_compressed_length_ptr (__VA_ARGS__)
+#define snappy_compress(...) provider_service_snappy->snappy_compress_ptr (__VA_ARGS__)
+#define snappy_uncompressed_length(...) provider_service_snappy->snappy_uncompressed_length_ptr (__VA_ARGS__)
+#define snappy_uncompress(...) provider_service_snappy->snappy_uncompress_ptr (__VA_ARGS__)
+#endif
+
+#define DEFINE_snappy_max_compressed_length(NAME) NAME( \
+ size_t source_length \
+)
+
+#define DEFINE_snappy_compress(NAME) NAME( \
+ const char *input, \
+ size_t input_length, \
+ char *compressed, \
+ size_t *compressed_length \
+)
+
+#define DEFINE_snappy_uncompressed_length(NAME) NAME( \
+ const char *compressed, \
+ size_t compressed_length, \
+ size_t *result \
+)
+
+#define DEFINE_snappy_uncompress(NAME) NAME( \
+ const char *compressed, \
+ size_t compressed_length, \
+ char *uncompressed, \
+ size_t *uncompressed_length \
+)
+
+struct provider_service_snappy_st
+{
+ size_t DEFINE_snappy_max_compressed_length((*snappy_max_compressed_length_ptr));
+ snappy_status DEFINE_snappy_compress((*snappy_compress_ptr));
+ snappy_status DEFINE_snappy_uncompressed_length((*snappy_uncompressed_length_ptr));
+ snappy_status DEFINE_snappy_uncompress((*snappy_uncompress_ptr));
+
+ bool is_loaded;
+};
+
+extern struct provider_service_snappy_st *provider_service_snappy;
+
+#ifdef __cplusplus
+}
+#endif
+
+#define SNAPPY_C_INCLUDED
+#endif
diff --git a/include/service_versions.h b/include/service_versions.h
index 34e4952c94c..9abae740a7b 100644
--- a/include/service_versions.h
+++ b/include/service_versions.h
@@ -44,3 +44,10 @@
#define VERSION_wsrep 0x0500
#define VERSION_json 0x0100
#define VERSION_thd_mdl 0x0100
+#define VERSION_sql_service 0x0101
+
+#define VERSION_provider_bzip2 0x0100
+#define VERSION_provider_lz4 0x0100
+#define VERSION_provider_lzma 0x0100
+#define VERSION_provider_lzo 0x0100
+#define VERSION_provider_snappy 0x0100
diff --git a/include/sql_common.h b/include/sql_common.h
index 9fc983616a0..ad5ab7e19af 100644
--- a/include/sql_common.h
+++ b/include/sql_common.h
@@ -61,13 +61,13 @@ typedef struct st_mysql_methods
MYSQL_ROW column, unsigned int field_count);
void (*flush_use_result)(MYSQL *mysql, my_bool flush_all_results);
int (*read_change_user_result)(MYSQL *mysql);
+ void (*on_close_free)(MYSQL *mysql);
#if !defined(MYSQL_SERVER) || defined(EMBEDDED_LIBRARY)
MYSQL_FIELD * (*list_fields)(MYSQL *mysql);
my_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);
- void (*free_embedded_thd)(MYSQL *mysql);
const char *(*read_statistics)(MYSQL *mysql);
my_bool (*next_result)(MYSQL *mysql);
int (*read_rows_from_cursor)(MYSQL_STMT *stmt);