Commit 828789a4 authored by serg@serg.mylan's avatar serg@serg.mylan

Merge bk-internal:/home/bk/mysql-3.23/

into serg.mylan:/usr/home/serg/Abk/mysql
parents 5c57eb22 5bc4965d
...@@ -355,6 +355,11 @@ void Item_string::make_field(Send_field *tmp_field) ...@@ -355,6 +355,11 @@ void Item_string::make_field(Send_field *tmp_field)
init_make_field(tmp_field,FIELD_TYPE_STRING); init_make_field(tmp_field,FIELD_TYPE_STRING);
} }
void Item_empty_string::make_field(Send_field *tmp_field)
{
init_make_field(tmp_field,FIELD_TYPE_VAR_STRING);
}
void Item_datetime::make_field(Send_field *tmp_field) void Item_datetime::make_field(Send_field *tmp_field)
{ {
init_make_field(tmp_field,FIELD_TYPE_DATETIME); init_make_field(tmp_field,FIELD_TYPE_DATETIME);
......
...@@ -564,27 +564,19 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) ...@@ -564,27 +564,19 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
DBUG_RETURN(1); DBUG_RETURN(1);
} }
List<Item> field_list; String packet;
field_list.push_back(new Item_empty_string("Table",NAME_LEN)); packet.length(0);
field_list.push_back(new Item_empty_string("Create Table",1024)); net_store_data(&packet, table->table_name);
if (send_fields(thd,field_list,1))
DBUG_RETURN(1);
String *packet = &thd->packet;
{
packet->length(0);
net_store_data(packet, table->table_name);
/* /*
A hack - we need to reserve some space for the length before A hack - we need to reserve some space for the length before
we know what it is - let's assume that the length of create table we know what it is - let's assume that the length of create table
statement will fit into 3 bytes ( 16 MB max :-) ) statement will fit into 3 bytes ( 16 MB max :-) )
*/ */
ulong store_len_offset = packet->length(); ulong store_len_offset = packet.length();
packet->length(store_len_offset + 4); packet.length(store_len_offset + 4);
if (store_create_info(thd, table, packet)) if (store_create_info(thd, table, &packet))
DBUG_RETURN(-1); DBUG_RETURN(-1);
ulong create_len = packet->length() - store_len_offset - 4; ulong create_len = packet.length() - store_len_offset - 4;
if (create_len > 0x00ffffff) // better readable in HEX ... if (create_len > 0x00ffffff) // better readable in HEX ...
{ {
/* /*
...@@ -599,14 +591,20 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) ...@@ -599,14 +591,20 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
into fewer bytes, so we cannot use net_store_data() anymore, into fewer bytes, so we cannot use net_store_data() anymore,
and do it ourselves and do it ourselves
*/ */
char* p = (char*)packet->ptr() + store_len_offset; char* p = (char*)packet.ptr() + store_len_offset;
*p++ = (char) 253; // The client the length is stored using 3-bytes *p++ = (char) 253; // The client the length is stored using 3-bytes
int3store(p, create_len); int3store(p, create_len);
// now we are in business :-) List<Item> field_list;
if (my_net_write(&thd->net, (char*)packet->ptr(), packet->length())) field_list.push_back(new Item_empty_string("Table",NAME_LEN));
field_list.push_back(new Item_empty_string("Create Table",packet.length()));
if (send_fields(thd,field_list,1))
DBUG_RETURN(1); DBUG_RETURN(1);
}
if (my_net_write(&thd->net, (char*)packet.ptr(), packet.length()))
DBUG_RETURN(1);
send_eof(&thd->net); send_eof(&thd->net);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
......
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