MDEV-19275 SQL service for plugins.
host/user/db arguments of the mysql_real_connect_local() are removed.
This commit is contained in:
parent
74daa97adf
commit
e1f9a80900
@ -467,9 +467,7 @@ int json_unescape_json(const char *json_str, const char *json_end,
|
||||
extern "C" {
|
||||
extern struct sql_service_st {
|
||||
MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
|
||||
MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql,
|
||||
const char *host, const char *user, const char *db,
|
||||
unsigned long clientflag);
|
||||
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);
|
||||
@ -484,9 +482,7 @@ extern struct sql_service_st {
|
||||
MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
|
||||
void (STDCALL *mysql_close_func)(MYSQL *mysql);
|
||||
} *sql_service;
|
||||
MYSQL *mysql_real_connect_local(MYSQL *mysql,
|
||||
const char *host, const char *user, const char *db,
|
||||
unsigned long clientflag);
|
||||
MYSQL *mysql_real_connect_local(MYSQL *mysql);
|
||||
}
|
||||
}
|
||||
struct st_mysql_xid {
|
||||
|
@ -467,9 +467,7 @@ int json_unescape_json(const char *json_str, const char *json_end,
|
||||
extern "C" {
|
||||
extern struct sql_service_st {
|
||||
MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
|
||||
MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql,
|
||||
const char *host, const char *user, const char *db,
|
||||
unsigned long clientflag);
|
||||
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);
|
||||
@ -484,9 +482,7 @@ extern struct sql_service_st {
|
||||
MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
|
||||
void (STDCALL *mysql_close_func)(MYSQL *mysql);
|
||||
} *sql_service;
|
||||
MYSQL *mysql_real_connect_local(MYSQL *mysql,
|
||||
const char *host, const char *user, const char *db,
|
||||
unsigned long clientflag);
|
||||
MYSQL *mysql_real_connect_local(MYSQL *mysql);
|
||||
}
|
||||
}
|
||||
struct st_mysql_xid {
|
||||
|
@ -467,9 +467,7 @@ int json_unescape_json(const char *json_str, const char *json_end,
|
||||
extern "C" {
|
||||
extern struct sql_service_st {
|
||||
MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
|
||||
MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql,
|
||||
const char *host, const char *user, const char *db,
|
||||
unsigned long clientflag);
|
||||
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);
|
||||
@ -484,9 +482,7 @@ extern struct sql_service_st {
|
||||
MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
|
||||
void (STDCALL *mysql_close_func)(MYSQL *mysql);
|
||||
} *sql_service;
|
||||
MYSQL *mysql_real_connect_local(MYSQL *mysql,
|
||||
const char *host, const char *user, const char *db,
|
||||
unsigned long clientflag);
|
||||
MYSQL *mysql_real_connect_local(MYSQL *mysql);
|
||||
}
|
||||
}
|
||||
struct st_mysql_xid {
|
||||
|
@ -467,9 +467,7 @@ int json_unescape_json(const char *json_str, const char *json_end,
|
||||
extern "C" {
|
||||
extern struct sql_service_st {
|
||||
MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
|
||||
MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql,
|
||||
const char *host, const char *user, const char *db,
|
||||
unsigned long clientflag);
|
||||
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);
|
||||
@ -484,9 +482,7 @@ extern struct sql_service_st {
|
||||
MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
|
||||
void (STDCALL *mysql_close_func)(MYSQL *mysql);
|
||||
} *sql_service;
|
||||
MYSQL *mysql_real_connect_local(MYSQL *mysql,
|
||||
const char *host, const char *user, const char *db,
|
||||
unsigned long clientflag);
|
||||
MYSQL *mysql_real_connect_local(MYSQL *mysql);
|
||||
}
|
||||
}
|
||||
struct st_mysql_xid {
|
||||
|
@ -467,9 +467,7 @@ int json_unescape_json(const char *json_str, const char *json_end,
|
||||
extern "C" {
|
||||
extern struct sql_service_st {
|
||||
MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
|
||||
MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql,
|
||||
const char *host, const char *user, const char *db,
|
||||
unsigned long clientflag);
|
||||
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);
|
||||
@ -484,9 +482,7 @@ extern struct sql_service_st {
|
||||
MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
|
||||
void (STDCALL *mysql_close_func)(MYSQL *mysql);
|
||||
} *sql_service;
|
||||
MYSQL *mysql_real_connect_local(MYSQL *mysql,
|
||||
const char *host, const char *user, const char *db,
|
||||
unsigned long clientflag);
|
||||
MYSQL *mysql_real_connect_local(MYSQL *mysql);
|
||||
}
|
||||
}
|
||||
struct st_mysql_xid {
|
||||
|
@ -467,9 +467,7 @@ int json_unescape_json(const char *json_str, const char *json_end,
|
||||
extern "C" {
|
||||
extern struct sql_service_st {
|
||||
MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
|
||||
MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql,
|
||||
const char *host, const char *user, const char *db,
|
||||
unsigned long clientflag);
|
||||
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);
|
||||
@ -484,9 +482,7 @@ extern struct sql_service_st {
|
||||
MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
|
||||
void (STDCALL *mysql_close_func)(MYSQL *mysql);
|
||||
} *sql_service;
|
||||
MYSQL *mysql_real_connect_local(MYSQL *mysql,
|
||||
const char *host, const char *user, const char *db,
|
||||
unsigned long clientflag);
|
||||
MYSQL *mysql_real_connect_local(MYSQL *mysql);
|
||||
}
|
||||
}
|
||||
struct st_mysql_xid {
|
||||
|
@ -467,9 +467,7 @@ int json_unescape_json(const char *json_str, const char *json_end,
|
||||
extern "C" {
|
||||
extern struct sql_service_st {
|
||||
MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
|
||||
MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql,
|
||||
const char *host, const char *user, const char *db,
|
||||
unsigned long clientflag);
|
||||
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);
|
||||
@ -484,9 +482,7 @@ extern struct sql_service_st {
|
||||
MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
|
||||
void (STDCALL *mysql_close_func)(MYSQL *mysql);
|
||||
} *sql_service;
|
||||
MYSQL *mysql_real_connect_local(MYSQL *mysql,
|
||||
const char *host, const char *user, const char *db,
|
||||
unsigned long clientflag);
|
||||
MYSQL *mysql_real_connect_local(MYSQL *mysql);
|
||||
}
|
||||
}
|
||||
struct st_mysql_xid {
|
||||
|
@ -48,9 +48,7 @@ extern "C" {
|
||||
|
||||
extern struct sql_service_st {
|
||||
MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
|
||||
MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql,
|
||||
const char *host, const char *user, const char *db,
|
||||
unsigned long clientflag);
|
||||
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);
|
||||
@ -69,7 +67,7 @@ extern struct sql_service_st {
|
||||
#ifdef MYSQL_DYNAMIC_PLUGIN
|
||||
|
||||
#define mysql_init(M) sql_service->mysql_init_func(M)
|
||||
#define mysql_real_connect_local(M,H,U,D,F) sql_service->mysql_real_connect_local_func(M,H,U,D,F)
|
||||
#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)
|
||||
@ -83,9 +81,14 @@ extern struct sql_service_st {
|
||||
|
||||
#else
|
||||
|
||||
MYSQL *mysql_real_connect_local(MYSQL *mysql,
|
||||
const char *host, const char *user, const char *db,
|
||||
unsigned long clientflag);
|
||||
/*
|
||||
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 */
|
||||
|
||||
|
@ -104,7 +104,7 @@ static int do_tests()
|
||||
int result= 1;
|
||||
|
||||
mysql= mysql_init(NULL);
|
||||
if (mysql_real_connect_local(mysql, NULL, NULL, NULL, 0) == NULL)
|
||||
if (mysql_real_connect_local(mysql) == NULL)
|
||||
return 1;
|
||||
|
||||
if (run_queries(mysql))
|
||||
@ -188,7 +188,7 @@ static int run_sql_local(MYSQL_THD thd, struct st_mysql_sys_var *var, void *save
|
||||
int result= 1;
|
||||
|
||||
mysql= mysql_init(NULL);
|
||||
if (mysql_real_connect_local(mysql, NULL, NULL, NULL, 0) == NULL)
|
||||
if (mysql_real_connect_local(mysql) == NULL)
|
||||
return 1;
|
||||
|
||||
if (run_sql(mysql, save, value))
|
||||
@ -217,7 +217,7 @@ static int test_sql_service_plugin_init(void *p __attribute__((unused)))
|
||||
global_mysql= mysql_init(NULL);
|
||||
|
||||
if (!global_mysql ||
|
||||
mysql_real_connect_local(global_mysql, NULL, NULL, NULL, 0) == NULL)
|
||||
mysql_real_connect_local(global_mysql) == NULL)
|
||||
return 1;
|
||||
|
||||
init_done= 1;
|
||||
|
@ -6344,9 +6344,7 @@ static MYSQL_METHODS local_methods=
|
||||
|
||||
Atomic_counter<uint32_t> local_connection_thread_count;
|
||||
|
||||
extern "C" MYSQL *mysql_real_connect_local(MYSQL *mysql,
|
||||
const char *host, const char *user, const char *db,
|
||||
unsigned long clientflag)
|
||||
extern "C" MYSQL *mysql_real_connect_local(MYSQL *mysql)
|
||||
{
|
||||
THD *thd_orig= current_thd;
|
||||
THD *new_thd;
|
||||
@ -6360,17 +6358,7 @@ extern "C" MYSQL *mysql_real_connect_local(MYSQL *mysql,
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
if (!host || !host[0])
|
||||
host= mysql->options.host;
|
||||
|
||||
mysql->methods= &local_methods;
|
||||
|
||||
if (!db || !db[0])
|
||||
db=mysql->options.db;
|
||||
|
||||
if (!user || !user[0])
|
||||
user=mysql->options.user;
|
||||
|
||||
mysql->user= NULL;
|
||||
|
||||
mysql->info_buffer= (char *) my_malloc(PSI_INSTRUMENT_ME,
|
||||
|
Loading…
x
Reference in New Issue
Block a user