From: Date: January 30 2007 10:48pm Subject: bk commit into 5.1 tree (guilhem:1.2413) BUG#735 List-Archive: http://lists.mysql.com/commits/19039 X-Bug: 735 Message-Id: <200701302148.l0ULmFCk014331@gbichot3.local> Below is the list of changes that have just been committed into a local 5.1 repository of guilhem. When guilhem does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2007-01-30 22:48:05+01:00, guilhem@stripped +7 -0 Mechanical class renaming: Protocol_simple->Protocol_text; Protocol_prep->Protocol_binary and also THD::protocol_simple->THD::protocol_text, THD::protocol_prep->THD::protocol_binary. Reason: the binary protocol is not bound to be used only with prepared statements long term (see WL#3559 "Decouple binary protocol from prepared statements"). Renaming now is pressing because the fix for BUG#735 "Prepared Statements: there is no support for Query Cache" will introduce a new member in class Query_cache_flags telling about the protocol's nature. Other reason: "simple" is less accurate than "text". Future patches for BUG#735 will rely on this cset. libmysqld/lib_sql.cc@stripped, 2007-01-30 22:48:02+01:00, guilhem@stripped +6 -6 Protocol_simple->Protocol_text; Protocol_prep->Protocol_binary sql/protocol.cc@stripped, 2007-01-30 22:48:02+01:00, guilhem@stripped +34 -34 Protocol_simple->Protocol_text; Protocol_prep->Protocol_binary sql/protocol.h@stripped, 2007-01-30 22:48:02+01:00, guilhem@stripped +6 -6 Protocol_simple->Protocol_text; Protocol_prep->Protocol_binary sql/set_var.cc@stripped, 2007-01-30 22:48:03+01:00, guilhem@stripped +2 -2 Protocol_simple->Protocol_text; Protocol_prep->Protocol_binary sql/sql_class.cc@stripped, 2007-01-30 22:48:03+01:00, guilhem@stripped +3 -3 Protocol_simple->Protocol_text; Protocol_prep->Protocol_binary sql/sql_class.h@stripped, 2007-01-30 22:48:03+01:00, guilhem@stripped +2 -2 Protocol_simple->Protocol_text; Protocol_prep->Protocol_binary sql/sql_prepare.cc@stripped, 2007-01-30 22:48:03+01:00, guilhem@stripped +16 -16 Protocol_simple->Protocol_text; Protocol_prep->Protocol_binary # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: guilhem # Host: gbichot3.local # Root: /home/mysql_src/mysql-5.1-runtime-735 --- 1.122/sql/protocol.cc 2007-01-30 22:48:15 +01:00 +++ 1.123/sql/protocol.cc 2007-01-30 22:48:15 +01:00 @@ -33,7 +33,7 @@ void net_send_error_packet(THD *thd, uin #ifndef EMBEDDED_LIBRARY bool Protocol::net_store_data(const char *from, uint length) #else -bool Protocol_prep::net_store_data(const char *from, uint length) +bool Protocol_binary::net_store_data(const char *from, uint length) #endif { ulong packet_length=packet->length(); @@ -555,7 +555,7 @@ bool Protocol::send_fields(List *l Item *item; char buff[80]; String tmp((char*) buff,sizeof(buff),&my_charset_bin); - Protocol_simple prot(thd); + Protocol_text prot(thd); String *local_packet= prot.storage_packet(); CHARSET_INFO *thd_charset= thd->variables.character_set_results; DBUG_ENTER("send_fields"); @@ -758,7 +758,7 @@ bool Protocol::store(I_List* s ****************************************************************************/ #ifndef EMBEDDED_LIBRARY -void Protocol_simple::prepare_for_resend() +void Protocol_text::prepare_for_resend() { packet->length(0); #ifndef DBUG_OFF @@ -766,7 +766,7 @@ void Protocol_simple::prepare_for_resend #endif } -bool Protocol_simple::store_null() +bool Protocol_text::store_null() { #ifndef DBUG_OFF field_pos++; @@ -799,7 +799,7 @@ bool Protocol::store_string_aux(const ch } -bool Protocol_simple::store(const char *from, uint length, +bool Protocol_text::store(const char *from, uint length, CHARSET_INFO *fromcs, CHARSET_INFO *tocs) { #ifndef DBUG_OFF @@ -815,7 +815,7 @@ bool Protocol_simple::store(const char * } -bool Protocol_simple::store(const char *from, uint length, +bool Protocol_text::store(const char *from, uint length, CHARSET_INFO *fromcs) { CHARSET_INFO *tocs= this->thd->variables.character_set_results; @@ -832,7 +832,7 @@ bool Protocol_simple::store(const char * } -bool Protocol_simple::store_tiny(longlong from) +bool Protocol_text::store_tiny(longlong from) { #ifndef DBUG_OFF DBUG_ASSERT(field_types == 0 || field_types[field_pos] == MYSQL_TYPE_TINY); @@ -844,7 +844,7 @@ bool Protocol_simple::store_tiny(longlon } -bool Protocol_simple::store_short(longlong from) +bool Protocol_text::store_short(longlong from) { #ifndef DBUG_OFF DBUG_ASSERT(field_types == 0 || @@ -858,7 +858,7 @@ bool Protocol_simple::store_short(longlo } -bool Protocol_simple::store_long(longlong from) +bool Protocol_text::store_long(longlong from) { #ifndef DBUG_OFF DBUG_ASSERT(field_types == 0 || @@ -872,7 +872,7 @@ bool Protocol_simple::store_long(longlon } -bool Protocol_simple::store_longlong(longlong from, bool unsigned_flag) +bool Protocol_text::store_longlong(longlong from, bool unsigned_flag) { #ifndef DBUG_OFF DBUG_ASSERT(field_types == 0 || @@ -887,7 +887,7 @@ bool Protocol_simple::store_longlong(lon } -bool Protocol_simple::store_decimal(const my_decimal *d) +bool Protocol_text::store_decimal(const my_decimal *d) { #ifndef DBUG_OFF DBUG_ASSERT(field_types == 0 || @@ -901,7 +901,7 @@ bool Protocol_simple::store_decimal(cons } -bool Protocol_simple::store(float from, uint32 decimals, String *buffer) +bool Protocol_text::store(float from, uint32 decimals, String *buffer) { #ifndef DBUG_OFF DBUG_ASSERT(field_types == 0 || @@ -913,7 +913,7 @@ bool Protocol_simple::store(float from, } -bool Protocol_simple::store(double from, uint32 decimals, String *buffer) +bool Protocol_text::store(double from, uint32 decimals, String *buffer) { #ifndef DBUG_OFF DBUG_ASSERT(field_types == 0 || @@ -925,7 +925,7 @@ bool Protocol_simple::store(double from, } -bool Protocol_simple::store(Field *field) +bool Protocol_text::store(Field *field) { if (field->is_null()) return store_null(); @@ -959,7 +959,7 @@ bool Protocol_simple::store(Field *field */ -bool Protocol_simple::store(TIME *tm) +bool Protocol_text::store(TIME *tm) { #ifndef DBUG_OFF DBUG_ASSERT(field_types == 0 || @@ -982,7 +982,7 @@ bool Protocol_simple::store(TIME *tm) } -bool Protocol_simple::store_date(TIME *tm) +bool Protocol_text::store_date(TIME *tm) { #ifndef DBUG_OFF DBUG_ASSERT(field_types == 0 || @@ -1001,7 +1001,7 @@ bool Protocol_simple::store_date(TIME *t we support 0-6 decimals for time. */ -bool Protocol_simple::store_time(TIME *tm) +bool Protocol_text::store_time(TIME *tm) { #ifndef DBUG_OFF DBUG_ASSERT(field_types == 0 || @@ -1041,7 +1041,7 @@ bool Protocol_simple::store_time(TIME *t [..]..[[length]data] data ****************************************************************************/ -bool Protocol_prep::prepare_for_send(List *item_list) +bool Protocol_binary::prepare_for_send(List *item_list) { Protocol::prepare_for_send(item_list); bit_fields= (field_count+9)/8; @@ -1052,7 +1052,7 @@ bool Protocol_prep::prepare_for_send(Lis } -void Protocol_prep::prepare_for_resend() +void Protocol_binary::prepare_for_resend() { packet->length(bit_fields+1); bzero((char*) packet->ptr(), 1+bit_fields); @@ -1060,21 +1060,21 @@ void Protocol_prep::prepare_for_resend() } -bool Protocol_prep::store(const char *from, uint length, CHARSET_INFO *fromcs) +bool Protocol_binary::store(const char *from, uint length, CHARSET_INFO *fromcs) { CHARSET_INFO *tocs= thd->variables.character_set_results; field_pos++; return store_string_aux(from, length, fromcs, tocs); } -bool Protocol_prep::store(const char *from,uint length, +bool Protocol_binary::store(const char *from,uint length, CHARSET_INFO *fromcs, CHARSET_INFO *tocs) { field_pos++; return store_string_aux(from, length, fromcs, tocs); } -bool Protocol_prep::store_null() +bool Protocol_binary::store_null() { uint offset= (field_pos+2)/8+1, bit= (1 << ((field_pos+2) & 7)); /* Room for this as it's allocated in prepare_for_send */ @@ -1085,7 +1085,7 @@ bool Protocol_prep::store_null() } -bool Protocol_prep::store_tiny(longlong from) +bool Protocol_binary::store_tiny(longlong from) { char buff[1]; field_pos++; @@ -1094,7 +1094,7 @@ bool Protocol_prep::store_tiny(longlong } -bool Protocol_prep::store_short(longlong from) +bool Protocol_binary::store_short(longlong from) { field_pos++; char *to= packet->prep_append(2, PACKET_BUFFER_EXTRA_ALLOC); @@ -1105,7 +1105,7 @@ bool Protocol_prep::store_short(longlong } -bool Protocol_prep::store_long(longlong from) +bool Protocol_binary::store_long(longlong from) { field_pos++; char *to= packet->prep_append(4, PACKET_BUFFER_EXTRA_ALLOC); @@ -1116,7 +1116,7 @@ bool Protocol_prep::store_long(longlong } -bool Protocol_prep::store_longlong(longlong from, bool unsigned_flag) +bool Protocol_binary::store_longlong(longlong from, bool unsigned_flag) { field_pos++; char *to= packet->prep_append(8, PACKET_BUFFER_EXTRA_ALLOC); @@ -1126,7 +1126,7 @@ bool Protocol_prep::store_longlong(longl return 0; } -bool Protocol_prep::store_decimal(const my_decimal *d) +bool Protocol_binary::store_decimal(const my_decimal *d) { #ifndef DBUG_OFF DBUG_ASSERT(field_types == 0 || @@ -1139,7 +1139,7 @@ bool Protocol_prep::store_decimal(const return store(str.ptr(), str.length(), str.charset()); } -bool Protocol_prep::store(float from, uint32 decimals, String *buffer) +bool Protocol_binary::store(float from, uint32 decimals, String *buffer) { field_pos++; char *to= packet->prep_append(4, PACKET_BUFFER_EXTRA_ALLOC); @@ -1150,7 +1150,7 @@ bool Protocol_prep::store(float from, ui } -bool Protocol_prep::store(double from, uint32 decimals, String *buffer) +bool Protocol_binary::store(double from, uint32 decimals, String *buffer) { field_pos++; char *to= packet->prep_append(8, PACKET_BUFFER_EXTRA_ALLOC); @@ -1161,7 +1161,7 @@ bool Protocol_prep::store(double from, u } -bool Protocol_prep::store(Field *field) +bool Protocol_binary::store(Field *field) { /* We should not increment field_pos here as send_binary() will call another @@ -1173,7 +1173,7 @@ bool Protocol_prep::store(Field *field) } -bool Protocol_prep::store(TIME *tm) +bool Protocol_binary::store(TIME *tm) { char buff[12],*pos; uint length; @@ -1199,15 +1199,15 @@ bool Protocol_prep::store(TIME *tm) return packet->append(buff, length+1, PACKET_BUFFER_EXTRA_ALLOC); } -bool Protocol_prep::store_date(TIME *tm) +bool Protocol_binary::store_date(TIME *tm) { tm->hour= tm->minute= tm->second=0; tm->second_part= 0; - return Protocol_prep::store(tm); + return Protocol_binary::store(tm); } -bool Protocol_prep::store_time(TIME *tm) +bool Protocol_binary::store_time(TIME *tm) { char buff[13], *pos; uint length; --- 1.310/sql/sql_class.cc 2007-01-30 22:48:15 +01:00 +++ 1.311/sql/sql_class.cc 2007-01-30 22:48:15 +01:00 @@ -300,9 +300,9 @@ THD::THD() bzero((char*) &user_var_events, sizeof(user_var_events)); /* Protocol */ - protocol= &protocol_simple; // Default protocol - protocol_simple.init(this); - protocol_prep.init(this); + protocol= &protocol_text; // Default protocol + protocol_text.init(this); + protocol_binary.init(this); tablespace_op=FALSE; ulong tmp=sql_rnd_with_mutex(); --- 1.338/sql/sql_class.h 2007-01-30 22:48:15 +01:00 +++ 1.339/sql/sql_class.h 2007-01-30 22:48:15 +01:00 @@ -853,8 +853,8 @@ public: NET net; // client connection descriptor MEM_ROOT warn_root; // For warnings and errors Protocol *protocol; // Current protocol - Protocol_simple protocol_simple; // Normal protocol - Protocol_prep protocol_prep; // Binary protocol + Protocol_text protocol_text; // Normal protocol + Protocol_binary protocol_binary; // Binary protocol HASH user_vars; // hash for user variables String packet; // dynamic buffer for network I/O String convert_buffer; // buffer for charset conversions --- 1.37/sql/protocol.h 2007-01-30 22:48:15 +01:00 +++ 1.38/sql/protocol.h 2007-01-30 22:48:15 +01:00 @@ -101,11 +101,11 @@ public: /* Class used for the old (MySQL 4.0 protocol) */ -class Protocol_simple :public Protocol +class Protocol_text :public Protocol { public: - Protocol_simple() {} - Protocol_simple(THD *thd_arg) :Protocol(thd_arg) {} + Protocol_text() {} + Protocol_text(THD *thd_arg) :Protocol(thd_arg) {} virtual void prepare_for_resend(); virtual bool store_null(); virtual bool store_tiny(longlong from); @@ -128,13 +128,13 @@ public: }; -class Protocol_prep :public Protocol +class Protocol_binary :public Protocol { private: uint bit_fields; public: - Protocol_prep() {} - Protocol_prep(THD *thd_arg) :Protocol(thd_arg) {} + Protocol_binary() {} + Protocol_binary(THD *thd_arg) :Protocol(thd_arg) {} virtual bool prepare_for_send(List *item_list); virtual void prepare_for_resend(); #ifdef EMBEDDED_LIBRARY --- 1.211/sql/set_var.cc 2007-01-30 22:48:15 +01:00 +++ 1.212/sql/set_var.cc 2007-01-30 22:48:15 +01:00 @@ -2730,8 +2730,8 @@ int set_var_collation_client::update(THD thd->variables.character_set_results= character_set_results; thd->variables.collation_connection= collation_connection; thd->update_charset(); - thd->protocol_simple.init(thd); - thd->protocol_prep.init(thd); + thd->protocol_text.init(thd); + thd->protocol_binary.init(thd); return 0; } --- 1.127/libmysqld/lib_sql.cc 2007-01-30 22:48:15 +01:00 +++ 1.128/libmysqld/lib_sql.cc 2007-01-30 22:48:15 +01:00 @@ -825,7 +825,7 @@ int Protocol::begin_dataset() remove last row of current recordset SYNOPSIS - Protocol_simple::remove_last_row() + Protocol_text::remove_last_row() NOTES does the loop from the beginning of the current recordset to @@ -833,12 +833,12 @@ int Protocol::begin_dataset() Not supposed to be frequently called. */ -void Protocol_simple::remove_last_row() +void Protocol_text::remove_last_row() { MYSQL_DATA *data= thd->cur_data; MYSQL_ROWS **last_row_hook= &data->data; uint count= data->rows; - DBUG_ENTER("Protocol_simple::remove_last_row"); + DBUG_ENTER("Protocol_text::remove_last_row"); while (--count) last_row_hook= &(*last_row_hook)->next; @@ -967,7 +967,7 @@ bool Protocol::write() return false; } -bool Protocol_prep::write() +bool Protocol_binary::write() { MYSQL_ROWS *cur; MYSQL_DATA *data= thd->cur_data; @@ -1034,7 +1034,7 @@ void net_send_error_packet(THD *thd, uin } -void Protocol_simple::prepare_for_resend() +void Protocol_text::prepare_for_resend() { MYSQL_ROWS *cur; MYSQL_DATA *data= thd->cur_data; @@ -1058,7 +1058,7 @@ void Protocol_simple::prepare_for_resend DBUG_VOID_RETURN; } -bool Protocol_simple::store_null() +bool Protocol_text::store_null() { *(next_field++)= NULL; ++next_mysql_field; --- 1.190/sql/sql_prepare.cc 2007-01-30 22:48:15 +01:00 +++ 1.191/sql/sql_prepare.cc 2007-01-30 22:48:15 +01:00 @@ -83,11 +83,11 @@ When one supplies long data for a placeh /* A result class used to send cursor rows using the binary protocol. */ -class Select_fetch_protocol_prep: public select_send +class Select_fetch_protocol_binary: public select_send { - Protocol_prep protocol; + Protocol_binary protocol; public: - Select_fetch_protocol_prep(THD *thd); + Select_fetch_protocol_binary(THD *thd); virtual bool send_fields(List &list, uint flags); virtual bool send_data(List &items); virtual bool send_eof(); @@ -112,7 +112,7 @@ public: }; THD *thd; - Select_fetch_protocol_prep result; + Select_fetch_protocol_binary result; Protocol *protocol; Item_param **param_array; uint param_count; @@ -224,9 +224,9 @@ static bool send_prep_stmt(Prepared_stat */ DBUG_RETURN(my_net_write(net, buff, sizeof(buff)) || (stmt->param_count && - stmt->thd->protocol_simple.send_fields((List *) - &stmt->lex->param_list, - Protocol::SEND_EOF))); + stmt->thd->protocol_text.send_fields((List *) + &stmt->lex->param_list, + Protocol::SEND_EOF))); } #else static bool send_prep_stmt(Prepared_statement *stmt, @@ -1882,7 +1882,7 @@ void mysql_stmt_prepare(THD *thd, const /* First of all clear possible warnings from the previous command */ mysql_reset_thd_for_next_command(thd); - if (! (stmt= new Prepared_statement(thd, &thd->protocol_prep))) + if (! (stmt= new Prepared_statement(thd, &thd->protocol_binary))) DBUG_VOID_RETURN; /* out of memory: error is set in Sql_alloc */ if (thd->stmt_map.insert(thd, stmt)) @@ -2054,7 +2054,7 @@ void mysql_sql_stmt_prepare(THD *thd) const char *query; uint query_len; DBUG_ENTER("mysql_sql_stmt_prepare"); - DBUG_ASSERT(thd->protocol == &thd->protocol_simple); + DBUG_ASSERT(thd->protocol == &thd->protocol_text); if ((stmt= (Prepared_statement*) thd->stmt_map.find_by_name(name))) { @@ -2067,7 +2067,7 @@ void mysql_sql_stmt_prepare(THD *thd) } if (! (query= get_dynamic_sql_string(lex, &query_len)) || - ! (stmt= new Prepared_statement(thd, &thd->protocol_simple))) + ! (stmt= new Prepared_statement(thd, &thd->protocol_text))) { DBUG_VOID_RETURN; /* out of memory */ } @@ -2617,14 +2617,14 @@ void mysql_stmt_get_longdata(THD *thd, c /*************************************************************************** - Select_fetch_protocol_prep + Select_fetch_protocol_binary ****************************************************************************/ -Select_fetch_protocol_prep::Select_fetch_protocol_prep(THD *thd) +Select_fetch_protocol_binary::Select_fetch_protocol_binary(THD *thd) :protocol(thd) {} -bool Select_fetch_protocol_prep::send_fields(List &list, uint flags) +bool Select_fetch_protocol_binary::send_fields(List &list, uint flags) { bool rc; Protocol *save_protocol= thd->protocol; @@ -2642,7 +2642,7 @@ bool Select_fetch_protocol_prep::send_fi return rc; } -bool Select_fetch_protocol_prep::send_eof() +bool Select_fetch_protocol_binary::send_eof() { Protocol *save_protocol= thd->protocol; @@ -2654,7 +2654,7 @@ bool Select_fetch_protocol_prep::send_eo bool -Select_fetch_protocol_prep::send_data(List &fields) +Select_fetch_protocol_binary::send_data(List &fields) { Protocol *save_protocol= thd->protocol; bool rc; @@ -2998,7 +2998,7 @@ bool Prepared_statement::execute(String mysql_open_cursor(thd, (uint) ALWAYS_MATERIALIZED_CURSOR, &result, &cursor) : mysql_execute_command(thd)); - thd->protocol= &thd->protocol_simple; /* use normal protocol */ + thd->protocol= &thd->protocol_text; /* use normal protocol */ /* Assert that if an error, no cursor is open */ DBUG_ASSERT(! (error && cursor));