summaryrefslogtreecommitdiff
path: root/include/mysql
diff options
context:
space:
mode:
Diffstat (limited to 'include/mysql')
-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
15 files changed, 313 insertions, 13 deletions
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
}