~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to server/item_sum.h

  • Committer: Monty Taylor
  • Date: 2008-07-22 05:48:51 UTC
  • mto: (202.1.3 toru)
  • mto: This revision was merged to the branch mainline in revision 204.
  • Revision ID: monty@inaugust.com-20080722054851-airxt73370725p7x
Re-enabled optimizations for the normal build, and added back the --with-debug option to turn them off. 

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
 
 */
 
1
/* Copyright (C) 2000-2006 MySQL AB
 
2
 
 
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.
 
6
 
 
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.
 
11
 
 
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 */
19
15
 
20
16
 
21
17
/* classes for sum functions */
22
18
 
 
19
#ifdef USE_PRAGMA_INTERFACE
 
20
#pragma interface                       /* gcc class implementation */
 
21
#endif
23
22
 
24
 
#include <mysys/my_tree.h>
 
23
#include <my_tree.h>
25
24
 
26
25
/*
27
26
  Class Item_sum is the base class used for special expressions that SQL calls
226
225
  enum Sumfunctype
227
226
  { COUNT_FUNC, COUNT_DISTINCT_FUNC, SUM_FUNC, SUM_DISTINCT_FUNC, AVG_FUNC,
228
227
    AVG_DISTINCT_FUNC, MIN_FUNC, MAX_FUNC, STD_FUNC,
229
 
    VARIANCE_FUNC, SUM_BIT_FUNC, GROUP_CONCAT_FUNC
 
228
    VARIANCE_FUNC, SUM_BIT_FUNC, UDF_SUM_FUNC, GROUP_CONCAT_FUNC
230
229
  };
231
230
 
232
231
  Item **args, *tmp_args[2];
233
232
  Item **ref_by; /* pointer to a ref to the object used to register it */
234
233
  Item_sum *next; /* next in the circular chain of registered objects  */
235
 
  uint32_t arg_count;
 
234
  uint arg_count;
236
235
  Item_sum *in_sum_func;  /* embedding set function if any */ 
237
236
  st_select_lex * aggr_sel; /* select where the function is aggregated       */ 
238
 
  int8_t nest_level;        /* number of the nesting level of the set function */
239
 
  int8_t aggr_level;        /* nesting level of the aggregating subquery       */
240
 
  int8_t max_arg_level;     /* max level of unbound column references          */
241
 
  int8_t max_sum_func_level;/* max level of aggregation for embedded functions */
 
237
  int8 nest_level;        /* number of the nesting level of the set function */
 
238
  int8 aggr_level;        /* nesting level of the aggregating subquery       */
 
239
  int8 max_arg_level;     /* max level of unbound column references          */
 
240
  int8 max_sum_func_level;/* max level of aggregation for embedded functions */
242
241
  bool quick_group;                     /* If incremental update of fields */
243
242
  /*
244
243
    This list is used by the check for mixing non aggregated fields and
364
363
  */
365
364
  void no_rows_in_result() { clear(); }
366
365
 
367
 
  virtual bool setup(THD *thd __attribute__((unused))) {return 0;}
 
366
  virtual bool setup(THD *thd __attribute__((__unused__))) {return 0;}
368
367
  virtual void make_unique(void) {}
369
368
  Item *get_tmp_table_item(THD *thd);
370
 
  virtual Field *create_tmp_field(bool group, Table *table,
371
 
                                  uint32_t convert_blob_length);
372
 
  bool walk(Item_processor processor, bool walk_subquery, unsigned char *argument);
 
369
  virtual Field *create_tmp_field(bool group, TABLE *table,
 
370
                                  uint convert_blob_length);
 
371
  bool walk(Item_processor processor, bool walk_subquery, uchar *argument);
373
372
  bool init_sum_func_check(THD *thd);
374
373
  bool check_sum_func(THD *thd, Item **ref);
375
374
  bool register_sum_func(THD *thd, Item **ref);
430
429
  Item_result hybrid_type;
431
430
  double sum;
432
431
  my_decimal dec_buffs[2];
433
 
  uint32_t curr_dec_buff;
 
432
  uint curr_dec_buff;
434
433
  void fix_length_and_dec();
435
434
 
436
435
public:
465
464
  Hybrid_type val;
466
465
  /* storage for unique elements */
467
466
  Unique *tree;
468
 
  Table *table;
 
467
  TABLE *table;
469
468
  enum enum_field_types table_field_type;
470
 
  uint32_t tree_key_length;
 
469
  uint tree_key_length;
471
470
protected:
472
471
  Item_sum_distinct(THD *thd, Item_sum_distinct *item);
473
472
public:
524
523
  Item_sum_avg_distinct(THD *thd, Item_sum_avg_distinct *original)
525
524
    :Item_sum_distinct(thd, original) {}
526
525
public:
527
 
  uint32_t prec_increment;
 
526
  uint prec_increment;
528
527
  Item_sum_avg_distinct(Item *item_arg) : Item_sum_distinct(item_arg) {}
529
528
 
530
529
  void fix_length_and_dec();
568
567
 
569
568
class Item_sum_count_distinct :public Item_sum_int
570
569
{
571
 
  Table *table;
572
 
  uint32_t *field_lengths;
 
570
  TABLE *table;
 
571
  uint32 *field_lengths;
573
572
  TMP_TABLE_PARAM *tmp_table_param;
574
573
  bool force_copy_fields;
575
574
  /*
589
588
    (to correctly free resources)
590
589
  */
591
590
  Item_sum_count_distinct *original;
592
 
  uint32_t tree_key_length;
 
591
  uint tree_key_length;
593
592
 
594
593
 
595
594
  bool always_null;             // Set to 1 if the result is always NULL
596
595
 
597
596
 
598
 
  friend int composite_key_cmp(void* arg, unsigned char* key1, unsigned char* key2);
599
 
  friend int simple_str_key_cmp(void* arg, unsigned char* key1, unsigned char* key2);
 
597
  friend int composite_key_cmp(void* arg, uchar* key1, uchar* key2);
 
598
  friend int simple_str_key_cmp(void* arg, uchar* key1, uchar* key2);
600
599
 
601
600
public:
602
601
  Item_sum_count_distinct(List<Item> &list)
639
638
public:
640
639
  Field *field;
641
640
  Item_result hybrid_type;
642
 
  uint32_t f_precision, f_scale, dec_bin_size;
643
 
  uint32_t prec_increment;
 
641
  uint f_precision, f_scale, dec_bin_size;
 
642
  uint prec_increment;
644
643
  Item_avg_field(Item_result res_type, Item_sum_avg *item);
645
644
  enum Type type() const { return FIELD_AVG_ITEM; }
646
645
  double val_real();
651
650
  enum_field_types field_type() const
652
651
  {
653
652
    return hybrid_type == DECIMAL_RESULT ?
654
 
      DRIZZLE_TYPE_NEWDECIMAL : DRIZZLE_TYPE_DOUBLE;
 
653
      MYSQL_TYPE_NEWDECIMAL : MYSQL_TYPE_DOUBLE;
655
654
  }
656
655
  void fix_length_and_dec() {}
657
656
  enum Item_result result_type () const { return hybrid_type; }
662
661
{
663
662
public:
664
663
  uint64_t count;
665
 
  uint32_t prec_increment;
666
 
  uint32_t f_precision, f_scale, dec_bin_size;
 
664
  uint prec_increment;
 
665
  uint f_precision, f_scale, dec_bin_size;
667
666
 
668
667
  Item_sum_avg(Item *item_par) :Item_sum_sum(item_par), count(0) {}
669
668
  Item_sum_avg(THD *thd, Item_sum_avg *item)
681
680
  String *val_str(String *str);
682
681
  void reset_field();
683
682
  void update_field();
684
 
  Item *result_item(Field *field __attribute__((unused)))
 
683
  Item *result_item(Field *field __attribute__((__unused__)))
685
684
  { return new Item_avg_field(hybrid_type, this); }
686
685
  void no_rows_in_result() {}
687
686
  const char *func_name() const { return "avg("; }
688
687
  Item *copy_or_same(THD* thd);
689
 
  Field *create_tmp_field(bool group, Table *table, uint32_t convert_blob_length);
 
688
  Field *create_tmp_field(bool group, TABLE *table, uint convert_blob_length);
690
689
  void cleanup()
691
690
  {
692
691
    count= 0;
701
700
public:
702
701
  Field *field;
703
702
  Item_result hybrid_type;
704
 
  uint32_t f_precision0, f_scale0;
705
 
  uint32_t f_precision1, f_scale1;
706
 
  uint32_t dec_bin_size0, dec_bin_size1;
707
 
  uint32_t sample;
708
 
  uint32_t prec_increment;
 
703
  uint f_precision0, f_scale0;
 
704
  uint f_precision1, f_scale1;
 
705
  uint dec_bin_size0, dec_bin_size1;
 
706
  uint sample;
 
707
  uint prec_increment;
709
708
  Item_variance_field(Item_sum_variance *item);
710
709
  enum Type type() const {return FIELD_VARIANCE_ITEM; }
711
710
  double val_real();
719
718
  enum_field_types field_type() const
720
719
  {
721
720
    return hybrid_type == DECIMAL_RESULT ?
722
 
      DRIZZLE_TYPE_NEWDECIMAL : DRIZZLE_TYPE_DOUBLE;
 
721
      MYSQL_TYPE_NEWDECIMAL : MYSQL_TYPE_DOUBLE;
723
722
  }
724
723
  void fix_length_and_dec() {}
725
724
  enum Item_result result_type () const { return hybrid_type; }
755
754
  int cur_dec;
756
755
  double recurrence_m, recurrence_s;    /* Used in recurrence relation. */
757
756
  uint64_t count;
758
 
  uint32_t f_precision0, f_scale0;
759
 
  uint32_t f_precision1, f_scale1;
760
 
  uint32_t dec_bin_size0, dec_bin_size1;
761
 
  uint32_t sample;
762
 
  uint32_t prec_increment;
 
757
  uint f_precision0, f_scale0;
 
758
  uint f_precision1, f_scale1;
 
759
  uint dec_bin_size0, dec_bin_size1;
 
760
  uint sample;
 
761
  uint prec_increment;
763
762
 
764
 
  Item_sum_variance(Item *item_par, uint32_t sample_arg) :Item_sum_num(item_par),
 
763
  Item_sum_variance(Item *item_par, uint sample_arg) :Item_sum_num(item_par),
765
764
    hybrid_type(REAL_RESULT), count(0), sample(sample_arg)
766
765
    {}
767
766
  Item_sum_variance(THD *thd, Item_sum_variance *item);
772
771
  my_decimal *val_decimal(my_decimal *);
773
772
  void reset_field();
774
773
  void update_field();
775
 
  Item *result_item(Field *field __attribute__((unused)))
 
774
  Item *result_item(Field *field __attribute__((__unused__)))
776
775
  { return new Item_variance_field(this); }
777
776
  void no_rows_in_result() {}
778
777
  const char *func_name() const
779
778
    { return sample ? "var_samp(" : "variance("; }
780
779
  Item *copy_or_same(THD* thd);
781
 
  Field *create_tmp_field(bool group, Table *table, uint32_t convert_blob_length);
 
780
  Field *create_tmp_field(bool group, TABLE *table, uint convert_blob_length);
782
781
  enum Item_result result_type () const { return REAL_RESULT; }
783
782
  void cleanup()
784
783
  {
797
796
  double val_real();
798
797
  my_decimal *val_decimal(my_decimal *);
799
798
  enum Item_result result_type () const { return REAL_RESULT; }
800
 
  enum_field_types field_type() const { return DRIZZLE_TYPE_DOUBLE;}
 
799
  enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE;}
801
800
};
802
801
 
803
802
/*
807
806
class Item_sum_std :public Item_sum_variance
808
807
{
809
808
  public:
810
 
  Item_sum_std(Item *item_par, uint32_t sample_arg)
 
809
  Item_sum_std(Item *item_par, uint sample_arg)
811
810
    :Item_sum_variance(item_par, sample_arg) {}
812
811
  Item_sum_std(THD *thd, Item_sum_std *item)
813
812
    :Item_sum_variance(thd, item)
814
813
    {}
815
814
  enum Sumfunctype sum_func () const { return STD_FUNC; }
816
815
  double val_real();
817
 
  Item *result_item(Field *field __attribute__((unused)))
 
816
  Item *result_item(Field *field __attribute__((__unused__)))
818
817
    { return new Item_std_field(this); }
819
818
  const char *func_name() const { return "std("; }
820
819
  Item *copy_or_same(THD* thd);
821
820
  enum Item_result result_type () const { return REAL_RESULT; }
822
 
  enum_field_types field_type() const { return DRIZZLE_TYPE_DOUBLE;}
 
821
  enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE;}
823
822
};
824
823
 
825
824
// This class is a string or number function depending on num_func
839
838
  public:
840
839
  Item_sum_hybrid(Item *item_par,int sign)
841
840
    :Item_sum(item_par), sum(0.0), sum_int(0),
842
 
    hybrid_type(INT_RESULT), hybrid_field_type(DRIZZLE_TYPE_LONGLONG),
 
841
    hybrid_type(INT_RESULT), hybrid_field_type(MYSQL_TYPE_LONGLONG),
843
842
    cmp_sign(sign), was_values(true)
844
843
  { collation.set(&my_charset_bin); }
845
844
  Item_sum_hybrid(THD *thd, Item_sum_hybrid *item);
861
860
  void cleanup();
862
861
  bool any_value() { return was_values; }
863
862
  void no_rows_in_result();
864
 
  Field *create_tmp_field(bool group, Table *table,
865
 
                          uint32_t convert_blob_length);
 
863
  Field *create_tmp_field(bool group, TABLE *table,
 
864
                          uint convert_blob_length);
866
865
};
867
866
 
868
867
 
920
919
class Item_sum_or :public Item_sum_bit
921
920
{
922
921
public:
923
 
  Item_sum_or(Item *item_par) :Item_sum_bit(item_par,0) {}
 
922
  Item_sum_or(Item *item_par) :Item_sum_bit(item_par,0LL) {}
924
923
  Item_sum_or(THD *thd, Item_sum_or *item) :Item_sum_bit(thd, item) {}
925
924
  bool add();
926
925
  const char *func_name() const { return "bit_or("; }
941
940
class Item_sum_xor :public Item_sum_bit
942
941
{
943
942
  public:
944
 
  Item_sum_xor(Item *item_par) :Item_sum_bit(item_par,0) {}
 
943
  Item_sum_xor(Item *item_par) :Item_sum_bit(item_par,0LL) {}
945
944
  Item_sum_xor(THD *thd, Item_sum_xor *item) :Item_sum_bit(thd, item) {}
946
945
  bool add();
947
946
  const char *func_name() const { return "bit_xor("; }
949
948
};
950
949
 
951
950
 
952
 
 
953
 
class DRIZZLE_ERROR;
 
951
/*
 
952
  User defined aggregates
 
953
*/
 
954
 
 
955
class Item_udf_sum : public Item_sum
 
956
{
 
957
protected:
 
958
  udf_handler udf;
 
959
 
 
960
public:
 
961
  Item_udf_sum(udf_func *udf_arg)
 
962
    :Item_sum(), udf(udf_arg)
 
963
  { quick_group=0; }
 
964
  Item_udf_sum(udf_func *udf_arg, List<Item> &list)
 
965
    :Item_sum(list), udf(udf_arg)
 
966
  { quick_group=0;}
 
967
  Item_udf_sum(THD *thd, Item_udf_sum *item)
 
968
    :Item_sum(thd, item), udf(item->udf)
 
969
  { udf.not_original= true; }
 
970
  const char *func_name() const { return udf.name(); }
 
971
  bool fix_fields(THD *thd, Item **ref)
 
972
  {
 
973
    assert(fixed == 0);
 
974
 
 
975
    if (init_sum_func_check(thd))
 
976
      return true;
 
977
 
 
978
    fixed= 1;
 
979
    if (udf.fix_fields(thd, this, this->arg_count, this->args))
 
980
      return true;
 
981
 
 
982
    return check_sum_func(thd, ref);
 
983
  }
 
984
  enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
 
985
  virtual bool have_field_update(void) const { return 0; }
 
986
 
 
987
  void clear();
 
988
  bool add();
 
989
  void reset_field() {};
 
990
  void update_field() {};
 
991
  void cleanup();
 
992
  virtual void print(String *str, enum_query_type query_type);
 
993
};
 
994
 
 
995
 
 
996
class Item_sum_udf_float :public Item_udf_sum
 
997
{
 
998
 public:
 
999
  Item_sum_udf_float(udf_func *udf_arg)
 
1000
    :Item_udf_sum(udf_arg) {}
 
1001
  Item_sum_udf_float(udf_func *udf_arg, List<Item> &list)
 
1002
    :Item_udf_sum(udf_arg, list) {}
 
1003
  Item_sum_udf_float(THD *thd, Item_sum_udf_float *item)
 
1004
    :Item_udf_sum(thd, item) {}
 
1005
  int64_t val_int()
 
1006
  {
 
1007
    assert(fixed == 1);
 
1008
    return (int64_t) rint(Item_sum_udf_float::val_real());
 
1009
  }
 
1010
  double val_real();
 
1011
  String *val_str(String*str);
 
1012
  my_decimal *val_decimal(my_decimal *);
 
1013
  void fix_length_and_dec() { fix_num_length_and_dec(); }
 
1014
  Item *copy_or_same(THD* thd);
 
1015
};
 
1016
 
 
1017
 
 
1018
class Item_sum_udf_int :public Item_udf_sum
 
1019
{
 
1020
public:
 
1021
  Item_sum_udf_int(udf_func *udf_arg)
 
1022
    :Item_udf_sum(udf_arg) {}
 
1023
  Item_sum_udf_int(udf_func *udf_arg, List<Item> &list)
 
1024
    :Item_udf_sum(udf_arg, list) {}
 
1025
  Item_sum_udf_int(THD *thd, Item_sum_udf_int *item)
 
1026
    :Item_udf_sum(thd, item) {}
 
1027
  int64_t val_int();
 
1028
  double val_real()
 
1029
    { assert(fixed == 1); return (double) Item_sum_udf_int::val_int(); }
 
1030
  String *val_str(String*str);
 
1031
  my_decimal *val_decimal(my_decimal *);
 
1032
  enum Item_result result_type () const { return INT_RESULT; }
 
1033
  void fix_length_and_dec() { decimals=0; max_length=21; }
 
1034
  Item *copy_or_same(THD* thd);
 
1035
};
 
1036
 
 
1037
 
 
1038
class Item_sum_udf_str :public Item_udf_sum
 
1039
{
 
1040
public:
 
1041
  Item_sum_udf_str(udf_func *udf_arg)
 
1042
    :Item_udf_sum(udf_arg) {}
 
1043
  Item_sum_udf_str(udf_func *udf_arg, List<Item> &list)
 
1044
    :Item_udf_sum(udf_arg,list) {}
 
1045
  Item_sum_udf_str(THD *thd, Item_sum_udf_str *item)
 
1046
    :Item_udf_sum(thd, item) {}
 
1047
  String *val_str(String *);
 
1048
  double val_real()
 
1049
  {
 
1050
    int err_not_used;
 
1051
    char *end_not_used;
 
1052
    String *res;
 
1053
    res=val_str(&str_value);
 
1054
    return res ? my_strntod(res->charset(),(char*) res->ptr(),res->length(),
 
1055
                            &end_not_used, &err_not_used) : 0.0;
 
1056
  }
 
1057
  int64_t val_int()
 
1058
  {
 
1059
    int err_not_used;
 
1060
    char *end;
 
1061
    String *res;
 
1062
    CHARSET_INFO *cs;
 
1063
 
 
1064
    if (!(res= val_str(&str_value)))
 
1065
      return 0;                                 /* Null value */
 
1066
    cs= res->charset();
 
1067
    end= (char*) res->ptr()+res->length();
 
1068
    return cs->cset->strtoll10(cs, res->ptr(), &end, &err_not_used);
 
1069
  }
 
1070
  my_decimal *val_decimal(my_decimal *dec);
 
1071
  enum Item_result result_type () const { return STRING_RESULT; }
 
1072
  void fix_length_and_dec();
 
1073
  Item *copy_or_same(THD* thd);
 
1074
};
 
1075
 
 
1076
 
 
1077
class Item_sum_udf_decimal :public Item_udf_sum
 
1078
{
 
1079
public:
 
1080
  Item_sum_udf_decimal(udf_func *udf_arg)
 
1081
    :Item_udf_sum(udf_arg) {}
 
1082
  Item_sum_udf_decimal(udf_func *udf_arg, List<Item> &list)
 
1083
    :Item_udf_sum(udf_arg, list) {}
 
1084
  Item_sum_udf_decimal(THD *thd, Item_sum_udf_decimal *item)
 
1085
    :Item_udf_sum(thd, item) {}
 
1086
  String *val_str(String *);
 
1087
  double val_real();
 
1088
  int64_t val_int();
 
1089
  my_decimal *val_decimal(my_decimal *);
 
1090
  enum Item_result result_type () const { return DECIMAL_RESULT; }
 
1091
  void fix_length_and_dec() { fix_num_length_and_dec(); }
 
1092
  Item *copy_or_same(THD* thd);
 
1093
};
 
1094
 
 
1095
class MYSQL_ERROR;
954
1096
 
955
1097
class Item_func_group_concat : public Item_sum
956
1098
{
957
1099
  TMP_TABLE_PARAM *tmp_table_param;
958
 
  DRIZZLE_ERROR *warning;
 
1100
  MYSQL_ERROR *warning;
959
1101
  String result;
960
1102
  String *separator;
961
1103
  TREE tree_base;
969
1111
     @see Item_func_group_concat::clear
970
1112
   */
971
1113
  Unique *unique_filter;
972
 
  Table *table;
973
 
  order_st **order;
 
1114
  TABLE *table;
 
1115
  ORDER **order;
974
1116
  Name_resolution_context *context;
975
1117
  /** The number of ORDER BY items. */
976
 
  uint32_t arg_count_order;
 
1118
  uint arg_count_order;
977
1119
  /** The number of selected items, aka the expr list. */
978
 
  uint32_t arg_count_field;
979
 
  uint32_t count_cut_values;
 
1120
  uint arg_count_field;
 
1121
  uint count_cut_values;
980
1122
  bool distinct;
981
1123
  bool warning_for_row;
982
1124
  bool always_null;
992
1134
                                                const void* key2);
993
1135
  friend int group_concat_key_cmp_with_order(void* arg, const void* key1,
994
1136
                                             const void* key2);
995
 
  friend int dump_leaf_key(unsigned char* key,
 
1137
  friend int dump_leaf_key(uchar* key,
996
1138
                           element_count count __attribute__((unused)),
997
1139
                           Item_func_group_concat *group_concat_item);
998
1140
 
1011
1153
  enum_field_types field_type() const
1012
1154
  {
1013
1155
    if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB )
1014
 
      return DRIZZLE_TYPE_BLOB;
 
1156
      return MYSQL_TYPE_BLOB;
1015
1157
    else
1016
 
      return DRIZZLE_TYPE_VARCHAR;
 
1158
      return MYSQL_TYPE_VARCHAR;
1017
1159
  }
1018
1160
  void clear();
1019
1161
  bool add();
1045
1187
  Item *copy_or_same(THD* thd);
1046
1188
  void no_rows_in_result() {}
1047
1189
  virtual void print(String *str, enum_query_type query_type);
1048
 
  virtual bool change_context_processor(unsigned char *cntx)
 
1190
  virtual bool change_context_processor(uchar *cntx)
1049
1191
    { context= (Name_resolution_context *)cntx; return false; }
1050
1192
};