diff options
author | unknown <bar@bar.mysql.r18.ru> | 2003-02-27 16:53:10 +0400 |
---|---|---|
committer | unknown <bar@bar.mysql.r18.ru> | 2003-02-27 16:53:10 +0400 |
commit | f047e28068c0c6a683ef2f29bfbb8021aa3bf991 (patch) | |
tree | 782f22c6eb14b4ec5998b556819c9ec9aa047fd4 /sql | |
parent | 4d1cb030db40a8bda93ce1a3a1423c76754138d5 (diff) | |
download | mariadb-git-f047e28068c0c6a683ef2f29bfbb8021aa3bf991.tar.gz |
sql_yacc.yy, item_strfunc.cc:
Two separate functions charset() and collatio()
item_strfunc.h:
Two separate functions charset() and collation()
sql/item_strfunc.cc:
Two separate functions charset() and collatio()
sql/item_strfunc.h:
Two separate functions charset() and collation()
sql/sql_yacc.yy:
Two separate functions charset() and collatio()
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_strfunc.cc | 11 | ||||
-rw-r--r-- | sql/item_strfunc.h | 13 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 2 |
3 files changed, 26 insertions, 0 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index bb844feffb5..8d9b3f5daed 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2230,6 +2230,17 @@ 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, thd_charset()); + return str; +} + +String *Item_func_collation::val_str(String *str) +{ + String *res = args[0]->val_str(str); + + if ((null_value=(args[0]->null_value || !res->charset()))) + return 0; str->copy(res->charset()->name,strlen(res->charset()->name), &my_charset_latin1, thd_charset()); return str; diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index b2e54474494..63b3bb20dc3 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -616,6 +616,19 @@ public: }; }; +class Item_func_collation :public Item_str_func +{ +public: + Item_func_collation(Item *a) :Item_str_func(a) {} + String *val_str(String *); + const char *func_name() const { return "collation"; } + void fix_length_and_dec() + { + max_length=40; // should be enough + set_charset(thd_charset()); + }; +}; + /******************************************************* Spatial functions diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index c74ca65709e..b970c1a64a0 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2156,6 +2156,8 @@ simple_expr: { $$= new Item_func_charset($3); } | COALESCE '(' expr_list ')' { $$= new Item_func_coalesce(* $3); } + | COLLATION_SYM '(' expr ')' + { $$= new Item_func_collation($3); } | CONCAT '(' expr_list ')' { $$= new Item_func_concat(* $3); } | CONCAT_WS '(' expr ',' expr_list ')' |