New CHARSET() function
This commit is contained in:
parent
2583ecd642
commit
f7322a3cbd
@ -1911,12 +1911,25 @@ outp:
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String *Item_func_charset::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));
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Item_func_conv_charset3::fix_length_and_dec()
|
void Item_func_conv_charset3::fix_length_and_dec()
|
||||||
{
|
{
|
||||||
/* BAR TODO: What to do here??? */
|
/* BAR TODO: What to do here??? */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String *Item_func_hex::val_str(String *str)
|
String *Item_func_hex::val_str(String *str)
|
||||||
{
|
{
|
||||||
if (args[0]->result_type() != STRING_RESULT)
|
if (args[0]->result_type() != STRING_RESULT)
|
||||||
|
@ -503,6 +503,18 @@ public:
|
|||||||
const char *func_name() const { return "conv_charset3"; }
|
const char *func_name() const { return "conv_charset3"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class Item_func_charset :public Item_str_func
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Item_func_charset(Item *a) :Item_str_func(a) {}
|
||||||
|
String *val_str(String *);
|
||||||
|
const char *func_name() const { return "charset"; }
|
||||||
|
void fix_length_and_dec()
|
||||||
|
{
|
||||||
|
max_length=20; // should be enough
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************
|
/*******************************************************
|
||||||
Spatial functions
|
Spatial functions
|
||||||
|
@ -1784,6 +1784,8 @@ simple_expr:
|
|||||||
{ $$= new Item_func_atan($3,$5); }
|
{ $$= new Item_func_atan($3,$5); }
|
||||||
| CHAR_SYM '(' expr_list ')'
|
| CHAR_SYM '(' expr_list ')'
|
||||||
{ $$= new Item_func_char(*$3); }
|
{ $$= new Item_func_char(*$3); }
|
||||||
|
| CHARSET '(' expr ')'
|
||||||
|
{ $$= new Item_func_charset($3); }
|
||||||
| COALESCE '(' expr_list ')'
|
| COALESCE '(' expr_list ')'
|
||||||
{ $$= new Item_func_coalesce(* $3); }
|
{ $$= new Item_func_coalesce(* $3); }
|
||||||
| CONCAT '(' expr_list ')'
|
| CONCAT '(' expr_list ')'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user