Commit d6672f71 authored by gkodinov/kgeorge@macbook.gmz's avatar gkodinov/kgeorge@macbook.gmz

Merge macbook.gmz:/Users/kgeorge/mysql/work/B19216-4.1-opt

into  macbook.gmz:/Users/kgeorge/mysql/work/B19216-5.0-opt
parents 0be7e703 9a41822b
...@@ -1191,6 +1191,8 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, ...@@ -1191,6 +1191,8 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
for (row=data->data; row ; row = row->next,field++) for (row=data->data; row ; row = row->next,field++)
{ {
uchar *pos; uchar *pos;
/* fields count may be wrong */
DBUG_ASSERT ((field - result) < fields);
cli_fetch_lengths(&lengths[0], row->data, default_value ? 8 : 7); cli_fetch_lengths(&lengths[0], row->data, default_value ? 8 : 7);
field->catalog = strdup_root(alloc,(char*) row->data[0]); field->catalog = strdup_root(alloc,(char*) row->data[0]);
field->db = strdup_root(alloc,(char*) row->data[1]); field->db = strdup_root(alloc,(char*) row->data[1]);
......
...@@ -46,7 +46,7 @@ bool Protocol_prep::net_store_data(const char *from, uint length) ...@@ -46,7 +46,7 @@ bool Protocol_prep::net_store_data(const char *from, uint length)
packet->realloc(packet_length+9+length)) packet->realloc(packet_length+9+length))
return 1; return 1;
char *to=(char*) net_store_length((char*) packet->ptr()+packet_length, char *to=(char*) net_store_length((char*) packet->ptr()+packet_length,
(ulonglong) length); length);
memcpy(to,from,length); memcpy(to,from,length);
packet->length((uint) (to+length-packet->ptr())); packet->length((uint) (to+length-packet->ptr()));
return 0; return 0;
...@@ -280,8 +280,8 @@ send_ok(THD *thd, ha_rows affected_rows, ulonglong id, const char *message) ...@@ -280,8 +280,8 @@ send_ok(THD *thd, ha_rows affected_rows, ulonglong id, const char *message)
} }
buff[0]=0; // No fields buff[0]=0; // No fields
pos=net_store_length(buff+1,(ulonglong) affected_rows); pos=net_store_length(buff+1,affected_rows);
pos=net_store_length(pos, (ulonglong) id); pos=net_store_length(pos, id);
if (thd->client_capabilities & CLIENT_PROTOCOL_41) if (thd->client_capabilities & CLIENT_PROTOCOL_41)
{ {
DBUG_PRINT("info", DBUG_PRINT("info",
...@@ -456,7 +456,7 @@ void net_send_error_packet(THD *thd, uint sql_errno, const char *err) ...@@ -456,7 +456,7 @@ void net_send_error_packet(THD *thd, uint sql_errno, const char *err)
ulonglong for bigger numbers. ulonglong for bigger numbers.
*/ */
char *net_store_length(char *pkg, uint length) static char *net_store_length_fast(char *pkg, uint length)
{ {
uchar *packet=(uchar*) pkg; uchar *packet=(uchar*) pkg;
if (length < 251) if (length < 251)
...@@ -479,7 +479,7 @@ char *net_store_length(char *pkg, uint length) ...@@ -479,7 +479,7 @@ char *net_store_length(char *pkg, uint length)
char *net_store_data(char *to,const char *from, uint length) char *net_store_data(char *to,const char *from, uint length)
{ {
to=net_store_length(to,length); to=net_store_length_fast(to,length);
memcpy(to,from,length); memcpy(to,from,length);
return to+length; return to+length;
} }
...@@ -488,7 +488,7 @@ char *net_store_data(char *to,int32 from) ...@@ -488,7 +488,7 @@ char *net_store_data(char *to,int32 from)
{ {
char buff[20]; char buff[20];
uint length=(uint) (int10_to_str(from,buff,10)-buff); uint length=(uint) (int10_to_str(from,buff,10)-buff);
to=net_store_length(to,length); to=net_store_length_fast(to,length);
memcpy(to,buff,length); memcpy(to,buff,length);
return to+length; return to+length;
} }
...@@ -497,7 +497,7 @@ char *net_store_data(char *to,longlong from) ...@@ -497,7 +497,7 @@ char *net_store_data(char *to,longlong from)
{ {
char buff[22]; char buff[22];
uint length=(uint) (longlong10_to_str(from,buff,10)-buff); uint length=(uint) (longlong10_to_str(from,buff,10)-buff);
to=net_store_length(to,length); to=net_store_length_fast(to,length);
memcpy(to,buff,length); memcpy(to,buff,length);
return to+length; return to+length;
} }
...@@ -561,7 +561,7 @@ bool Protocol::send_fields(List<Item> *list, uint flags) ...@@ -561,7 +561,7 @@ bool Protocol::send_fields(List<Item> *list, uint flags)
if (flags & SEND_NUM_ROWS) if (flags & SEND_NUM_ROWS)
{ // Packet with number of elements { // Packet with number of elements
char *pos=net_store_length(buff, (uint) list->elements); char *pos=net_store_length(buff, list->elements);
(void) my_net_write(&thd->net, buff,(uint) (pos-buff)); (void) my_net_write(&thd->net, buff,(uint) (pos-buff));
} }
......
...@@ -166,7 +166,6 @@ void send_ok(THD *thd, ha_rows affected_rows=0L, ulonglong id=0L, ...@@ -166,7 +166,6 @@ void send_ok(THD *thd, ha_rows affected_rows=0L, ulonglong id=0L,
const char *info=0); const char *info=0);
void send_eof(THD *thd); void send_eof(THD *thd);
bool send_old_password_request(THD *thd); bool send_old_password_request(THD *thd);
char *net_store_length(char *packet,uint length);
char *net_store_data(char *to,const char *from, uint length); char *net_store_data(char *to,const char *from, uint length);
char *net_store_data(char *to,int32 from); char *net_store_data(char *to,int32 from);
char *net_store_data(char *to,longlong from); char *net_store_data(char *to,longlong from);
......
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