~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to sql/item_sum.h

Renamed more stuff to drizzle.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#pragma interface                       /* gcc class implementation */
21
21
#endif
22
22
 
23
 
#include <mysys/my_tree.h>
 
23
#include <my_tree.h>
24
24
 
25
25
/*
26
26
  Class Item_sum is the base class used for special expressions that SQL calls
234
234
  uint arg_count;
235
235
  Item_sum *in_sum_func;  /* embedding set function if any */ 
236
236
  st_select_lex * aggr_sel; /* select where the function is aggregated       */ 
237
 
  int8_t nest_level;        /* number of the nesting level of the set function */
238
 
  int8_t aggr_level;        /* nesting level of the aggregating subquery       */
239
 
  int8_t max_arg_level;     /* max level of unbound column references          */
240
 
  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 */
241
241
  bool quick_group;                     /* If incremental update of fields */
242
242
  /*
243
243
    This list is used by the check for mixing non aggregated fields and
254
254
public:  
255
255
 
256
256
  void mark_as_sum_func();
257
 
  Item_sum() :arg_count(0), quick_group(1), forced_const(false)
 
257
  Item_sum() :arg_count(0), quick_group(1), forced_const(FALSE)
258
258
  {
259
259
    mark_as_sum_func();
260
260
  }
261
261
  Item_sum(Item *a) :args(tmp_args), arg_count(1), quick_group(1), 
262
 
    forced_const(false)
 
262
    forced_const(FALSE)
263
263
  {
264
264
    args[0]=a;
265
265
    mark_as_sum_func();
266
266
  }
267
267
  Item_sum( Item *a, Item *b ) :args(tmp_args), arg_count(2), quick_group(1),
268
 
    forced_const(false)
 
268
    forced_const(FALSE)
269
269
  {
270
270
    args[0]=a; args[1]=b;
271
271
    mark_as_sum_func();
340
340
  void cleanup() 
341
341
  { 
342
342
    Item::cleanup();
343
 
    forced_const= false; 
 
343
    forced_const= FALSE; 
344
344
  }
345
345
  bool is_null() { return null_value; }
346
346
  void make_const () 
347
347
  { 
348
348
    used_tables_cache= 0; 
349
 
    forced_const= true; 
 
349
    forced_const= TRUE; 
350
350
  }
351
351
  virtual bool const_item() const { return forced_const; }
352
352
  void make_field(Send_field *field);
363
363
  */
364
364
  void no_rows_in_result() { clear(); }
365
365
 
366
 
  virtual bool setup(THD *thd __attribute__((unused))) {return 0;}
 
366
  virtual bool setup(THD *thd __attribute__((__unused__))) {return 0;}
367
367
  virtual void make_unique(void) {}
368
368
  Item *get_tmp_table_item(THD *thd);
369
 
  virtual Field *create_tmp_field(bool group, Table *table,
 
369
  virtual Field *create_tmp_field(bool group, TABLE *table,
370
370
                                  uint convert_blob_length);
371
371
  bool walk(Item_processor processor, bool walk_subquery, uchar *argument);
372
372
  bool init_sum_func_check(THD *thd);
388
388
  */
389
389
  bool is_evaluated;
390
390
public:
391
 
  Item_sum_num() :Item_sum(),is_evaluated(false) {}
 
391
  Item_sum_num() :Item_sum(),is_evaluated(FALSE) {}
392
392
  Item_sum_num(Item *item_par) 
393
 
    :Item_sum(item_par), is_evaluated(false) {}
394
 
  Item_sum_num(Item *a, Item* b) :Item_sum(a,b),is_evaluated(false) {}
 
393
    :Item_sum(item_par), is_evaluated(FALSE) {}
 
394
  Item_sum_num(Item *a, Item* b) :Item_sum(a,b),is_evaluated(FALSE) {}
395
395
  Item_sum_num(List<Item> &list) 
396
 
    :Item_sum(list), is_evaluated(false) {}
 
396
    :Item_sum(list), is_evaluated(FALSE) {}
397
397
  Item_sum_num(THD *thd, Item_sum_num *item) 
398
398
    :Item_sum(thd, item),is_evaluated(item->is_evaluated) {}
399
399
  bool fix_fields(THD *, Item **);
400
 
  int64_t val_int()
 
400
  longlong val_int()
401
401
  {
402
 
    assert(fixed == 1);
403
 
    return (int64_t) rint(val_real());             /* Real as default */
 
402
    DBUG_ASSERT(fixed == 1);
 
403
    return (longlong) rint(val_real());             /* Real as default */
404
404
  }
405
405
  String *val_str(String*str);
406
406
  my_decimal *val_decimal(my_decimal *);
414
414
  Item_sum_int(Item *item_par) :Item_sum_num(item_par) {}
415
415
  Item_sum_int(List<Item> &list) :Item_sum_num(list) {}
416
416
  Item_sum_int(THD *thd, Item_sum_int *item) :Item_sum_num(thd, item) {}
417
 
  double val_real() { assert(fixed == 1); return (double) val_int(); }
 
417
  double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
418
418
  String *val_str(String*str);
419
419
  my_decimal *val_decimal(my_decimal *);
420
420
  enum Item_result result_type () const { return INT_RESULT; }
439
439
  void clear();
440
440
  bool add();
441
441
  double val_real();
442
 
  int64_t val_int();
 
442
  longlong val_int();
443
443
  String *val_str(String*str);
444
444
  my_decimal *val_decimal(my_decimal *);
445
445
  enum Item_result result_type () const { return hybrid_type; }
460
460
{
461
461
protected:
462
462
  /* storage for the summation result */
463
 
  uint64_t count;
 
463
  ulonglong count;
464
464
  Hybrid_type val;
465
465
  /* storage for unique elements */
466
466
  Unique *tree;
467
 
  Table *table;
 
467
  TABLE *table;
468
468
  enum enum_field_types table_field_type;
469
469
  uint tree_key_length;
470
470
protected:
479
479
  bool add();
480
480
  double val_real();
481
481
  my_decimal *val_decimal(my_decimal *);
482
 
  int64_t val_int();
 
482
  longlong val_int();
483
483
  String *val_str(String *str);
484
484
 
485
485
  /* XXX: does it need make_unique? */
536
536
 
537
537
class Item_sum_count :public Item_sum_int
538
538
{
539
 
  int64_t count;
 
539
  longlong count;
540
540
 
541
541
  public:
542
542
  Item_sum_count(Item *item_par)
549
549
  void clear();
550
550
  void no_rows_in_result() { count=0; }
551
551
  bool add();
552
 
  void make_const(int64_t count_arg) 
 
552
  void make_const(longlong count_arg) 
553
553
  { 
554
554
    count=count_arg;
555
555
    Item_sum::make_const();
556
556
  }
557
 
  int64_t val_int();
 
557
  longlong val_int();
558
558
  void reset_field();
559
559
  void cleanup();
560
560
  void update_field();
567
567
 
568
568
class Item_sum_count_distinct :public Item_sum_int
569
569
{
570
 
  Table *table;
571
 
  uint32_t *field_lengths;
 
570
  TABLE *table;
 
571
  uint32 *field_lengths;
572
572
  TMP_TABLE_PARAM *tmp_table_param;
573
573
  bool force_copy_fields;
574
574
  /*
582
582
   will not recalculate on each call. Validitiy of the value is stored in
583
583
   is_evaluated.
584
584
  */
585
 
  int64_t count;
 
585
  longlong count;
586
586
  /*
587
587
    Following is 0 normal object and pointer to original one for copy 
588
588
    (to correctly free resources)
601
601
  Item_sum_count_distinct(List<Item> &list)
602
602
    :Item_sum_int(list), table(0), field_lengths(0), tmp_table_param(0),
603
603
     force_copy_fields(0), tree(0), count(0),
604
 
     original(0), always_null(false)
 
604
     original(0), always_null(FALSE)
605
605
  { quick_group= 0; }
606
606
  Item_sum_count_distinct(THD *thd, Item_sum_count_distinct *item)
607
607
    :Item_sum_int(thd, item), table(item->table),
618
618
  enum Sumfunctype sum_func () const { return COUNT_DISTINCT_FUNC; }
619
619
  void clear();
620
620
  bool add();
621
 
  int64_t val_int();
 
621
  longlong val_int();
622
622
  void reset_field() { return ;}                // Never called
623
623
  void update_field() { return ; }              // Never called
624
624
  const char *func_name() const { return "count(distinct "; }
643
643
  Item_avg_field(Item_result res_type, Item_sum_avg *item);
644
644
  enum Type type() const { return FIELD_AVG_ITEM; }
645
645
  double val_real();
646
 
  int64_t val_int();
 
646
  longlong val_int();
647
647
  my_decimal *val_decimal(my_decimal *);
648
648
  bool is_null() { update_null_value(); return null_value; }
649
649
  String *val_str(String*);
650
650
  enum_field_types field_type() const
651
651
  {
652
652
    return hybrid_type == DECIMAL_RESULT ?
653
 
      DRIZZLE_TYPE_NEWDECIMAL : DRIZZLE_TYPE_DOUBLE;
 
653
      MYSQL_TYPE_NEWDECIMAL : MYSQL_TYPE_DOUBLE;
654
654
  }
655
655
  void fix_length_and_dec() {}
656
656
  enum Item_result result_type () const { return hybrid_type; }
660
660
class Item_sum_avg :public Item_sum_sum
661
661
{
662
662
public:
663
 
  uint64_t count;
 
663
  ulonglong count;
664
664
  uint prec_increment;
665
665
  uint f_precision, f_scale, dec_bin_size;
666
666
 
675
675
  bool add();
676
676
  double val_real();
677
677
  // In SPs we might force the "wrong" type with select into a declare variable
678
 
  int64_t val_int() { return (int64_t) rint(val_real()); }
 
678
  longlong val_int() { return (longlong) rint(val_real()); }
679
679
  my_decimal *val_decimal(my_decimal *);
680
680
  String *val_str(String *str);
681
681
  void reset_field();
682
682
  void update_field();
683
 
  Item *result_item(Field *field __attribute__((unused)))
 
683
  Item *result_item(Field *field __attribute__((__unused__)))
684
684
  { return new Item_avg_field(hybrid_type, this); }
685
685
  void no_rows_in_result() {}
686
686
  const char *func_name() const { return "avg("; }
687
687
  Item *copy_or_same(THD* thd);
688
 
  Field *create_tmp_field(bool group, Table *table, uint convert_blob_length);
 
688
  Field *create_tmp_field(bool group, TABLE *table, uint convert_blob_length);
689
689
  void cleanup()
690
690
  {
691
691
    count= 0;
708
708
  Item_variance_field(Item_sum_variance *item);
709
709
  enum Type type() const {return FIELD_VARIANCE_ITEM; }
710
710
  double val_real();
711
 
  int64_t val_int()
712
 
  { /* can't be fix_fields()ed */ return (int64_t) rint(val_real()); }
 
711
  longlong val_int()
 
712
  { /* can't be fix_fields()ed */ return (longlong) rint(val_real()); }
713
713
  String *val_str(String *str)
714
714
  { return val_string_from_real(str); }
715
715
  my_decimal *val_decimal(my_decimal *dec_buf)
718
718
  enum_field_types field_type() const
719
719
  {
720
720
    return hybrid_type == DECIMAL_RESULT ?
721
 
      DRIZZLE_TYPE_NEWDECIMAL : DRIZZLE_TYPE_DOUBLE;
 
721
      MYSQL_TYPE_NEWDECIMAL : MYSQL_TYPE_DOUBLE;
722
722
  }
723
723
  void fix_length_and_dec() {}
724
724
  enum Item_result result_type () const { return hybrid_type; }
753
753
  Item_result hybrid_type;
754
754
  int cur_dec;
755
755
  double recurrence_m, recurrence_s;    /* Used in recurrence relation. */
756
 
  uint64_t count;
 
756
  ulonglong count;
757
757
  uint f_precision0, f_scale0;
758
758
  uint f_precision1, f_scale1;
759
759
  uint dec_bin_size0, dec_bin_size1;
771
771
  my_decimal *val_decimal(my_decimal *);
772
772
  void reset_field();
773
773
  void update_field();
774
 
  Item *result_item(Field *field __attribute__((unused)))
 
774
  Item *result_item(Field *field __attribute__((__unused__)))
775
775
  { return new Item_variance_field(this); }
776
776
  void no_rows_in_result() {}
777
777
  const char *func_name() const
778
778
    { return sample ? "var_samp(" : "variance("; }
779
779
  Item *copy_or_same(THD* thd);
780
 
  Field *create_tmp_field(bool group, Table *table, uint convert_blob_length);
 
780
  Field *create_tmp_field(bool group, TABLE *table, uint convert_blob_length);
781
781
  enum Item_result result_type () const { return REAL_RESULT; }
782
782
  void cleanup()
783
783
  {
796
796
  double val_real();
797
797
  my_decimal *val_decimal(my_decimal *);
798
798
  enum Item_result result_type () const { return REAL_RESULT; }
799
 
  enum_field_types field_type() const { return DRIZZLE_TYPE_DOUBLE;}
 
799
  enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE;}
800
800
};
801
801
 
802
802
/*
813
813
    {}
814
814
  enum Sumfunctype sum_func () const { return STD_FUNC; }
815
815
  double val_real();
816
 
  Item *result_item(Field *field __attribute__((unused)))
 
816
  Item *result_item(Field *field __attribute__((__unused__)))
817
817
    { return new Item_std_field(this); }
818
818
  const char *func_name() const { return "std("; }
819
819
  Item *copy_or_same(THD* thd);
820
820
  enum Item_result result_type () const { return REAL_RESULT; }
821
 
  enum_field_types field_type() const { return DRIZZLE_TYPE_DOUBLE;}
 
821
  enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE;}
822
822
};
823
823
 
824
824
// This class is a string or number function depending on num_func
828
828
protected:
829
829
  String value,tmp_value;
830
830
  double sum;
831
 
  int64_t sum_int;
 
831
  longlong sum_int;
832
832
  my_decimal sum_dec;
833
833
  Item_result hybrid_type;
834
834
  enum_field_types hybrid_field_type;
838
838
  public:
839
839
  Item_sum_hybrid(Item *item_par,int sign)
840
840
    :Item_sum(item_par), sum(0.0), sum_int(0),
841
 
    hybrid_type(INT_RESULT), hybrid_field_type(DRIZZLE_TYPE_LONGLONG),
842
 
    cmp_sign(sign), was_values(true)
 
841
    hybrid_type(INT_RESULT), hybrid_field_type(MYSQL_TYPE_LONGLONG),
 
842
    cmp_sign(sign), was_values(TRUE)
843
843
  { collation.set(&my_charset_bin); }
844
844
  Item_sum_hybrid(THD *thd, Item_sum_hybrid *item);
845
845
  bool fix_fields(THD *, Item **);
846
846
  void clear();
847
847
  double val_real();
848
 
  int64_t val_int();
 
848
  longlong val_int();
849
849
  my_decimal *val_decimal(my_decimal *);
850
850
  void reset_field();
851
851
  String *val_str(String *);
860
860
  void cleanup();
861
861
  bool any_value() { return was_values; }
862
862
  void no_rows_in_result();
863
 
  Field *create_tmp_field(bool group, Table *table,
 
863
  Field *create_tmp_field(bool group, TABLE *table,
864
864
                          uint convert_blob_length);
865
865
};
866
866
 
894
894
class Item_sum_bit :public Item_sum_int
895
895
{
896
896
protected:
897
 
  uint64_t reset_bits,bits;
 
897
  ulonglong reset_bits,bits;
898
898
 
899
899
public:
900
 
  Item_sum_bit(Item *item_par,uint64_t reset_arg)
 
900
  Item_sum_bit(Item *item_par,ulonglong reset_arg)
901
901
    :Item_sum_int(item_par),reset_bits(reset_arg),bits(reset_arg) {}
902
902
  Item_sum_bit(THD *thd, Item_sum_bit *item):
903
903
    Item_sum_int(thd, item), reset_bits(item->reset_bits), bits(item->bits) {}
904
904
  enum Sumfunctype sum_func () const {return SUM_BIT_FUNC;}
905
905
  void clear();
906
 
  int64_t val_int();
 
906
  longlong val_int();
907
907
  void reset_field();
908
908
  void update_field();
909
909
  void fix_length_and_dec()
930
930
class Item_sum_and :public Item_sum_bit
931
931
{
932
932
  public:
933
 
  Item_sum_and(Item *item_par) :Item_sum_bit(item_par, UINT64_MAX) {}
 
933
  Item_sum_and(Item *item_par) :Item_sum_bit(item_par, ULONGLONG_MAX) {}
934
934
  Item_sum_and(THD *thd, Item_sum_and *item) :Item_sum_bit(thd, item) {}
935
935
  bool add();
936
936
  const char *func_name() const { return "bit_and("; }
952
952
  User defined aggregates
953
953
*/
954
954
 
 
955
#ifdef HAVE_DLOPEN
 
956
 
955
957
class Item_udf_sum : public Item_sum
956
958
{
957
959
protected:
966
968
  { quick_group=0;}
967
969
  Item_udf_sum(THD *thd, Item_udf_sum *item)
968
970
    :Item_sum(thd, item), udf(item->udf)
969
 
  { udf.not_original= true; }
 
971
  { udf.not_original= TRUE; }
970
972
  const char *func_name() const { return udf.name(); }
971
973
  bool fix_fields(THD *thd, Item **ref)
972
974
  {
973
 
    assert(fixed == 0);
 
975
    DBUG_ASSERT(fixed == 0);
974
976
 
975
977
    if (init_sum_func_check(thd))
976
 
      return true;
 
978
      return TRUE;
977
979
 
978
980
    fixed= 1;
979
981
    if (udf.fix_fields(thd, this, this->arg_count, this->args))
980
 
      return true;
 
982
      return TRUE;
981
983
 
982
984
    return check_sum_func(thd, ref);
983
985
  }
1002
1004
    :Item_udf_sum(udf_arg, list) {}
1003
1005
  Item_sum_udf_float(THD *thd, Item_sum_udf_float *item)
1004
1006
    :Item_udf_sum(thd, item) {}
1005
 
  int64_t val_int()
 
1007
  longlong val_int()
1006
1008
  {
1007
 
    assert(fixed == 1);
1008
 
    return (int64_t) rint(Item_sum_udf_float::val_real());
 
1009
    DBUG_ASSERT(fixed == 1);
 
1010
    return (longlong) rint(Item_sum_udf_float::val_real());
1009
1011
  }
1010
1012
  double val_real();
1011
1013
  String *val_str(String*str);
1024
1026
    :Item_udf_sum(udf_arg, list) {}
1025
1027
  Item_sum_udf_int(THD *thd, Item_sum_udf_int *item)
1026
1028
    :Item_udf_sum(thd, item) {}
1027
 
  int64_t val_int();
 
1029
  longlong val_int();
1028
1030
  double val_real()
1029
 
    { assert(fixed == 1); return (double) Item_sum_udf_int::val_int(); }
 
1031
    { DBUG_ASSERT(fixed == 1); return (double) Item_sum_udf_int::val_int(); }
1030
1032
  String *val_str(String*str);
1031
1033
  my_decimal *val_decimal(my_decimal *);
1032
1034
  enum Item_result result_type () const { return INT_RESULT; }
1054
1056
    return res ? my_strntod(res->charset(),(char*) res->ptr(),res->length(),
1055
1057
                            &end_not_used, &err_not_used) : 0.0;
1056
1058
  }
1057
 
  int64_t val_int()
 
1059
  longlong val_int()
1058
1060
  {
1059
1061
    int err_not_used;
1060
1062
    char *end;
1061
1063
    String *res;
1062
 
    const CHARSET_INFO *cs;
 
1064
    CHARSET_INFO *cs;
1063
1065
 
1064
1066
    if (!(res= val_str(&str_value)))
1065
1067
      return 0;                                 /* Null value */
1085
1087
    :Item_udf_sum(thd, item) {}
1086
1088
  String *val_str(String *);
1087
1089
  double val_real();
1088
 
  int64_t val_int();
 
1090
  longlong val_int();
1089
1091
  my_decimal *val_decimal(my_decimal *);
1090
1092
  enum Item_result result_type () const { return DECIMAL_RESULT; }
1091
1093
  void fix_length_and_dec() { fix_num_length_and_dec(); }
1092
1094
  Item *copy_or_same(THD* thd);
1093
1095
};
1094
1096
 
1095
 
class DRIZZLE_ERROR;
 
1097
#else /* Dummy functions to get sql_yacc.cc compiled */
 
1098
 
 
1099
class Item_sum_udf_float :public Item_sum_num
 
1100
{
 
1101
 public:
 
1102
  Item_sum_udf_float(udf_func *udf_arg)
 
1103
    :Item_sum_num() {}
 
1104
  Item_sum_udf_float(udf_func *udf_arg, List<Item> &list) :Item_sum_num() {}
 
1105
  Item_sum_udf_float(THD *thd, Item_sum_udf_float *item)
 
1106
    :Item_sum_num(thd, item) {}
 
1107
  enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
 
1108
  double val_real() { DBUG_ASSERT(fixed == 1); return 0.0; }
 
1109
  void clear() {}
 
1110
  bool add() { return 0; }  
 
1111
  void update_field() {}
 
1112
};
 
1113
 
 
1114
 
 
1115
class Item_sum_udf_int :public Item_sum_num
 
1116
{
 
1117
public:
 
1118
  Item_sum_udf_int(udf_func *udf_arg)
 
1119
    :Item_sum_num() {}
 
1120
  Item_sum_udf_int(udf_func *udf_arg, List<Item> &list) :Item_sum_num() {}
 
1121
  Item_sum_udf_int(THD *thd, Item_sum_udf_int *item)
 
1122
    :Item_sum_num(thd, item) {}
 
1123
  enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
 
1124
  longlong val_int() { DBUG_ASSERT(fixed == 1); return 0; }
 
1125
  double val_real() { DBUG_ASSERT(fixed == 1); return 0; }
 
1126
  void clear() {}
 
1127
  bool add() { return 0; }  
 
1128
  void update_field() {}
 
1129
};
 
1130
 
 
1131
 
 
1132
class Item_sum_udf_decimal :public Item_sum_num
 
1133
{
 
1134
 public:
 
1135
  Item_sum_udf_decimal(udf_func *udf_arg)
 
1136
    :Item_sum_num() {}
 
1137
  Item_sum_udf_decimal(udf_func *udf_arg, List<Item> &list)
 
1138
    :Item_sum_num() {}
 
1139
  Item_sum_udf_decimal(THD *thd, Item_sum_udf_float *item)
 
1140
    :Item_sum_num(thd, item) {}
 
1141
  enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
 
1142
  double val_real() { DBUG_ASSERT(fixed == 1); return 0.0; }
 
1143
  my_decimal *val_decimal(my_decimal *) { DBUG_ASSERT(fixed == 1); return 0; }
 
1144
  void clear() {}
 
1145
  bool add() { return 0; }
 
1146
  void update_field() {}
 
1147
};
 
1148
 
 
1149
 
 
1150
class Item_sum_udf_str :public Item_sum_num
 
1151
{
 
1152
public:
 
1153
  Item_sum_udf_str(udf_func *udf_arg)
 
1154
    :Item_sum_num() {}
 
1155
  Item_sum_udf_str(udf_func *udf_arg, List<Item> &list)
 
1156
    :Item_sum_num() {}
 
1157
  Item_sum_udf_str(THD *thd, Item_sum_udf_str *item)
 
1158
    :Item_sum_num(thd, item) {}
 
1159
  String *val_str(String *)
 
1160
    { DBUG_ASSERT(fixed == 1); null_value=1; return 0; }
 
1161
  double val_real() { DBUG_ASSERT(fixed == 1); null_value=1; return 0.0; }
 
1162
  longlong val_int() { DBUG_ASSERT(fixed == 1); null_value=1; return 0; }
 
1163
  enum Item_result result_type () const { return STRING_RESULT; }
 
1164
  void fix_length_and_dec() { maybe_null=1; max_length=0; }
 
1165
  enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
 
1166
  void clear() {}
 
1167
  bool add() { return 0; }  
 
1168
  void update_field() {}
 
1169
};
 
1170
 
 
1171
#endif /* HAVE_DLOPEN */
 
1172
 
 
1173
class MYSQL_ERROR;
1096
1174
 
1097
1175
class Item_func_group_concat : public Item_sum
1098
1176
{
1099
1177
  TMP_TABLE_PARAM *tmp_table_param;
1100
 
  DRIZZLE_ERROR *warning;
 
1178
  MYSQL_ERROR *warning;
1101
1179
  String result;
1102
1180
  String *separator;
1103
1181
  TREE tree_base;
1111
1189
     @see Item_func_group_concat::clear
1112
1190
   */
1113
1191
  Unique *unique_filter;
1114
 
  Table *table;
1115
 
  order_st **order;
 
1192
  TABLE *table;
 
1193
  ORDER **order;
1116
1194
  Name_resolution_context *context;
1117
1195
  /** The number of ORDER BY items. */
1118
1196
  uint arg_count_order;
1153
1231
  enum_field_types field_type() const
1154
1232
  {
1155
1233
    if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB )
1156
 
      return DRIZZLE_TYPE_BLOB;
 
1234
      return MYSQL_TYPE_BLOB;
1157
1235
    else
1158
 
      return DRIZZLE_TYPE_VARCHAR;
 
1236
      return MYSQL_TYPE_VARCHAR;
1159
1237
  }
1160
1238
  void clear();
1161
1239
  bool add();
1162
 
  void reset_field() { assert(0); }        // not used
1163
 
  void update_field() { assert(0); }       // not used
 
1240
  void reset_field() { DBUG_ASSERT(0); }        // not used
 
1241
  void update_field() { DBUG_ASSERT(0); }       // not used
1164
1242
  bool fix_fields(THD *,Item **);
1165
1243
  bool setup(THD *thd);
1166
1244
  void make_unique();
1169
1247
    String *res;  res=val_str(&str_value);
1170
1248
    return res ? my_atof(res->c_ptr()) : 0.0;
1171
1249
  }
1172
 
  int64_t val_int()
 
1250
  longlong val_int()
1173
1251
  {
1174
1252
    String *res;
1175
1253
    char *end_ptr;
1176
1254
    int error;
1177
1255
    if (!(res= val_str(&str_value)))
1178
 
      return (int64_t) 0;
 
1256
      return (longlong) 0;
1179
1257
    end_ptr= (char*) res->ptr()+ res->length();
1180
1258
    return my_strtoll10(res->ptr(), &end_ptr, &error);
1181
1259
  }
1188
1266
  void no_rows_in_result() {}
1189
1267
  virtual void print(String *str, enum_query_type query_type);
1190
1268
  virtual bool change_context_processor(uchar *cntx)
1191
 
    { context= (Name_resolution_context *)cntx; return false; }
 
1269
    { context= (Name_resolution_context *)cntx; return FALSE; }
1192
1270
};