Commit 1a2c7da8 authored by bar@bar.mysql.r18.ru's avatar bar@bar.mysql.r18.ru

sql_analyse.cc, spatial.cc:

  Some default_charset_info were removed
sql_select.cc:
  Some default_charset_info were removed.
parent d134e6f2
...@@ -66,8 +66,7 @@ Geometry::GClassInfo *Geometry::find_class(const char *name, size_t len) ...@@ -66,8 +66,7 @@ Geometry::GClassInfo *Geometry::find_class(const char *name, size_t len)
cur_rt < ci_collection_end; ++cur_rt) cur_rt < ci_collection_end; ++cur_rt)
{ {
if ((cur_rt->m_name[len] == 0) && if ((cur_rt->m_name[len] == 0) &&
(default_charset_info->strncasecmp(default_charset_info, (my_strncasecmp(&my_charset_latin1, cur_rt->m_name, name, len) == 0))
cur_rt->m_name, name, len) == 0))
{ {
return cur_rt; return cur_rt;
} }
......
...@@ -278,7 +278,7 @@ void free_string(String *s) ...@@ -278,7 +278,7 @@ void free_string(String *s)
void field_str::add() void field_str::add()
{ {
char buff[MAX_FIELD_WIDTH], *ptr; char buff[MAX_FIELD_WIDTH], *ptr;
String s(buff, sizeof(buff),default_charset_info), *res; String s(buff, sizeof(buff),&my_charset_bin), *res;
ulong length; ulong length;
if (!(res = item->val_str(&s))) if (!(res = item->val_str(&s)))
...@@ -581,9 +581,9 @@ bool analyse::end_of_records() ...@@ -581,9 +581,9 @@ bool analyse::end_of_records()
{ {
field_info **f = f_info; field_info **f = f_info;
char buff[MAX_FIELD_WIDTH]; char buff[MAX_FIELD_WIDTH];
String *res, s_min(buff, sizeof(buff),default_charset_info), String *res, s_min(buff, sizeof(buff),&my_charset_bin),
s_max(buff, sizeof(buff),default_charset_info), s_max(buff, sizeof(buff),&my_charset_bin),
ans(buff, sizeof(buff),default_charset_info); ans(buff, sizeof(buff),&my_charset_bin);
for (; f != f_end; f++) for (; f != f_end; f++)
{ {
...@@ -629,14 +629,14 @@ bool analyse::end_of_records() ...@@ -629,14 +629,14 @@ bool analyse::end_of_records()
((*f)->tree.elements_in_tree * 3 - 1 + 6)))) ((*f)->tree.elements_in_tree * 3 - 1 + 6))))
{ {
char tmp[331]; //331, because one double prec. num. can be this long char tmp[331]; //331, because one double prec. num. can be this long
String tmp_str(tmp, sizeof(tmp),default_charset_info); String tmp_str(tmp, sizeof(tmp),&my_charset_bin);
TREE_INFO tree_info; TREE_INFO tree_info;
tree_info.str = &tmp_str; tree_info.str = &tmp_str;
tree_info.found = 0; tree_info.found = 0;
tree_info.item = (*f)->item; tree_info.item = (*f)->item;
tmp_str.set("ENUM(", 5,default_charset_info); tmp_str.set("ENUM(", 5,&my_charset_bin);
tree_walk(&(*f)->tree, (*f)->collect_enum(), (char*) &tree_info, tree_walk(&(*f)->tree, (*f)->collect_enum(), (char*) &tree_info,
left_root_right); left_root_right);
tmp_str.append(')'); tmp_str.append(')');
...@@ -919,14 +919,14 @@ int collect_longlong(longlong *element, ...@@ -919,14 +919,14 @@ int collect_longlong(longlong *element,
TREE_INFO *info) TREE_INFO *info)
{ {
char buff[MAX_FIELD_WIDTH]; char buff[MAX_FIELD_WIDTH];
String s(buff, sizeof(buff),default_charset_info); String s(buff, sizeof(buff),&my_charset_bin);
if (info->found) if (info->found)
info->str->append(','); info->str->append(',');
else else
info->found = 1; info->found = 1;
info->str->append('\''); info->str->append('\'');
s.set(*element,default_charset_info); s.set(*element, current_thd->variables.thd_charset);
info->str->append(s); info->str->append(s);
info->str->append('\''); info->str->append('\'');
return 0; return 0;
...@@ -938,14 +938,14 @@ int collect_ulonglong(ulonglong *element, ...@@ -938,14 +938,14 @@ int collect_ulonglong(ulonglong *element,
TREE_INFO *info) TREE_INFO *info)
{ {
char buff[MAX_FIELD_WIDTH]; char buff[MAX_FIELD_WIDTH];
String s(buff, sizeof(buff),default_charset_info); String s(buff, sizeof(buff),&my_charset_bin);
if (info->found) if (info->found)
info->str->append(','); info->str->append(',');
else else
info->found = 1; info->found = 1;
info->str->append('\''); info->str->append('\'');
s.set(*element,default_charset_info); s.set(*element, current_thd->variables.thd_charset);
info->str->append(s); info->str->append(s);
info->str->append('\''); info->str->append('\'');
return 0; return 0;
......
...@@ -7874,6 +7874,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, ...@@ -7874,6 +7874,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
SELECT_LEX *select_lex = &(join->thd->lex.select_lex); SELECT_LEX *select_lex = &(join->thd->lex.select_lex);
select_result *result=join->result; select_result *result=join->result;
Item *item_null= new Item_null(); Item *item_null= new Item_null();
CHARSET_INFO *cs= &my_charset_latin1;
DBUG_ENTER("select_describe"); DBUG_ENTER("select_describe");
DBUG_PRINT("info", ("Select 0x%lx, type %s, message %s", DBUG_PRINT("info", ("Select 0x%lx, type %s, message %s",
(ulong)join->select_lex, join->select_lex->type, (ulong)join->select_lex, join->select_lex->type,
...@@ -7886,12 +7887,10 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, ...@@ -7886,12 +7887,10 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
{ {
item_list.push_back(new Item_int((int32) join->select_lex->select_number)); item_list.push_back(new Item_int((int32) join->select_lex->select_number));
item_list.push_back(new Item_string(join->select_lex->type, item_list.push_back(new Item_string(join->select_lex->type,
strlen(join->select_lex->type), strlen(join->select_lex->type), cs));
default_charset_info));
for (uint i=0 ; i < 7; i++) for (uint i=0 ; i < 7; i++)
item_list.push_back(item_null); item_list.push_back(item_null);
item_list.push_back(new Item_string(message,strlen(message), item_list.push_back(new Item_string(message,strlen(message),cs));
default_charset_info));
if (result->send_data(item_list)) if (result->send_data(item_list))
join->error= 1; join->error= 1;
} }
...@@ -7904,8 +7903,8 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, ...@@ -7904,8 +7903,8 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
TABLE *table=tab->table; TABLE *table=tab->table;
char buff[512],*buff_ptr=buff; char buff[512],*buff_ptr=buff;
char buff1[512], buff2[512]; char buff1[512], buff2[512];
String tmp1(buff1,sizeof(buff1),default_charset_info); String tmp1(buff1,sizeof(buff1),cs);
String tmp2(buff2,sizeof(buff2),default_charset_info); String tmp2(buff2,sizeof(buff2),cs);
tmp1.length(0); tmp1.length(0);
tmp2.length(0); tmp2.length(0);
...@@ -7914,7 +7913,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, ...@@ -7914,7 +7913,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
join->select_lex->select_number)); join->select_lex->select_number));
item_list.push_back(new Item_string(join->select_lex->type, item_list.push_back(new Item_string(join->select_lex->type,
strlen(join->select_lex->type), strlen(join->select_lex->type),
default_charset_info)); cs));
if (tab->type == JT_ALL && tab->select && tab->select->quick) if (tab->type == JT_ALL && tab->select && tab->select->quick)
tab->type= JT_RANGE; tab->type= JT_RANGE;
if (table->tmp_table == TMP_TABLE && table->derived_select_number != 0) if (table->tmp_table == TMP_TABLE && table->derived_select_number != 0)
...@@ -7923,15 +7922,15 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, ...@@ -7923,15 +7922,15 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
char buff[512]; char buff[512];
int len= my_snprintf(buff, 512, "<derived%u>", int len= my_snprintf(buff, 512, "<derived%u>",
table->derived_select_number); table->derived_select_number);
item_list.push_back(new Item_string(buff, len, default_charset_info)); item_list.push_back(new Item_string(buff, len, cs));
} }
else else
item_list.push_back(new Item_string(table->table_name, item_list.push_back(new Item_string(table->table_name,
strlen(table->table_name), strlen(table->table_name),
default_charset_info)); cs));
item_list.push_back(new Item_string(join_type_str[tab->type], item_list.push_back(new Item_string(join_type_str[tab->type],
strlen(join_type_str[tab->type]), strlen(join_type_str[tab->type]),
default_charset_info)); cs));
key_map bits; key_map bits;
uint j; uint j;
for (j=0,bits=tab->keys ; bits ; j++,bits>>=1) for (j=0,bits=tab->keys ; bits ; j++,bits>>=1)
...@@ -7944,8 +7943,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, ...@@ -7944,8 +7943,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
} }
} }
if (tmp1.length()) if (tmp1.length())
item_list.push_back(new Item_string(tmp1.ptr(),tmp1.length(), item_list.push_back(new Item_string(tmp1.ptr(),tmp1.length(),cs));
default_charset_info));
else else
item_list.push_back(item_null); item_list.push_back(item_null);
if (tab->ref.key_parts) if (tab->ref.key_parts)
...@@ -7961,15 +7959,13 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, ...@@ -7961,15 +7959,13 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
tmp2.append(','); tmp2.append(',');
tmp2.append((*ref)->name()); tmp2.append((*ref)->name());
} }
item_list.push_back(new Item_string(tmp2.ptr(),tmp2.length(), item_list.push_back(new Item_string(tmp2.ptr(),tmp2.length(),cs));
default_charset_info));
} }
else if (tab->type == JT_NEXT) else if (tab->type == JT_NEXT)
{ {
KEY *key_info=table->key_info+ tab->index; KEY *key_info=table->key_info+ tab->index;
item_list.push_back(new Item_string(key_info->name, item_list.push_back(new Item_string(key_info->name,
strlen(key_info->name), strlen(key_info->name),cs));
default_charset_info));
item_list.push_back(new Item_int((int32) key_info->key_length)); item_list.push_back(new Item_int((int32) key_info->key_length));
item_list.push_back(item_null); item_list.push_back(item_null);
} }
...@@ -7977,8 +7973,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, ...@@ -7977,8 +7973,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
{ {
KEY *key_info=table->key_info+ tab->select->quick->index; KEY *key_info=table->key_info+ tab->select->quick->index;
item_list.push_back(new Item_string(key_info->name, item_list.push_back(new Item_string(key_info->name,
strlen(key_info->name), strlen(key_info->name),cs));
default_charset_info));
item_list.push_back(new Item_int((int32) tab->select->quick-> item_list.push_back(new Item_int((int32) tab->select->quick->
max_used_key_length)); max_used_key_length));
item_list.push_back(item_null); item_list.push_back(item_null);
...@@ -7998,8 +7993,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, ...@@ -7998,8 +7993,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
key_read=1; key_read=1;
if (tab->info) if (tab->info)
item_list.push_back(new Item_string(tab->info,strlen(tab->info), item_list.push_back(new Item_string(tab->info,strlen(tab->info),cs));
default_charset_info));
else else
{ {
if (tab->select) if (tab->select)
...@@ -8032,7 +8026,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, ...@@ -8032,7 +8026,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
if (buff_ptr == buff) if (buff_ptr == buff)
buff_ptr+= 2; // Skip inital "; " buff_ptr+= 2; // Skip inital "; "
item_list.push_back(new Item_string(buff+2,(uint) (buff_ptr - buff)-2, item_list.push_back(new Item_string(buff+2,(uint) (buff_ptr - buff)-2,
default_charset_info)); cs));
} }
// For next iteration // For next iteration
used_tables|=table->map; used_tables|=table->map;
......
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