1
/* Copyright (C) 2000-2003 MySQL AB
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems
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.
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.
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
17
21
/* This file defines all string functions */
19
#ifdef USE_PRAGMA_INTERFACE
20
#pragma interface /* gcc class implementation */
23
24
class Item_str_func :public Item_func
325
328
void update_used_tables();
326
329
const char *func_name() const { return "make_set"; }
328
bool walk(Item_processor processor, bool walk_subquery, uchar *arg)
331
bool walk(Item_processor processor, bool walk_subquery, unsigned char *arg)
330
333
return item->walk(processor, walk_subquery, arg) ||
331
334
Item_str_func::walk(processor, walk_subquery, arg);
333
Item *transform(Item_transformer transformer, uchar *arg);
336
Item *transform(Item_transformer transformer, unsigned char *arg);
334
337
virtual void print(String *str, enum_query_type query_type);
527
532
conv_charset= cs;
528
533
if (cache_if_const && args[0]->const_item())
531
536
String tmp, *str= args[0]->val_str(&tmp);
532
537
if (!str || str_value.copy(str->ptr(), str->length(),
533
538
str->charset(), conv_charset, &errors))
606
611
class Item_func_weight_string :public Item_str_func
608
613
String tmp_value;
612
Item_func_weight_string(Item *a, uint nweights_arg, uint flags_arg)
617
Item_func_weight_string(Item *a, uint32_t nweights_arg, uint32_t flags_arg)
613
618
:Item_str_func(a) { nweights= nweights_arg; flags= flags_arg; }
614
619
const char *func_name() const { return "weight_string"; }
615
620
String *val_str(String *);
616
621
void fix_length_and_dec();
619
class Item_func_uncompressed_length : public Item_int_func
623
Item_func_uncompressed_length(Item *a):Item_int_func(a){}
624
const char *func_name() const{return "uncompressed_length";}
625
void fix_length_and_dec() { max_length=10; }
630
#define ZLIB_DEPENDED_FUNCTION ;
632
#define ZLIB_DEPENDED_FUNCTION { null_value=1; return 0; }
635
class Item_func_compress: public Item_str_func
639
Item_func_compress(Item *a):Item_str_func(a){}
640
void fix_length_and_dec(){max_length= (args[0]->max_length*120)/100+12;}
641
const char *func_name() const{return "compress";}
642
String *val_str(String *) ZLIB_DEPENDED_FUNCTION
645
class Item_func_uncompress: public Item_str_func
649
Item_func_uncompress(Item *a): Item_str_func(a){}
650
void fix_length_and_dec(){ maybe_null= 1; max_length= MAX_BLOB_WIDTH; }
651
const char *func_name() const{return "uncompress";}
652
String *val_str(String *) ZLIB_DEPENDED_FUNCTION
623
TODO: Currently this Item is not allowed for virtual columns
624
only due to a bug in generating virtual column value.
626
bool check_vcol_func_processor(unsigned char *int_arg __attribute__((unused)))
655
630
#define UUID_LENGTH (8+1+4+1+4+1+4+1+12)