~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/cmpfunc.h

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
/* compare and test functions */
24
24
 
25
 
#include <drizzled/common.h>
26
 
#include <drizzled/comp_creator.h>
27
 
#include <drizzled/function/math/int.h>
28
 
#include <drizzled/function/numhybrid.h>
29
 
#include <drizzled/item/decimal.h>
30
 
#include <drizzled/item/float.h>
31
 
#include <drizzled/item/function/boolean.h>
32
 
#include <drizzled/item/int.h>
33
 
#include <drizzled/item/row.h>
34
 
#include <drizzled/item/string.h>
35
 
#include <drizzled/item/sum.h>
36
 
#include <drizzled/qsort_cmp.h>
 
25
#include "drizzled/comp_creator.h"
 
26
#include "drizzled/item/row.h"
 
27
#include "drizzled/item/sum.h"
 
28
#include "drizzled/item/int.h"
 
29
#include "drizzled/item/float.h"
 
30
#include "drizzled/item/string.h"
 
31
#include "drizzled/item/decimal.h"
 
32
#include "drizzled/function/math/int.h"
 
33
#include "drizzled/function/numhybrid.h"
 
34
#include "drizzled/common.h"
 
35
#include "drizzled/qsort_cmp.h"
 
36
#include "drizzled/item/function/boolean.h"
37
37
 
38
38
namespace drizzled
39
39
{
75
75
public:
76
76
  DTCollation cmp_collation;
77
77
 
78
 
  Arg_comparator();
 
78
  Arg_comparator():
 
79
    session(current_session),
 
80
    a_cache(0),
 
81
    b_cache(0)
 
82
  {};
79
83
 
80
 
  Arg_comparator(Item **a1, Item **a2);
 
84
  Arg_comparator(Item **a1, Item **a2):
 
85
    a(a1),
 
86
    b(a2),
 
87
    session(current_session),
 
88
    a_cache(0),
 
89
    b_cache(0)
 
90
  {};
81
91
 
82
92
  int set_compare_func(Item_bool_func2 *owner, Item_result type);
83
93
  inline int set_compare_func(Item_bool_func2 *owner_arg)
880
890
  /* Cache for the left item. */
881
891
  Item *lval_cache;
882
892
 
883
 
  in_datetime(Item *warn_item_arg, uint32_t elements);
884
 
 
 
893
  in_datetime(Item *warn_item_arg, uint32_t elements)
 
894
    :in_int64_t(elements), session(current_session), warn_item(warn_item_arg),
 
895
     lval_cache(0) {};
885
896
  void set(uint32_t pos,Item *item);
886
897
  unsigned char *get_value(Item *item);
887
898
  friend int cmp_int64_t(void *cmp_arg, packed_int64_t *a,packed_int64_t *b);
1042
1053
  /* Cache for the left item. */
1043
1054
  Item *lval_cache;
1044
1055
 
1045
 
  cmp_item_datetime(Item *warn_item_arg);
1046
 
 
 
1056
  cmp_item_datetime(Item *warn_item_arg)
 
1057
    :session(current_session), warn_item(warn_item_arg), lval_cache(0) {}
1047
1058
  void store_value(Item *item);
1048
1059
  int cmp(Item *arg);
1049
1060
  int compare(cmp_item *ci);
1540
1551
 
1541
1552
class Item_equal: public item::function::Boolean
1542
1553
{
 
1554
  List<Item_field> fields; /* list of equal field items                    */
 
1555
  Item *const_item;        /* optional constant item equal to fields items */
 
1556
  cmp_item *eval_item;
 
1557
  bool cond_false;
 
1558
 
1543
1559
public:
1544
 
  typedef List<Item_field> fields_t;
1545
 
 
1546
 
  Item_equal() :
 
1560
  inline Item_equal() :
 
1561
    item::function::Boolean(),
1547
1562
    const_item(0),
1548
1563
    eval_item(0),
1549
1564
    cond_false(0)
1551
1566
    const_item_cache=0;
1552
1567
  }
1553
1568
 
1554
 
  fields_t::iterator begin()
1555
 
  {
1556
 
    return fields.begin();
1557
 
  }
1558
 
 
1559
1569
  Item_equal(Item_field *f1, Item_field *f2);
1560
1570
  Item_equal(Item *c, Item_field *f);
1561
1571
  Item_equal(Item_equal *item_equal);
1581
1591
  virtual void print(String *str, enum_query_type query_type);
1582
1592
  const CHARSET_INFO *compare_collation()
1583
1593
  { return fields.head()->collation.collation; }
1584
 
private:
1585
 
  fields_t fields; /* list of equal field items                    */
1586
 
  Item *const_item;        /* optional constant item equal to fields items */
1587
 
  cmp_item *eval_item;
1588
 
  bool cond_false;
1589
 
 
1590
1594
};
1591
1595
 
1592
1596
class COND_EQUAL: public memory::SqlAlloc
1604
1608
};
1605
1609
 
1606
1610
 
1607
 
class Item_equal_iterator : public List<Item_field>::iterator
 
1611
class Item_equal_iterator : public List_iterator_fast<Item_field>
1608
1612
{
1609
1613
public:
1610
1614
  inline Item_equal_iterator(Item_equal &item_equal)
1611
 
    :List<Item_field>::iterator (item_equal.fields.begin() )
 
1615
    :List_iterator_fast<Item_field> (item_equal.fields)
1612
1616
  {}
1613
1617
  inline Item_field* operator++(int)
1614
1618
  {
1615
 
    Item_field *item= (*(List<Item_field>::iterator *) this)++;
 
1619
    Item_field *item= (*(List_iterator_fast<Item_field> *) this)++;
1616
1620
    return  item;
1617
1621
  }
 
1622
  inline void rewind(void)
 
1623
  {
 
1624
    List_iterator_fast<Item_field>::rewind();
 
1625
  }
1618
1626
};
1619
1627
 
1620
1628
class Item_cond_and :public Item_cond