summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <bar@bar.intranet.mysql.r18.ru>2004-02-11 16:53:39 +0400
committerunknown <bar@bar.intranet.mysql.r18.ru>2004-02-11 16:53:39 +0400
commitb268952faf2a3a3eca9794018f1a368a5653aede (patch)
tree72c6cad0694d2bd8f6b418b228ce142641c812ac /sql
parent24e3862cb8752618a5c8d5a41eb739e698b727cb (diff)
downloadmariadb-git-b268952faf2a3a3eca9794018f1a368a5653aede.tar.gz
Bug 2701: Function CHARSET() inconsistency
CONVERT3 was removed, it was for test purposes, and rather harmful.
Diffstat (limited to 'sql')
-rw-r--r--sql/item_strfunc.cc40
-rw-r--r--sql/item_strfunc.h14
-rw-r--r--sql/sql_yacc.yy2
3 files changed, 4 insertions, 52 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index fd1222d5f1a..ed6e44262c7 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2124,42 +2124,6 @@ void Item_func_conv_charset::print(String *str)
str->append(')');
}
-String *Item_func_conv_charset3::val_str(String *str)
-{
- char cs1[30], cs2[30];
- String to_cs_buff(cs1, sizeof(cs1), default_charset_info);
- String from_cs_buff(cs2, sizeof(cs2), default_charset_info);
- String *arg= args[0]->val_str(str);
- String *to_cs= args[1]->val_str(&to_cs_buff);
- String *from_cs= args[2]->val_str(&from_cs_buff);
- CHARSET_INFO *from_charset;
- CHARSET_INFO *to_charset;
-
- if (!arg || args[0]->null_value ||
- !to_cs || args[1]->null_value ||
- !from_cs || args[2]->null_value ||
- !(from_charset=get_charset_by_name(from_cs->ptr(), MYF(MY_WME))) ||
- !(to_charset=get_charset_by_name(to_cs->ptr(), MYF(MY_WME))))
- {
- null_value= 1;
- return 0;
- }
-
- if (str_value.copy(arg->ptr(), arg->length(), from_charset, to_charset))
- {
- null_value= 1;
- return 0;
- }
- null_value= 0;
- return &str_value;
-}
-
-
-void Item_func_conv_charset3::fix_length_and_dec()
-{
- max_length = args[0]->max_length;
-}
-
String *Item_func_set_collation::val_str(String *str)
{
str=args[0]->val_str(str);
@@ -2226,7 +2190,7 @@ String *Item_func_charset::val_str(String *str)
if ((null_value=(args[0]->null_value || !res->charset())))
return 0;
str->copy(res->charset()->csname,strlen(res->charset()->csname),
- &my_charset_latin1, default_charset());
+ &my_charset_latin1, collation.collation);
return str;
}
@@ -2237,7 +2201,7 @@ String *Item_func_collation::val_str(String *str)
if ((null_value=(args[0]->null_value || !res->charset())))
return 0;
str->copy(res->charset()->name,strlen(res->charset()->name),
- &my_charset_latin1, default_charset());
+ &my_charset_latin1, collation.collation);
return str;
}
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 465300e721e..4832ddbd1b1 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -619,16 +619,6 @@ public:
void print(String *str) { print_op(str); }
};
-class Item_func_conv_charset3 :public Item_str_func
-{
-public:
- Item_func_conv_charset3(Item *arg1,Item *arg2,Item *arg3)
- :Item_str_func(arg1,arg2,arg3) {}
- String *val_str(String *);
- void fix_length_and_dec();
- const char *func_name() const { return "convert"; }
-};
-
class Item_func_charset :public Item_str_func
{
public:
@@ -637,8 +627,8 @@ public:
const char *func_name() const { return "charset"; }
void fix_length_and_dec()
{
- max_length=40; // should be enough
collation.set(system_charset_info);
+ max_length= 64 * collation.collation->mbmaxlen; // should be enough
};
};
@@ -650,8 +640,8 @@ public:
const char *func_name() const { return "collation"; }
void fix_length_and_dec()
{
- max_length=40; // should be enough
collation.set(system_charset_info);
+ max_length= 64 * collation.collation->mbmaxlen; // should be enough
};
};
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 0dbe8981466..bdeaf5a0b86 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -2574,8 +2574,6 @@ simple_expr:
}
| CONVERT_SYM '(' expr USING charset_name ')'
{ $$= new Item_func_conv_charset($3,$5); }
- | CONVERT_SYM '(' expr ',' expr ',' expr ')'
- { $$= new Item_func_conv_charset3($3,$7,$5); }
| DEFAULT '(' simple_ident ')'
{ $$= new Item_default_value($3); }
| VALUES '(' simple_ident ')'