~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item_cmpfunc.h

  • Committer: Brian Aker
  • Date: 2008-10-06 06:47:29 UTC
  • Revision ID: brian@tangent.org-20081006064729-2i9mhjkzyvow9xsm
RemoveĀ uint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
112
112
  Item_bool_func(THD *thd, Item_bool_func *item) :Item_int_func(thd, item) {}
113
113
  bool is_bool_func() { return 1; }
114
114
  void fix_length_and_dec() { decimals=0; max_length=1; }
115
 
  uint decimal_precision() const { return 1; }
 
115
  uint32_t decimal_precision() const { return 1; }
116
116
};
117
117
 
118
118
 
352
352
  bool is_null() { return test(args[0]->is_null() || args[1]->is_null()); }
353
353
  bool is_bool_func() { return 1; }
354
354
  const CHARSET_INFO *compare_collation() { return cmp.cmp_collation.collation; }
355
 
  uint decimal_precision() const { return 1; }
 
355
  uint32_t decimal_precision() const { return 1; }
356
356
  void top_level_item() { abort_on_null= true; }
357
357
 
358
358
  friend class  Arg_comparator;
611
611
  virtual void print(String *str, enum_query_type query_type);
612
612
  bool is_bool_func() { return 1; }
613
613
  const CHARSET_INFO *compare_collation() { return cmp_collation.collation; }
614
 
  uint decimal_precision() const { return 1; }
 
614
  uint32_t decimal_precision() const { return 1; }
615
615
};
616
616
 
617
617
 
651
651
  int64_t val_int();
652
652
  void fix_length_and_dec();
653
653
  const char *func_name() const { return "interval"; }
654
 
  uint decimal_precision() const { return 2; }
 
654
  uint32_t decimal_precision() const { return 2; }
655
655
};
656
656
 
657
657
 
689
689
  void fix_length_and_dec();
690
690
  const char *func_name() const { return "ifnull"; }
691
691
  Field *tmp_table_field(Table *table);
692
 
  uint decimal_precision() const;
 
692
  uint32_t decimal_precision() const;
693
693
};
694
694
 
695
695
 
709
709
  enum_field_types field_type() const { return cached_field_type; }
710
710
  bool fix_fields(THD *, Item **);
711
711
  void fix_length_and_dec();
712
 
  uint decimal_precision() const;
 
712
  uint32_t decimal_precision() const;
713
713
  const char *func_name() const { return "if"; }
714
714
};
715
715
 
727
727
  my_decimal *val_decimal(my_decimal *);
728
728
  enum Item_result result_type () const { return cached_result_type; }
729
729
  void fix_length_and_dec();
730
 
  uint decimal_precision() const { return args[0]->decimal_precision(); }
 
730
  uint32_t decimal_precision() const { return args[0]->decimal_precision(); }
731
731
  const char *func_name() const { return "nullif"; }
732
732
 
733
733
  virtual inline void print(String *str, enum_query_type query_type)
749
749
{
750
750
public:
751
751
  char *base;
752
 
  uint size;
 
752
  uint32_t size;
753
753
  qsort2_cmp compare;
754
754
  const CHARSET_INFO *collation;
755
 
  uint count;
756
 
  uint used_count;
 
755
  uint32_t count;
 
756
  uint32_t used_count;
757
757
  in_vector() {}
758
 
  in_vector(uint elements,uint element_length,qsort2_cmp cmp_func, 
 
758
  in_vector(uint32_t elements,uint32_t element_length,qsort2_cmp cmp_func, 
759
759
            const CHARSET_INFO * const cmp_coll)
760
760
    :base((char*) sql_calloc(elements*element_length)),
761
761
     size(element_length), compare(cmp_func), collation(cmp_coll),
762
762
     count(elements), used_count(elements) {}
763
763
  virtual ~in_vector() {}
764
 
  virtual void set(uint pos,Item *item)=0;
 
764
  virtual void set(uint32_t pos,Item *item)=0;
765
765
  virtual unsigned char *get_value(Item *item)=0;
766
766
  void sort()
767
767
  {
787
787
        item  Constant item to store value into. The item must be of the same
788
788
              type that create_item() returns.
789
789
  */
790
 
  virtual void value_to_item(uint pos __attribute__((unused)),
 
790
  virtual void value_to_item(uint32_t pos __attribute__((unused)),
791
791
                             Item *item __attribute__((unused))) { }
792
792
  
793
793
  /* Compare values number pos1 and pos2 for equality */
794
 
  bool compare_elems(uint pos1, uint pos2)
 
794
  bool compare_elems(uint32_t pos1, uint32_t pos2)
795
795
  {
796
796
    return test(compare(collation, base + pos1*size, base + pos2*size));
797
797
  }
803
803
  char buff[STRING_BUFFER_USUAL_SIZE];
804
804
  String tmp;
805
805
public:
806
 
  in_string(uint elements,qsort2_cmp cmp_func, const CHARSET_INFO * const cs);
 
806
  in_string(uint32_t elements,qsort2_cmp cmp_func, const CHARSET_INFO * const cs);
807
807
  ~in_string();
808
 
  void set(uint pos,Item *item);
 
808
  void set(uint32_t pos,Item *item);
809
809
  unsigned char *get_value(Item *item);
810
810
  Item* create_item()
811
811
  { 
812
812
    return new Item_string(collation);
813
813
  }
814
 
  void value_to_item(uint pos, Item *item)
 
814
  void value_to_item(uint32_t pos, Item *item)
815
815
  {    
816
816
    String *str=((String*) base)+pos;
817
817
    Item_string *to= (Item_string*)item;
834
834
    int64_t unsigned_flag;  // Use int64_t, not bool, to preserve alignment
835
835
  } tmp;
836
836
public:
837
 
  in_int64_t(uint elements);
838
 
  void set(uint pos,Item *item);
 
837
  in_int64_t(uint32_t elements);
 
838
  void set(uint32_t pos,Item *item);
839
839
  unsigned char *get_value(Item *item);
840
840
  
841
841
  Item* create_item()
846
846
    */
847
847
    return new Item_int((int64_t)0);
848
848
  }
849
 
  void value_to_item(uint pos, Item *item)
 
849
  void value_to_item(uint32_t pos, Item *item)
850
850
  {
851
851
    ((Item_int*) item)->value= ((packed_int64_t*) base)[pos].val;
852
852
    ((Item_int*) item)->unsigned_flag= (bool)
873
873
  /* Cache for the left item. */
874
874
  Item *lval_cache;
875
875
 
876
 
  in_datetime(Item *warn_item_arg, uint elements)
 
876
  in_datetime(Item *warn_item_arg, uint32_t elements)
877
877
    :in_int64_t(elements), thd(current_thd), warn_item(warn_item_arg),
878
878
     lval_cache(0) {};
879
 
  void set(uint pos,Item *item);
 
879
  void set(uint32_t pos,Item *item);
880
880
  unsigned char *get_value(Item *item);
881
881
  friend int cmp_int64_t(void *cmp_arg, packed_int64_t *a,packed_int64_t *b);
882
882
};
886
886
{
887
887
  double tmp;
888
888
public:
889
 
  in_double(uint elements);
890
 
  void set(uint pos,Item *item);
 
889
  in_double(uint32_t elements);
 
890
  void set(uint32_t pos,Item *item);
891
891
  unsigned char *get_value(Item *item);
892
892
  Item *create_item()
893
893
  { 
894
894
    return new Item_float(0.0, 0);
895
895
  }
896
 
  void value_to_item(uint pos, Item *item)
 
896
  void value_to_item(uint32_t pos, Item *item)
897
897
  {
898
898
    ((Item_float*)item)->value= ((double*) base)[pos];
899
899
  }
905
905
{
906
906
  my_decimal val;
907
907
public:
908
 
  in_decimal(uint elements);
909
 
  void set(uint pos, Item *item);
 
908
  in_decimal(uint32_t elements);
 
909
  void set(uint32_t pos, Item *item);
910
910
  unsigned char *get_value(Item *item);
911
911
  Item *create_item()
912
912
  { 
913
913
    return new Item_decimal(0, false);
914
914
  }
915
 
  void value_to_item(uint pos, Item *item)
 
915
  void value_to_item(uint32_t pos, Item *item)
916
916
  {
917
917
    my_decimal *dec= ((my_decimal *)base) + pos;
918
918
    Item_decimal *item_dec= (Item_decimal*)item;
1130
1130
  int first_expr_num, else_expr_num;
1131
1131
  enum Item_result cached_result_type, left_result_type;
1132
1132
  String tmp_value;
1133
 
  uint ncases;
 
1133
  uint32_t ncases;
1134
1134
  Item_result cmp_type;
1135
1135
  DTCollation cmp_collation;
1136
1136
  enum_field_types cached_field_type;
1161
1161
  my_decimal *val_decimal(my_decimal *);
1162
1162
  bool fix_fields(THD *thd, Item **ref);
1163
1163
  void fix_length_and_dec();
1164
 
  uint decimal_precision() const;
 
1164
  uint32_t decimal_precision() const;
1165
1165
  table_map not_null_tables() const { return 0; }
1166
1166
  enum Item_result result_type () const { return cached_result_type; }
1167
1167
  enum_field_types field_type() const { return cached_field_type; }
1216
1216
  int64_t val_int();
1217
1217
  bool fix_fields(THD *, Item **);
1218
1218
  void fix_length_and_dec();
1219
 
  uint decimal_precision() const { return 1; }
 
1219
  uint32_t decimal_precision() const { return 1; }
1220
1220
  void cleanup()
1221
1221
  {
1222
 
    uint i;
 
1222
    uint32_t i;
1223
1223
    Item_int_func::cleanup();
1224
1224
    delete array;
1225
1225
    array= 0;
1243
1243
class cmp_item_row :public cmp_item
1244
1244
{
1245
1245
  cmp_item **comparators;
1246
 
  uint n;
 
1246
  uint32_t n;
1247
1247
public:
1248
1248
  cmp_item_row(): comparators(0), n(0) {}
1249
1249
  ~cmp_item_row();
1261
1261
{
1262
1262
  cmp_item_row tmp;
1263
1263
public:
1264
 
  in_row(uint elements, Item *);
 
1264
  in_row(uint32_t elements, Item *);
1265
1265
  ~in_row();
1266
 
  void set(uint pos,Item *item);
 
1266
  void set(uint32_t pos,Item *item);
1267
1267
  unsigned char *get_value(Item *item);
1268
1268
  friend void Item_func_in::fix_length_and_dec();
1269
1269
  Item_result result_type() { return ROW_RESULT; }
1539
1539
  inline Item* get_const() { return const_item; }
1540
1540
  void add(Item *c);
1541
1541
  void add(Item_field *f);
1542
 
  uint members();
 
1542
  uint32_t members();
1543
1543
  bool contains(Field *field);
1544
1544
  Item_field* get_first() { return fields.head(); }
1545
1545
  void merge(Item_equal *item);
1563
1563
class COND_EQUAL: public Sql_alloc
1564
1564
{
1565
1565
public:
1566
 
  uint max_members;               /* max number of members the current level
 
1566
  uint32_t max_members;               /* max number of members the current level
1567
1567
                                     list and all lower level lists */ 
1568
1568
  COND_EQUAL *upper_levels;       /* multiple equalities of upper and levels */
1569
1569
  List<Item_equal> current_level; /* list of multiple equalities of