From 6326ec9944e8ab44fceff629d6681700573ab686 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 12 Apr 2002 21:35:46 +0300 Subject: Update for BTREE keys in HEAP tables Split handler->option_flag() to handler->table_flags() and handler->index_flags() Docs/manual.texi: Updated standard binary options include/my_base.h: Update for BTREE keys in HEAP tables libmysql/net.c: merge with net_serv.cc mysql-test/r/func_misc.result: Update for new behaviour of inet_ntoa sql/field.cc: Update for BTREE keys in HEAP tables sql/field.h: Update for BTREE keys in HEAP tables sql/filesort.cc: Update for BTREE keys in HEAP tables sql/ha_berkeley.h: Update for BTREE keys in HEAP tables sql/ha_heap.h: Update for BTREE keys in HEAP tables sql/ha_innodb.h: Update for BTREE keys in HEAP tables sql/ha_isam.cc: Update for BTREE keys in HEAP tables sql/ha_isam.h: Update for BTREE keys in HEAP tables sql/ha_isammrg.h: Update for BTREE keys in HEAP tables sql/ha_myisam.cc: Update for BTREE keys in HEAP tables sql/ha_myisam.h: Update for BTREE keys in HEAP tables sql/ha_myisammrg.h: Update for BTREE keys in HEAP tables sql/handler.cc: Update for BTREE keys in HEAP tables sql/handler.h: Update for BTREE keys in HEAP tables sql/log.cc: Update for BTREE keys in HEAP tables sql/net_serv.cc: Update for BTREE keys in HEAP tables sql/opt_range.cc: Update for BTREE keys in HEAP tables sql/opt_sum.cc: Update for BTREE keys in HEAP tables sql/records.cc: Update for BTREE keys in HEAP tables sql/sql_class.h: Update for BTREE keys in HEAP tables sql/sql_handler.cc: Update for BTREE keys in HEAP tables sql/sql_insert.cc: Update for BTREE keys in HEAP tables sql/sql_select.cc: Update for BTREE keys in HEAP tables sql/sql_show.cc: Update for BTREE keys in HEAP tables sql/sql_table.cc: Update for BTREE keys in HEAP tables sql/structs.h: Update for BTREE keys in HEAP tables sql/table.cc: Update for BTREE keys in HEAP tables sql/unireg.cc: Update for BTREE keys in HEAP tables --- libmysql/net.c | 52 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 21 deletions(-) (limited to 'libmysql/net.c') diff --git a/libmysql/net.c b/libmysql/net.c index 666c572ccee..0d6e548a873 100644 --- a/libmysql/net.c +++ b/libmysql/net.c @@ -54,32 +54,32 @@ ulong max_allowed_packet=65536; extern ulong net_read_timeout,net_write_timeout; extern uint test_flags; +#define USE_QUERY_CACHE +extern void query_cache_insert(NET *net, const char *packet, ulong length); #else ulong max_allowed_packet=16*1024*1024L; ulong net_read_timeout= NET_READ_TIMEOUT; ulong net_write_timeout= NET_WRITE_TIMEOUT; #endif -#ifdef __WIN__ -/* The following is because alarms doesn't work on windows. */ -#undef MYSQL_SERVER +#if defined(__WIN__) || !defined(MYSQL_SERVER) + /* The following is because alarms doesn't work on windows. */ +#define NO_ALARM #endif - -#ifdef MYSQL_SERVER + +#ifndef NO_ALARM #include "my_pthread.h" void sql_print_error(const char *format,...); #define RETRY_COUNT mysqld_net_retry_count extern ulong mysqld_net_retry_count; 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) #define DONT_USE_THR_ALARM #define RETRY_COUNT 1 -#endif /* MYSQL_SERVER */ +#endif /* NO_ALARM */ #include "thr_alarm.h" @@ -167,7 +167,7 @@ static my_bool net_realloc(NET *net, ulong length) void net_clear(NET *net) { -#ifndef EXTRA_DEBUG +#if !defined(EXTRA_DEBUG) && !defined(EMBEDDED_LIBRARY) int count; /* One may get 'unused' warn */ bool is_blocking=vio_is_blocking(net->vio); if (is_blocking) @@ -322,15 +322,16 @@ net_real_write(NET *net,const char *packet,ulong len) long int length; char *pos,*end; thr_alarm_t alarmed; -#if defined(MYSQL_SERVER) +#ifndef NO_ALARM ALARM alarm_buff; #endif uint retry_count=0; my_bool net_blocking = vio_is_blocking(net->vio); DBUG_ENTER("net_real_write"); -#ifdef MYSQL_SERVER - query_cache_insert(net, packet, len); +#if defined(MYSQL_SERVER) && defined(HAVE_QUERY_CACHE) + if (net->query_cache_query != 0) + query_cache_insert(net, packet, len); #endif if (net->error == 2) @@ -370,13 +371,13 @@ net_real_write(NET *net,const char *packet,ulong len) #endif /* HAVE_COMPRESS */ /* DBUG_DUMP("net",packet,len); */ -#ifdef MYSQL_SERVER +#ifndef NO_ALARM thr_alarm_init(&alarmed); if (net_blocking) thr_alarm(&alarmed,(uint) net_write_timeout,&alarm_buff); #else alarmed=0; -#endif /* MYSQL_SERVER */ +#endif /* NO_ALARM */ pos=(char*) packet; end=pos+len; while (pos != end) @@ -458,8 +459,7 @@ net_real_write(NET *net,const char *packet,ulong len) ** Read something from server/clinet *****************************************************************************/ -#ifdef MYSQL_SERVER - +#ifndef NO_ALARM /* Help function to clear the commuication buffer when we get a too big packet @@ -492,7 +492,7 @@ static void my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed) statistic_add(bytes_received,length,&LOCK_bytes_received); } } -#endif /* MYSQL_SERVER */ +#endif /* NO_ALARM */ /* @@ -509,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(MYSQL_SERVER) +#ifndef NO_ALARM ALARM alarm_buff; #endif my_bool net_blocking=vio_is_blocking(net->vio); @@ -519,10 +519,10 @@ my_real_read(NET *net, ulong *complen) net->reading_or_writing=1; thr_alarm_init(&alarmed); -#ifdef MYSQL_SERVER +#ifndef NO_ALARM if (net_blocking) thr_alarm(&alarmed,net->timeout,&alarm_buff); -#endif /* MYSQL_SERVER */ +#endif /* NO_ALARM */ pos = net->buff + net->where_b; /* net->packet -4 */ for (i=0 ; i < 2 ; i++) @@ -645,7 +645,7 @@ my_real_read(NET *net, ulong *complen) { if (net_realloc(net,helping)) { -#ifdef MYSQL_SERVER +#ifndef NO_ALARM if (i == 1) my_net_skip_rest(net, (uint32) len, &alarmed); #endif @@ -814,3 +814,13 @@ my_net_read(NET *net) #endif /* HAVE_COMPRESS */ return len; } + +int net_request_file(NET* net, const char* fname) +{ + char tmp [FN_REFLEN+1],*end; + DBUG_ENTER("net_request_file"); + tmp[0] = (char) 251; /* NULL_LENGTH */ + end=strnmov(tmp+1,fname,sizeof(tmp)-2); + DBUG_RETURN(my_net_write(net,tmp,(uint) (end-tmp)) || + net_flush(net)); +} -- cgit v1.2.1