~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item_strfunc.h

  • Committer: Monty Taylor
  • Date: 2008-11-07 00:15:51 UTC
  • mto: This revision was merged to the branch mainline in revision 579.
  • Revision ID: monty@inaugust.com-20081107001551-8vxb6sf1ti0i5p09
Cleaned up some headers for PCH.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 
3
 *
 
4
 *  Copyright (C) 2008 Sun Microsystems
 
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
#ifndef DRIZZLED_ITEM_STRFUNC_H
 
21
#define DRIZZLED_ITEM_STRFUNC_H
 
22
 
 
23
/* This file defines all string functions */
 
24
 
 
25
 
 
26
class Item_str_func :public Item_func
 
27
{
 
28
public:
 
29
  Item_str_func() :Item_func() { decimals=NOT_FIXED_DEC; }
 
30
  Item_str_func(Item *a) :Item_func(a) {decimals=NOT_FIXED_DEC; }
 
31
  Item_str_func(Item *a,Item *b) :Item_func(a,b) { decimals=NOT_FIXED_DEC; }
 
32
  Item_str_func(Item *a,Item *b,Item *c) :Item_func(a,b,c) { decimals=NOT_FIXED_DEC; }
 
33
  Item_str_func(Item *a,Item *b,Item *c,Item *d) :Item_func(a,b,c,d) {decimals=NOT_FIXED_DEC; }
 
34
  Item_str_func(Item *a,Item *b,Item *c,Item *d, Item* e) :Item_func(a,b,c,d,e) {decimals=NOT_FIXED_DEC; }
 
35
  Item_str_func(List<Item> &list) :Item_func(list) {decimals=NOT_FIXED_DEC; }
 
36
  int64_t val_int();
 
37
  double val_real();
 
38
  my_decimal *val_decimal(my_decimal *);
 
39
  enum Item_result result_type () const { return STRING_RESULT; }
 
40
  void left_right_max_length();
 
41
  bool fix_fields(Session *session, Item **ref);
 
42
};
 
43
 
 
44
 
 
45
class Item_func_concat :public Item_str_func
 
46
{
 
47
  String tmp_value;
 
48
public:
 
49
  Item_func_concat(List<Item> &list) :Item_str_func(list) {}
 
50
  Item_func_concat(Item *a,Item *b) :Item_str_func(a,b) {}
 
51
  String *val_str(String *);
 
52
  void fix_length_and_dec();
 
53
  const char *func_name() const { return "concat"; }
 
54
};
 
55
 
 
56
class Item_func_concat_ws :public Item_str_func
 
57
{
 
58
  String tmp_value;
 
59
public:
 
60
  Item_func_concat_ws(List<Item> &list) :Item_str_func(list) {}
 
61
  String *val_str(String *);
 
62
  void fix_length_and_dec();
 
63
  const char *func_name() const { return "concat_ws"; }
 
64
  table_map not_null_tables() const { return 0; }
 
65
};
 
66
 
 
67
class Item_func_reverse :public Item_str_func
 
68
{
 
69
  String tmp_value;
 
70
public:
 
71
  Item_func_reverse(Item *a) :Item_str_func(a) {}
 
72
  String *val_str(String *);
 
73
  void fix_length_and_dec();
 
74
  const char *func_name() const { return "reverse"; }
 
75
};
 
76
 
 
77
 
 
78
class Item_func_replace :public Item_str_func
 
79
{
 
80
  String tmp_value,tmp_value2;
 
81
public:
 
82
  Item_func_replace(Item *org,Item *find,Item *replace)
 
83
    :Item_str_func(org,find,replace) {}
 
84
  String *val_str(String *);
 
85
  void fix_length_and_dec();
 
86
  const char *func_name() const { return "replace"; }
 
87
};
 
88
 
 
89
 
 
90
class Item_func_insert :public Item_str_func
 
91
{
 
92
  String tmp_value;
 
93
public:
 
94
  Item_func_insert(Item *org,Item *start,Item *length,Item *new_str)
 
95
    :Item_str_func(org,start,length,new_str) {}
 
96
  String *val_str(String *);
 
97
  void fix_length_and_dec();
 
98
  const char *func_name() const { return "insert"; }
 
99
};
 
100
 
 
101
 
 
102
class Item_str_conv :public Item_str_func
 
103
{
 
104
protected:
 
105
  uint32_t multiply;
 
106
  my_charset_conv_case converter;
 
107
  String tmp_value;
 
108
public:
 
109
  Item_str_conv(Item *item) :Item_str_func(item) {}
 
110
  String *val_str(String *);
 
111
};
 
112
 
 
113
 
 
114
class Item_func_lcase :public Item_str_conv
 
115
{
 
116
public:
 
117
  Item_func_lcase(Item *item) :Item_str_conv(item) {}
 
118
  const char *func_name() const { return "lcase"; }
 
119
  void fix_length_and_dec();
 
120
};
 
121
 
 
122
class Item_func_ucase :public Item_str_conv
 
123
{
 
124
public:
 
125
  Item_func_ucase(Item *item) :Item_str_conv(item) {}
 
126
  const char *func_name() const { return "ucase"; }
 
127
  void fix_length_and_dec();
 
128
};
 
129
 
 
130
 
 
131
class Item_func_left :public Item_str_func
 
132
{
 
133
  String tmp_value;
 
134
public:
 
135
  Item_func_left(Item *a,Item *b) :Item_str_func(a,b) {}
 
136
  String *val_str(String *);
 
137
  void fix_length_and_dec();
 
138
  const char *func_name() const { return "left"; }
 
139
};
 
140
 
 
141
 
 
142
class Item_func_right :public Item_str_func
 
143
{
 
144
  String tmp_value;
 
145
public:
 
146
  Item_func_right(Item *a,Item *b) :Item_str_func(a,b) {}
 
147
  String *val_str(String *);
 
148
  void fix_length_and_dec();
 
149
  const char *func_name() const { return "right"; }
 
150
};
 
151
 
 
152
 
 
153
class Item_func_substr :public Item_str_func
 
154
{
 
155
  String tmp_value;
 
156
public:
 
157
  Item_func_substr(Item *a,Item *b) :Item_str_func(a,b) {}
 
158
  Item_func_substr(Item *a,Item *b,Item *c) :Item_str_func(a,b,c) {}
 
159
  String *val_str(String *);
 
160
  void fix_length_and_dec();
 
161
  const char *func_name() const { return "substr"; }
 
162
};
 
163
 
 
164
 
 
165
class Item_func_substr_index :public Item_str_func
 
166
{
 
167
  String tmp_value;
 
168
public:
 
169
  Item_func_substr_index(Item *a,Item *b,Item *c) :Item_str_func(a,b,c) {}
 
170
  String *val_str(String *);
 
171
  void fix_length_and_dec();
 
172
  const char *func_name() const { return "substring_index"; }
 
173
};
 
174
 
 
175
 
 
176
class Item_func_trim :public Item_str_func
 
177
{
 
178
protected:
 
179
  String tmp_value;
 
180
  String remove;
 
181
public:
 
182
  Item_func_trim(Item *a,Item *b) :Item_str_func(a,b) {}
 
183
  Item_func_trim(Item *a) :Item_str_func(a) {}
 
184
  String *val_str(String *);
 
185
  void fix_length_and_dec();
 
186
  const char *func_name() const { return "trim"; }
 
187
  virtual void print(String *str, enum_query_type query_type);
 
188
  virtual const char *mode_name() const { return "both"; }
 
189
};
 
190
 
 
191
 
 
192
class Item_func_ltrim :public Item_func_trim
 
193
{
 
194
public:
 
195
  Item_func_ltrim(Item *a,Item *b) :Item_func_trim(a,b) {}
 
196
  Item_func_ltrim(Item *a) :Item_func_trim(a) {}
 
197
  String *val_str(String *);
 
198
  const char *func_name() const { return "ltrim"; }
 
199
  const char *mode_name() const { return "leading"; }
 
200
};
 
201
 
 
202
 
 
203
class Item_func_rtrim :public Item_func_trim
 
204
{
 
205
public:
 
206
  Item_func_rtrim(Item *a,Item *b) :Item_func_trim(a,b) {}
 
207
  Item_func_rtrim(Item *a) :Item_func_trim(a) {}
 
208
  String *val_str(String *);
 
209
  const char *func_name() const { return "rtrim"; }
 
210
  const char *mode_name() const { return "trailing"; }
 
211
};
 
212
 
 
213
 
 
214
class Item_func_sysconst :public Item_str_func
 
215
{
 
216
public:
 
217
  Item_func_sysconst()
 
218
  { collation.set(system_charset_info,DERIVATION_SYSCONST); }
 
219
  Item *safe_charset_converter(const CHARSET_INFO * const tocs);
 
220
  /*
 
221
    Used to create correct Item name in new converted item in
 
222
    safe_charset_converter, return string representation of this function
 
223
    call
 
224
  */
 
225
  virtual const char *fully_qualified_func_name() const = 0;
 
226
  bool check_vcol_func_processor(unsigned char *int_arg __attribute__((unused)))
 
227
  { return true; }
 
228
};
 
229
 
 
230
 
 
231
class Item_func_database :public Item_func_sysconst
 
232
{
 
233
public:
 
234
  Item_func_database() :Item_func_sysconst() {}
 
235
  String *val_str(String *);
 
236
  void fix_length_and_dec()
 
237
  {
 
238
    max_length= MAX_FIELD_NAME * system_charset_info->mbmaxlen;
 
239
    maybe_null=1;
 
240
  }
 
241
  const char *func_name() const { return "database"; }
 
242
  const char *fully_qualified_func_name() const { return "database()"; }
 
243
};
 
244
 
 
245
 
 
246
class Item_func_user :public Item_func_sysconst
 
247
{
 
248
protected:
 
249
  bool init (const char *user, const char *host);
 
250
 
 
251
public:
 
252
  Item_func_user()
 
253
  {
 
254
    str_value.set("", 0, system_charset_info);
 
255
  }
 
256
  String *val_str(String *)
 
257
  {
 
258
    assert(fixed == 1);
 
259
    return (null_value ? 0 : &str_value);
 
260
  }
 
261
  bool fix_fields(Session *session, Item **ref);
 
262
  void fix_length_and_dec()
 
263
  {
 
264
    max_length= (USERNAME_CHAR_LENGTH + HOSTNAME_LENGTH + 1) *
 
265
                system_charset_info->mbmaxlen;
 
266
  }
 
267
  const char *func_name() const { return "user"; }
 
268
  const char *fully_qualified_func_name() const { return "user()"; }
 
269
  int save_in_field(Field *field,
 
270
                    bool no_conversions __attribute__((unused)))
 
271
  {
 
272
    return save_str_value_in_field(field, &str_value);
 
273
  }
 
274
};
 
275
 
 
276
 
 
277
class Item_func_current_user :public Item_func_user
 
278
{
 
279
  Name_resolution_context *context;
 
280
 
 
281
public:
 
282
  Item_func_current_user(Name_resolution_context *context_arg)
 
283
    : context(context_arg) {}
 
284
  bool fix_fields(Session *session, Item **ref);
 
285
  const char *func_name() const { return "current_user"; }
 
286
  const char *fully_qualified_func_name() const { return "current_user()"; }
 
287
};
 
288
 
 
289
 
 
290
class Item_func_soundex :public Item_str_func
 
291
{
 
292
  String tmp_value;
 
293
public:
 
294
  Item_func_soundex(Item *a) :Item_str_func(a) {}
 
295
  String *val_str(String *);
 
296
  void fix_length_and_dec();
 
297
  const char *func_name() const { return "soundex"; }
 
298
};
 
299
 
 
300
 
 
301
class Item_func_elt :public Item_str_func
 
302
{
 
303
public:
 
304
  Item_func_elt(List<Item> &list) :Item_str_func(list) {}
 
305
  double val_real();
 
306
  int64_t val_int();
 
307
  String *val_str(String *str);
 
308
  void fix_length_and_dec();
 
309
  const char *func_name() const { return "elt"; }
 
310
};
 
311
 
 
312
 
 
313
class Item_func_make_set :public Item_str_func
 
314
{
 
315
  Item *item;
 
316
  String tmp_str;
 
317
 
 
318
public:
 
319
  Item_func_make_set(Item *a,List<Item> &list) :Item_str_func(list),item(a) {}
 
320
  String *val_str(String *str);
 
321
  bool fix_fields(Session *session, Item **ref)
 
322
  {
 
323
    assert(fixed == 0);
 
324
    return ((!item->fixed && item->fix_fields(session, &item)) ||
 
325
            item->check_cols(1) ||
 
326
            Item_func::fix_fields(session, ref));
 
327
  }
 
328
  void split_sum_func(Session *session, Item **ref_pointer_array, List<Item> &fields);
 
329
  void fix_length_and_dec();
 
330
  void update_used_tables();
 
331
  const char *func_name() const { return "make_set"; }
 
332
 
 
333
  bool walk(Item_processor processor, bool walk_subquery, unsigned char *arg)
 
334
  {
 
335
    return item->walk(processor, walk_subquery, arg) ||
 
336
      Item_str_func::walk(processor, walk_subquery, arg);
 
337
  }
 
338
  Item *transform(Item_transformer transformer, unsigned char *arg);
 
339
  virtual void print(String *str, enum_query_type query_type);
 
340
};
 
341
 
 
342
 
 
343
class Item_func_format :public Item_str_func
 
344
{
 
345
  String tmp_str;
 
346
public:
 
347
  Item_func_format(Item *org, Item *dec);
 
348
  String *val_str(String *);
 
349
  void fix_length_and_dec();
 
350
  const char *func_name() const { return "format"; }
 
351
  virtual void print(String *str, enum_query_type query_type);
 
352
};
 
353
 
 
354
 
 
355
class Item_func_char :public Item_str_func
 
356
{
 
357
public:
 
358
  Item_func_char(List<Item> &list) :Item_str_func(list)
 
359
  { collation.set(&my_charset_bin); }
 
360
  Item_func_char(List<Item> &list, const CHARSET_INFO * const cs) :Item_str_func(list)
 
361
  { collation.set(cs); }  
 
362
  String *val_str(String *);
 
363
  void fix_length_and_dec() 
 
364
  {
 
365
    max_length= arg_count * 4;
 
366
  }
 
367
  const char *func_name() const { return "char"; }
 
368
};
 
369
 
 
370
 
 
371
class Item_func_repeat :public Item_str_func
 
372
{
 
373
  String tmp_value;
 
374
public:
 
375
  Item_func_repeat(Item *arg1,Item *arg2) :Item_str_func(arg1,arg2) {}
 
376
  String *val_str(String *);
 
377
  void fix_length_and_dec();
 
378
  const char *func_name() const { return "repeat"; }
 
379
};
 
380
 
 
381
 
 
382
class Item_func_rpad :public Item_str_func
 
383
{
 
384
  String tmp_value, rpad_str;
 
385
public:
 
386
  Item_func_rpad(Item *arg1,Item *arg2,Item *arg3)
 
387
    :Item_str_func(arg1,arg2,arg3) {}
 
388
  String *val_str(String *);
 
389
  void fix_length_and_dec();
 
390
  const char *func_name() const { return "rpad"; }
 
391
};
 
392
 
 
393
 
 
394
class Item_func_lpad :public Item_str_func
 
395
{
 
396
  String tmp_value, lpad_str;
 
397
public:
 
398
  Item_func_lpad(Item *arg1,Item *arg2,Item *arg3)
 
399
    :Item_str_func(arg1,arg2,arg3) {}
 
400
  String *val_str(String *);
 
401
  void fix_length_and_dec();
 
402
  const char *func_name() const { return "lpad"; }
 
403
};
 
404
 
 
405
 
 
406
class Item_func_conv :public Item_str_func
 
407
{
 
408
public:
 
409
  Item_func_conv(Item *a,Item *b,Item *c) :Item_str_func(a,b,c) {}
 
410
  const char *func_name() const { return "conv"; }
 
411
  String *val_str(String *);
 
412
  void fix_length_and_dec()
 
413
  {
 
414
    collation.set(default_charset());
 
415
    max_length=64;
 
416
    maybe_null= 1;
 
417
  }
 
418
};
 
419
 
 
420
 
 
421
class Item_func_hex :public Item_str_func
 
422
{
 
423
  String tmp_value;
 
424
public:
 
425
  Item_func_hex(Item *a) :Item_str_func(a) {}
 
426
  const char *func_name() const { return "hex"; }
 
427
  String *val_str(String *);
 
428
  void fix_length_and_dec()
 
429
  {
 
430
    collation.set(default_charset());
 
431
    decimals=0;
 
432
    max_length=args[0]->max_length*2*collation.collation->mbmaxlen;
 
433
  }
 
434
};
 
435
 
 
436
class Item_func_unhex :public Item_str_func
 
437
{
 
438
  String tmp_value;
 
439
public:
 
440
  Item_func_unhex(Item *a) :Item_str_func(a) 
 
441
  { 
 
442
    /* there can be bad hex strings */
 
443
    maybe_null= 1; 
 
444
  }
 
445
  const char *func_name() const { return "unhex"; }
 
446
  String *val_str(String *);
 
447
  void fix_length_and_dec()
 
448
  {
 
449
    collation.set(&my_charset_bin);
 
450
    decimals=0;
 
451
    max_length=(1+args[0]->max_length)/2;
 
452
  }
 
453
};
 
454
 
 
455
 
 
456
class Item_func_binary :public Item_str_func
 
457
{
 
458
public:
 
459
  Item_func_binary(Item *a) :Item_str_func(a) {}
 
460
  String *val_str(String *a)
 
461
  {
 
462
    assert(fixed == 1);
 
463
    String *tmp=args[0]->val_str(a);
 
464
    null_value=args[0]->null_value;
 
465
    if (tmp)
 
466
      tmp->set_charset(&my_charset_bin);
 
467
    return tmp;
 
468
  }
 
469
  void fix_length_and_dec()
 
470
  {
 
471
    collation.set(&my_charset_bin);
 
472
    max_length=args[0]->max_length;
 
473
  }
 
474
  virtual void print(String *str, enum_query_type query_type);
 
475
  const char *func_name() const { return "cast_as_binary"; }
 
476
};
 
477
 
 
478
 
 
479
class Item_load_file :public Item_str_func
 
480
{
 
481
  String tmp_value;
 
482
public:
 
483
  Item_load_file(Item *a) :Item_str_func(a) {}
 
484
  String *val_str(String *);
 
485
  const char *func_name() const { return "load_file"; }
 
486
  void fix_length_and_dec()
 
487
  {
 
488
    collation.set(&my_charset_bin, DERIVATION_COERCIBLE);
 
489
    maybe_null=1;
 
490
    max_length=MAX_BLOB_WIDTH;
 
491
  }
 
492
  bool check_vcol_func_processor(unsigned char *int_arg __attribute__((unused)))
 
493
  { return true; }
 
494
};
 
495
 
 
496
 
 
497
class Item_func_export_set: public Item_str_func
 
498
{
 
499
 public:
 
500
  Item_func_export_set(Item *a,Item *b,Item* c) :Item_str_func(a,b,c) {}
 
501
  Item_func_export_set(Item *a,Item *b,Item* c,Item* d) :Item_str_func(a,b,c,d) {}
 
502
  Item_func_export_set(Item *a,Item *b,Item* c,Item* d,Item* e) :Item_str_func(a,b,c,d,e) {}
 
503
  String  *val_str(String *str);
 
504
  void fix_length_and_dec();
 
505
  const char *func_name() const { return "export_set"; }
 
506
};
 
507
 
 
508
class Item_func_quote :public Item_str_func
 
509
{
 
510
  String tmp_value;
 
511
public:
 
512
  Item_func_quote(Item *a) :Item_str_func(a) {}
 
513
  const char *func_name() const { return "quote"; }
 
514
  String *val_str(String *);
 
515
  void fix_length_and_dec()
 
516
  {
 
517
    collation.set(args[0]->collation);
 
518
    max_length= args[0]->max_length * 2 + 2;
 
519
  }
 
520
};
 
521
 
 
522
class Item_func_conv_charset :public Item_str_func
 
523
{
 
524
  bool use_cached_value;
 
525
public:
 
526
  bool safe;
 
527
  const CHARSET_INFO *conv_charset; // keep it public
 
528
  Item_func_conv_charset(Item *a, const CHARSET_INFO * const cs) :Item_str_func(a) 
 
529
  { conv_charset= cs; use_cached_value= 0; safe= 0; }
 
530
  Item_func_conv_charset(Item *a, const CHARSET_INFO * const cs, bool cache_if_const) 
 
531
    :Item_str_func(a) 
 
532
  {
 
533
    assert(args[0]->fixed);
 
534
    conv_charset= cs;
 
535
    if (cache_if_const && args[0]->const_item())
 
536
    {
 
537
      uint32_t errors= 0;
 
538
      String tmp, *str= args[0]->val_str(&tmp);
 
539
      if (!str || str_value.copy(str->ptr(), str->length(),
 
540
                                 str->charset(), conv_charset, &errors))
 
541
        null_value= 1;
 
542
      use_cached_value= 1;
 
543
      str_value.mark_as_const();
 
544
      safe= (errors == 0);
 
545
    }
 
546
    else
 
547
    {
 
548
      use_cached_value= 0;
 
549
      /*
 
550
        Conversion from and to "binary" is safe.
 
551
        Conversion to Unicode is safe.
 
552
        Other kind of conversions are potentially lossy.
 
553
      */
 
554
      safe= (args[0]->collation.collation == &my_charset_bin ||
 
555
             cs == &my_charset_bin ||
 
556
             (cs->state & MY_CS_UNICODE));
 
557
    }
 
558
  }
 
559
  String *val_str(String *);
 
560
  void fix_length_and_dec();
 
561
  const char *func_name() const { return "convert"; }
 
562
  virtual void print(String *str, enum_query_type query_type);
 
563
};
 
564
 
 
565
class Item_func_set_collation :public Item_str_func
 
566
{
 
567
public:
 
568
  Item_func_set_collation(Item *a, Item *b) :Item_str_func(a,b) {};
 
569
  String *val_str(String *);
 
570
  void fix_length_and_dec();
 
571
  bool eq(const Item *item, bool binary_cmp) const;
 
572
  const char *func_name() const { return "collate"; }
 
573
  enum Functype functype() const { return COLLATE_FUNC; }
 
574
  virtual void print(String *str, enum_query_type query_type);
 
575
  Item_field *filed_for_view_update()
 
576
  {
 
577
    /* this function is transparent for view updating */
 
578
    return args[0]->filed_for_view_update();
 
579
  }
 
580
};
 
581
 
 
582
class Item_func_charset :public Item_str_func
 
583
{
 
584
public:
 
585
  Item_func_charset(Item *a) :Item_str_func(a) {}
 
586
  String *val_str(String *);
 
587
  const char *func_name() const { return "charset"; }
 
588
  void fix_length_and_dec()
 
589
  {
 
590
     collation.set(system_charset_info);
 
591
     max_length= 64 * collation.collation->mbmaxlen; // should be enough
 
592
     maybe_null= 0;
 
593
  };
 
594
  table_map not_null_tables() const { return 0; }
 
595
};
 
596
 
 
597
class Item_func_collation :public Item_str_func
 
598
{
 
599
public:
 
600
  Item_func_collation(Item *a) :Item_str_func(a) {}
 
601
  String *val_str(String *);
 
602
  const char *func_name() const { return "collation"; }
 
603
  void fix_length_and_dec()
 
604
  {
 
605
     collation.set(system_charset_info);
 
606
     max_length= 64 * collation.collation->mbmaxlen; // should be enough
 
607
     maybe_null= 0;
 
608
  };
 
609
  table_map not_null_tables() const { return 0; }
 
610
};
 
611
 
 
612
 
 
613
class Item_func_weight_string :public Item_str_func
 
614
{
 
615
  String tmp_value;
 
616
  uint32_t flags;
 
617
  uint32_t nweights;
 
618
public:
 
619
  Item_func_weight_string(Item *a, uint32_t nweights_arg, uint32_t flags_arg)
 
620
  :Item_str_func(a) { nweights= nweights_arg; flags= flags_arg; }
 
621
  const char *func_name() const { return "weight_string"; }
 
622
  String *val_str(String *);
 
623
  void fix_length_and_dec();
 
624
  /*
 
625
    TODO: Currently this Item is not allowed for virtual columns
 
626
    only due to a bug in generating virtual column value.
 
627
  */
 
628
  bool check_vcol_func_processor(unsigned char *int_arg __attribute__((unused)))
 
629
  { return true; }
 
630
};
 
631
 
 
632
#define UUID_LENGTH (8+1+4+1+4+1+4+1+12)
 
633
class Item_func_uuid: public Item_str_func
 
634
{
 
635
public:
 
636
  Item_func_uuid(): Item_str_func() {}
 
637
  void fix_length_and_dec() {
 
638
    collation.set(system_charset_info);
 
639
    /*
 
640
       NOTE! uuid() should be changed to use 'ascii'
 
641
       charset when hex(), format(), md5(), etc, and implicit
 
642
       number-to-string conversion will use 'ascii'
 
643
    */
 
644
    max_length= UUID_LENGTH * system_charset_info->mbmaxlen;
 
645
  }
 
646
  const char *func_name() const{ return "uuid"; }
 
647
  String *val_str(String *);
 
648
  bool check_vcol_func_processor(unsigned char *int_arg __attribute__((unused)))
 
649
  { return true; }
 
650
};
 
651
 
 
652
#endif /* DRIZZLED_ITEM_STRFUNC_H */