Fix to make Windows compilation smoother
This commit is contained in:
parent
9a5dafba83
commit
78f58ff384
@ -368,10 +368,6 @@ SOURCE=.\row\row0vers.c
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\srv\srv0que.c
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\srv\srv0srv.c
|
SOURCE=.\srv\srv0srv.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
@ -129,6 +129,7 @@ static my_bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0,
|
|||||||
vertical=0, line_numbers=1, column_names=1,opt_html=0,
|
vertical=0, line_numbers=1, column_names=1,opt_html=0,
|
||||||
opt_xml=0,opt_nopager=1, opt_outfile=0, named_cmds= 0,
|
opt_xml=0,opt_nopager=1, opt_outfile=0, named_cmds= 0,
|
||||||
tty_password= 0, opt_nobeep=0;
|
tty_password= 0, opt_nobeep=0;
|
||||||
|
static ulong opt_max_allowed_packet, opt_net_buffer_length;
|
||||||
static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0;
|
static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0;
|
||||||
static my_string opt_mysql_unix_port=0;
|
static my_string opt_mysql_unix_port=0;
|
||||||
static int connect_flag=CLIENT_INTERACTIVE;
|
static int connect_flag=CLIENT_INTERACTIVE;
|
||||||
@ -330,7 +331,7 @@ int main(int argc,char *argv[])
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (status.batch && !status.line_buff &&
|
if (status.batch && !status.line_buff &&
|
||||||
!(status.line_buff=batch_readline_init(max_allowed_packet+512,stdin)))
|
!(status.line_buff=batch_readline_init(opt_max_allowed_packet+512,stdin)))
|
||||||
{
|
{
|
||||||
free_defaults(defaults_argv);
|
free_defaults(defaults_argv);
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -573,11 +574,11 @@ static struct my_option my_long_options[] =
|
|||||||
(gptr*) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 3600*12, 0,
|
(gptr*) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 3600*12, 0,
|
||||||
0, 1},
|
0, 1},
|
||||||
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, "",
|
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, "",
|
||||||
(gptr*) &max_allowed_packet, (gptr*) &max_allowed_packet, 0, GET_ULONG,
|
(gptr*) &opt_max_allowed_packet, (gptr*) &opt_max_allowed_packet, 0, GET_ULONG,
|
||||||
REQUIRED_ARG, 16 *1024L*1024L, 4096, (longlong) 2*1024L*1024L*1024L,
|
REQUIRED_ARG, 16 *1024L*1024L, 4096, (longlong) 2*1024L*1024L*1024L,
|
||||||
MALLOC_OVERHEAD, 1024, 0},
|
MALLOC_OVERHEAD, 1024, 0},
|
||||||
{"net_buffer_length", OPT_NET_BUFFER_LENGTH, "",
|
{"net_buffer_length", OPT_NET_BUFFER_LENGTH, "",
|
||||||
(gptr*) &net_buffer_length, (gptr*) &net_buffer_length, 0, GET_ULONG,
|
(gptr*) &opt_net_buffer_length, (gptr*) &opt_net_buffer_length, 0, GET_ULONG,
|
||||||
REQUIRED_ARG, 16384, 1024, 512*1024*1024L, MALLOC_OVERHEAD, 1024, 0},
|
REQUIRED_ARG, 16384, 1024, 512*1024*1024L, MALLOC_OVERHEAD, 1024, 0},
|
||||||
{"select_limit", OPT_SELECT_LIMIT, "", (gptr*) &select_limit,
|
{"select_limit", OPT_SELECT_LIMIT, "", (gptr*) &select_limit,
|
||||||
(gptr*) &select_limit, 0, GET_ULONG, REQUIRED_ARG, 1000L, 1, ~0L, 0, 1, 0},
|
(gptr*) &select_limit, 0, GET_ULONG, REQUIRED_ARG, 1000L, 1, ~0L, 0, 1, 0},
|
||||||
@ -738,6 +739,7 @@ static int get_options(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
char *tmp, *pagpoint;
|
char *tmp, *pagpoint;
|
||||||
int ho_error;
|
int ho_error;
|
||||||
|
MYSQL_PARAMETERS *mysql_params= mysql_get_parameters();
|
||||||
|
|
||||||
tmp= (char *) getenv("MYSQL_HOST");
|
tmp= (char *) getenv("MYSQL_HOST");
|
||||||
if (tmp)
|
if (tmp)
|
||||||
@ -753,9 +755,15 @@ static int get_options(int argc, char **argv)
|
|||||||
strmov(pager, pagpoint);
|
strmov(pager, pagpoint);
|
||||||
strmov(default_pager, pager);
|
strmov(default_pager, pager);
|
||||||
|
|
||||||
|
opt_max_allowed_packet= *mysql_params->p_max_allowed_packet;
|
||||||
|
opt_net_buffer_length= *mysql_params->p_net_buffer_length;
|
||||||
|
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
exit(ho_error);
|
exit(ho_error);
|
||||||
|
|
||||||
|
*mysql_params->p_max_allowed_packet= opt_max_allowed_packet;
|
||||||
|
*mysql_params->p_net_buffer_length= opt_net_buffer_length;
|
||||||
|
|
||||||
if (status.batch) /* disable pager and outfile in this case */
|
if (status.batch) /* disable pager and outfile in this case */
|
||||||
{
|
{
|
||||||
strmov(default_pager, "stdout");
|
strmov(default_pager, "stdout");
|
||||||
@ -2164,7 +2172,7 @@ static int com_source(String *buffer, char *line)
|
|||||||
return put_info(buff, INFO_ERROR, 0);
|
return put_info(buff, INFO_ERROR, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(line_buff=batch_readline_init(max_allowed_packet+512,sql_file)))
|
if (!(line_buff=batch_readline_init(opt_max_allowed_packet+512,sql_file)))
|
||||||
{
|
{
|
||||||
my_fclose(sql_file,MYF(0));
|
my_fclose(sql_file,MYF(0));
|
||||||
return put_info("Can't initialize batch_readline", INFO_ERROR, 0);
|
return put_info("Can't initialize batch_readline", INFO_ERROR, 0);
|
||||||
|
@ -79,6 +79,7 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick=0, extended_insert = 0,
|
|||||||
opt_autocommit=0,opt_master_data,opt_disable_keys=0,opt_xml=0,
|
opt_autocommit=0,opt_master_data,opt_disable_keys=0,opt_xml=0,
|
||||||
opt_delete_master_logs=0, tty_password=0,
|
opt_delete_master_logs=0, tty_password=0,
|
||||||
opt_single_transaction=0, opt_comments= 0;
|
opt_single_transaction=0, opt_comments= 0;
|
||||||
|
static ulong opt_max_allowed_packet, opt_net_buffer_length;
|
||||||
static MYSQL mysql_connection,*sock=0;
|
static MYSQL mysql_connection,*sock=0;
|
||||||
static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
|
static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
|
||||||
*current_host=0,*path=0,*fields_terminated=0,
|
*current_host=0,*path=0,*fields_terminated=0,
|
||||||
@ -87,7 +88,6 @@ static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
|
|||||||
static uint opt_mysql_port=0;
|
static uint opt_mysql_port=0;
|
||||||
static my_string opt_mysql_unix_port=0;
|
static my_string opt_mysql_unix_port=0;
|
||||||
static int first_error=0;
|
static int first_error=0;
|
||||||
extern ulong net_buffer_length;
|
|
||||||
static DYNAMIC_STRING extended_row;
|
static DYNAMIC_STRING extended_row;
|
||||||
#include <sslopt-vars.h>
|
#include <sslopt-vars.h>
|
||||||
FILE *md_result_file;
|
FILE *md_result_file;
|
||||||
@ -238,11 +238,11 @@ static struct my_option my_long_options[] =
|
|||||||
{"xml", 'X', "Dump a database as well formed XML.", 0, 0, 0, GET_NO_ARG,
|
{"xml", 'X', "Dump a database as well formed XML.", 0, 0, 0, GET_NO_ARG,
|
||||||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, "",
|
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, "",
|
||||||
(gptr*) &max_allowed_packet, (gptr*) &max_allowed_packet, 0,
|
(gptr*) &opt_max_allowed_packet, (gptr*) &opt_max_allowed_packet, 0,
|
||||||
GET_ULONG, REQUIRED_ARG, 24*1024*1024, 4096,
|
GET_ULONG, REQUIRED_ARG, 24*1024*1024, 4096,
|
||||||
(longlong) 2L*1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
|
(longlong) 2L*1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
|
||||||
{"net_buffer_length", OPT_NET_BUFFER_LENGTH, "",
|
{"net_buffer_length", OPT_NET_BUFFER_LENGTH, "",
|
||||||
(gptr*) &net_buffer_length, (gptr*) &net_buffer_length, 0,
|
(gptr*) &opt_net_buffer_length, (gptr*) &opt_net_buffer_length, 0,
|
||||||
GET_ULONG, REQUIRED_ARG, 1024*1024L-1025, 4096, 16*1024L*1024L,
|
GET_ULONG, REQUIRED_ARG, 1024*1024L-1025, 4096, 16*1024L*1024L,
|
||||||
MALLOC_OVERHEAD-1024, 1024, 0},
|
MALLOC_OVERHEAD-1024, 1024, 0},
|
||||||
{"comments", 'i', "Write additional information.",
|
{"comments", 'i', "Write additional information.",
|
||||||
@ -405,6 +405,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
static int get_options(int *argc, char ***argv)
|
static int get_options(int *argc, char ***argv)
|
||||||
{
|
{
|
||||||
int ho_error;
|
int ho_error;
|
||||||
|
MYSQL_PARAMETERS *mysql_params= mysql_get_parameters();
|
||||||
|
|
||||||
|
opt_max_allowed_packet= *mysql_params->p_max_allowed_packet;
|
||||||
|
opt_net_buffer_length= *mysql_params->p_net_buffer_length;
|
||||||
|
|
||||||
md_result_file= stdout;
|
md_result_file= stdout;
|
||||||
load_defaults("my",load_default_groups,argc,argv);
|
load_defaults("my",load_default_groups,argc,argv);
|
||||||
@ -412,6 +416,9 @@ static int get_options(int *argc, char ***argv)
|
|||||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
exit(ho_error);
|
exit(ho_error);
|
||||||
|
|
||||||
|
*mysql_params->p_max_allowed_packet= opt_max_allowed_packet;
|
||||||
|
*mysql_params->p_net_buffer_length= opt_net_buffer_length;
|
||||||
|
|
||||||
if (opt_delayed)
|
if (opt_delayed)
|
||||||
opt_lock=0; /* Can't have lock with delayed */
|
opt_lock=0; /* Can't have lock with delayed */
|
||||||
if (!path && (enclosed || opt_enclosed || escaped || lines_terminated ||
|
if (!path && (enclosed || opt_enclosed || escaped || lines_terminated ||
|
||||||
|
@ -244,6 +244,17 @@ typedef struct st_mysql_manager
|
|||||||
char last_error[MAX_MYSQL_MANAGER_ERR];
|
char last_error[MAX_MYSQL_MANAGER_ERR];
|
||||||
} MYSQL_MANAGER;
|
} MYSQL_MANAGER;
|
||||||
|
|
||||||
|
typedef struct st_mysql_parameters
|
||||||
|
{
|
||||||
|
unsigned long *p_max_allowed_packet;
|
||||||
|
unsigned long *p_net_buffer_length;
|
||||||
|
} MYSQL_PARAMETERS;
|
||||||
|
|
||||||
|
#if !defined(MYSQL_CLIENT) && !defined(MYSQL_SERVER) && !defined(EMBEDDED_LIBRARY)
|
||||||
|
#define max_allowed_packet (*mysql_get_parameters()->p_max_allowed_packet)
|
||||||
|
#define net_buffer_length (*mysql_get_parameters()->p_net_buffer_length)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Set up and bring down the server; to ensure that applications will
|
Set up and bring down the server; to ensure that applications will
|
||||||
work when linked against either the standard client library or the
|
work when linked against either the standard client library or the
|
||||||
@ -252,6 +263,8 @@ typedef struct st_mysql_manager
|
|||||||
int STDCALL mysql_server_init(int argc, char **argv, char **groups);
|
int STDCALL mysql_server_init(int argc, char **argv, char **groups);
|
||||||
void STDCALL mysql_server_end(void);
|
void STDCALL mysql_server_end(void);
|
||||||
|
|
||||||
|
MYSQL_PARAMETERS *STDCALL mysql_get_parameters();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Set up and bring down a thread; these function should be called
|
Set up and bring down a thread; these function should be called
|
||||||
for each thread in an application which opens at least one MySQL
|
for each thread in an application which opens at least one MySQL
|
||||||
|
@ -34,12 +34,6 @@
|
|||||||
#define MYSQL_SERVICENAME "MySQL"
|
#define MYSQL_SERVICENAME "MySQL"
|
||||||
#endif /* __WIN__ */
|
#endif /* __WIN__ */
|
||||||
|
|
||||||
#if defined(__WIN__) && !defined(MYSQL_SERVER) && !defined(MYSQL_CLIENT) && !defined(EMBEDDED_LIBRARY)
|
|
||||||
#define dll_import_spec __declspec( dllimport )
|
|
||||||
#else
|
|
||||||
#define dll_import_spec
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum enum_server_command {
|
enum enum_server_command {
|
||||||
COM_SLEEP, COM_QUIT, COM_INIT_DB, COM_QUERY, COM_FIELD_LIST,
|
COM_SLEEP, COM_QUIT, COM_INIT_DB, COM_QUERY, COM_FIELD_LIST,
|
||||||
COM_CREATE_DB, COM_DROP_DB, COM_REFRESH, COM_SHUTDOWN, COM_STATISTICS,
|
COM_CREATE_DB, COM_DROP_DB, COM_REFRESH, COM_SHUTDOWN, COM_STATISTICS,
|
||||||
@ -229,9 +223,6 @@ typedef struct st_udf_init
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dll_import_spec extern unsigned long max_allowed_packet;
|
|
||||||
dll_import_spec extern unsigned long net_buffer_length;
|
|
||||||
|
|
||||||
void randominit(struct rand_struct *,unsigned long seed1,
|
void randominit(struct rand_struct *,unsigned long seed1,
|
||||||
unsigned long seed2);
|
unsigned long seed2);
|
||||||
double my_rnd(struct rand_struct *);
|
double my_rnd(struct rand_struct *);
|
||||||
|
@ -121,6 +121,14 @@ void STDCALL mysql_server_end()
|
|||||||
mysql_client_init= org_my_init_done= 0;
|
mysql_client_init= org_my_init_done= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static MYSQL_PARAMETERS mysql_internal_parameters=
|
||||||
|
{&max_allowed_packet, &net_buffer_length};
|
||||||
|
|
||||||
|
MYSQL_PARAMETERS *STDCALL mysql_get_parameters()
|
||||||
|
{
|
||||||
|
return &mysql_internal_parameters;
|
||||||
|
}
|
||||||
|
|
||||||
my_bool STDCALL mysql_thread_init()
|
my_bool STDCALL mysql_thread_init()
|
||||||
{
|
{
|
||||||
#ifdef THREAD
|
#ifdef THREAD
|
||||||
|
@ -59,7 +59,6 @@ EXPORTS
|
|||||||
is_prefix
|
is_prefix
|
||||||
list_add
|
list_add
|
||||||
list_delete
|
list_delete
|
||||||
max_allowed_packet
|
|
||||||
my_casecmp
|
my_casecmp
|
||||||
my_init
|
my_init
|
||||||
my_end
|
my_end
|
||||||
@ -70,7 +69,6 @@ EXPORTS
|
|||||||
my_realloc
|
my_realloc
|
||||||
mysql_thread_end
|
mysql_thread_end
|
||||||
mysql_thread_init
|
mysql_thread_init
|
||||||
net_buffer_length
|
|
||||||
set_dynamic
|
set_dynamic
|
||||||
strcend
|
strcend
|
||||||
strdup_root
|
strdup_root
|
||||||
@ -111,19 +109,4 @@ EXPORTS
|
|||||||
load_defaults
|
load_defaults
|
||||||
free_defaults
|
free_defaults
|
||||||
my_path
|
my_path
|
||||||
|
mysql_get_parameters
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
|
|
||||||
target = libmysqlclient_r.la
|
target = libmysqlclient_r.la
|
||||||
target_defs = -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@
|
target_defs = -DDONT_USE_RAID -DMYSQL_CLIENT @LIB_EXTRA_CCFLAGS@
|
||||||
LIBS = @LIBS@ @openssl_libs@
|
LIBS = @LIBS@ @openssl_libs@
|
||||||
|
|
||||||
INCLUDES = @MT_INCLUDES@ -I$(srcdir)/../include -I../include \
|
INCLUDES = @MT_INCLUDES@ -I$(srcdir)/../include -I../include \
|
||||||
|
@ -23,6 +23,11 @@
|
|||||||
#define mysql_unix_port mysql_inix_port1
|
#define mysql_unix_port mysql_inix_port1
|
||||||
#define mysql_port mysql_port1
|
#define mysql_port mysql_port1
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
unsigned long max_allowed_packet, net_buffer_length;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined (__WIN__)
|
#if defined (__WIN__)
|
||||||
#include "../sql/mysqld.cpp"
|
#include "../sql/mysqld.cpp"
|
||||||
#else
|
#else
|
||||||
@ -315,7 +320,6 @@ extern "C"
|
|||||||
|
|
||||||
static my_bool org_my_init_done;
|
static my_bool org_my_init_done;
|
||||||
my_bool server_inited;
|
my_bool server_inited;
|
||||||
ulong max_allowed_packet, net_buffer_length;
|
|
||||||
char ** copy_arguments_ptr= 0;
|
char ** copy_arguments_ptr= 0;
|
||||||
|
|
||||||
int STDCALL mysql_server_init(int argc, char **argv, char **groups)
|
int STDCALL mysql_server_init(int argc, char **argv, char **groups)
|
||||||
|
@ -46,6 +46,9 @@
|
|||||||
#define INADDR_NONE -1
|
#define INADDR_NONE -1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern ulong net_buffer_length;
|
||||||
|
extern ulong max_allowed_packet;
|
||||||
|
|
||||||
static my_bool mysql_client_init=0;
|
static my_bool mysql_client_init=0;
|
||||||
uint mysql_port=0;
|
uint mysql_port=0;
|
||||||
my_string mysql_unix_port=0;
|
my_string mysql_unix_port=0;
|
||||||
@ -722,6 +725,15 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static MYSQL_PARAMETERS mysql_internal_parameters=
|
||||||
|
{&max_allowed_packet, &net_buffer_length};
|
||||||
|
|
||||||
|
MYSQL_PARAMETERS *STDCALL mysql_get_parameters()
|
||||||
|
{
|
||||||
|
return &mysql_internal_parameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
** Init MySQL structure or allocate one
|
** Init MySQL structure or allocate one
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -63,6 +63,5 @@ EXPORTS
|
|||||||
mysql_refresh
|
mysql_refresh
|
||||||
mysql_odbc_escape_string
|
mysql_odbc_escape_string
|
||||||
myodbc_remove_escape
|
myodbc_remove_escape
|
||||||
net_buffer_length
|
|
||||||
max_allowed_packet
|
|
||||||
get_tty_password
|
get_tty_password
|
||||||
|
mysql_get_parameters
|
||||||
|
@ -532,6 +532,7 @@ end:
|
|||||||
#else
|
#else
|
||||||
#define UNLOCK_MUTEX
|
#define UNLOCK_MUTEX
|
||||||
#define LOCK_MUTEX
|
#define LOCK_MUTEX
|
||||||
|
#define max_allowed_packet (*mysql_get_parameters()->p_max_allowed_packet)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// allocates memory - the caller is responsible for clean-up
|
// allocates memory - the caller is responsible for clean-up
|
||||||
|
@ -355,7 +355,7 @@ LOG_MSG_FUNC(log_info,LOG_INFO)
|
|||||||
#ifndef DBUG_OFF
|
#ifndef DBUG_OFF
|
||||||
LOG_MSG_FUNC(log_debug,LOG_DEBUG)
|
LOG_MSG_FUNC(log_debug,LOG_DEBUG)
|
||||||
#else
|
#else
|
||||||
void log_debug(const char* __attribute__((unused)) fmt,...) {}
|
void log_debug(const char* fmt __attribute__((unused)),...) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void handle_sigterm(int sig __attribute__((unused)))
|
static void handle_sigterm(int sig __attribute__((unused)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user