summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2001-10-04 02:44:18 +0300
committerunknown <monty@hundin.mysql.fi>2001-10-04 02:44:18 +0300
commitb39f54aafb57d26b3f971fc2f9fed0365dc0d743 (patch)
treeb1013532246a774deaac975b2e53d6cd4332aabd /sql
parent664647d1f7c190f1cc54fb817b10c86f994c1fdc (diff)
downloadmariadb-git-b39f54aafb57d26b3f971fc2f9fed0365dc0d743.tar.gz
Fixed some build problems.
Fix that compressed packets and normal packets looks indentical before calling net_real_write() (Needed for query cache) Optimize IS NULL handling Build-tools/Do-compile: Fix for machines with clocks in an earlier timezone Docs/manual.texi: Fixed typo acinclude.m4: Fixed typo client/mysqlbinlog.cc: Cleanup client/mysqltest.c: Added --compress to test the compressed protocol configure.in: Increment shared library number (because structs changed) include/mysql.h: Optimize structs for Ia64 include/mysql_com.h: Optimize structs for Ia64 libmysql/libmysql.c: Portability fixes libmysql/net.c: Fix that compressed packets and normal packets looks indentical before calling net_real_write() (Needed for query cache) libmysqld/examples/Makefile.am: Portability fix libmysqld/libmysqld.c: Portability fixes mysql-test/mysql-test-run.sh: Added --compress to test the compressed protocol mysql-test/t/type_enum.test: A mysys/mf_casecnv.c: Portability fixes mysys/mf_tempfile.c: Portability fixes scripts/make_binary_distribution.sh: Add libmysqld to binary distribution sql-bench/server-cfg.sh: Fix for Interbase sql/item.h: Optimize IS NULL handling sql/item_cmpfunc.cc: Optimize IS NULL handling sql/item_cmpfunc.h: Optimize IS NULL handling sql/item_func.cc: cleanup sql/item_func.h: Optimize IS NULL handling sql/mysql_priv.h: c sql/net_serv.cc: Fix that compressed packets and normal packets looks indentical before calling net_real_write() (Needed for query cache)
Diffstat (limited to 'sql')
-rw-r--r--sql/item.h4
-rw-r--r--sql/item_cmpfunc.cc12
-rw-r--r--sql/item_cmpfunc.h5
-rw-r--r--sql/item_func.cc1
-rw-r--r--sql/item_func.h3
-rw-r--r--sql/mysql_priv.h4
-rw-r--r--sql/net_serv.cc50
7 files changed, 38 insertions, 41 deletions
diff --git a/sql/item.h b/sql/item.h
index 9ab41af3398..27611a3cce5 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -81,6 +81,7 @@ public:
virtual void split_sum_func(List<Item> &fields) {}
virtual bool get_date(TIME *ltime,bool fuzzydate);
virtual bool get_time(TIME *ltime);
+ virtual bool is_null() { return 0; }
};
@@ -130,6 +131,7 @@ public:
Field *tmp_table_field() { return result_field; }
bool get_date(TIME *ltime,bool fuzzydate);
bool get_time(TIME *ltime);
+ bool is_null() { return field->is_null(); }
};
@@ -150,6 +152,7 @@ public:
bool send(String *str);
bool basic_const_item() const { return 1; }
Item *new_item() { return new Item_null(name); }
+ bool is_null() { return 1; }
};
@@ -383,6 +386,7 @@ public:
void copy();
table_map used_tables() const { return (table_map) 1L; }
bool const_item() const { return 0; }
+ bool is_null() { return null_value; }
};
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index ac8534916d6..f825b4960c5 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1197,20 +1197,12 @@ longlong Item_cond_or::val_int()
longlong Item_func_isnull::val_int()
{
- if (internal_result_type == REAL_RESULT)
- (void) args[0]->val();
- else
- (void) args[0]->val_int();
- return (args[0]->null_value) ? 1 : 0;
+ return args[0]->is_null() ? 1: 0;
}
longlong Item_func_isnotnull::val_int()
{
- if (internal_result_type == REAL_RESULT)
- (void) args[0]->val();
- else
- (void) args[0]->val_int();
- return !(args[0]->null_value) ? 1 : 0;
+ return args[0]->is_null() ? 0 : 1;
}
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 9c9336264f7..9ed3e86d6e8 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -46,6 +46,7 @@ public:
virtual enum Functype rev_functype() const { return UNKNOWN_FUNC; }
bool have_rev_func() const { return rev_functype() != UNKNOWN_FUNC; }
void print(String *str) { Item_func::print_op(str); }
+ bool is_null() { return test(args[0]->is_null() || args[1]->is_null()); }
};
@@ -429,7 +430,6 @@ class Item_func_in :public Item_int_func
class Item_func_isnull :public Item_bool_func
{
- enum Item_result internal_result_type;
public:
Item_func_isnull(Item *a) :Item_bool_func(a) {}
longlong val_int();
@@ -438,7 +438,6 @@ public:
{
decimals=0; max_length=1; maybe_null=0;
Item_func_isnull::update_used_tables();
- internal_result_type=args[0]->result_type();
}
const char *func_name() const { return "isnull"; }
/* Optimize case of not_null_column IS NULL */
@@ -457,7 +456,6 @@ public:
class Item_func_isnotnull :public Item_bool_func
{
- enum Item_result internal_result_type;
public:
Item_func_isnotnull(Item *a) :Item_bool_func(a) {}
longlong val_int();
@@ -465,7 +463,6 @@ public:
void fix_length_and_dec()
{
decimals=0; max_length=1; maybe_null=0;
- internal_result_type=args[0]->result_type();
}
const char *func_name() const { return "isnotnull"; }
optimize_type select_optimize() const { return OPTIMIZE_NULL; }
diff --git a/sql/item_func.cc b/sql/item_func.cc
index a4d0e1a7ed1..e09f81a4b1b 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -209,7 +209,6 @@ void Item_func::fix_num_length_and_dec()
max_length=float_length(decimals);
}
-
String *Item_int_func::val_str(String *str)
{
longlong nr=val_int();
diff --git a/sql/item_func.h b/sql/item_func.h
index ac4c230f312..bd3ef0bf2d7 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -119,6 +119,7 @@ public:
{
return (null_value=args[0]->get_time(ltime));
}
+ bool is_null() { (void) val_int(); return null_value; }
friend class udf_handler;
};
@@ -147,6 +148,7 @@ public:
longlong val_int() { return (longlong) val(); }
enum Item_result result_type () const { return hybrid_type; }
void fix_length_and_dec() { fix_num_length_and_dec(); }
+ bool is_null() { (void) val(); return null_value; }
};
@@ -161,6 +163,7 @@ class Item_num_op :public Item_func
enum Item_result result_type () const { return hybrid_type; }
void fix_length_and_dec() { fix_num_length_and_dec(); find_num_type(); }
void find_num_type(void);
+ bool is_null() { (void) val(); return null_value; }
};
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 851e33fca04..f817d53f33e 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -508,7 +508,7 @@ void sql_print_error(const char *format,...)
extern uint32 server_id;
extern char *mysql_data_home,server_version[SERVER_VERSION_LENGTH],
max_sort_char, mysql_real_data_home[];
-extern my_string mysql_unix_port,mysql_tmpdir;
+extern my_string mysql_tmpdir;
extern const char *first_keyword, *localhost, *delayed_user;
extern ulong refresh_version,flush_version, thread_id,query_id,opened_tables,
created_tmp_tables, created_tmp_disk_tables,
@@ -522,7 +522,7 @@ extern ulong filesort_merge_passes;
extern ulong select_range_check_count, select_range_count, select_scan_count;
extern ulong select_full_range_join_count,select_full_join_count,
slave_open_temp_tables;
-extern uint test_flags,select_errors,mysql_port,ha_open_options;
+extern uint test_flags,select_errors,ha_open_options;
extern ulong thd_startup_options, slow_launch_threads, slow_launch_time;
extern time_t start_time;
extern const char *command_name[];
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index 59fee295b60..44e3dd14f80 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -41,7 +41,6 @@
#include <signal.h>
#include <errno.h>
#include <sys/types.h>
-#include <assert.h>
#ifdef MYSQL_SERVER
ulong max_allowed_packet=65536;
@@ -91,7 +90,7 @@ extern ulong mysqld_net_retry_count;
typedef my_bool thr_alarm_t;
typedef my_bool ALARM;
#define thr_alarm_init(A) (*(A))=0
-#define thr_alarm_in_use(A) (*(A))
+#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)))
@@ -131,7 +130,7 @@ int my_net_init(NET *net, Vio* vio)
net->no_send_ok = 0;
net->error=0; net->return_errno=0; net->return_status=0;
net->timeout=(uint) net_read_timeout; /* Timeout for read */
- net->pkt_nr=0;
+ net->pkt_nr=net->compress_pkt_nr=0;
net->write_pos=net->read_pos = net->buff;
net->last_error[0]=0;
net->compress=0; net->reading_or_writing=0;
@@ -192,7 +191,7 @@ static my_bool net_realloc(NET *net, ulong length)
void net_clear(NET *net)
{
#ifndef EXTRA_DEBUG
- int count; // One may get 'unused' warning
+ int count; /* One may get 'unused' warn */
bool is_blocking=vio_is_blocking(net->vio);
if (is_blocking)
vio_blocking(net->vio, FALSE);
@@ -206,7 +205,7 @@ void net_clear(NET *net)
vio_blocking(net->vio, TRUE);
}
#endif /* EXTRA_DEBUG */
- net->pkt_nr=0; /* Ready for new command */
+ net->pkt_nr=net->compress_pkt_nr=0; /* Ready for new command */
net->write_pos=net->buff;
}
@@ -219,9 +218,12 @@ int net_flush(NET *net)
if (net->buff != net->write_pos)
{
error=net_real_write(net,(char*) net->buff,
- (uint) (net->write_pos - net->buff));
+ (ulong) (net->write_pos - net->buff));
net->write_pos=net->buff;
}
+ /* Sync packet number if using compression */
+ if (net->compress)
+ net->pkt_nr=net->compress_pkt_nr;
DBUG_RETURN(error);
}
@@ -250,7 +252,7 @@ my_net_write(NET *net,const char *packet,ulong len)
{
const ulong z_size = MAX_THREE_BYTES;
int3store(buff, z_size);
- buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++);
+ buff[3]= net->pkt_nr++;
if (net_write_buff(net, (char*) buff, NET_HEADER_SIZE) ||
net_write_buff(net, packet, z_size))
return 1;
@@ -259,7 +261,7 @@ my_net_write(NET *net,const char *packet,ulong len)
}
/* Write last packet */
int3store(buff,len);
- buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++);
+ buff[3]= net->pkt_nr++;
if (net_write_buff(net,(char*) buff,NET_HEADER_SIZE))
return 1;
return net_write_buff(net,packet,len);
@@ -277,7 +279,7 @@ my_net_write(NET *net,const char *packet,ulong len)
int
net_write_command(NET *net,uchar command,const char *packet,ulong len)
{
- uint length=len+1; /* 1 extra byte for command */
+ ulong length=len+1; /* 1 extra byte for command */
uchar buff[NET_HEADER_SIZE+1];
uint header_size=NET_HEADER_SIZE+1;
buff[4]=command; /* For first packet */
@@ -289,7 +291,7 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len)
do
{
int3store(buff, MAX_THREE_BYTES);
- buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++);
+ buff[3]= net->pkt_nr++;
if (net_write_buff(net,(char*) buff, header_size) ||
net_write_buff(net,packet,len))
return 1;
@@ -301,7 +303,7 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len)
len=length; /* Data left to be written */
}
int3store(buff,length);
- buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++);
+ buff[3]= net->pkt_nr++;
return test(net_write_buff(net,(char*) buff,header_size) ||
net_write_buff(net,packet,len) || net_flush(net));
}
@@ -314,7 +316,7 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len)
static int
net_write_buff(NET *net,const char *packet,ulong len)
{
- uint left_length=(uint) (net->buff_end - net->write_pos);
+ ulong left_length=(ulong) (net->buff_end - net->write_pos);
while (len > left_length)
{
@@ -340,10 +342,10 @@ net_write_buff(NET *net,const char *packet,ulong len)
int
net_real_write(NET *net,const char *packet,ulong len)
{
- int length;
+ long int length;
char *pos,*end;
thr_alarm_t alarmed;
-#if !defined(__WIN__)
+#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2)
ALARM alarm_buff;
#endif
uint retry_count=0;
@@ -380,7 +382,7 @@ net_real_write(NET *net,const char *packet,ulong len)
}
int3store(&b[NET_HEADER_SIZE],complen);
int3store(b,len);
- b[3]=(uchar) (net->pkt_nr++);
+ b[3]=(uchar) (net->compress_pkt_nr++);
len+= header_length;
packet= (char*) b;
}
@@ -398,7 +400,7 @@ net_real_write(NET *net,const char *packet,ulong len)
pos=(char*) packet; end=pos+len;
while (pos != end)
{
- if ((int) (length=vio_write(net->vio,pos,(int) (end-pos))) <= 0)
+ if ((long) (length=vio_write(net->vio,pos,(ulong) (end-pos))) <= 0)
{
my_bool interrupted = vio_should_retry(net->vio);
#if (!defined(__WIN__) && !defined(__EMX__) && !defined(OS2))
@@ -499,7 +501,7 @@ static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed)
{
my_bool interrupted = vio_should_retry(net->vio);
if (!thr_got_alarm(&alarmed) && interrupted)
- { /* Probably in MIT threads */
+ { /* Probably in MIT threads */
if (retry_count++ < RETRY_COUNT)
continue;
}
@@ -518,7 +520,7 @@ static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed)
This function reallocates the net->buff buffer if necessary.
*/
-static uint
+static ulong
my_real_read(NET *net, ulong *complen)
{
uchar *pos;
@@ -629,9 +631,9 @@ my_real_read(NET *net, ulong *complen)
if (net->buff[net->where_b] != (uchar) 255)
{
DBUG_PRINT("error",
- ("Packets out of order (Found: %d, expected %d)",
+ ("Packets out of order (Found: %d, expected %u)",
(int) net->buff[net->where_b + 3],
- (uint) (uchar) net->pkt_nr));
+ net->pkt_nr));
#ifdef EXTRA_DEBUG
fprintf(stderr,"Packets out of order (Found: %d, expected %d)\n",
(int) net->buff[net->where_b + 3],
@@ -644,7 +646,7 @@ my_real_read(NET *net, ulong *complen)
#endif
goto end;
}
- net->pkt_nr++;
+ net->compress_pkt_nr= ++net->pkt_nr;
#ifdef HAVE_COMPRESS
if (net->compress)
{
@@ -712,7 +714,7 @@ my_net_read(NET *net)
if (len == MAX_THREE_BYTES)
{
/* First packet of a multi-packet. Concatenate the packets */
- int save_pos = net->where_b;
+ ulong save_pos = net->where_b;
ulong total_length=0;
do
{
@@ -822,8 +824,8 @@ my_net_read(NET *net)
net->read_pos= net->buff+ first_packet_offset + NET_HEADER_SIZE;
net->buf_length= buf_length;
- net->remain_in_buf= buf_length - start_of_packet;
- len = ((uint) (start_of_packet - first_packet_offset) - NET_HEADER_SIZE -
+ net->remain_in_buf= (ulong) (buf_length - start_of_packet);
+ len = ((ulong) (start_of_packet - first_packet_offset) - NET_HEADER_SIZE -
multi_byte_packet);
net->save_char= net->read_pos[len]; /* Must be saved */
net->read_pos[len]=0; /* Safeguard for mysql_use_result */