Commit 33a4e760 authored by unknown's avatar unknown

Bug#34655 Compile error

Rename client_last_error to last_error and client_last_errno to last_errno
to not break connectors which use the internal net structure for error handling.


include/mysql_com.h:
  Rename client_last_error to last_error, client_last_errno to last_errno.
include/mysql_h.ic:
  Rename client_last_error to last_error, client_last_errno to last_errno.
libmysql/libmysql.c:
  Rename client_last_error to last_error, client_last_errno to last_errno.
libmysql/manager.c:
  Rename client_last_error to last_error, client_last_errno to last_errno.
libmysqld/lib_sql.cc:
  Rename client_last_error to last_error, client_last_errno to last_errno.
libmysqld/libmysqld.c:
  Rename client_last_error to last_error, client_last_errno to last_errno.
server-tools/instance-manager/mysql_connection.cc:
  Rename client_last_error to last_error, client_last_errno to last_errno.
sql/log_event.cc:
  Rename client_last_error to last_error, client_last_errno to last_errno.
sql-common/client.c:
  Rename client_last_error to last_error, client_last_errno to last_errno.
sql/log_event_old.cc:
  Rename client_last_error to last_error, client_last_errno to last_errno.
sql/net_serv.cc:
  Rename client_last_error to last_error, client_last_errno to last_errno.
sql/repl_failsafe.cc:
  Rename client_last_error to last_error, client_last_errno to last_errno.
parent 944f2599
...@@ -217,12 +217,12 @@ typedef struct st_net { ...@@ -217,12 +217,12 @@ typedef struct st_net {
functions and methods to maintain proper locking. functions and methods to maintain proper locking.
*/ */
unsigned char *query_cache_query; unsigned char *query_cache_query;
unsigned int client_last_errno; unsigned int last_errno;
unsigned char error; unsigned char error;
my_bool unused2; /* Please remove with the next incompatible ABI change. */ my_bool unused2; /* Please remove with the next incompatible ABI change. */
my_bool return_errno; my_bool return_errno;
/** Client library error message buffer. Actually belongs to struct MYSQL. */ /** Client library error message buffer. Actually belongs to struct MYSQL. */
char client_last_error[MYSQL_ERRMSG_SIZE]; char last_error[MYSQL_ERRMSG_SIZE];
/** Client library sqlstate buffer. Set along with the error message. */ /** Client library sqlstate buffer. Set along with the error message. */
char sqlstate[SQLSTATE_LENGTH+1]; char sqlstate[SQLSTATE_LENGTH+1];
void *extension; void *extension;
......
...@@ -106,9 +106,9 @@ typedef struct st_mysql_ftparser_param MYSQL_FTPARSER_PARAM; ...@@ -106,9 +106,9 @@ typedef struct st_mysql_ftparser_param MYSQL_FTPARSER_PARAM;
typedef struct st_mysql_methods MYSQL_METHODS; typedef struct st_mysql_methods MYSQL_METHODS;
# 47 "mysql_time.h" # 47 "mysql_time.h"
typedef struct st_mysql_time MYSQL_TIME; typedef struct st_mysql_time MYSQL_TIME;
# 384 "mysql_com.h" # 383 "mysql_com.h"
typedef struct st_udf_args UDF_ARGS; typedef struct st_udf_args UDF_ARGS;
# 398 "mysql_com.h" # 397 "mysql_com.h"
typedef struct st_udf_init UDF_INIT; typedef struct st_udf_init UDF_INIT;
# 26 "my_alloc.h" # 26 "my_alloc.h"
typedef struct st_used_mem USED_MEM; typedef struct st_used_mem USED_MEM;
...@@ -130,7 +130,7 @@ struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(vo ...@@ -130,7 +130,7 @@ struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(vo
unsigned int mbminlen; unsigned int mbminlen;
unsigned int mbmaxlen; unsigned int mbmaxlen;
}; };
# 370 "mysql_com.h" # 369 "mysql_com.h"
struct __attribute__((aligned(__alignof__(unsigned long int)), aligned(__alignof__(double)))) rand_struct struct __attribute__((aligned(__alignof__(unsigned long int)), aligned(__alignof__(double)))) rand_struct
{ {
unsigned long int seed1; unsigned long int seed1;
...@@ -542,11 +542,11 @@ struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned ...@@ -542,11 +542,11 @@ struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned
my_bool compress; my_bool compress;
my_bool unused1; my_bool unused1;
unsigned char * query_cache_query; unsigned char * query_cache_query;
unsigned int client_last_errno; unsigned int last_errno;
unsigned char error; unsigned char error;
my_bool unused2; my_bool unused2;
my_bool return_errno; my_bool return_errno;
char client_last_error[512]; char last_error[512];
char sqlstate[(5 + 1)]; char sqlstate[(5 + 1)];
void * extension; void * extension;
}; };
...@@ -558,7 +558,7 @@ struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(vo ...@@ -558,7 +558,7 @@ struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(vo
char const * * type_names; char const * * type_names;
unsigned int * type_lengths; unsigned int * type_lengths;
}; };
# 384 "mysql_com.h" # 383 "mysql_com.h"
struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(void *)))) st_udf_args struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(void *)))) st_udf_args
{ {
unsigned int arg_count; unsigned int arg_count;
...@@ -570,7 +570,7 @@ struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(vo ...@@ -570,7 +570,7 @@ struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(vo
unsigned long int * attribute_lengths; unsigned long int * attribute_lengths;
void * extension; void * extension;
}; };
# 398 "mysql_com.h" # 397 "mysql_com.h"
struct __attribute__((aligned(__alignof__(unsigned long int)), aligned(__alignof__(void *)))) st_udf_init struct __attribute__((aligned(__alignof__(unsigned long int)), aligned(__alignof__(void *)))) st_udf_init
{ {
my_bool maybe_null; my_bool maybe_null;
...@@ -587,7 +587,7 @@ struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned ...@@ -587,7 +587,7 @@ struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned
unsigned int left; unsigned int left;
unsigned int size; unsigned int size;
}; };
# 381 "mysql_com.h" # 380 "mysql_com.h"
enum Item_result enum Item_result
{ {
STRING_RESULT = 0, STRING_RESULT = 0,
...@@ -596,7 +596,7 @@ enum Item_result ...@@ -596,7 +596,7 @@ enum Item_result
ROW_RESULT = 3, ROW_RESULT = 3,
DECIMAL_RESULT = 4, DECIMAL_RESULT = 4,
}; };
# 322 "mysql_com.h" # 321 "mysql_com.h"
enum enum_cursor_type enum enum_cursor_type
{ {
CURSOR_TYPE_NO_CURSOR = 0, CURSOR_TYPE_NO_CURSOR = 0,
...@@ -604,7 +604,7 @@ enum enum_cursor_type ...@@ -604,7 +604,7 @@ enum enum_cursor_type
CURSOR_TYPE_FOR_UPDATE = 2, CURSOR_TYPE_FOR_UPDATE = 2,
CURSOR_TYPE_SCROLLABLE = 4, CURSOR_TYPE_SCROLLABLE = 4,
}; };
# 235 "mysql_com.h" # 234 "mysql_com.h"
enum enum_field_types enum enum_field_types
{ {
MYSQL_TYPE_DECIMAL = 0, MYSQL_TYPE_DECIMAL = 0,
...@@ -651,7 +651,7 @@ enum enum_ftparser_mode ...@@ -651,7 +651,7 @@ enum enum_ftparser_mode
MYSQL_FTPARSER_WITH_STOPWORDS = 1, MYSQL_FTPARSER_WITH_STOPWORDS = 1,
MYSQL_FTPARSER_FULL_BOOLEAN_INFO = 2, MYSQL_FTPARSER_FULL_BOOLEAN_INFO = 2,
}; };
# 332 "mysql_com.h" # 331 "mysql_com.h"
enum enum_mysql_set_option enum enum_mysql_set_option
{ {
MYSQL_OPTION_MULTI_STATEMENTS_ON = 0, MYSQL_OPTION_MULTI_STATEMENTS_ON = 0,
...@@ -730,7 +730,7 @@ enum enum_stmt_attr_type ...@@ -730,7 +730,7 @@ enum enum_stmt_attr_type
STMT_ATTR_CURSOR_TYPE = 1, STMT_ATTR_CURSOR_TYPE = 1,
STMT_ATTR_PREFETCH_ROWS = 2, STMT_ATTR_PREFETCH_ROWS = 2,
}; };
# 297 "mysql_com.h" # 296 "mysql_com.h"
enum mysql_enum_shutdown_level enum mysql_enum_shutdown_level
{ {
SHUTDOWN_DEFAULT = 0, SHUTDOWN_DEFAULT = 0,
...@@ -790,13 +790,13 @@ enum mysql_status ...@@ -790,13 +790,13 @@ enum mysql_status
MYSQL_STATUS_GET_RESULT = 1, MYSQL_STATUS_GET_RESULT = 1,
MYSQL_STATUS_USE_RESULT = 2, MYSQL_STATUS_USE_RESULT = 2,
}; };
# 439 "mysql_com.h" # 441 "mysql_com.h"
extern my_bool check_scramble(char const * reply, char const * message, unsigned char const * hash_stage2); extern my_bool check_scramble(char const * reply, char const * message, unsigned char const * hash_stage2);
# 432 "mysql_com.h" # 434 "mysql_com.h"
extern my_bool check_scramble_323(char const *, char const * message, unsigned long int * salt); extern my_bool check_scramble_323(char const *, char const * message, unsigned long int * salt);
# 35 "typelib.h" # 35 "typelib.h"
extern TYPELIB * copy_typelib(MEM_ROOT * root, TYPELIB * from); extern TYPELIB * copy_typelib(MEM_ROOT * root, TYPELIB * from);
# 427 "mysql_com.h" # 429 "mysql_com.h"
extern void create_random_string(char * to, unsigned int, struct rand_struct * rand_st); extern void create_random_string(char * to, unsigned int, struct rand_struct * rand_st);
# 32 "typelib.h" # 32 "typelib.h"
extern int find_type(char * x, TYPELIB const * typelib, unsigned int); extern int find_type(char * x, TYPELIB const * typelib, unsigned int);
...@@ -804,15 +804,15 @@ extern int find_type(char * x, TYPELIB const * typelib, unsigned int); ...@@ -804,15 +804,15 @@ extern int find_type(char * x, TYPELIB const * typelib, unsigned int);
extern int find_type_or_exit(char const * x, TYPELIB * typelib, char const * option); extern int find_type_or_exit(char const * x, TYPELIB * typelib, char const * option);
# 29 "typelib.h" # 29 "typelib.h"
extern my_ulonglong find_typeset(char * x, TYPELIB * typelib, int * error_position); extern my_ulonglong find_typeset(char * x, TYPELIB * typelib, int * error_position);
# 441 "mysql_com.h" # 443 "mysql_com.h"
extern void get_salt_from_password(unsigned char * res, char const * password); extern void get_salt_from_password(unsigned char * res, char const * password);
# 434 "mysql_com.h" # 436 "mysql_com.h"
extern void get_salt_from_password_323(unsigned long int * res, char const * password); extern void get_salt_from_password_323(unsigned long int * res, char const * password);
# 447 "mysql_com.h" # 449 "mysql_com.h"
extern char * get_tty_password(char const * opt_message); extern char * get_tty_password(char const * opt_message);
# 34 "typelib.h" # 34 "typelib.h"
extern char const * get_type(TYPELIB * typelib, unsigned int); extern char const * get_type(TYPELIB * typelib, unsigned int);
# 429 "mysql_com.h" # 431 "mysql_com.h"
extern void hash_password(unsigned long int * to, char const * password, unsigned int); extern void hash_password(unsigned long int * to, char const * password, unsigned int);
# 30 "my_list.h" # 30 "my_list.h"
extern LIST * list_add(LIST * root, LIST * element); extern LIST * list_add(LIST * root, LIST * element);
...@@ -828,31 +828,31 @@ extern unsigned int list_length(LIST *); ...@@ -828,31 +828,31 @@ extern unsigned int list_length(LIST *);
extern LIST * list_reverse(LIST * root); extern LIST * list_reverse(LIST * root);
# 36 "my_list.h" # 36 "my_list.h"
extern int list_walk(LIST *, list_walk_action, unsigned char * argument); extern int list_walk(LIST *, list_walk_action, unsigned char * argument);
# 442 "mysql_com.h" # 444 "mysql_com.h"
extern void make_password_from_salt(char * to, unsigned char const * hash_stage2); extern void make_password_from_salt(char * to, unsigned char const * hash_stage2);
# 435 "mysql_com.h"
extern void make_password_from_salt_323(char * to, unsigned long int const * salt);
# 437 "mysql_com.h" # 437 "mysql_com.h"
extern void make_password_from_salt_323(char * to, unsigned long int const * salt);
# 439 "mysql_com.h"
extern void make_scrambled_password(char * to, char const * password); extern void make_scrambled_password(char * to, char const * password);
# 430 "mysql_com.h" # 432 "mysql_com.h"
extern void make_scrambled_password_323(char * to, char const * password); extern void make_scrambled_password_323(char * to, char const * password);
# 33 "typelib.h" # 33 "typelib.h"
extern void make_type(char * to, unsigned int, TYPELIB * typelib); extern void make_type(char * to, unsigned int, TYPELIB * typelib);
# 367 "mysql_com.h" # 366 "mysql_com.h"
extern int my_connect(my_socket, struct sockaddr const * name, unsigned int, unsigned int); extern int my_connect(my_socket, struct sockaddr const * name, unsigned int, unsigned int);
# 344 "mysql_com.h" # 343 "mysql_com.h"
extern my_bool my_net_init(NET * net, Vio * vio); extern my_bool my_net_init(NET * net, Vio * vio);
# 345 "mysql_com.h" # 344 "mysql_com.h"
extern void my_net_local_init(NET * net); extern void my_net_local_init(NET * net);
# 355 "mysql_com.h" # 354 "mysql_com.h"
extern unsigned long int my_net_read(NET * net); extern unsigned long int my_net_read(NET * net);
# 350 "mysql_com.h" # 349 "mysql_com.h"
extern my_bool my_net_write(NET * net, unsigned char const * packet, size_t); extern my_bool my_net_write(NET * net, unsigned char const * packet, size_t);
# 426 "mysql_com.h" # 428 "mysql_com.h"
extern double my_rnd(struct rand_struct *); extern double my_rnd(struct rand_struct *);
# 453 "mysql_com.h" # 455 "mysql_com.h"
extern void my_thread_end(void); extern void my_thread_end(void);
# 452 "mysql_com.h" # 454 "mysql_com.h"
extern my_bool my_thread_init(void); extern my_bool my_thread_init(void);
# 560 "mysql.h" # 560 "mysql.h"
extern void myodbc_remove_escape(MYSQL * mysql, char * name); extern void myodbc_remove_escape(MYSQL * mysql, char * name);
...@@ -890,7 +890,7 @@ extern void mysql_enable_rpl_parse(MYSQL * mysql); ...@@ -890,7 +890,7 @@ extern void mysql_enable_rpl_parse(MYSQL * mysql);
extern my_bool mysql_eof(MYSQL_RES * res); extern my_bool mysql_eof(MYSQL_RES * res);
# 423 "mysql.h" # 423 "mysql.h"
extern unsigned int mysql_errno(MYSQL * mysql); extern unsigned int mysql_errno(MYSQL * mysql);
# 448 "mysql_com.h" # 450 "mysql_com.h"
extern char const * mysql_errno_to_sqlstate(unsigned int); extern char const * mysql_errno_to_sqlstate(unsigned int);
# 424 "mysql.h" # 424 "mysql.h"
extern char const * mysql_error(MYSQL * mysql); extern char const * mysql_error(MYSQL * mysql);
...@@ -1108,25 +1108,25 @@ extern char * mysql_unix_port; ...@@ -1108,25 +1108,25 @@ extern char * mysql_unix_port;
extern MYSQL_RES * mysql_use_result(MYSQL * mysql); extern MYSQL_RES * mysql_use_result(MYSQL * mysql);
# 426 "mysql.h" # 426 "mysql.h"
extern unsigned int mysql_warning_count(MYSQL * mysql); extern unsigned int mysql_warning_count(MYSQL * mysql);
# 347 "mysql_com.h"
extern void net_clear(NET * net, my_bool);
# 346 "mysql_com.h" # 346 "mysql_com.h"
extern void net_clear(NET * net, my_bool);
# 345 "mysql_com.h"
extern void net_end(NET * net); extern void net_end(NET * net);
# 349 "mysql_com.h" # 348 "mysql_com.h"
extern my_bool net_flush(NET * net); extern my_bool net_flush(NET * net);
# 354 "mysql_com.h" # 353 "mysql_com.h"
extern int net_real_write(NET * net, unsigned char const * packet, size_t); extern int net_real_write(NET * net, unsigned char const * packet, size_t);
# 348 "mysql_com.h" # 347 "mysql_com.h"
extern my_bool net_realloc(NET * net, size_t); extern my_bool net_realloc(NET * net, size_t);
# 351 "mysql_com.h" # 350 "mysql_com.h"
extern my_bool net_write_command(NET * net, unsigned char, unsigned char const * header, size_t, unsigned char const * packet, size_t); extern my_bool net_write_command(NET * net, unsigned char, unsigned char const * header, size_t, unsigned char const * packet, size_t);
# 443 "mysql_com.h" # 445 "mysql_com.h"
extern char * octet2hex(char * to, char const * str, unsigned int); extern char * octet2hex(char * to, char const * str, unsigned int);
# 424 "mysql_com.h" # 426 "mysql_com.h"
extern void randominit(struct rand_struct *, unsigned long int, unsigned long int); extern void randominit(struct rand_struct *, unsigned long int, unsigned long int);
# 438 "mysql_com.h" # 440 "mysql_com.h"
extern void scramble(char * to, char const * message, char const * password); extern void scramble(char * to, char const * message, char const * password);
# 431 "mysql_com.h" # 433 "mysql_com.h"
extern void scramble_323(char * to, char const * message, char const * password); extern void scramble_323(char * to, char const * message, char const * password);
# 37 "typelib.h" # 37 "typelib.h"
extern TYPELIB sql_protocol_typelib; extern TYPELIB sql_protocol_typelib;
......
...@@ -440,11 +440,11 @@ static void expand_error(MYSQL* mysql, int error) ...@@ -440,11 +440,11 @@ static void expand_error(MYSQL* mysql, int error)
char tmp[MYSQL_ERRMSG_SIZE]; char tmp[MYSQL_ERRMSG_SIZE];
char *p; char *p;
uint err_length; uint err_length;
strmake(tmp, mysql->net.client_last_error, MYSQL_ERRMSG_SIZE-1); strmake(tmp, mysql->net.last_error, MYSQL_ERRMSG_SIZE-1);
p = strmake(mysql->net.client_last_error, ER(error), MYSQL_ERRMSG_SIZE-1); p = strmake(mysql->net.last_error, ER(error), MYSQL_ERRMSG_SIZE-1);
err_length= (uint) (p - mysql->net.client_last_error); err_length= (uint) (p - mysql->net.last_error);
strmake(p, tmp, MYSQL_ERRMSG_SIZE-1 - err_length); strmake(p, tmp, MYSQL_ERRMSG_SIZE-1 - err_length);
mysql->net.client_last_errno = error; mysql->net.last_errno = error;
} }
/* /*
...@@ -870,10 +870,10 @@ my_bool handle_local_infile(MYSQL *mysql, const char *net_filename) ...@@ -870,10 +870,10 @@ my_bool handle_local_infile(MYSQL *mysql, const char *net_filename)
VOID(my_net_write(net,(const uchar*) "",0)); /* Server needs one packet */ VOID(my_net_write(net,(const uchar*) "",0)); /* Server needs one packet */
net_flush(net); net_flush(net);
strmov(net->sqlstate, unknown_sqlstate); strmov(net->sqlstate, unknown_sqlstate);
net->client_last_errno= net->last_errno=
(*options->local_infile_error)(li_ptr, (*options->local_infile_error)(li_ptr,
net->client_last_error, net->last_error,
sizeof(net->client_last_error)-1); sizeof(net->last_error)-1);
goto err; goto err;
} }
...@@ -900,10 +900,10 @@ my_bool handle_local_infile(MYSQL *mysql, const char *net_filename) ...@@ -900,10 +900,10 @@ my_bool handle_local_infile(MYSQL *mysql, const char *net_filename)
if (readcount < 0) if (readcount < 0)
{ {
net->client_last_errno= net->last_errno=
(*options->local_infile_error)(li_ptr, (*options->local_infile_error)(li_ptr,
net->client_last_error, net->last_error,
sizeof(net->client_last_error)-1); sizeof(net->last_error)-1);
goto err; goto err;
} }
...@@ -1397,7 +1397,7 @@ const char *cli_read_statistics(MYSQL *mysql) ...@@ -1397,7 +1397,7 @@ const char *cli_read_statistics(MYSQL *mysql)
if (!mysql->net.read_pos[0]) if (!mysql->net.read_pos[0])
{ {
set_mysql_error(mysql, CR_WRONG_HOST_INFO, unknown_sqlstate); set_mysql_error(mysql, CR_WRONG_HOST_INFO, unknown_sqlstate);
return mysql->net.client_last_error; return mysql->net.last_error;
} }
return (char*) mysql->net.read_pos; return (char*) mysql->net.read_pos;
} }
...@@ -1408,7 +1408,7 @@ mysql_stat(MYSQL *mysql) ...@@ -1408,7 +1408,7 @@ mysql_stat(MYSQL *mysql)
{ {
DBUG_ENTER("mysql_stat"); DBUG_ENTER("mysql_stat");
if (simple_command(mysql,COM_STATISTICS,0,0,0)) if (simple_command(mysql,COM_STATISTICS,0,0,0))
DBUG_RETURN(mysql->net.client_last_error); DBUG_RETURN(mysql->net.last_error);
DBUG_RETURN((*mysql->methods->read_statistics)(mysql)); DBUG_RETURN((*mysql->methods->read_statistics)(mysql));
} }
...@@ -1773,7 +1773,7 @@ static my_bool my_realloc_str(NET *net, ulong length) ...@@ -1773,7 +1773,7 @@ static my_bool my_realloc_str(NET *net, ulong length)
if (res) if (res)
{ {
strmov(net->sqlstate, unknown_sqlstate); strmov(net->sqlstate, unknown_sqlstate);
strmov(net->client_last_error, ER(net->client_last_errno)); strmov(net->last_error, ER(net->last_errno));
} }
net->write_pos= net->buff+ buf_length; net->write_pos= net->buff+ buf_length;
} }
...@@ -1825,14 +1825,14 @@ void set_stmt_errmsg(MYSQL_STMT *stmt, NET *net) ...@@ -1825,14 +1825,14 @@ void set_stmt_errmsg(MYSQL_STMT *stmt, NET *net)
{ {
DBUG_ENTER("set_stmt_errmsg"); DBUG_ENTER("set_stmt_errmsg");
DBUG_PRINT("enter", ("error: %d/%s '%s'", DBUG_PRINT("enter", ("error: %d/%s '%s'",
net->client_last_errno, net->last_errno,
net->sqlstate, net->sqlstate,
net->client_last_error)); net->last_error));
DBUG_ASSERT(stmt != 0); DBUG_ASSERT(stmt != 0);
stmt->last_errno= net->client_last_errno; stmt->last_errno= net->last_errno;
if (net->client_last_error && net->client_last_error[0]) if (net->last_error && net->last_error[0])
strmov(stmt->last_error, net->client_last_error); strmov(stmt->last_error, net->last_error);
strmov(stmt->sqlstate, net->sqlstate); strmov(stmt->sqlstate, net->sqlstate);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
......
...@@ -160,7 +160,7 @@ MYSQL_MANAGER* STDCALL mysql_manager_connect(MYSQL_MANAGER* con, ...@@ -160,7 +160,7 @@ MYSQL_MANAGER* STDCALL mysql_manager_connect(MYSQL_MANAGER* con,
msg_len=strlen(msg_buf); msg_len=strlen(msg_buf);
if (my_net_write(&con->net,(uchar*) msg_buf,msg_len) || net_flush(&con->net)) if (my_net_write(&con->net,(uchar*) msg_buf,msg_len) || net_flush(&con->net))
{ {
con->last_errno=con->net.client_last_errno; con->last_errno=con->net.last_errno;
strmov(con->last_error,"Write error on socket"); strmov(con->last_error,"Write error on socket");
goto err; goto err;
} }
......
...@@ -61,8 +61,8 @@ void embedded_get_error(MYSQL *mysql, MYSQL_DATA *data) ...@@ -61,8 +61,8 @@ void embedded_get_error(MYSQL *mysql, MYSQL_DATA *data)
{ {
NET *net= &mysql->net; NET *net= &mysql->net;
struct embedded_query_result *ei= data->embedded_info; struct embedded_query_result *ei= data->embedded_info;
net->client_last_errno= ei->last_errno; net->last_errno= ei->last_errno;
strmake(net->client_last_error, ei->info, sizeof(net->client_last_error)-1); strmake(net->last_error, ei->info, sizeof(net->last_error)-1);
memcpy(net->sqlstate, ei->sqlstate, sizeof(net->sqlstate)); memcpy(net->sqlstate, ei->sqlstate, sizeof(net->sqlstate));
mysql->server_status= ei->server_status; mysql->server_status= ei->server_status;
my_free(data, MYF(0)); my_free(data, MYF(0));
...@@ -685,7 +685,7 @@ int check_embedded_connection(MYSQL *mysql, const char *db) ...@@ -685,7 +685,7 @@ int check_embedded_connection(MYSQL *mysql, const char *db)
err: err:
{ {
NET *net= &mysql->net; NET *net= &mysql->net;
strmake(net->client_last_error, thd->main_da.message(), sizeof(net->client_last_error)-1); strmake(net->last_error, thd->main_da.message(), sizeof(net->last_error)-1);
memcpy(net->sqlstate, memcpy(net->sqlstate,
mysql_errno_to_sqlstate(thd->main_da.sql_errno()), mysql_errno_to_sqlstate(thd->main_da.sql_errno()),
sizeof(net->sqlstate)-1); sizeof(net->sqlstate)-1);
......
...@@ -210,8 +210,8 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, ...@@ -210,8 +210,8 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
error: error:
DBUG_PRINT("error",("message: %u (%s)", DBUG_PRINT("error",("message: %u (%s)",
mysql->net.client_last_errno, mysql->net.last_errno,
mysql->net.client_last_error)); mysql->net.last_error));
{ {
/* Free alloced memory */ /* Free alloced memory */
my_bool free_me=mysql->free_me; my_bool free_me=mysql->free_me;
......
...@@ -257,7 +257,7 @@ int Mysql_connection::do_command() ...@@ -257,7 +257,7 @@ int Mysql_connection::do_command()
return 1; return 1;
if (thread_registry->is_shutdown()) if (thread_registry->is_shutdown())
return 1; return 1;
net_send_error(&net, net.client_last_errno); net_send_error(&net, net.last_errno);
net.error= 0; net.error= 0;
return 0; return 0;
} }
......
...@@ -289,8 +289,8 @@ void set_mysql_error(MYSQL *mysql, int errcode, const char *sqlstate) ...@@ -289,8 +289,8 @@ void set_mysql_error(MYSQL *mysql, int errcode, const char *sqlstate)
DBUG_ASSERT(mysql != 0); DBUG_ASSERT(mysql != 0);
net= &mysql->net; net= &mysql->net;
net->client_last_errno= errcode; net->last_errno= errcode;
strmov(net->client_last_error, ER(errcode)); strmov(net->last_error, ER(errcode));
strmov(net->sqlstate, sqlstate); strmov(net->sqlstate, sqlstate);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
...@@ -304,8 +304,8 @@ void set_mysql_error(MYSQL *mysql, int errcode, const char *sqlstate) ...@@ -304,8 +304,8 @@ void set_mysql_error(MYSQL *mysql, int errcode, const char *sqlstate)
void net_clear_error(NET *net) void net_clear_error(NET *net)
{ {
net->client_last_errno= 0; net->last_errno= 0;
net->client_last_error[0]= '\0'; net->last_error[0]= '\0';
strmov(net->sqlstate, not_error_sqlstate); strmov(net->sqlstate, not_error_sqlstate);
} }
...@@ -331,9 +331,9 @@ static void set_mysql_extended_error(MYSQL *mysql, int errcode, ...@@ -331,9 +331,9 @@ static void set_mysql_extended_error(MYSQL *mysql, int errcode,
DBUG_ASSERT(mysql != 0); DBUG_ASSERT(mysql != 0);
net= &mysql->net; net= &mysql->net;
net->client_last_errno= errcode; net->last_errno= errcode;
va_start(args, format); va_start(args, format);
my_vsnprintf(net->client_last_error, sizeof(net->client_last_error)-1, my_vsnprintf(net->last_error, sizeof(net->last_error)-1,
format, args); format, args);
va_end(args); va_end(args);
strmov(net->sqlstate, sqlstate); strmov(net->sqlstate, sqlstate);
...@@ -667,7 +667,7 @@ cli_safe_read(MYSQL *mysql) ...@@ -667,7 +667,7 @@ cli_safe_read(MYSQL *mysql)
return (packet_error); return (packet_error);
#endif /*MYSQL_SERVER*/ #endif /*MYSQL_SERVER*/
end_server(mysql); end_server(mysql);
set_mysql_error(mysql, net->client_last_errno == ER_NET_PACKET_TOO_LARGE ? set_mysql_error(mysql, net->last_errno == ER_NET_PACKET_TOO_LARGE ?
CR_NET_PACKET_TOO_LARGE: CR_SERVER_LOST, unknown_sqlstate); CR_NET_PACKET_TOO_LARGE: CR_SERVER_LOST, unknown_sqlstate);
return (packet_error); return (packet_error);
} }
...@@ -676,7 +676,7 @@ cli_safe_read(MYSQL *mysql) ...@@ -676,7 +676,7 @@ cli_safe_read(MYSQL *mysql)
if (len > 3) if (len > 3)
{ {
char *pos=(char*) net->read_pos+1; char *pos=(char*) net->read_pos+1;
net->client_last_errno=uint2korr(pos); net->last_errno=uint2korr(pos);
pos+=2; pos+=2;
len-=2; len-=2;
if (protocol_41(mysql) && pos[0] == '#') if (protocol_41(mysql) && pos[0] == '#')
...@@ -684,8 +684,8 @@ cli_safe_read(MYSQL *mysql) ...@@ -684,8 +684,8 @@ cli_safe_read(MYSQL *mysql)
strmake(net->sqlstate, pos+1, SQLSTATE_LENGTH); strmake(net->sqlstate, pos+1, SQLSTATE_LENGTH);
pos+= SQLSTATE_LENGTH+1; pos+= SQLSTATE_LENGTH+1;
} }
(void) strmake(net->client_last_error,(char*) pos, (void) strmake(net->last_error,(char*) pos,
min((uint) len,(uint) sizeof(net->client_last_error)-1)); min((uint) len,(uint) sizeof(net->last_error)-1));
} }
else else
set_mysql_error(mysql, CR_UNKNOWN_ERROR, unknown_sqlstate); set_mysql_error(mysql, CR_UNKNOWN_ERROR, unknown_sqlstate);
...@@ -701,9 +701,9 @@ cli_safe_read(MYSQL *mysql) ...@@ -701,9 +701,9 @@ cli_safe_read(MYSQL *mysql)
mysql->server_status&= ~SERVER_MORE_RESULTS_EXISTS; mysql->server_status&= ~SERVER_MORE_RESULTS_EXISTS;
DBUG_PRINT("error",("Got error: %d/%s (%s)", DBUG_PRINT("error",("Got error: %d/%s (%s)",
net->client_last_errno, net->last_errno,
net->sqlstate, net->sqlstate,
net->client_last_error)); net->last_error));
return(packet_error); return(packet_error);
} }
return len; return len;
...@@ -760,7 +760,7 @@ cli_advanced_command(MYSQL *mysql, enum enum_server_command command, ...@@ -760,7 +760,7 @@ cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
{ {
DBUG_PRINT("error",("Can't send command to server. Error: %d", DBUG_PRINT("error",("Can't send command to server. Error: %d",
socket_errno)); socket_errno));
if (net->client_last_errno == ER_NET_PACKET_TOO_LARGE) if (net->last_errno == ER_NET_PACKET_TOO_LARGE)
{ {
set_mysql_error(mysql, CR_NET_PACKET_TOO_LARGE, unknown_sqlstate); set_mysql_error(mysql, CR_NET_PACKET_TOO_LARGE, unknown_sqlstate);
goto end; goto end;
...@@ -845,7 +845,7 @@ static my_bool is_NT(void) ...@@ -845,7 +845,7 @@ static my_bool is_NT(void)
@retval 0 success @retval 0 success
@retval !0 network error or the server is not commercial. @retval !0 network error or the server is not commercial.
Error code is saved in mysql->net.client_last_errno. Error code is saved in mysql->net.last_errno.
*/ */
static int check_license(MYSQL *mysql) static int check_license(MYSQL *mysql)
...@@ -858,7 +858,7 @@ static int check_license(MYSQL *mysql) ...@@ -858,7 +858,7 @@ static int check_license(MYSQL *mysql)
if (mysql_real_query(mysql, query, sizeof(query)-1)) if (mysql_real_query(mysql, query, sizeof(query)-1))
{ {
if (net->client_last_errno == ER_UNKNOWN_SYSTEM_VARIABLE) if (net->last_errno == ER_UNKNOWN_SYSTEM_VARIABLE)
{ {
set_mysql_extended_error(mysql, CR_WRONG_LICENSE, unknown_sqlstate, set_mysql_extended_error(mysql, CR_WRONG_LICENSE, unknown_sqlstate,
ER(CR_WRONG_LICENSE), required_license); ER(CR_WRONG_LICENSE), required_license);
...@@ -873,7 +873,7 @@ static int check_license(MYSQL *mysql) ...@@ -873,7 +873,7 @@ static int check_license(MYSQL *mysql)
two is ever true for server variables now), or column value two is ever true for server variables now), or column value
mismatch, set wrong license error. mismatch, set wrong license error.
*/ */
if (!net->client_last_errno && if (!net->last_errno &&
(!row || !row[0] || (!row || !row[0] ||
strncmp(row[0], required_license, sizeof(required_license)))) strncmp(row[0], required_license, sizeof(required_license))))
{ {
...@@ -881,7 +881,7 @@ static int check_license(MYSQL *mysql) ...@@ -881,7 +881,7 @@ static int check_license(MYSQL *mysql)
ER(CR_WRONG_LICENSE), required_license); ER(CR_WRONG_LICENSE), required_license);
} }
mysql_free_result(res); mysql_free_result(res);
return net->client_last_errno; return net->last_errno;
} }
#endif /* CHECK_LICENSE */ #endif /* CHECK_LICENSE */
...@@ -2090,7 +2090,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -2090,7 +2090,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
if ((pkt_length=cli_safe_read(mysql)) == packet_error) if ((pkt_length=cli_safe_read(mysql)) == packet_error)
{ {
if (mysql->net.client_last_errno == CR_SERVER_LOST) if (mysql->net.last_errno == CR_SERVER_LOST)
set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate, set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate,
ER(CR_SERVER_LOST_EXTENDED), ER(CR_SERVER_LOST_EXTENDED),
"reading initial communication packet", "reading initial communication packet",
...@@ -2324,7 +2324,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -2324,7 +2324,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
if ((pkt_length=cli_safe_read(mysql)) == packet_error) if ((pkt_length=cli_safe_read(mysql)) == packet_error)
{ {
if (mysql->net.client_last_errno == CR_SERVER_LOST) if (mysql->net.last_errno == CR_SERVER_LOST)
set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate, set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate,
ER(CR_SERVER_LOST_EXTENDED), ER(CR_SERVER_LOST_EXTENDED),
"reading authorization packet", "reading authorization packet",
...@@ -2352,7 +2352,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -2352,7 +2352,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
/* Read what server thinks about out new auth message report */ /* Read what server thinks about out new auth message report */
if (cli_safe_read(mysql) == packet_error) if (cli_safe_read(mysql) == packet_error)
{ {
if (mysql->net.client_last_errno == CR_SERVER_LOST) if (mysql->net.last_errno == CR_SERVER_LOST)
set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate, set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate,
ER(CR_SERVER_LOST_EXTENDED), ER(CR_SERVER_LOST_EXTENDED),
"reading final connect information", "reading final connect information",
...@@ -2371,7 +2371,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -2371,7 +2371,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
if (db && mysql_select_db(mysql, db)) if (db && mysql_select_db(mysql, db))
{ {
if (mysql->net.client_last_errno == CR_SERVER_LOST) if (mysql->net.last_errno == CR_SERVER_LOST)
set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate, set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate,
ER(CR_SERVER_LOST_EXTENDED), ER(CR_SERVER_LOST_EXTENDED),
"Setting intital database", "Setting intital database",
...@@ -2415,9 +2415,9 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -2415,9 +2415,9 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
error: error:
reset_sigpipe(mysql); reset_sigpipe(mysql);
DBUG_PRINT("error",("message: %u/%s (%s)", DBUG_PRINT("error",("message: %u/%s (%s)",
net->client_last_errno, net->last_errno,
net->sqlstate, net->sqlstate,
net->client_last_error)); net->last_error));
{ {
/* Free alloced memory */ /* Free alloced memory */
end_server(mysql); end_server(mysql);
...@@ -2475,8 +2475,8 @@ my_bool mysql_reconnect(MYSQL *mysql) ...@@ -2475,8 +2475,8 @@ my_bool mysql_reconnect(MYSQL *mysql)
mysql->db, mysql->port, mysql->unix_socket, mysql->db, mysql->port, mysql->unix_socket,
mysql->client_flag | CLIENT_REMEMBER_OPTIONS)) mysql->client_flag | CLIENT_REMEMBER_OPTIONS))
{ {
mysql->net.client_last_errno= tmp_mysql.net.client_last_errno; mysql->net.last_errno= tmp_mysql.net.last_errno;
strmov(mysql->net.client_last_error, tmp_mysql.net.client_last_error); strmov(mysql->net.last_error, tmp_mysql.net.last_error);
strmov(mysql->net.sqlstate, tmp_mysql.net.sqlstate); strmov(mysql->net.sqlstate, tmp_mysql.net.sqlstate);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
...@@ -2485,8 +2485,8 @@ my_bool mysql_reconnect(MYSQL *mysql) ...@@ -2485,8 +2485,8 @@ my_bool mysql_reconnect(MYSQL *mysql)
DBUG_PRINT("error", ("mysql_set_character_set() failed")); DBUG_PRINT("error", ("mysql_set_character_set() failed"));
bzero((char*) &tmp_mysql.options,sizeof(tmp_mysql.options)); bzero((char*) &tmp_mysql.options,sizeof(tmp_mysql.options));
mysql_close(&tmp_mysql); mysql_close(&tmp_mysql);
mysql->net.client_last_errno= tmp_mysql.net.client_last_errno; mysql->net.last_errno= tmp_mysql.net.last_errno;
strmov(mysql->net.client_last_error, tmp_mysql.net.client_last_error); strmov(mysql->net.last_error, tmp_mysql.net.last_error);
strmov(mysql->net.sqlstate, tmp_mysql.net.sqlstate); strmov(mysql->net.sqlstate, tmp_mysql.net.sqlstate);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
...@@ -3087,13 +3087,13 @@ unsigned int STDCALL mysql_num_fields(MYSQL_RES *res) ...@@ -3087,13 +3087,13 @@ unsigned int STDCALL mysql_num_fields(MYSQL_RES *res)
uint STDCALL mysql_errno(MYSQL *mysql) uint STDCALL mysql_errno(MYSQL *mysql)
{ {
return mysql->net.client_last_errno; return mysql->net.last_errno;
} }
const char * STDCALL mysql_error(MYSQL *mysql) const char * STDCALL mysql_error(MYSQL *mysql)
{ {
return mysql->net.client_last_error; return mysql->net.last_error;
} }
...@@ -3162,7 +3162,7 @@ int STDCALL mysql_set_character_set(MYSQL *mysql, const char *cs_name) ...@@ -3162,7 +3162,7 @@ int STDCALL mysql_set_character_set(MYSQL *mysql, const char *cs_name)
ER(CR_CANT_READ_CHARSET), cs_name, cs_dir_name); ER(CR_CANT_READ_CHARSET), cs_name, cs_dir_name);
} }
charsets_dir= save_csdir; charsets_dir= save_csdir;
return mysql->net.client_last_errno; return mysql->net.last_errno;
} }
...@@ -137,7 +137,7 @@ static void inline slave_rows_error_report(enum loglevel level, int ha_error, ...@@ -137,7 +137,7 @@ static void inline slave_rows_error_report(enum loglevel level, int ha_error,
" %s, Error_code: %d;", err->msg, err->code); " %s, Error_code: %d;", err->msg, err->code);
} }
rli->report(level, thd->net.client_last_errno, rli->report(level, thd->net.last_errno,
"Could not execute %s event on table %s.%s;" "Could not execute %s event on table %s.%s;"
"%s handler error %s; " "%s handler error %s; "
"the event's master log %s, end_log_pos %lu", "the event's master log %s, end_log_pos %lu",
......
...@@ -1529,10 +1529,10 @@ int Old_rows_log_event::do_apply_event(Relay_log_info const *rli) ...@@ -1529,10 +1529,10 @@ int Old_rows_log_event::do_apply_event(Relay_log_info const *rli)
Error reporting borrowed from Query_log_event with many excessive Error reporting borrowed from Query_log_event with many excessive
simplifications (we don't honour --slave-skip-errors) simplifications (we don't honour --slave-skip-errors)
*/ */
uint actual_error= thd->net.client_last_errno; uint actual_error= thd->net.last_errno;
rli->report(ERROR_LEVEL, actual_error, rli->report(ERROR_LEVEL, actual_error,
"Error '%s' in %s event: when locking tables", "Error '%s' in %s event: when locking tables",
(actual_error ? thd->net.client_last_error : (actual_error ? thd->net.last_error :
"unexpected success or fatal error"), "unexpected success or fatal error"),
get_type_str()); get_type_str());
thd->is_fatal_error= 1; thd->is_fatal_error= 1;
...@@ -1573,10 +1573,10 @@ int Old_rows_log_event::do_apply_event(Relay_log_info const *rli) ...@@ -1573,10 +1573,10 @@ int Old_rows_log_event::do_apply_event(Relay_log_info const *rli)
Error reporting borrowed from Query_log_event with many excessive Error reporting borrowed from Query_log_event with many excessive
simplifications (we don't honour --slave-skip-errors) simplifications (we don't honour --slave-skip-errors)
*/ */
uint actual_error= thd->net.client_last_errno; uint actual_error= thd->net.last_errno;
rli->report(ERROR_LEVEL, actual_error, rli->report(ERROR_LEVEL, actual_error,
"Error '%s' on reopening tables", "Error '%s' on reopening tables",
(actual_error ? thd->net.client_last_error : (actual_error ? thd->net.last_error :
"unexpected success or fatal error")); "unexpected success or fatal error"));
thd->is_slave_error= 1; thd->is_slave_error= 1;
} }
...@@ -1729,10 +1729,10 @@ int Old_rows_log_event::do_apply_event(Relay_log_info const *rli) ...@@ -1729,10 +1729,10 @@ int Old_rows_log_event::do_apply_event(Relay_log_info const *rli)
break; break;
default: default:
rli->report(ERROR_LEVEL, thd->net.client_last_errno, rli->report(ERROR_LEVEL, thd->net.last_errno,
"Error in %s event: row application failed. %s", "Error in %s event: row application failed. %s",
get_type_str(), get_type_str(),
thd->net.client_last_error ? thd->net.client_last_error : ""); thd->net.last_error ? thd->net.last_error : "");
thd->is_slave_error= 1; thd->is_slave_error= 1;
break; break;
} }
...@@ -1779,12 +1779,12 @@ int Old_rows_log_event::do_apply_event(Relay_log_info const *rli) ...@@ -1779,12 +1779,12 @@ int Old_rows_log_event::do_apply_event(Relay_log_info const *rli)
if (error) if (error)
{ /* error has occured during the transaction */ { /* error has occured during the transaction */
rli->report(ERROR_LEVEL, thd->net.client_last_errno, rli->report(ERROR_LEVEL, thd->net.last_errno,
"Error in %s event: error during transaction execution " "Error in %s event: error during transaction execution "
"on table %s.%s. %s", "on table %s.%s. %s",
get_type_str(), table->s->db.str, get_type_str(), table->s->db.str,
table->s->table_name.str, table->s->table_name.str,
thd->net.client_last_error ? thd->net.client_last_error : ""); thd->net.last_error ? thd->net.last_error : "");
/* /*
If one day we honour --skip-slave-errors in row-based replication, and If one day we honour --skip-slave-errors in row-based replication, and
...@@ -1913,7 +1913,7 @@ Old_rows_log_event::do_update_pos(Relay_log_info *rli) ...@@ -1913,7 +1913,7 @@ Old_rows_log_event::do_update_pos(Relay_log_info *rli)
example "no key found" (as this is allowed). This is a safety example "no key found" (as this is allowed). This is a safety
measure; apparently those errors (e.g. when executing a measure; apparently those errors (e.g. when executing a
Delete_rows_log_event_old of a non-existing row, like in Delete_rows_log_event_old of a non-existing row, like in
rpl_row_mystery22.test, thd->net.client_last_error = "Can't rpl_row_mystery22.test, thd->net.last_error = "Can't
find record in 't1'" and last_errno=1032) do not become find record in 't1'" and last_errno=1032) do not become
visible. We still prefer to wipe them out. visible. We still prefer to wipe them out.
*/ */
...@@ -2647,8 +2647,8 @@ Write_rows_log_event_old::do_exec_row(const Relay_log_info *const rli) ...@@ -2647,8 +2647,8 @@ Write_rows_log_event_old::do_exec_row(const Relay_log_info *const rli)
DBUG_ASSERT(m_table != NULL); DBUG_ASSERT(m_table != NULL);
int error= write_row(rli, TRUE /* overwrite */); int error= write_row(rli, TRUE /* overwrite */);
if (error && !thd->net.client_last_errno) if (error && !thd->net.last_errno)
thd->net.client_last_errno= error; thd->net.last_errno= error;
return error; return error;
} }
......
...@@ -127,10 +127,10 @@ my_bool my_net_init(NET *net, Vio* vio) ...@@ -127,10 +127,10 @@ my_bool my_net_init(NET *net, Vio* vio)
net->error=0; net->return_errno=0; net->return_status=0; net->error=0; net->return_errno=0; net->return_status=0;
net->pkt_nr=net->compress_pkt_nr=0; net->pkt_nr=net->compress_pkt_nr=0;
net->write_pos=net->read_pos = net->buff; net->write_pos=net->read_pos = net->buff;
net->client_last_error[0]=0; net->last_error[0]=0;
net->compress=0; net->reading_or_writing=0; net->compress=0; net->reading_or_writing=0;
net->where_b = net->remain_in_buf=0; net->where_b = net->remain_in_buf=0;
net->client_last_errno=0; net->last_errno=0;
#ifdef USE_QUERY_CACHE #ifdef USE_QUERY_CACHE
query_cache_init_query(net); query_cache_init_query(net);
#else #else
...@@ -177,7 +177,7 @@ my_bool net_realloc(NET *net, size_t length) ...@@ -177,7 +177,7 @@ my_bool net_realloc(NET *net, size_t length)
net->max_packet_size)); net->max_packet_size));
/* @todo: 1 and 2 codes are identical. */ /* @todo: 1 and 2 codes are identical. */
net->error= 1; net->error= 1;
net->client_last_errno= ER_NET_PACKET_TOO_LARGE; net->last_errno= ER_NET_PACKET_TOO_LARGE;
#ifdef MYSQL_SERVER #ifdef MYSQL_SERVER
my_error(ER_NET_PACKET_TOO_LARGE, MYF(0)); my_error(ER_NET_PACKET_TOO_LARGE, MYF(0));
#endif #endif
...@@ -194,7 +194,7 @@ my_bool net_realloc(NET *net, size_t length) ...@@ -194,7 +194,7 @@ my_bool net_realloc(NET *net, size_t length)
{ {
/* @todo: 1 and 2 codes are identical. */ /* @todo: 1 and 2 codes are identical. */
net->error= 1; net->error= 1;
net->client_last_errno= ER_OUT_OF_RESOURCES; net->last_errno= ER_OUT_OF_RESOURCES;
/* In the server the error is reported by MY_WME flag. */ /* In the server the error is reported by MY_WME flag. */
DBUG_RETURN(1); DBUG_RETURN(1);
} }
...@@ -579,7 +579,7 @@ net_real_write(NET *net,const uchar *packet, size_t len) ...@@ -579,7 +579,7 @@ net_real_write(NET *net,const uchar *packet, size_t len)
COMP_HEADER_SIZE, MYF(MY_WME)))) COMP_HEADER_SIZE, MYF(MY_WME))))
{ {
net->error= 2; net->error= 2;
net->client_last_errno= ER_OUT_OF_RESOURCES; net->last_errno= ER_OUT_OF_RESOURCES;
/* In the server, the error is reported by MY_WME flag. */ /* In the server, the error is reported by MY_WME flag. */
net->reading_or_writing= 0; net->reading_or_writing= 0;
DBUG_RETURN(1); DBUG_RETURN(1);
...@@ -632,7 +632,7 @@ net_real_write(NET *net,const uchar *packet, size_t len) ...@@ -632,7 +632,7 @@ net_real_write(NET *net,const uchar *packet, size_t len)
my_progname,vio_errno(net->vio)); my_progname,vio_errno(net->vio));
#endif /* EXTRA_DEBUG */ #endif /* EXTRA_DEBUG */
net->error= 2; /* Close socket */ net->error= 2; /* Close socket */
net->client_last_errno= ER_NET_PACKET_TOO_LARGE; net->last_errno= ER_NET_PACKET_TOO_LARGE;
#ifdef MYSQL_SERVER #ifdef MYSQL_SERVER
my_error(ER_NET_PACKET_TOO_LARGE, MYF(0)); my_error(ER_NET_PACKET_TOO_LARGE, MYF(0));
#endif #endif
...@@ -662,10 +662,10 @@ net_real_write(NET *net,const uchar *packet, size_t len) ...@@ -662,10 +662,10 @@ net_real_write(NET *net,const uchar *packet, size_t len)
} }
#endif /* defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER) */ #endif /* defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER) */
net->error= 2; /* Close socket */ net->error= 2; /* Close socket */
net->client_last_errno= (interrupted ? ER_NET_WRITE_INTERRUPTED : net->last_errno= (interrupted ? ER_NET_WRITE_INTERRUPTED :
ER_NET_ERROR_ON_WRITE); ER_NET_ERROR_ON_WRITE);
#ifdef MYSQL_SERVER #ifdef MYSQL_SERVER
my_error(net->client_last_errno, MYF(0)); my_error(net->last_errno, MYF(0));
#endif /* MYSQL_SERVER */ #endif /* MYSQL_SERVER */
break; break;
} }
...@@ -844,7 +844,7 @@ my_real_read(NET *net, size_t *complen) ...@@ -844,7 +844,7 @@ my_real_read(NET *net, size_t *complen)
#endif /* EXTRA_DEBUG */ #endif /* EXTRA_DEBUG */
len= packet_error; len= packet_error;
net->error= 2; /* Close socket */ net->error= 2; /* Close socket */
net->client_last_errno= ER_NET_FCNTL_ERROR; net->last_errno= ER_NET_FCNTL_ERROR;
#ifdef MYSQL_SERVER #ifdef MYSQL_SERVER
my_error(ER_NET_FCNTL_ERROR, MYF(0)); my_error(ER_NET_FCNTL_ERROR, MYF(0));
#endif #endif
...@@ -876,11 +876,11 @@ my_real_read(NET *net, size_t *complen) ...@@ -876,11 +876,11 @@ my_real_read(NET *net, size_t *complen)
remain, vio_errno(net->vio), (long) length)); remain, vio_errno(net->vio), (long) length));
len= packet_error; len= packet_error;
net->error= 2; /* Close socket */ net->error= 2; /* Close socket */
net->client_last_errno= (vio_was_interrupted(net->vio) ? net->last_errno= (vio_was_interrupted(net->vio) ?
ER_NET_READ_INTERRUPTED : ER_NET_READ_INTERRUPTED :
ER_NET_READ_ERROR); ER_NET_READ_ERROR);
#ifdef MYSQL_SERVER #ifdef MYSQL_SERVER
my_error(net->client_last_errno, MYF(0)); my_error(net->last_errno, MYF(0));
#endif #endif
goto end; goto end;
} }
...@@ -1100,7 +1100,7 @@ my_net_read(NET *net) ...@@ -1100,7 +1100,7 @@ my_net_read(NET *net)
&complen)) &complen))
{ {
net->error= 2; /* caller will close socket */ net->error= 2; /* caller will close socket */
net->client_last_errno= ER_NET_UNCOMPRESS_ERROR; net->last_errno= ER_NET_UNCOMPRESS_ERROR;
#ifdef MYSQL_SERVER #ifdef MYSQL_SERVER
my_error(ER_NET_UNCOMPRESS_ERROR, MYF(0)); my_error(ER_NET_UNCOMPRESS_ERROR, MYF(0));
#endif #endif
......
...@@ -699,7 +699,7 @@ int connect_to_master(THD *thd, MYSQL* mysql, Master_info* mi) ...@@ -699,7 +699,7 @@ int connect_to_master(THD *thd, MYSQL* mysql, Master_info* mi)
if (!mi->host || !*mi->host) /* empty host */ if (!mi->host || !*mi->host) /* empty host */
{ {
strmov(mysql->net.client_last_error, "Master is not configured"); strmov(mysql->net.last_error, "Master is not configured");
DBUG_RETURN(1); DBUG_RETURN(1);
} }
mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (char *) &slave_net_timeout); mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (char *) &slave_net_timeout);
......
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