summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.h
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_strfunc.h')
-rw-r--r--sql/item_strfunc.h66
1 files changed, 20 insertions, 46 deletions
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 3648438a69b..81baf9a4c5f 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -144,8 +144,7 @@ class Item_str_conv :public Item_str_func
{
protected:
uint multiply;
- uint (*converter)(CHARSET_INFO *cs, char *src, uint srclen,
- char *dst, uint dstlen);
+ my_charset_conv_case converter;
String tmp_value;
public:
Item_str_conv(Item *item) :Item_str_func(item) {}
@@ -158,13 +157,7 @@ class Item_func_lcase :public Item_str_conv
public:
Item_func_lcase(Item *item) :Item_str_conv(item) {}
const char *func_name() const { return "lcase"; }
- void fix_length_and_dec()
- {
- collation.set(args[0]->collation);
- multiply= collation.collation->casedn_multiply;
- converter= collation.collation->cset->casedn;
- max_length= args[0]->max_length * multiply;
- }
+ void fix_length_and_dec();
};
class Item_func_ucase :public Item_str_conv
@@ -172,13 +165,7 @@ class Item_func_ucase :public Item_str_conv
public:
Item_func_ucase(Item *item) :Item_str_conv(item) {}
const char *func_name() const { return "ucase"; }
- void fix_length_and_dec()
- {
- collation.set(args[0]->collation);
- multiply= collation.collation->caseup_multiply;
- converter= collation.collation->cset->caseup;
- max_length= args[0]->max_length * multiply;
- }
+ void fix_length_and_dec();
};
@@ -238,7 +225,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "trim"; }
- void print(String *str);
+ virtual void print(String *str, enum_query_type query_type);
virtual const char *mode_name() const { return "both"; }
};
@@ -355,26 +342,19 @@ public:
class Item_func_encode :public Item_str_func
{
- protected:
- SQL_CRYPT sql_crypt;
- String seed;
public:
- Item_func_encode(Item *a, char *seed_arg):
- Item_str_func(a), sql_crypt(seed_arg)
- {
- seed.copy(seed_arg, strlen(seed_arg), default_charset_info);
- }
+ Item_func_encode(Item *a, Item *seed):
+ Item_str_func(a, seed) {}
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "encode"; }
- void print(String *str);
};
class Item_func_decode :public Item_func_encode
{
public:
- Item_func_decode(Item *a, char *seed_arg): Item_func_encode(a, seed_arg) {}
+ Item_func_decode(Item *a, Item *seed): Item_func_encode(a, seed) {}
String *val_str(String *);
const char *func_name() const { return "decode"; }
};
@@ -428,8 +408,8 @@ public:
bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec()
{
- max_length= ((USERNAME_LENGTH + HOSTNAME_LENGTH + 1) *
- system_charset_info->mbmaxlen);
+ max_length= (USERNAME_LENGTH +
+ (HOSTNAME_LENGTH + 1) * SYSTEM_CHARSET_MBMAXLEN);
}
const char *func_name() const { return "user"; }
const char *fully_qualified_func_name() const { return "user()"; }
@@ -496,13 +476,13 @@ public:
void update_used_tables();
const char *func_name() const { return "make_set"; }
- bool walk(Item_processor processor, byte *arg)
+ bool walk(Item_processor processor, bool walk_subquery, uchar *arg)
{
- return item->walk(processor, arg) ||
- Item_str_func::walk(processor, arg);
+ return item->walk(processor, walk_subquery, arg) ||
+ Item_str_func::walk(processor, walk_subquery, arg);
}
- Item *transform(Item_transformer transformer, byte *arg);
- void print(String *str);
+ Item *transform(Item_transformer transformer, uchar *arg);
+ virtual void print(String *str, enum_query_type query_type);
};
@@ -510,17 +490,11 @@ class Item_func_format :public Item_str_func
{
String tmp_str;
public:
- Item_func_format(Item *org,int dec);
+ Item_func_format(Item *org, Item *dec);
String *val_str(String *);
- void fix_length_and_dec()
- {
- collation.set(default_charset());
- uint char_length= args[0]->max_length/args[0]->collation.collation->mbmaxlen;
- max_length= ((char_length + (char_length-args[0]->decimals)/3) *
- collation.collation->mbmaxlen);
- }
+ void fix_length_and_dec();
const char *func_name() const { return "format"; }
- void print(String *);
+ virtual void print(String *str, enum_query_type query_type);
};
@@ -643,7 +617,7 @@ public:
collation.set(&my_charset_bin);
max_length=args[0]->max_length;
}
- void print(String *str);
+ virtual void print(String *str, enum_query_type query_type);
const char *func_name() const { return "cast_as_binary"; }
};
@@ -745,7 +719,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "convert"; }
- void print(String *str);
+ virtual void print(String *str, enum_query_type query_type);
};
class Item_func_set_collation :public Item_str_func
@@ -757,7 +731,7 @@ public:
bool eq(const Item *item, bool binary_cmp) const;
const char *func_name() const { return "collate"; }
enum Functype functype() const { return COLLATE_FUNC; }
- void print(String *str);
+ virtual void print(String *str, enum_query_type query_type);
Item_field *filed_for_view_update()
{
/* this function is transparent for view updating */