MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
item_strfunc.h
1 #ifndef ITEM_STRFUNC_INCLUDED
2 #define ITEM_STRFUNC_INCLUDED
3 
4 /* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; version 2 of the License.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
18 
19 
20 /* This file defines all string functions */
21 #include "crypt_genhash_impl.h"
22 
23 class MY_LOCALE;
24 
25 class Item_str_func :public Item_func
26 {
27 protected:
34  str_value.set("", 0, collation.collation);
35  return &str_value;
36  }
37 public:
38  Item_str_func() :Item_func() { decimals=NOT_FIXED_DEC; }
39  Item_str_func(Item *a) :Item_func(a) {decimals=NOT_FIXED_DEC; }
40  Item_str_func(Item *a,Item *b) :Item_func(a,b) { decimals=NOT_FIXED_DEC; }
41  Item_str_func(Item *a,Item *b,Item *c) :Item_func(a,b,c) { decimals=NOT_FIXED_DEC; }
42  Item_str_func(Item *a,Item *b,Item *c,Item *d) :Item_func(a,b,c,d) {decimals=NOT_FIXED_DEC; }
43  Item_str_func(Item *a,Item *b,Item *c,Item *d, Item* e) :Item_func(a,b,c,d,e) {decimals=NOT_FIXED_DEC; }
44  Item_str_func(List<Item> &list) :Item_func(list) {decimals=NOT_FIXED_DEC; }
45  longlong val_int();
46  double val_real();
47  my_decimal *val_decimal(my_decimal *);
48  bool get_date(MYSQL_TIME *ltime, uint fuzzydate)
49  {
50  return get_date_from_string(ltime, fuzzydate);
51  }
52  bool get_time(MYSQL_TIME *ltime)
53  {
54  return get_time_from_string(ltime);
55  }
56  enum Item_result result_type () const { return STRING_RESULT; }
57  void left_right_max_length();
58  bool fix_fields(THD *thd, Item **ref);
59  String *val_str_from_val_str_ascii(String *str, String *str2);
60 };
61 
62 
63 
64 /*
65  Functions that return values with ASCII repertoire
66 */
68 {
69  String ascii_buf;
70 public:
72  { collation.set_repertoire(MY_REPERTOIRE_ASCII); }
74  { collation.set_repertoire(MY_REPERTOIRE_ASCII); }
76  { collation.set_repertoire(MY_REPERTOIRE_ASCII); }
78  { collation.set_repertoire(MY_REPERTOIRE_ASCII); }
79  String *val_str(String *str)
80  {
81  return val_str_from_val_str_ascii(str, &ascii_buf);
82  }
83  virtual String *val_str_ascii(String *)= 0;
84 };
85 
86 
88 {
89  String tmp_value;
90 public:
92  String *val_str_ascii(String *);
93  void fix_length_and_dec();
94  const char *func_name() const { return "md5"; }
95 };
96 
97 
99 {
100 public:
102  String *val_str_ascii(String *);
103  void fix_length_and_dec();
104  const char *func_name() const { return "sha"; }
105 };
106 
108 {
109 public:
110  Item_func_sha2(Item *a, Item *b) :Item_str_ascii_func(a, b) {}
111  String *val_str_ascii(String *);
112  void fix_length_and_dec();
113  const char *func_name() const { return "sha2"; }
114 };
115 
117 {
118  String tmp_value;
119 public:
121  String *val_str_ascii(String *);
122  void fix_length_and_dec();
123  const char *func_name() const { return "to_base64"; }
124 };
125 
127 {
128  String tmp_value;
129 public:
131  String *val_str(String *);
132  void fix_length_and_dec();
133  const char *func_name() const { return "from_base64"; }
134 };
135 
136 
138 {
139 public:
141  String *val_str(String *);
142  void fix_length_and_dec();
143  const char *func_name() const { return "aes_encrypt"; }
144 };
145 
147 {
148 public:
150  String *val_str(String *);
151  void fix_length_and_dec();
152  const char *func_name() const { return "aes_decrypt"; }
153 };
154 
155 
157 {
158  String tmp_value;
159 public:
160  Item_func_concat(List<Item> &list) :Item_str_func(list) {}
161  Item_func_concat(Item *a,Item *b) :Item_str_func(a,b) {}
162  String *val_str(String *);
163  void fix_length_and_dec();
164  const char *func_name() const { return "concat"; }
165 };
166 
168 {
169  String tmp_value;
170 public:
172  String *val_str(String *);
173  void fix_length_and_dec();
174  const char *func_name() const { return "concat_ws"; }
175  table_map not_null_tables() const { return 0; }
176 };
177 
179 {
180  String tmp_value;
181 public:
183  String *val_str(String *);
184  void fix_length_and_dec();
185  const char *func_name() const { return "reverse"; }
186 };
187 
188 
190 {
191  String tmp_value,tmp_value2;
192 public:
193  Item_func_replace(Item *org,Item *find,Item *replace)
194  :Item_str_func(org,find,replace) {}
195  String *val_str(String *);
196  void fix_length_and_dec();
197  const char *func_name() const { return "replace"; }
198 };
199 
200 
202 {
203  String tmp_value;
204 public:
205  Item_func_insert(Item *org,Item *start,Item *length,Item *new_str)
206  :Item_str_func(org,start,length,new_str) {}
207  String *val_str(String *);
208  void fix_length_and_dec();
209  const char *func_name() const { return "insert"; }
210 };
211 
212 
214 {
215 protected:
216  uint multiply;
217  my_charset_conv_case converter;
218  String tmp_value;
219 public:
220  Item_str_conv(Item *item) :Item_str_func(item) {}
221  String *val_str(String *);
222 };
223 
224 
226 {
227 public:
228  Item_func_lcase(Item *item) :Item_str_conv(item) {}
229  const char *func_name() const { return "lcase"; }
230  void fix_length_and_dec();
231 };
232 
234 {
235 public:
236  Item_func_ucase(Item *item) :Item_str_conv(item) {}
237  const char *func_name() const { return "ucase"; }
238  void fix_length_and_dec();
239 };
240 
241 
243 {
244  String tmp_value;
245 public:
246  Item_func_left(Item *a,Item *b) :Item_str_func(a,b) {}
247  String *val_str(String *);
248  void fix_length_and_dec();
249  const char *func_name() const { return "left"; }
250 };
251 
252 
254 {
255  String tmp_value;
256 public:
257  Item_func_right(Item *a,Item *b) :Item_str_func(a,b) {}
258  String *val_str(String *);
259  void fix_length_and_dec();
260  const char *func_name() const { return "right"; }
261 };
262 
263 
265 {
266  String tmp_value;
267 public:
268  Item_func_substr(Item *a,Item *b) :Item_str_func(a,b) {}
269  Item_func_substr(Item *a,Item *b,Item *c) :Item_str_func(a,b,c) {}
270  String *val_str(String *);
271  void fix_length_and_dec();
272  const char *func_name() const { return "substr"; }
273 };
274 
275 
277 {
278  String tmp_value;
279 public:
280  Item_func_substr_index(Item *a,Item *b,Item *c) :Item_str_func(a,b,c) {}
281  String *val_str(String *);
282  void fix_length_and_dec();
283  const char *func_name() const { return "substring_index"; }
284 };
285 
286 
288 {
289 protected:
290  String tmp_value;
291  String remove;
292 public:
293  Item_func_trim(Item *a,Item *b) :Item_str_func(a,b) {}
295  String *val_str(String *);
296  void fix_length_and_dec();
297  const char *func_name() const { return "trim"; }
298  virtual void print(String *str, enum_query_type query_type);
299  virtual const char *mode_name() const { return "both"; }
300 };
301 
302 
304 {
305 public:
306  Item_func_ltrim(Item *a,Item *b) :Item_func_trim(a,b) {}
308  String *val_str(String *);
309  const char *func_name() const { return "ltrim"; }
310  const char *mode_name() const { return "leading"; }
311 };
312 
313 
315 {
316 public:
317  Item_func_rtrim(Item *a,Item *b) :Item_func_trim(a,b) {}
319  String *val_str(String *);
320  const char *func_name() const { return "rtrim"; }
321  const char *mode_name() const { return "trailing"; }
322 };
323 
324 
325 /*
326  Item_func_password -- new (4.1.1) PASSWORD() function implementation.
327  Returns strcat('*', octet2hex(sha1(sha1(password)))). '*' stands for new
328  password format, sha1(sha1(password) is so-called hash_stage2 value.
329  Length of returned string is always 41 byte. To find out how entire
330  authentication procedure works, see comments in password.c.
331 */
332 
334 {
335  char m_hashed_password_buffer[CRYPT_MAX_PASSWORD_SIZE + 1];
336  unsigned int m_hashed_password_buffer_len;
337  bool m_recalculate_password;
338 public:
340  {
341  m_hashed_password_buffer_len= 0;
342  m_recalculate_password= false;
343  }
344  String *val_str_ascii(String *str);
345  void fix_length_and_dec();
346  const char *func_name() const { return "password"; }
347  static char *create_password_hash_buffer(THD *thd, const char *password,
348  size_t pass_len);
349 };
350 
351 
352 /*
353  Item_func_old_password -- PASSWORD() implementation used in MySQL 3.21 - 4.0
354  compatibility mode. This item is created in sql_yacc.yy when
355  'old_passwords' session variable is set, and to handle OLD_PASSWORD()
356  function.
357 */
358 
360 {
361  char tmp_value[SCRAMBLED_PASSWORD_CHAR_LENGTH_323+1];
362 public:
364  String *val_str_ascii(String *str);
365  void fix_length_and_dec()
366  {
367  fix_length_and_charset(SCRAMBLED_PASSWORD_CHAR_LENGTH_323, default_charset());
368  }
369  const char *func_name() const { return "old_password"; }
370  static char *alloc(THD *thd, const char *password, size_t pass_len);
371 };
372 
373 
375 {
376  String tmp_value,tmp_arg;
377 public:
380  String *val_str(String *);
381  void fix_length_and_dec()
382  {
383  maybe_null=1;
384  /* 9 = MAX ((8- (arg_len % 8)) + 1) */
385  max_length = args[0]->max_length + 9;
386  }
387  const char *func_name() const { return "des_encrypt"; }
388 };
389 
391 {
392  String tmp_value;
393 public:
396  String *val_str(String *);
397  void fix_length_and_dec()
398  {
399  maybe_null=1;
400  /* 9 = MAX ((8- (arg_len % 8)) + 1) */
401  max_length= args[0]->max_length;
402  if (max_length >= 9U)
403  max_length-= 9U;
404  }
405  const char *func_name() const { return "des_decrypt"; }
406 };
407 
409 {
410  String tmp_value;
411 
412  /* Encapsulate common constructor actions */
413  void constructor_helper()
414  {
415  collation.set(&my_charset_bin);
416  }
417 public:
419  {
420  constructor_helper();
421  }
423  {
424  constructor_helper();
425  }
426  String *val_str(String *);
427  void fix_length_and_dec() { maybe_null=1; max_length = 13; }
428  const char *func_name() const { return "encrypt"; }
429 };
430 
431 #include "sql_crypt.h"
432 
433 
435 {
436 private:
438  bool seeded;
439 protected:
440  SQL_CRYPT sql_crypt;
441 public:
442  Item_func_encode(Item *a, Item *seed):
443  Item_str_func(a, seed) {}
444  String *val_str(String *);
445  void fix_length_and_dec();
446  const char *func_name() const { return "encode"; }
447 protected:
448  virtual void crypto_transform(String *);
449 private:
451  bool seed();
452 };
453 
454 
456 {
457 public:
458  Item_func_decode(Item *a, Item *seed): Item_func_encode(a, seed) {}
459  const char *func_name() const { return "decode"; }
460 protected:
461  void crypto_transform(String *);
462 };
463 
464 
466 {
467 public:
469  { collation.set(system_charset_info,DERIVATION_SYSCONST); }
470  Item *safe_charset_converter(const CHARSET_INFO *tocs);
471  /*
472  Used to create correct Item name in new converted item in
473  safe_charset_converter, return string representation of this function
474  call
475  */
476  virtual const Name_string fully_qualified_func_name() const = 0;
477 };
478 
479 
481 {
482 public:
484  String *val_str(String *);
485  void fix_length_and_dec()
486  {
487  max_length= MAX_FIELD_NAME * system_charset_info->mbmaxlen;
488  maybe_null=1;
489  }
490  const char *func_name() const { return "database"; }
491  const Name_string fully_qualified_func_name() const
492  { return NAME_STRING("database()"); }
493 };
494 
495 
497 {
498 protected:
499  bool init (const char *user, const char *host);
500 
501 public:
503  {
504  str_value.set("", 0, system_charset_info);
505  }
506  String *val_str(String *)
507  {
508  DBUG_ASSERT(fixed == 1);
509  return (null_value ? 0 : &str_value);
510  }
511  bool fix_fields(THD *thd, Item **ref);
512  void fix_length_and_dec()
513  {
514  max_length= (USERNAME_LENGTH +
515  (HOSTNAME_LENGTH + 1) * SYSTEM_CHARSET_MBMAXLEN);
516  }
517  const char *func_name() const { return "user"; }
518  const Name_string fully_qualified_func_name() const
519  { return NAME_STRING("user()"); }
520  type_conversion_status save_in_field(Field *field, bool no_conversions)
521  {
522  return save_str_value_in_field(field, &str_value);
523  }
524 };
525 
526 
528 {
529  Name_resolution_context *context;
530 
531 public:
533  : context(context_arg) {}
534  bool fix_fields(THD *thd, Item **ref);
535  const char *func_name() const { return "current_user"; }
536  const Name_string fully_qualified_func_name() const
537  { return NAME_STRING("current_user()"); }
538 };
539 
540 
542 {
543  String tmp_value;
544 public:
546  String *val_str(String *);
547  void fix_length_and_dec();
548  const char *func_name() const { return "soundex"; }
549 };
550 
551 
553 {
554 public:
555  Item_func_elt(List<Item> &list) :Item_str_func(list) {}
556  double val_real();
557  longlong val_int();
558  String *val_str(String *str);
559  void fix_length_and_dec();
560  const char *func_name() const { return "elt"; }
561 };
562 
563 
565 {
566  Item *item;
567  String tmp_str;
568 
569 public:
570  Item_func_make_set(Item *a,List<Item> &list) :Item_str_func(list),item(a) {}
571  String *val_str(String *str);
572  bool fix_fields(THD *thd, Item **ref)
573  {
574  DBUG_ASSERT(fixed == 0);
575  bool res= ((!item->fixed && item->fix_fields(thd, &item)) ||
576  item->check_cols(1) ||
577  Item_func::fix_fields(thd, ref));
578  maybe_null|= item->maybe_null;
579  return res;
580  }
581  void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array,
582  List<Item> &fields);
583  void fix_length_and_dec();
584  void update_used_tables();
585  const char *func_name() const { return "make_set"; }
586 
587  bool walk(Item_processor processor, bool walk_subquery, uchar *arg)
588  {
589  return item->walk(processor, walk_subquery, arg) ||
590  Item_str_func::walk(processor, walk_subquery, arg);
591  }
592  Item *transform(Item_transformer transformer, uchar *arg);
593  virtual void print(String *str, enum_query_type query_type);
594 };
595 
596 
598 {
599  String tmp_str;
600  MY_LOCALE *locale;
601 public:
602  Item_func_format(Item *org, Item *dec): Item_str_ascii_func(org, dec) {}
603  Item_func_format(Item *org, Item *dec, Item *lang):
604  Item_str_ascii_func(org, dec, lang) {}
605 
606  MY_LOCALE *get_locale(Item *item);
608  void fix_length_and_dec();
609  const char *func_name() const { return "format"; }
610  virtual void print(String *str, enum_query_type query_type);
611 };
612 
613 
615 {
616 public:
618  { collation.set(&my_charset_bin); }
619  Item_func_char(List<Item> &list, const CHARSET_INFO *cs) :
620  Item_str_func(list)
621  { collation.set(cs); }
622  String *val_str(String *);
623  void fix_length_and_dec()
624  {
625  max_length= arg_count * 4;
626  }
627  const char *func_name() const { return "char"; }
628 };
629 
630 
632 {
633  String tmp_value;
634 public:
635  Item_func_repeat(Item *arg1,Item *arg2) :Item_str_func(arg1,arg2) {}
636  String *val_str(String *);
637  void fix_length_and_dec();
638  const char *func_name() const { return "repeat"; }
639 };
640 
641 
643 {
644 public:
645  Item_func_space(Item *arg1):Item_str_func(arg1) {}
646  String *val_str(String *);
647  void fix_length_and_dec();
648  const char *func_name() const { return "space"; }
649 };
650 
651 
653 {
654  String tmp_value, rpad_str;
655 public:
656  Item_func_rpad(Item *arg1,Item *arg2,Item *arg3)
657  :Item_str_func(arg1,arg2,arg3) {}
658  String *val_str(String *);
659  void fix_length_and_dec();
660  const char *func_name() const { return "rpad"; }
661 };
662 
663 
665 {
666  String tmp_value, lpad_str;
667 public:
668  Item_func_lpad(Item *arg1,Item *arg2,Item *arg3)
669  :Item_str_func(arg1,arg2,arg3) {}
670  String *val_str(String *);
671  void fix_length_and_dec();
672  const char *func_name() const { return "lpad"; }
673 };
674 
675 
677 {
678 public:
679  Item_func_conv(Item *a,Item *b,Item *c) :Item_str_func(a,b,c) {}
680  const char *func_name() const { return "conv"; }
681  String *val_str(String *);
682  void fix_length_and_dec()
683  {
684  collation.set(default_charset());
685  max_length=64;
686  maybe_null= 1;
687  }
688 };
689 
690 
692 {
693  String tmp_value;
694 public:
696  const char *func_name() const { return "hex"; }
697  String *val_str_ascii(String *);
698  void fix_length_and_dec()
699  {
700  collation.set(default_charset());
701  decimals=0;
702  fix_char_length(args[0]->max_length * 2);
703  }
704 };
705 
707 {
708  String tmp_value;
709 public:
711  {
712  /* there can be bad hex strings */
713  maybe_null= 1;
714  }
715  const char *func_name() const { return "unhex"; }
716  String *val_str(String *);
717  void fix_length_and_dec()
718  {
719  collation.set(&my_charset_bin);
720  decimals=0;
721  max_length=(1+args[0]->max_length)/2;
722  }
723 };
724 
725 
726 #ifndef DBUG_OFF
728 {
729 protected:
730  String min_str;
731  String max_str;
732  const bool is_min;
733 public:
734  Item_func_like_range(Item *a, Item *b, bool is_min_arg)
735  :Item_str_func(a, b), is_min(is_min_arg)
736  { maybe_null= 1; }
737  String *val_str(String *);
738  void fix_length_and_dec()
739  {
740  collation.set(args[0]->collation);
741  decimals=0;
742  max_length= MAX_BLOB_WIDTH;
743  }
744 };
745 
746 
748 {
749 public:
751  :Item_func_like_range(a, b, true) { }
752  const char *func_name() const { return "like_range_min"; }
753 };
754 
755 
757 {
758 public:
760  :Item_func_like_range(a, b, false) { }
761  const char *func_name() const { return "like_range_max"; }
762 };
763 #endif
764 
765 
767 {
768  int cast_length;
769  const CHARSET_INFO *cast_cs, *from_cs;
770  bool charset_conversion;
771  String tmp_value;
772 public:
773  Item_char_typecast(Item *a, int length_arg, const CHARSET_INFO *cs_arg)
774  :Item_str_func(a), cast_length(length_arg), cast_cs(cs_arg) {}
775  enum Functype functype() const { return CHAR_TYPECAST_FUNC; }
776  bool eq(const Item *item, bool binary_cmp) const;
777  const char *func_name() const { return "cast_as_char"; }
778  String *val_str(String *a);
779  void fix_length_and_dec();
780  virtual void print(String *str, enum_query_type query_type);
781 };
782 
783 
785 {
786 public:
788  String *val_str(String *a)
789  {
790  DBUG_ASSERT(fixed == 1);
791  String *tmp=args[0]->val_str(a);
792  null_value=args[0]->null_value;
793  if (tmp)
794  tmp->set_charset(&my_charset_bin);
795  return tmp;
796  }
797  void fix_length_and_dec()
798  {
799  collation.set(&my_charset_bin);
800  max_length=args[0]->max_length;
801  }
802  virtual void print(String *str, enum_query_type query_type);
803  const char *func_name() const { return "cast_as_binary"; }
804 };
805 
806 
808 {
809  String tmp_value;
810 public:
812  String *val_str(String *);
813  const char *func_name() const { return "load_file"; }
814  void fix_length_and_dec()
815  {
816  collation.set(&my_charset_bin, DERIVATION_COERCIBLE);
817  maybe_null=1;
818  max_length=MAX_BLOB_WIDTH;
819  }
820 };
821 
822 
824 {
825  public:
826  Item_func_export_set(Item *a,Item *b,Item* c) :Item_str_func(a,b,c) {}
827  Item_func_export_set(Item *a,Item *b,Item* c,Item* d) :Item_str_func(a,b,c,d) {}
828  Item_func_export_set(Item *a,Item *b,Item* c,Item* d,Item* e) :Item_str_func(a,b,c,d,e) {}
829  String *val_str(String *str);
830  void fix_length_and_dec();
831  const char *func_name() const { return "export_set"; }
832 };
833 
835 {
836  String tmp_value;
837 public:
839  const char *func_name() const { return "quote"; }
840  String *val_str(String *);
841  void fix_length_and_dec()
842  {
843  collation.set(args[0]->collation);
844  ulong max_result_length= (ulong) args[0]->max_length * 2 +
845  2 * collation.collation->mbmaxlen;
846  max_length= std::min<ulong>(max_result_length, MAX_BLOB_WIDTH);
847  }
848 };
849 
851 {
852  bool use_cached_value;
853  String tmp_value;
854 public:
855  bool safe;
856  const CHARSET_INFO *conv_charset; // keep it public
858  { conv_charset= cs; use_cached_value= 0; safe= 0; }
860  bool cache_if_const) :Item_str_func(a)
861  {
862  DBUG_ASSERT(args[0]->fixed);
863  conv_charset= cs;
864  if (cache_if_const && args[0]->const_item())
865  {
866  uint errors= 0;
867  String tmp, *str= args[0]->val_str(&tmp);
868  if (!str || str_value.copy(str->ptr(), str->length(),
869  str->charset(), conv_charset, &errors))
870  null_value= 1;
871  use_cached_value= 1;
872  str_value.mark_as_const();
873  safe= (errors == 0);
874  }
875  else
876  {
877  use_cached_value= 0;
878  /*
879  Conversion from and to "binary" is safe.
880  Conversion to Unicode is safe.
881  Other kind of conversions are potentially lossy.
882  */
883  safe= (args[0]->collation.collation == &my_charset_bin ||
884  cs == &my_charset_bin ||
885  (cs->state & MY_CS_UNICODE));
886  }
887  }
888  String *val_str(String *);
889  void fix_length_and_dec();
890  const char *func_name() const { return "convert"; }
891  virtual void print(String *str, enum_query_type query_type);
892 };
893 
895 {
896 public:
898  String *val_str(String *);
899  void fix_length_and_dec();
900  bool eq(const Item *item, bool binary_cmp) const;
901  const char *func_name() const { return "collate"; }
902  enum Functype functype() const { return COLLATE_FUNC; }
903  virtual void print(String *str, enum_query_type query_type);
904  Item_field *field_for_view_update()
905  {
906  /* this function is transparent for view updating */
907  return args[0]->field_for_view_update();
908  }
909 };
910 
912 {
913 public:
915  String *val_str(String *);
916  const char *func_name() const { return "charset"; }
917  void fix_length_and_dec()
918  {
919  collation.set(system_charset_info);
920  max_length= 64 * collation.collation->mbmaxlen; // should be enough
921  maybe_null= 0;
922  };
923  table_map not_null_tables() const { return 0; }
924 };
925 
927 {
928 public:
930  String *val_str(String *);
931  const char *func_name() const { return "collation"; }
932  void fix_length_and_dec()
933  {
934  collation.set(system_charset_info);
935  max_length= 64 * collation.collation->mbmaxlen; // should be enough
936  maybe_null= 0;
937  };
938  table_map not_null_tables() const { return 0; }
939 };
940 
942 {
943  String tmp_value;
944  uint flags;
945  uint nweights;
946  uint result_length;
947  Field *field;
948 public:
949  Item_func_weight_string(Item *a, uint result_length_arg,
950  uint nweights_arg, uint flags_arg)
951  :Item_str_func(a), field(NULL)
952  {
953  nweights= nweights_arg;
954  flags= flags_arg;
955  result_length= result_length_arg;
956  }
957  const char *func_name() const { return "weight_string"; }
958  String *val_str(String *);
959  void fix_length_and_dec();
960 };
961 
963 {
964  String value;
965 public:
966  Item_func_crc32(Item *a) :Item_int_func(a) { unsigned_flag= 1; }
967  const char *func_name() const { return "crc32"; }
968  void fix_length_and_dec() { max_length=10; }
969  longlong val_int();
970 };
971 
973 {
974  String value;
975 public:
977  const char *func_name() const{return "uncompressed_length";}
978  void fix_length_and_dec() { max_length=10; }
979  longlong val_int();
980 };
981 
982 #ifdef HAVE_COMPRESS
983 #define ZLIB_DEPENDED_FUNCTION ;
984 #else
985 #define ZLIB_DEPENDED_FUNCTION { null_value=1; return 0; }
986 #endif
987 
989 {
990  String buffer;
991 public:
993  void fix_length_and_dec(){max_length= (args[0]->max_length*120)/100+12;}
994  const char *func_name() const{return "compress";}
995  String *val_str(String *) ZLIB_DEPENDED_FUNCTION
996 };
997 
999 {
1000  String buffer;
1001 public:
1003  void fix_length_and_dec(){ maybe_null= 1; max_length= MAX_BLOB_WIDTH; }
1004  const char *func_name() const{return "uncompress";}
1005  String *val_str(String *) ZLIB_DEPENDED_FUNCTION
1006 };
1007 
1009 {
1010 public:
1012  void fix_length_and_dec()
1013  {
1014  collation.set(system_charset_info,
1015  DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
1016  fix_char_length(UUID_LENGTH);
1017  }
1018  const char *func_name() const{ return "uuid"; }
1019  String *val_str(String *);
1020 };
1021 
1023 {
1024  String buf1, buf2;
1025 public:
1027  void fix_length_and_dec();
1028  const char *func_name() const{ return "gtid_subtract"; }
1029  String *val_str_ascii(String *);
1030 };
1031 
1032 #endif /* ITEM_STRFUNC_INCLUDED */