Commit a786c020 authored by Sergei Golubchik's avatar Sergei Golubchik Committed by Oleksandr Byelkin

remove MYSQL_SERVER requirement

parent 0a0dfd63
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#ifndef _my_alloc_h #ifndef _my_alloc_h
#define _my_alloc_h #define _my_alloc_h
#include <mysql/psi/psi_memory.h> typedef unsigned int PSI_memory_key;
#define ALLOC_MAX_BLOCK_TO_DROP 4096 #define ALLOC_MAX_BLOCK_TO_DROP 4096
#define ALLOC_MAX_BLOCK_USAGE_BEFORE_DROP 10 #define ALLOC_MAX_BLOCK_USAGE_BEFORE_DROP 10
......
...@@ -322,7 +322,7 @@ typedef struct st_mysql_res { ...@@ -322,7 +322,7 @@ typedef struct st_mysql_res {
} MYSQL_RES; } MYSQL_RES;
#if !defined(MYSQL_SERVER) && !defined(MYSQL_CLIENT) #if !defined(MYSQL_SERVICE_SQL) && !defined(MYSQL_CLIENT)
#define MYSQL_CLIENT #define MYSQL_CLIENT
#endif #endif
...@@ -354,7 +354,7 @@ typedef struct st_mysql_parameters ...@@ -354,7 +354,7 @@ typedef struct st_mysql_parameters
*/ */
#define MYSQL_WAIT_TIMEOUT 8 #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 max_allowed_packet (*mysql_get_parameters()->p_max_allowed_packet)
#define net_buffer_length (*mysql_get_parameters()->p_net_buffer_length) #define net_buffer_length (*mysql_get_parameters()->p_net_buffer_length)
#endif #endif
......
...@@ -238,12 +238,7 @@ typedef struct st_mysql_field { ...@@ -238,12 +238,7 @@ typedef struct st_mysql_field {
typedef char **MYSQL_ROW; typedef char **MYSQL_ROW;
typedef unsigned int MYSQL_FIELD_OFFSET; typedef unsigned int MYSQL_FIELD_OFFSET;
typedef unsigned long long my_ulonglong; typedef unsigned long long my_ulonglong;
extern "C" {
}
extern "C" {
struct PSI_thread;
typedef unsigned int PSI_memory_key; typedef unsigned int PSI_memory_key;
}
extern "C" { extern "C" {
typedef struct st_used_mem typedef struct st_used_mem
{ {
......
...@@ -464,6 +464,30 @@ int json_escape_string(const char *str,const char *str_end, ...@@ -464,6 +464,30 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end, int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_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,
const char *host, const char *user, const char *db,
unsigned long clientflag);
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);
} *sql_service;
MYSQL *mysql_real_connect_local(MYSQL *mysql,
const char *host, const char *user, const char *db,
unsigned long clientflag);
}
} }
struct st_mysql_xid { struct st_mysql_xid {
long formatID; long formatID;
......
...@@ -464,6 +464,30 @@ int json_escape_string(const char *str,const char *str_end, ...@@ -464,6 +464,30 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end, int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_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,
const char *host, const char *user, const char *db,
unsigned long clientflag);
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);
} *sql_service;
MYSQL *mysql_real_connect_local(MYSQL *mysql,
const char *host, const char *user, const char *db,
unsigned long clientflag);
}
} }
struct st_mysql_xid { struct st_mysql_xid {
long formatID; long formatID;
......
...@@ -464,6 +464,30 @@ int json_escape_string(const char *str,const char *str_end, ...@@ -464,6 +464,30 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end, int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_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,
const char *host, const char *user, const char *db,
unsigned long clientflag);
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);
} *sql_service;
MYSQL *mysql_real_connect_local(MYSQL *mysql,
const char *host, const char *user, const char *db,
unsigned long clientflag);
}
} }
struct st_mysql_xid { struct st_mysql_xid {
long formatID; long formatID;
......
...@@ -464,6 +464,30 @@ int json_escape_string(const char *str,const char *str_end, ...@@ -464,6 +464,30 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end, int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_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,
const char *host, const char *user, const char *db,
unsigned long clientflag);
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);
} *sql_service;
MYSQL *mysql_real_connect_local(MYSQL *mysql,
const char *host, const char *user, const char *db,
unsigned long clientflag);
}
} }
struct st_mysql_xid { struct st_mysql_xid {
long formatID; long formatID;
......
...@@ -464,6 +464,30 @@ int json_escape_string(const char *str,const char *str_end, ...@@ -464,6 +464,30 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end, int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_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,
const char *host, const char *user, const char *db,
unsigned long clientflag);
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);
} *sql_service;
MYSQL *mysql_real_connect_local(MYSQL *mysql,
const char *host, const char *user, const char *db,
unsigned long clientflag);
}
} }
struct st_mysql_xid { struct st_mysql_xid {
long formatID; long formatID;
......
...@@ -464,6 +464,30 @@ int json_escape_string(const char *str,const char *str_end, ...@@ -464,6 +464,30 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end, int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_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,
const char *host, const char *user, const char *db,
unsigned long clientflag);
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);
} *sql_service;
MYSQL *mysql_real_connect_local(MYSQL *mysql,
const char *host, const char *user, const char *db,
unsigned long clientflag);
}
} }
struct st_mysql_xid { struct st_mysql_xid {
long formatID; long formatID;
......
...@@ -464,6 +464,30 @@ int json_escape_string(const char *str,const char *str_end, ...@@ -464,6 +464,30 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end, int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_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,
const char *host, const char *user, const char *db,
unsigned long clientflag);
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);
} *sql_service;
MYSQL *mysql_real_connect_local(MYSQL *mysql,
const char *host, const char *user, const char *db,
unsigned long clientflag);
}
} }
struct st_mysql_xid { struct st_mysql_xid {
long formatID; long formatID;
......
...@@ -13,10 +13,12 @@ ...@@ -13,10 +13,12 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#if defined(MYSQL_SERVER) && !defined MYSQL_SERVICE_SQL #ifndef MYSQL_SERVICE_SQL
#define MYSQL_SERVICE_SQL #define MYSQL_SERVICE_SQL
#ifndef MYSQL_ABI_CHECK
#include <mysql.h> #include <mysql.h>
#endif
/** /**
@file @file
...@@ -45,39 +47,39 @@ extern "C" { ...@@ -45,39 +47,39 @@ extern "C" {
#endif #endif
extern struct sql_service_st { extern struct sql_service_st {
MYSQL *(STDCALL *mysql_init)(MYSQL *mysql); MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
MYSQL *(*mysql_real_connect_local)(MYSQL *mysql, MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql,
const char *host, const char *user, const char *db, const char *host, const char *user, const char *db,
unsigned long clientflag); unsigned long clientflag);
MYSQL *(STDCALL *mysql_real_connect)(MYSQL *mysql, const char *host, 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 *user, const char *passwd, const char *db, unsigned int port,
const char *unix_socket, unsigned long clientflag); const char *unix_socket, unsigned long clientflag);
unsigned int(STDCALL *mysql_errno)(MYSQL *mysql); unsigned int(STDCALL *mysql_errno_func)(MYSQL *mysql);
const char *(STDCALL *mysql_error)(MYSQL *mysql); const char *(STDCALL *mysql_error_func)(MYSQL *mysql);
int (STDCALL *mysql_real_query)(MYSQL *mysql, const char *q, int (STDCALL *mysql_real_query_func)(MYSQL *mysql, const char *q,
unsigned long length); unsigned long length);
my_ulonglong (STDCALL *mysql_affected_rows)(MYSQL *mysql); my_ulonglong (STDCALL *mysql_affected_rows_func)(MYSQL *mysql);
my_ulonglong (STDCALL *mysql_num_rows)(MYSQL_RES *res); my_ulonglong (STDCALL *mysql_num_rows_func)(MYSQL_RES *res);
MYSQL_RES *(STDCALL *mysql_store_result)(MYSQL *mysql); MYSQL_RES *(STDCALL *mysql_store_result_func)(MYSQL *mysql);
void (STDCALL *mysql_free_result)(MYSQL_RES *result); void (STDCALL *mysql_free_result_func)(MYSQL_RES *result);
MYSQL_ROW (STDCALL *mysql_fetch_row)(MYSQL_RES *result); MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
void (STDCALL *mysql_close)(MYSQL *sock); void (STDCALL *mysql_close_func)(MYSQL *mysql);
} *sql_service; } *sql_service;
#ifdef MYSQL_DYNAMIC_PLUGIN #ifdef MYSQL_DYNAMIC_PLUGIN
#define mysql_init sql_service->mysql_init #define mysql_init(M) sql_service->mysql_init_func(M)
#define mysql_real_connect_local sql_service->mysql_real_connect_local #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 sql_service->mysql_real_connect #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(M) #define mysql_errno(M) sql_service->mysql_errno_func(M)
#define mysql_error(M) sql_service->mysql_error(M) #define mysql_error(M) sql_service->mysql_error_func(M)
#define mysql_real_query sql_service->mysql_real_query #define mysql_real_query sql_service->mysql_real_query_func
#define mysql_affected_rows sql_service->mysql_affected_rows #define mysql_affected_rows(M) sql_service->mysql_affected_rows_func(M)
#define mysql_num_rows sql_service->mysql_num_rows #define mysql_num_rows(R) sql_service->mysql_num_rows_func(R)
#define mysql_store_result sql_service->mysql_store_result #define mysql_store_result(M) sql_service->mysql_store_result_func(M)
#define mysql_free_result sql_service->mysql_free_result #define mysql_free_result(R) sql_service->mysql_free_result_func(R)
#define mysql_fetch_row sql_service->mysql_fetch_row #define mysql_fetch_row(R) sql_service->mysql_fetch_row_func(R)
#define mysql_close sql_service->mysql_close #define mysql_close(M) sql_service->mysql_close_func(M)
#else #else
......
...@@ -1151,7 +1151,6 @@ static void setup_connection_simple(struct connection_info *ci) ...@@ -1151,7 +1151,6 @@ static void setup_connection_simple(struct connection_info *ci)
#define MAX_HOSTNAME (HOSTNAME_LENGTH + 1) /* len+1 in mysql.user */ #define MAX_HOSTNAME (HOSTNAME_LENGTH + 1) /* len+1 in mysql.user */
#define USERNAME_LENGTH 384
static void setup_connection_connect(MYSQL_THD thd,struct connection_info *cn, static void setup_connection_connect(MYSQL_THD thd,struct connection_info *cn,
const struct mysql_event_connection *event) const struct mysql_event_connection *event)
......
...@@ -15,5 +15,4 @@ ...@@ -15,5 +15,4 @@
SET(SOURCES test_sql_service.c) SET(SOURCES test_sql_service.c)
ADD_DEFINITIONS(-DMYSQL_SERVER)
MYSQL_ADD_PLUGIN(test_sql_service ${SOURCES} MODULE_ONLY) MYSQL_ADD_PLUGIN(test_sql_service ${SOURCES} MODULE_ONLY)
...@@ -14,8 +14,7 @@ ...@@ -14,8 +14,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
#define PLUGIN_VERSION 0x20000 #define PLUGIN_VERSION 0x200
#define PLUGIN_STR_VERSION "2.0"
#include <my_config.h> #include <my_config.h>
#include <my_global.h> #include <my_global.h>
...@@ -266,8 +265,8 @@ maria_declare_plugin(test_sql_service) ...@@ -266,8 +265,8 @@ maria_declare_plugin(test_sql_service)
PLUGIN_VERSION, PLUGIN_VERSION,
test_sql_status, test_sql_status,
test_sql_vars, test_sql_vars,
PLUGIN_STR_VERSION, NULL,
MariaDB_PLUGIN_MATURITY_STABLE MariaDB_PLUGIN_MATURITY_EXPERIMENTAL
} }
maria_declare_plugin_end; maria_declare_plugin_end;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment