mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fix for #2126 (mysql_server_init call shouldn't be needed)
now mysql_server_init is called from mysql_init with fake parameters mysql_once_init code included to mysql_server_init. embedded-specific initialization is in init_embedded_server function include/errmsg.h: this error won't happen include/mysql.h: declarations removed libmysql/client_settings.h: declaration of init_embedded_server/end_embedded_server added libmysql/errmsg.c: this error won't happen libmysql/libmysql.c: mysql_once_init -> mysql_server_init transformations libmysqld/embedded_priv.h: declaration deleted libmysqld/lib_sql.cc: mysql_server_init -> init_embedded_server mysql_server_end -> end_embedded_server libmysqld/libmysqld.c: check for server_inited not needed now sql-common/client.c: mysql_server_init now called from mysql_init sql/client_settings.h: fake mysql_server_init for server code sql/net_serv.cc: we need MYSQL_CLIENT defined in embedded server sql/sql_client.cc: not needed now
This commit is contained in:
@ -58,3 +58,14 @@ int cli_stmt_execute(MYSQL_STMT *stmt);
|
||||
MYSQL_DATA * cli_read_binary_rows(MYSQL_STMT *stmt);
|
||||
int cli_unbuffered_fetch(MYSQL *mysql, char **row);
|
||||
const char * cli_read_statistic(MYSQL *mysql);
|
||||
|
||||
#ifdef EMBEDDED_LIBRARY
|
||||
int init_embedded_server(int argc, char **argv, char **groups);
|
||||
void end_embedded_server();
|
||||
|
||||
#else
|
||||
/* Prevent warnings of unused parameters */
|
||||
#define init_embedded_server(a,b,c) ((void)a, (void)b, (void)c, 0)
|
||||
#define end_embedded_server()
|
||||
#endif /*EMBEDDED_LIBRARY*/
|
||||
|
||||
|
@ -72,7 +72,6 @@ const char *client_errors[]=
|
||||
"Can't open shared memory. Can't send the request event to server (%lu)",
|
||||
"Wrong or unknown protocol",
|
||||
"Invalid connection handle",
|
||||
"mysql_server_init wasn't called",
|
||||
"Connection using old (pre 4.1.1) authentication protocol refused (client option 'secure_auth' enabled)"
|
||||
};
|
||||
|
||||
@ -129,7 +128,6 @@ const char *client_errors[]=
|
||||
"Can't open shared memory. Can't send the request event to server (%lu)",
|
||||
"Wrong or unknown protocol",
|
||||
"Invalid connection handle",
|
||||
"mysql_server_init wasn't called",
|
||||
"Connection using old (pre 4.1.1) authentication protocol refused (client option 'secure_auth' enabled)"
|
||||
};
|
||||
|
||||
@ -184,7 +182,6 @@ const char *client_errors[]=
|
||||
"Can't open shared memory. Can't send the request event to server (%lu)",
|
||||
"Wrong or unknown protocol",
|
||||
"Invalid connection handle",
|
||||
"mysql_server_init wasn't called",
|
||||
"Connection using old (pre 4.1.1) authentication protocol refused (client option 'secure_auth' enabled)"
|
||||
};
|
||||
#endif
|
||||
|
@ -94,8 +94,9 @@ my_bool stmt_close(MYSQL_STMT *stmt, my_bool skip_list);
|
||||
static my_bool mysql_client_init= 0;
|
||||
static my_bool org_my_init_done= 0;
|
||||
|
||||
void mysql_once_init(void)
|
||||
int STDCALL mysql_server_init(int argc, char **argv, char **groups)
|
||||
{
|
||||
int result= 0;
|
||||
if (!mysql_client_init)
|
||||
{
|
||||
mysql_client_init=1;
|
||||
@ -131,24 +132,18 @@ void mysql_once_init(void)
|
||||
#if defined(SIGPIPE) && !defined(__WIN__)
|
||||
(void) signal(SIGPIPE, SIG_IGN);
|
||||
#endif
|
||||
result= init_embedded_server(argc, argv, groups);
|
||||
}
|
||||
#ifdef THREAD
|
||||
else
|
||||
my_thread_init(); /* Init if new thread */
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
int STDCALL mysql_server_init(int argc __attribute__((unused)),
|
||||
char **argv __attribute__((unused)),
|
||||
char **groups __attribute__((unused)))
|
||||
{
|
||||
mysql_once_init();
|
||||
return 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
void STDCALL mysql_server_end()
|
||||
{
|
||||
end_embedded_server();
|
||||
/* If library called my_init(), free memory allocated by it */
|
||||
if (!org_my_init_done)
|
||||
{
|
||||
@ -163,8 +158,6 @@ void STDCALL mysql_server_end()
|
||||
mysql_client_init= org_my_init_done= 0;
|
||||
}
|
||||
|
||||
#endif /*EMBEDDED_LIBRARY*/
|
||||
|
||||
my_bool STDCALL mysql_thread_init()
|
||||
{
|
||||
#ifdef THREAD
|
||||
|
Reference in New Issue
Block a user