Commit 8cb27d2f authored by unknown's avatar unknown

Merge bk-internal.mysql.com:/home/bk/mysql-4.1

into narttu.mysql.fi:/my/mysql-4.1


sql/field.cc:
  Auto merged
sql/ha_innodb.cc:
  Auto merged
sql/ha_myisam.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/repl_failsafe.cc:
  Auto merged
sql/slave.cc:
  Auto merged
sql/sql_repl.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
parents b0b315dc 61ca875e
...@@ -204,7 +204,7 @@ bool Field::send_binary(Protocol *protocol) ...@@ -204,7 +204,7 @@ bool Field::send_binary(Protocol *protocol)
char buff[MAX_FIELD_WIDTH]; char buff[MAX_FIELD_WIDTH];
String tmp(buff,sizeof(buff),charset()); String tmp(buff,sizeof(buff),charset());
val_str(&tmp,&tmp); val_str(&tmp,&tmp);
return protocol->store(tmp.ptr(), tmp.length()); return protocol->store(tmp.ptr(), tmp.length(), tmp.charset());
} }
......
...@@ -257,15 +257,15 @@ int berkeley_show_logs(Protocol *protocol) ...@@ -257,15 +257,15 @@ int berkeley_show_logs(Protocol *protocol)
for (a = all_logs, f = free_logs; *a; ++a) for (a = all_logs, f = free_logs; *a; ++a)
{ {
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(*a); protocol->store(*a, system_charset_info);
protocol->store("BDB", 3); protocol->store("BDB", 3, system_charset_info);
if (f && *f && strcmp(*a, *f) == 0) if (f && *f && strcmp(*a, *f) == 0)
{ {
f++; f++;
protocol->store(SHOW_LOG_STATUS_FREE); protocol->store(SHOW_LOG_STATUS_FREE, system_charset_info);
} }
else else
protocol->store(SHOW_LOG_STATUS_INUSE); protocol->store(SHOW_LOG_STATUS_INUSE, system_charset_info);
if (protocol->write()) if (protocol->write())
{ {
......
...@@ -4147,7 +4147,7 @@ innodb_show_status( ...@@ -4147,7 +4147,7 @@ innodb_show_status(
} }
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(buf, strlen(buf)); protocol->store(buf, strlen(buf), system_charset_info);
ut_free(buf); ut_free(buf);
if (protocol->write()) if (protocol->write())
......
...@@ -77,10 +77,10 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type, ...@@ -77,10 +77,10 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type,
length=(uint) (strxmov(name, param->db_name,".",param->table_name,NullS) - length=(uint) (strxmov(name, param->db_name,".",param->table_name,NullS) -
name); name);
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(name, length); protocol->store(name, length, system_charset_info);
protocol->store(param->op_name); protocol->store(param->op_name, system_charset_info);
protocol->store(msg_type); protocol->store(msg_type, system_charset_info);
protocol->store(msgbuf, msg_length); protocol->store(msgbuf, msg_length, system_charset_info);
if (protocol->write()) if (protocol->write())
sql_print_error("Failed on my_net_write, writing to stderr instead: %s\n", sql_print_error("Failed on my_net_write, writing to stderr instead: %s\n",
msgbuf); msgbuf);
......
...@@ -1012,7 +1012,7 @@ bool Item::send(Protocol *protocol, String *buffer) ...@@ -1012,7 +1012,7 @@ bool Item::send(Protocol *protocol, String *buffer)
{ {
String *res; String *res;
if ((res=val_str(buffer))) if ((res=val_str(buffer)))
result= protocol->store(res->ptr(),res->length()); result= protocol->store(res->ptr(),res->length(),res->charset());
break; break;
} }
case MYSQL_TYPE_TINY: case MYSQL_TYPE_TINY:
......
...@@ -348,10 +348,10 @@ int Log_event::net_send(Protocol *protocol, const char* log_name, my_off_t pos) ...@@ -348,10 +348,10 @@ int Log_event::net_send(Protocol *protocol, const char* log_name, my_off_t pos)
log_name = p + 1; log_name = p + 1;
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(log_name); protocol->store(log_name, system_charset_info);
protocol->store((ulonglong) pos); protocol->store((ulonglong) pos);
event_type = get_type_str(); event_type = get_type_str();
protocol->store(event_type, strlen(event_type)); protocol->store(event_type, strlen(event_type), system_charset_info);
protocol->store((uint32) server_id); protocol->store((uint32) server_id);
protocol->store((ulonglong) log_pos); protocol->store((ulonglong) log_pos);
pack_info(protocol); pack_info(protocol);
...@@ -731,7 +731,7 @@ void Query_log_event::pack_info(Protocol *protocol) ...@@ -731,7 +731,7 @@ void Query_log_event::pack_info(Protocol *protocol)
memcpy(pos, query, q_len); memcpy(pos, query, q_len);
pos+= q_len; pos+= q_len;
} }
protocol->store(buf, pos-buf); protocol->store(buf, pos-buf, system_charset_info);
my_free(buf, MYF(MY_ALLOW_ZERO_PTR)); my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
} }
#endif #endif
...@@ -1001,7 +1001,7 @@ void Start_log_event::pack_info(Protocol *protocol) ...@@ -1001,7 +1001,7 @@ void Start_log_event::pack_info(Protocol *protocol)
pos= strmov(pos, server_version); pos= strmov(pos, server_version);
pos= strmov(pos, ", Binlog ver: "); pos= strmov(pos, ", Binlog ver: ");
pos=int10_to_str(binlog_version, pos, 10); pos=int10_to_str(binlog_version, pos, 10);
protocol->store(buf, pos-buf); protocol->store(buf, pos-buf, system_charset_info);
} }
#endif #endif
...@@ -1200,7 +1200,7 @@ void Load_log_event::pack_info(Protocol *protocol) ...@@ -1200,7 +1200,7 @@ void Load_log_event::pack_info(Protocol *protocol)
*pos++= ')'; *pos++= ')';
} }
protocol->store(buf, pos-buf); protocol->store(buf, pos-buf, system_charset_info);
my_free(buf, MYF(MY_ALLOW_ZERO_PTR)); my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
} }
#endif #endif
...@@ -1675,7 +1675,7 @@ void Rotate_log_event::pack_info(Protocol *protocol) ...@@ -1675,7 +1675,7 @@ void Rotate_log_event::pack_info(Protocol *protocol)
b_pos=longlong10_to_str(pos, b_pos, 10); b_pos=longlong10_to_str(pos, b_pos, 10);
if (flags & LOG_EVENT_FORCED_ROTATE_F) if (flags & LOG_EVENT_FORCED_ROTATE_F)
b_pos= strmov(b_pos ,"; forced by master"); b_pos= strmov(b_pos ,"; forced by master");
protocol->store(buf, b_pos-buf); protocol->store(buf, b_pos-buf, system_charset_info);
my_free(buf, MYF(MY_ALLOW_ZERO_PTR)); my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
} }
#endif #endif
...@@ -1810,7 +1810,7 @@ void Intvar_log_event::pack_info(Protocol *protocol) ...@@ -1810,7 +1810,7 @@ void Intvar_log_event::pack_info(Protocol *protocol)
pos= strmov(buf, get_var_type_name()); pos= strmov(buf, get_var_type_name());
*(pos++)='='; *(pos++)='=';
pos= longlong10_to_str(val, pos, -10); pos= longlong10_to_str(val, pos, -10);
protocol->store(buf, pos-buf); protocol->store(buf, pos-buf, system_charset_info);
} }
#endif #endif
...@@ -1921,7 +1921,7 @@ void Rand_log_event::pack_info(Protocol *protocol) ...@@ -1921,7 +1921,7 @@ void Rand_log_event::pack_info(Protocol *protocol)
pos= int10_to_str((long) seed1, pos, 10); pos= int10_to_str((long) seed1, pos, 10);
pos= strmov(pos, ",rand_seed2="); pos= strmov(pos, ",rand_seed2=");
pos= int10_to_str((long) seed2, pos, 10); pos= int10_to_str((long) seed2, pos, 10);
protocol->store(buf1, (uint) (pos-buf1)); protocol->store(buf1, (uint) (pos-buf1), system_charset_info);
} }
#endif #endif
...@@ -2023,7 +2023,7 @@ void User_var_log_event::pack_info(Protocol* protocol) ...@@ -2023,7 +2023,7 @@ void User_var_log_event::pack_info(Protocol* protocol)
buf[0]= '@'; buf[0]= '@';
buf[1+name_len]= '='; buf[1+name_len]= '=';
memcpy(buf+1, name, name_len); memcpy(buf+1, name, name_len);
protocol->store(buf, event_len); protocol->store(buf, event_len, system_charset_info);
my_free(buf, MYF(MY_ALLOW_ZERO_PTR)); my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
} }
#endif // !MYSQL_CLIENT #endif // !MYSQL_CLIENT
...@@ -2223,7 +2223,7 @@ void Slave_log_event::pack_info(Protocol *protocol) ...@@ -2223,7 +2223,7 @@ void Slave_log_event::pack_info(Protocol *protocol)
pos= strmov(pos, master_log); pos= strmov(pos, master_log);
pos= strmov(pos, ",pos="); pos= strmov(pos, ",pos=");
pos= longlong10_to_str(master_pos, pos, 10); pos= longlong10_to_str(master_pos, pos, 10);
protocol->store(buf, pos-buf); protocol->store(buf, pos-buf, system_charset_info);
} }
#endif // !MYSQL_CLIENT #endif // !MYSQL_CLIENT
...@@ -2557,7 +2557,7 @@ void Create_file_log_event::pack_info(Protocol *protocol) ...@@ -2557,7 +2557,7 @@ void Create_file_log_event::pack_info(Protocol *protocol)
pos= int10_to_str((long) file_id, pos, 10); pos= int10_to_str((long) file_id, pos, 10);
pos= strmov(pos, ";block_len="); pos= strmov(pos, ";block_len=");
pos= int10_to_str((long) block_len, pos, 10); pos= int10_to_str((long) block_len, pos, 10);
protocol->store(buf, pos-buf); protocol->store(buf, pos-buf, system_charset_info);
} }
#endif #endif
...@@ -2708,7 +2708,7 @@ void Append_block_log_event::pack_info(Protocol *protocol) ...@@ -2708,7 +2708,7 @@ void Append_block_log_event::pack_info(Protocol *protocol)
length= (uint) my_sprintf(buf, length= (uint) my_sprintf(buf,
(buf, ";file_id=%u;block_len=%u", file_id, (buf, ";file_id=%u;block_len=%u", file_id,
block_len)); block_len));
protocol->store(buf, (int32) length); protocol->store(buf, (int32) length, system_charset_info);
} }
#endif #endif
...@@ -2821,7 +2821,7 @@ void Delete_file_log_event::pack_info(Protocol *protocol) ...@@ -2821,7 +2821,7 @@ void Delete_file_log_event::pack_info(Protocol *protocol)
char buf[64]; char buf[64];
uint length; uint length;
length= (uint) my_sprintf(buf, (buf, ";file_id=%u", (uint) file_id)); length= (uint) my_sprintf(buf, (buf, ";file_id=%u", (uint) file_id));
protocol->store(buf, (int32) length); protocol->store(buf, (int32) length, system_charset_info);
} }
#endif #endif
...@@ -2920,7 +2920,7 @@ void Execute_load_log_event::pack_info(Protocol *protocol) ...@@ -2920,7 +2920,7 @@ void Execute_load_log_event::pack_info(Protocol *protocol)
char buf[64]; char buf[64];
uint length; uint length;
length= (uint) my_sprintf(buf, (buf, ";file_id=%u", (uint) file_id)); length= (uint) my_sprintf(buf, (buf, ";file_id=%u", (uint) file_id));
protocol->store(buf, (int32) length); protocol->store(buf, (int32) length, system_charset_info);
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -528,18 +528,20 @@ bool Protocol::send_fields(List<Item> *list, uint flag) ...@@ -528,18 +528,20 @@ bool Protocol::send_fields(List<Item> *list, uint flag)
while ((item=it++)) while ((item=it++))
{ {
char *pos; char *pos;
CHARSET_INFO *cs= system_charset_info;
Send_field field; Send_field field;
item->make_field(&field); item->make_field(&field);
prot.prepare_for_resend(); prot.prepare_for_resend();
if (thd->client_capabilities & CLIENT_PROTOCOL_41) if (thd->client_capabilities & CLIENT_PROTOCOL_41)
{ {
if (prot.store(field.db_name, (uint) strlen(field.db_name)) || if (prot.store(field.db_name, (uint) strlen(field.db_name), cs) ||
prot.store(field.table_name, (uint) strlen(field.table_name)) || prot.store(field.table_name, (uint) strlen(field.table_name), cs) ||
prot.store(field.org_table_name, prot.store(field.org_table_name,
(uint) strlen(field.org_table_name)) || (uint) strlen(field.org_table_name), cs) ||
prot.store(field.col_name, (uint) strlen(field.col_name)) || prot.store(field.col_name, (uint) strlen(field.col_name), cs) ||
prot.store(field.org_col_name, (uint) strlen(field.org_col_name)) || prot.store(field.org_col_name,
(uint) strlen(field.org_col_name), cs) ||
packet->realloc(packet->length()+12)) packet->realloc(packet->length()+12))
goto err; goto err;
/* Store fixed length fields */ /* Store fixed length fields */
...@@ -556,8 +558,8 @@ bool Protocol::send_fields(List<Item> *list, uint flag) ...@@ -556,8 +558,8 @@ bool Protocol::send_fields(List<Item> *list, uint flag)
} }
else else
{ {
if (prot.store(field.table_name, (uint) strlen(field.table_name)) || if (prot.store(field.table_name, (uint) strlen(field.table_name), cs) ||
prot.store(field.col_name, (uint) strlen(field.col_name)) || prot.store(field.col_name, (uint) strlen(field.col_name), cs) ||
packet->realloc(packet->length()+10)) packet->realloc(packet->length()+10))
goto err; goto err;
pos= (char*) packet->ptr()+packet->length(); pos= (char*) packet->ptr()+packet->length();
...@@ -639,12 +641,12 @@ bool Protocol::write() ...@@ -639,12 +641,12 @@ bool Protocol::write()
1 error 1 error
*/ */
bool Protocol::store(const char *from) bool Protocol::store(const char *from, CHARSET_INFO *cs)
{ {
if (!from) if (!from)
return store_null(); return store_null();
uint length= strlen(from); uint length= strlen(from);
return store(from, length); return store(from, length, cs);
} }
...@@ -668,7 +670,7 @@ bool Protocol::store(I_List<i_string>* str_list) ...@@ -668,7 +670,7 @@ bool Protocol::store(I_List<i_string>* str_list)
} }
if ((len= tmp.length())) if ((len= tmp.length()))
len--; // Remove last ',' len--; // Remove last ','
return store((char*) tmp.ptr(), len); return store((char*) tmp.ptr(), len, tmp.charset());
} }
...@@ -701,7 +703,7 @@ bool Protocol_simple::store_null() ...@@ -701,7 +703,7 @@ bool Protocol_simple::store_null()
#endif #endif
bool Protocol_simple::store(const char *from, uint length) bool Protocol_simple::store(const char *from, uint length, CHARSET_INFO *cs)
{ {
#ifndef DEBUG_OFF #ifndef DEBUG_OFF
DBUG_ASSERT(field_types == 0 || DBUG_ASSERT(field_types == 0 ||
...@@ -712,7 +714,16 @@ bool Protocol_simple::store(const char *from, uint length) ...@@ -712,7 +714,16 @@ bool Protocol_simple::store(const char *from, uint length)
#endif #endif
if (convert) if (convert)
return convert_str(from, length); return convert_str(from, length);
return net_store_data(from, length); #if 0
if (cs != this->thd->charset())
{
String tmp;
tmp.copy(from, length, cs, this->thd->charset());
return net_store_data(tmp.ptr(), tmp.length());
}
else
#endif
return net_store_data(from, length);
} }
...@@ -904,7 +915,7 @@ void Protocol_prep::prepare_for_resend() ...@@ -904,7 +915,7 @@ void Protocol_prep::prepare_for_resend()
} }
bool Protocol_prep::store(const char *from,uint length) bool Protocol_prep::store(const char *from,uint length, CHARSET_INFO *cs)
{ {
#ifndef DEBUG_OFF #ifndef DEBUG_OFF
DBUG_ASSERT(field_types == 0 || DBUG_ASSERT(field_types == 0 ||
......
...@@ -52,7 +52,7 @@ public: ...@@ -52,7 +52,7 @@ public:
bool send_fields(List<Item> *list, uint flag); bool send_fields(List<Item> *list, uint flag);
bool send_records_num(List<Item> *list, ulonglong records); bool send_records_num(List<Item> *list, ulonglong records);
bool store(I_List<i_string> *str_list); bool store(I_List<i_string> *str_list);
bool store(const char *from); bool store(const char *from, CHARSET_INFO *cs);
String *storage_packet() { return packet; } String *storage_packet() { return packet; }
inline void free() { packet->free(); } inline void free() { packet->free(); }
bool write(); bool write();
...@@ -75,7 +75,7 @@ public: ...@@ -75,7 +75,7 @@ public:
virtual bool store_short(longlong from)=0; virtual bool store_short(longlong from)=0;
virtual bool store_long(longlong from)=0; virtual bool store_long(longlong from)=0;
virtual bool store_longlong(longlong from, bool unsigned_flag)=0; virtual bool store_longlong(longlong from, bool unsigned_flag)=0;
virtual bool store(const char *from, uint length)=0; virtual bool store(const char *from, uint length, CHARSET_INFO *cs)=0;
virtual bool store(float from, uint32 decimals, String *buffer)=0; virtual bool store(float from, uint32 decimals, String *buffer)=0;
virtual bool store(double from, uint32 decimals, String *buffer)=0; virtual bool store(double from, uint32 decimals, String *buffer)=0;
virtual bool store(TIME *time)=0; virtual bool store(TIME *time)=0;
...@@ -98,7 +98,7 @@ public: ...@@ -98,7 +98,7 @@ public:
virtual bool store_short(longlong from); virtual bool store_short(longlong from);
virtual bool store_long(longlong from); virtual bool store_long(longlong from);
virtual bool store_longlong(longlong from, bool unsigned_flag); virtual bool store_longlong(longlong from, bool unsigned_flag);
virtual bool store(const char *from, uint length); virtual bool store(const char *from, uint length, CHARSET_INFO *cs);
virtual bool store(TIME *time); virtual bool store(TIME *time);
virtual bool store_date(TIME *time); virtual bool store_date(TIME *time);
virtual bool store_time(TIME *time); virtual bool store_time(TIME *time);
...@@ -122,7 +122,7 @@ public: ...@@ -122,7 +122,7 @@ public:
virtual bool store_short(longlong from); virtual bool store_short(longlong from);
virtual bool store_long(longlong from); virtual bool store_long(longlong from);
virtual bool store_longlong(longlong from, bool unsigned_flag); virtual bool store_longlong(longlong from, bool unsigned_flag);
virtual bool store(const char *from,uint length); virtual bool store(const char *from,uint length, CHARSET_INFO *cs);
virtual bool store(TIME *time); virtual bool store(TIME *time);
virtual bool store_date(TIME *time); virtual bool store_date(TIME *time);
virtual bool store_time(TIME *time); virtual bool store_time(TIME *time);
......
...@@ -440,7 +440,7 @@ int show_new_master(THD* thd) ...@@ -440,7 +440,7 @@ int show_new_master(THD* thd)
if (protocol->send_fields(&field_list, 1)) if (protocol->send_fields(&field_list, 1))
DBUG_RETURN(-1); DBUG_RETURN(-1);
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(lex_mi->log_file_name); protocol->store(lex_mi->log_file_name, system_charset_info);
protocol->store((ulonglong) lex_mi->pos); protocol->store((ulonglong) lex_mi->pos);
if (protocol->write()) if (protocol->write())
DBUG_RETURN(-1); DBUG_RETURN(-1);
...@@ -638,11 +638,11 @@ int show_slave_hosts(THD* thd) ...@@ -638,11 +638,11 @@ int show_slave_hosts(THD* thd)
SLAVE_INFO* si = (SLAVE_INFO*) hash_element(&slave_list, i); SLAVE_INFO* si = (SLAVE_INFO*) hash_element(&slave_list, i);
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store((uint32) si->server_id); protocol->store((uint32) si->server_id);
protocol->store(si->host); protocol->store(si->host, system_charset_info);
if (opt_show_slave_auth_info) if (opt_show_slave_auth_info)
{ {
protocol->store(si->user); protocol->store(si->user, system_charset_info);
protocol->store(si->password); protocol->store(si->password, system_charset_info);
} }
protocol->store((uint32) si->port); protocol->store((uint32) si->port);
protocol->store((uint32) si->rpl_recovery_rank); protocol->store((uint32) si->rpl_recovery_rank);
......
...@@ -1618,22 +1618,22 @@ int show_master_info(THD* thd, MASTER_INFO* mi) ...@@ -1618,22 +1618,22 @@ int show_master_info(THD* thd, MASTER_INFO* mi)
pthread_mutex_lock(&mi->data_lock); pthread_mutex_lock(&mi->data_lock);
pthread_mutex_lock(&mi->rli.data_lock); pthread_mutex_lock(&mi->rli.data_lock);
protocol->store(mi->host); protocol->store(mi->host, system_charset_info);
protocol->store(mi->user); protocol->store(mi->user, system_charset_info);
protocol->store((uint32) mi->port); protocol->store((uint32) mi->port);
protocol->store((uint32) mi->connect_retry); protocol->store((uint32) mi->connect_retry);
protocol->store(mi->master_log_name); protocol->store(mi->master_log_name, system_charset_info);
protocol->store((ulonglong) mi->master_log_pos); protocol->store((ulonglong) mi->master_log_pos);
protocol->store(mi->rli.relay_log_name + protocol->store(mi->rli.relay_log_name +
dirname_length(mi->rli.relay_log_name)); dirname_length(mi->rli.relay_log_name), system_charset_info);
protocol->store((ulonglong) mi->rli.relay_log_pos); protocol->store((ulonglong) mi->rli.relay_log_pos);
protocol->store(mi->rli.master_log_name); protocol->store(mi->rli.master_log_name, system_charset_info);
protocol->store(mi->slave_running ? "Yes":"No"); protocol->store(mi->slave_running ? "Yes":"No", system_charset_info);
protocol->store(mi->rli.slave_running ? "Yes":"No"); protocol->store(mi->rli.slave_running ? "Yes":"No", system_charset_info);
protocol->store(&replicate_do_db); protocol->store(&replicate_do_db);
protocol->store(&replicate_ignore_db); protocol->store(&replicate_ignore_db);
protocol->store((uint32) mi->rli.last_slave_errno); protocol->store((uint32) mi->rli.last_slave_errno);
protocol->store(mi->rli.last_slave_error); protocol->store(mi->rli.last_slave_error, system_charset_info);
protocol->store((uint32) mi->rli.slave_skip_counter); protocol->store((uint32) mi->rli.slave_skip_counter);
protocol->store((ulonglong) mi->rli.master_log_pos); protocol->store((ulonglong) mi->rli.master_log_pos);
protocol->store((ulonglong) mi->rli.log_space_total); protocol->store((ulonglong) mi->rli.log_space_total);
......
...@@ -2954,7 +2954,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) ...@@ -2954,7 +2954,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
} }
} }
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(global.ptr(),global.length()); protocol->store(global.ptr(),global.length(),global.charset());
if (protocol->write()) if (protocol->write())
{ {
error=-1; error=-1;
...@@ -3012,7 +3012,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) ...@@ -3012,7 +3012,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
if (want_access & GRANT_ACL) if (want_access & GRANT_ACL)
db.append(" WITH GRANT OPTION",18); db.append(" WITH GRANT OPTION",18);
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(db.ptr(),db.length()); protocol->store(db.ptr(),db.length(),db.charset());
if (protocol->write()) if (protocol->write())
{ {
error=-1; error=-1;
...@@ -3100,7 +3100,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) ...@@ -3100,7 +3100,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
if (want_access & GRANT_ACL) if (want_access & GRANT_ACL)
global.append(" WITH GRANT OPTION",18); global.append(" WITH GRANT OPTION",18);
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(global.ptr(),global.length()); protocol->store(global.ptr(),global.length(),global.charset());
if (protocol->write()) if (protocol->write())
{ {
error= -1; error= -1;
......
...@@ -671,7 +671,7 @@ int mysqld_show_create_db(THD *thd, char *dbname, ...@@ -671,7 +671,7 @@ int mysqld_show_create_db(THD *thd, char *dbname,
DBUG_RETURN(1); DBUG_RETURN(1);
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(dbname, strlen(dbname)); protocol->store(dbname, strlen(dbname), system_charset_info);
to= strxmov(path, "CREATE DATABASE ", NullS); to= strxmov(path, "CREATE DATABASE ", NullS);
if (create_options & HA_LEX_CREATE_IF_NOT_EXISTS) if (create_options & HA_LEX_CREATE_IF_NOT_EXISTS)
to= strxmov(to,"/*!32312 IF NOT EXISTS*/ ", NullS); to= strxmov(to,"/*!32312 IF NOT EXISTS*/ ", NullS);
...@@ -685,7 +685,7 @@ int mysqld_show_create_db(THD *thd, char *dbname, ...@@ -685,7 +685,7 @@ int mysqld_show_create_db(THD *thd, char *dbname,
cl ? " COLLATE " : "", cl ? create.table_charset->name : "", cl ? " COLLATE " : "", cl ? create.table_charset->name : "",
" */",NullS); " */",NullS);
} }
protocol->store(path, (uint) (to-path)); protocol->store(path, (uint) (to-path), system_charset_info);
if (protocol->write()) if (protocol->write())
DBUG_RETURN(1); DBUG_RETURN(1);
......
...@@ -180,9 +180,9 @@ my_bool mysqld_show_warnings(THD *thd, ulong levels_to_show) ...@@ -180,9 +180,9 @@ my_bool mysqld_show_warnings(THD *thd, ulong levels_to_show)
} }
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(warning_level_names[err->level], protocol->store(warning_level_names[err->level],
warning_level_length[err->level]); warning_level_length[err->level], system_charset_info);
protocol->store((uint32) err->code); protocol->store((uint32) err->code);
protocol->store(err->msg, strlen(err->msg)); protocol->store(err->msg, strlen(err->msg), system_charset_info);
if (protocol->write()) if (protocol->write())
DBUG_RETURN(1); DBUG_RETURN(1);
if (!--limit) if (!--limit)
......
...@@ -201,8 +201,8 @@ int send_variant_2_list(Protocol *protocol, List<char> *names, ...@@ -201,8 +201,8 @@ int send_variant_2_list(Protocol *protocol, List<char> *names,
while ((cur_name= it++)) while ((cur_name= it++))
{ {
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(cur_name); protocol->store(cur_name, system_charset_info);
protocol->store(cat); protocol->store(cat, system_charset_info);
if (protocol->write()) if (protocol->write())
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
...@@ -317,10 +317,10 @@ int send_answer_1(Protocol *protocol, const char *s1, const char *s2, ...@@ -317,10 +317,10 @@ int send_answer_1(Protocol *protocol, const char *s1, const char *s2,
DBUG_RETURN(1); DBUG_RETURN(1);
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(s1); protocol->store(s1, system_charset_info);
protocol->store(s2); protocol->store(s2, system_charset_info);
protocol->store(s3); protocol->store(s3, system_charset_info);
protocol->store(s4); protocol->store(s4, system_charset_info);
if (protocol->write()) if (protocol->write())
DBUG_RETURN(-1); DBUG_RETURN(-1);
DBUG_RETURN(0); DBUG_RETURN(0);
......
...@@ -1109,7 +1109,7 @@ int show_binlog_info(THD* thd) ...@@ -1109,7 +1109,7 @@ int show_binlog_info(THD* thd)
LOG_INFO li; LOG_INFO li;
mysql_bin_log.get_current_log(&li); mysql_bin_log.get_current_log(&li);
int dir_len = dirname_length(li.log_file_name); int dir_len = dirname_length(li.log_file_name);
protocol->store(li.log_file_name + dir_len); protocol->store(li.log_file_name + dir_len, system_charset_info);
protocol->store((ulonglong) li.pos); protocol->store((ulonglong) li.pos);
protocol->store(&binlog_do_db); protocol->store(&binlog_do_db);
protocol->store(&binlog_ignore_db); protocol->store(&binlog_ignore_db);
...@@ -1166,7 +1166,7 @@ int show_binlogs(THD* thd) ...@@ -1166,7 +1166,7 @@ int show_binlogs(THD* thd)
protocol->prepare_for_resend(); protocol->prepare_for_resend();
int dir_len = dirname_length(fname); int dir_len = dirname_length(fname);
/* The -1 is for removing newline from fname */ /* The -1 is for removing newline from fname */
protocol->store(fname + dir_len, length-1-dir_len); protocol->store(fname + dir_len, length-1-dir_len, system_charset_info);
if (protocol->write()) if (protocol->write())
goto err; goto err;
} }
......
...@@ -6725,8 +6725,7 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table, ...@@ -6725,8 +6725,7 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table,
NullS)) NullS))
DBUG_RETURN(1); DBUG_RETURN(1);
// BAR TODO: this must be fixed to use charset from "table" argument if (hash_init(&hash, &my_charset_bin, (uint) file->records, 0,
if (hash_init(&hash, default_charset_info, (uint) file->records, 0,
key_length,(hash_get_key) 0, 0, 0)) key_length,(hash_get_key) 0, 0, 0))
{ {
my_free((char*) key_buffer,MYF(0)); my_free((char*) key_buffer,MYF(0));
...@@ -7703,7 +7702,7 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array, ...@@ -7703,7 +7702,7 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
if (_db_on_ && !item_field->name) if (_db_on_ && !item_field->name)
{ {
char buff[256]; char buff[256];
String str(buff,sizeof(buff),default_charset_info); String str(buff,sizeof(buff),&my_charset_bin);
str.length(0); str.length(0);
item->print(&str); item->print(&str);
item_field->name= sql_strmake(str.ptr(),str.length()); item_field->name= sql_strmake(str.ptr(),str.length());
......
This diff is collapsed.
...@@ -232,6 +232,10 @@ bool String::copy(const char *str,uint32 arg_length, CHARSET_INFO *cs) ...@@ -232,6 +232,10 @@ bool String::copy(const char *str,uint32 arg_length, CHARSET_INFO *cs)
bool String::copy(const char *str, uint32 arg_length, bool String::copy(const char *str, uint32 arg_length,
CHARSET_INFO *from_cs, CHARSET_INFO *to_cs) CHARSET_INFO *from_cs, CHARSET_INFO *to_cs)
{ {
if ((from_cs == &my_charset_bin) || (to_cs == &my_charset_bin))
{
return copy(str, arg_length, &my_charset_bin);
}
uint32 new_length= to_cs->mbmaxlen*arg_length; uint32 new_length= to_cs->mbmaxlen*arg_length;
if (alloc(new_length)) if (alloc(new_length))
return TRUE; return TRUE;
......
...@@ -1110,10 +1110,10 @@ static int send_check_errmsg(THD *thd, TABLE_LIST* table, ...@@ -1110,10 +1110,10 @@ static int send_check_errmsg(THD *thd, TABLE_LIST* table,
{ {
Protocol *protocol= thd->protocol; Protocol *protocol= thd->protocol;
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(table->alias); protocol->store(table->alias, system_charset_info);
protocol->store((char*) operator_name); protocol->store((char*) operator_name, system_charset_info);
protocol->store("error", 5); protocol->store("error", 5, system_charset_info);
protocol->store(errmsg); protocol->store(errmsg, system_charset_info);
thd->net.last_error[0]=0; thd->net.last_error[0]=0;
if (protocol->write()) if (protocol->write())
return -1; return -1;
...@@ -1303,12 +1303,12 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables, ...@@ -1303,12 +1303,12 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
{ {
const char *err_msg; const char *err_msg;
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(table_name); protocol->store(table_name, system_charset_info);
protocol->store(operator_name); protocol->store(operator_name, system_charset_info);
protocol->store("error",5); protocol->store("error",5, system_charset_info);
if (!(err_msg=thd->net.last_error)) if (!(err_msg=thd->net.last_error))
err_msg=ER(ER_CHECK_NO_SUCH_TABLE); err_msg=ER(ER_CHECK_NO_SUCH_TABLE);
protocol->store(err_msg); protocol->store(err_msg, system_charset_info);
thd->net.last_error[0]=0; thd->net.last_error[0]=0;
if (protocol->write()) if (protocol->write())
goto err; goto err;
...@@ -1318,11 +1318,11 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables, ...@@ -1318,11 +1318,11 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
{ {
char buff[FN_REFLEN + MYSQL_ERRMSG_SIZE]; char buff[FN_REFLEN + MYSQL_ERRMSG_SIZE];
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(table_name); protocol->store(table_name, system_charset_info);
protocol->store(operator_name); protocol->store(operator_name, system_charset_info);
protocol->store("error", 5); protocol->store("error", 5, system_charset_info);
sprintf(buff, ER(ER_OPEN_AS_READONLY), table_name); sprintf(buff, ER(ER_OPEN_AS_READONLY), table_name);
protocol->store(buff); protocol->store(buff, system_charset_info);
close_thread_tables(thd); close_thread_tables(thd);
table->table=0; // For query cache table->table=0; // For query cache
if (protocol->write()) if (protocol->write())
...@@ -1357,8 +1357,8 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables, ...@@ -1357,8 +1357,8 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
thd->net.last_errno= 0; // these errors shouldn't get client thd->net.last_errno= 0; // these errors shouldn't get client
#endif #endif
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(table_name); protocol->store(table_name, system_charset_info);
protocol->store(operator_name); protocol->store(operator_name, system_charset_info);
switch (result_code) { switch (result_code) {
case HA_ADMIN_NOT_IMPLEMENTED: case HA_ADMIN_NOT_IMPLEMENTED:
...@@ -1366,40 +1366,41 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables, ...@@ -1366,40 +1366,41 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
char buf[ERRMSGSIZE+20]; char buf[ERRMSGSIZE+20];
uint length=my_snprintf(buf, ERRMSGSIZE, uint length=my_snprintf(buf, ERRMSGSIZE,
ER(ER_CHECK_NOT_IMPLEMENTED), operator_name); ER(ER_CHECK_NOT_IMPLEMENTED), operator_name);
protocol->store("error", 5); protocol->store("error", 5, system_charset_info);
protocol->store(buf, length); protocol->store(buf, length, system_charset_info);
} }
break; break;
case HA_ADMIN_OK: case HA_ADMIN_OK:
protocol->store("status", 6); protocol->store("status", 6, system_charset_info);
protocol->store("OK",2); protocol->store("OK",2, system_charset_info);
break; break;
case HA_ADMIN_FAILED: case HA_ADMIN_FAILED:
protocol->store("status", 6); protocol->store("status", 6, system_charset_info);
protocol->store("Operation failed",16); protocol->store("Operation failed",16, system_charset_info);
break; break;
case HA_ADMIN_ALREADY_DONE: case HA_ADMIN_ALREADY_DONE:
protocol->store("status", 6); protocol->store("status", 6, system_charset_info);
protocol->store("Table is already up to date", 27); protocol->store("Table is already up to date", 27, system_charset_info);
break; break;
case HA_ADMIN_CORRUPT: case HA_ADMIN_CORRUPT:
protocol->store("error", 5); protocol->store("error", 5, system_charset_info);
protocol->store("Corrupt", 8); protocol->store("Corrupt", 8, system_charset_info);
fatal_error=1; fatal_error=1;
break; break;
case HA_ADMIN_INVALID: case HA_ADMIN_INVALID:
protocol->store("error", 5); protocol->store("error", 5, system_charset_info);
protocol->store("Invalid argument",16); protocol->store("Invalid argument",16, system_charset_info);
break; break;
default: // Probably HA_ADMIN_INTERNAL_ERROR default: // Probably HA_ADMIN_INTERNAL_ERROR
protocol->store("error", 5); protocol->store("error", 5, system_charset_info);
protocol->store("Unknown - internal error during operation", 41); protocol->store("Unknown - internal error during operation", 41
, system_charset_info);
fatal_error=1; fatal_error=1;
break; break;
} }
......
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