diff options
author | unknown <monty@hundin.mysql.fi> | 2001-12-21 07:00:58 +0200 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2001-12-21 07:00:58 +0200 |
commit | 9603291efdd930b1b7efb1534ba76569d517aac9 (patch) | |
tree | 14f15faabd0531594907bd3b9b9e4787da493d83 /libmysql | |
parent | 10863a359080d70a979bf0fc8bd88e7c51a6a2c2 (diff) | |
download | mariadb-git-9603291efdd930b1b7efb1534ba76569d517aac9.tar.gz |
Cleanup of alarm macros.
Fixed data corruption bug in query cache.
Made queries be dependent of the database in use.
Docs/manual.texi:
Update binary log reference
client/mysql.cc:
Removed warning
include/thr_alarm.h:
Cleanup of alarm macros.
libmysql/libmysql.c:
Portabiliy fix
libmysql/net.c:
Cleanup of alarm macros.
mysql-test/t/rpl_get_lock.test:
Fixed results after merge.
mysys/my_bitmap.c:
Removed warning.
sql/log_event.cc:
Use thd->db_length
sql/mini_client.cc:
Cleanup of alarm macros.
sql/net_serv.cc:
Cleanup of alarm macros.
sql/sql_acl.cc:
Use thd->db_length
sql/sql_cache.cc:
Store used database together with the query.
sql/sql_class.cc:
Use thd->db_length
sql/sql_class.h:
Use thd->db_length
sql/sql_db.cc:
Use thd->db_length
sql/sql_parse.cc:
Use thd->db_length
sql/sql_udf.cc:
Use thd->db_length
Diffstat (limited to 'libmysql')
-rw-r--r-- | libmysql/libmysql.c | 8 | ||||
-rw-r--r-- | libmysql/net.c | 67 |
2 files changed, 31 insertions, 44 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index f1043787b6a..0e9a163a5b5 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -2225,8 +2225,8 @@ send_file_to_server(MYSQL *mysql, const char *filename) my_net_write(&mysql->net,"",0); /* Server needs one packet */ net_flush(&mysql->net); mysql->net.last_errno=EE_FILENOTFOUND; - snprintf(mysql->net.last_error,sizeof(mysql->net.last_error)-1, - EE(mysql->net.last_errno),tmp_name, errno); + my_snprintf(mysql->net.last_error,sizeof(mysql->net.last_error)-1, + EE(mysql->net.last_errno),tmp_name, errno); goto err; } @@ -2250,8 +2250,8 @@ send_file_to_server(MYSQL *mysql, const char *filename) if (readcount < 0) { mysql->net.last_errno=EE_READ; /* the errmsg for not entire file read */ - snprintf(mysql->net.last_error,sizeof(mysql->net.last_error)-1, - tmp_name,errno); + my_snprintf(mysql->net.last_error,sizeof(mysql->net.last_error)-1, + tmp_name,errno); goto err; } result=0; /* Ok */ diff --git a/libmysql/net.c b/libmysql/net.c index 7eb4e0159a5..666c572ccee 100644 --- a/libmysql/net.c +++ b/libmysql/net.c @@ -41,68 +41,55 @@ #include <signal.h> #include <errno.h> +/* + The following handles the differences when this is linked between the + client and the server. + + This gives an error if a too big packet is found + The server can change this with the -O switch, but because the client + can't normally do this the client should have a bigger max_allowed_packet. +*/ + #ifdef MYSQL_SERVER ulong max_allowed_packet=65536; extern ulong net_read_timeout,net_write_timeout; extern uint test_flags; #else - -/* -** Give error if a too big packet is found -** The server can change this with the -O switch, but because the client -** can't normally do this the client should have a bigger max_allowed_packet. -*/ - -ulong max_allowed_packet=~0L; +ulong max_allowed_packet=16*1024*1024L; ulong net_read_timeout= NET_READ_TIMEOUT; ulong net_write_timeout= NET_WRITE_TIMEOUT; #endif -ulong net_buffer_length=8192; /* Default length. Enlarged if necessary */ -#if defined(__WIN__) || defined(MSDOS) -#undef MYSQL_SERVER /* Win32 can't handle interrupts */ +#ifdef __WIN__ +/* The following is because alarms doesn't work on windows. */ +#undef MYSQL_SERVER #endif + #ifdef MYSQL_SERVER #include "my_pthread.h" -#include "thr_alarm.h" void sql_print_error(const char *format,...); #define RETRY_COUNT mysqld_net_retry_count extern ulong mysqld_net_retry_count; -#else - -#ifdef OS2 /* avoid name conflict */ -#define thr_alarm_t thr_alarm_t_net -#define ALARM ALARM_net -#endif - -typedef my_bool thr_alarm_t; -typedef my_bool ALARM; -#define thr_alarm_init(A) (*(A))=0 -#define thr_alarm_in_use(A) (*(A) != 0) -#define thr_end_alarm(A) -#define thr_alarm(A,B,C) local_thr_alarm((A),(B),(C)) -inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused))) -{ - *A=1; - return 0; -} -#define thr_got_alarm(A) 0 -#define RETRY_COUNT 1 -#endif - -#ifdef MYSQL_SERVER extern ulong bytes_sent, bytes_received; extern pthread_mutex_t LOCK_bytes_sent , LOCK_bytes_received; + extern void query_cache_insert(NET *net, const char *packet, ulong length); #else #undef statistic_add #define statistic_add(A,B,C) -#endif +#define DONT_USE_THR_ALARM +#define RETRY_COUNT 1 +#endif /* MYSQL_SERVER */ + +#include "thr_alarm.h" #define TEST_BLOCKING 8 +#define MAX_THREE_BYTES 255L*255L*255L + +ulong net_buffer_length=8192; /* Default length. Enlarged if necessary */ + static int net_write_buff(NET *net,const char *packet,ulong len); -#define MAX_THREE_BYTES 255L*255L*255L /* Init with packet info */ @@ -335,7 +322,7 @@ net_real_write(NET *net,const char *packet,ulong len) long int length; char *pos,*end; thr_alarm_t alarmed; -#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) +#if defined(MYSQL_SERVER) ALARM alarm_buff; #endif uint retry_count=0; @@ -522,7 +509,7 @@ my_real_read(NET *net, ulong *complen) uint i,retry_count=0; ulong len=packet_error; thr_alarm_t alarmed; -#if (!defined(__WIN__) && !defined(__EMX__) && !defined(OS2)) || defined(MYSQL_SERVER) +#if defined(MYSQL_SERVER) ALARM alarm_buff; #endif my_bool net_blocking=vio_is_blocking(net->vio); @@ -775,7 +762,7 @@ my_net_read(NET *net) if (read_length != MAX_THREE_BYTES) /* last package */ { - multi_byte_packet= 0; // No last zero length packet + multi_byte_packet= 0; /* No last zero len packet */ break; } multi_byte_packet= NET_HEADER_SIZE; |