~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/func.h

  • Committer: Lee Bieber
  • Date: 2011-03-29 22:31:41 UTC
  • mfrom: (2257.1.3 build)
  • Revision ID: kalebral@gmail.com-20110329223141-yxc22h3l2he58sk0
Merge Andrew - 743842: Build failure using GCC 4.6
Merge Stewart - 738022: CachedDirectory silently fails to add entries if stat() fails
Merge Olaf - Common fwd: add copyright, add more declaration

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#ifndef DRIZZLED_FUNCTION_FUNC_H
21
 
#define DRIZZLED_FUNCTION_FUNC_H
 
20
 
 
21
 
 
22
#pragma once
22
23
 
23
24
/// TODO: Rename this file - func.h is stupid.
24
25
 
 
26
#include <drizzled/charset_info.h>
25
27
#include <drizzled/item.h>
 
28
#include <drizzled/item/bin_string.h>
 
29
#include <drizzled/lex_string.h>
26
30
#include <drizzled/sql_list.h>
27
 
#include <drizzled/item/bin_string.h>
28
 
#include "drizzled/current_session.h"
 
31
#include <drizzled/type/decimal.h>
 
32
 
 
33
#include <drizzled/visibility.h>
29
34
 
30
35
namespace drizzled
31
36
{
32
37
 
33
 
class Item_func :public Item_result_field
 
38
class DRIZZLED_API Item_func :
 
39
  public Item_result_field
34
40
{
35
41
  Session &_session;
36
42
 
41
47
    0 means get this number from first argument
42
48
  */
43
49
  uint32_t allowed_arg_cols;
 
50
 
44
51
public:
45
52
 
46
53
  using Item::split_sum_func;
65
72
  virtual enum Functype functype() const   { return UNKNOWN_FUNC; }
66
73
  virtual ~Item_func() {}
67
74
 
68
 
  Item_func(void):
69
 
    _session(*current_session),
70
 
    allowed_arg_cols(1), arg_count(0)
71
 
  {
72
 
    with_sum_func= 0;
73
 
    collation.set(DERIVATION_SYSCONST);
74
 
  }
 
75
  Item_func(void);
75
76
 
76
 
  Item_func(Item *a):
77
 
    _session(*current_session),
78
 
    allowed_arg_cols(1), arg_count(1)
79
 
  {
80
 
    args= tmp_arg;
81
 
    args[0]= a;
82
 
    with_sum_func= a->with_sum_func;
83
 
    collation.set(DERIVATION_SYSCONST);
84
 
  }
85
 
  
86
 
  Item_func(Item *a,Item *b):
87
 
    _session(*current_session),
88
 
    allowed_arg_cols(1), arg_count(2)
89
 
  {
90
 
    args= tmp_arg;
91
 
    args[0]= a; args[1]= b;
92
 
    with_sum_func= a->with_sum_func || b->with_sum_func;
93
 
    collation.set(DERIVATION_SYSCONST);
94
 
  }
95
 
  
96
 
  Item_func(Item *a,Item *b,Item *c):
97
 
    _session(*current_session),
98
 
    allowed_arg_cols(1)
99
 
  {
100
 
    arg_count= 0;
101
 
    if ((args= (Item**) memory::sql_alloc(sizeof(Item*)*3)))
102
 
    {
103
 
      arg_count= 3;
104
 
      args[0]= a; args[1]= b; args[2]= c;
105
 
      with_sum_func= a->with_sum_func || b->with_sum_func || c->with_sum_func;
106
 
    }
107
 
    collation.set(DERIVATION_SYSCONST);
108
 
  }
109
 
  
110
 
  Item_func(Item *a,Item *b,Item *c,Item *d):
111
 
    _session(*current_session),
112
 
    allowed_arg_cols(1)
113
 
  {
114
 
    arg_count= 0;
115
 
    if ((args= (Item**) memory::sql_alloc(sizeof(Item*)*4)))
116
 
    {
117
 
      arg_count= 4;
118
 
      args[0]= a; args[1]= b; args[2]= c; args[3]= d;
119
 
      with_sum_func= a->with_sum_func || b->with_sum_func ||
120
 
        c->with_sum_func || d->with_sum_func;
121
 
    }
122
 
    collation.set(DERIVATION_SYSCONST);
123
 
  }
124
 
  
125
 
  Item_func(Item *a,Item *b,Item *c,Item *d,Item* e):
126
 
    _session(*current_session),
127
 
    allowed_arg_cols(1)
128
 
  {
129
 
    arg_count= 5;
130
 
    if ((args= (Item**) memory::sql_alloc(sizeof(Item*)*5)))
131
 
    {
132
 
      args[0]= a; args[1]= b; args[2]= c; args[3]= d; args[4]= e;
133
 
      with_sum_func= a->with_sum_func || b->with_sum_func ||
134
 
        c->with_sum_func || d->with_sum_func || e->with_sum_func ;
135
 
    }
136
 
    collation.set(DERIVATION_SYSCONST);
137
 
  }
 
77
  Item_func(Item *a);
 
78
  
 
79
  Item_func(Item *a,Item *b);
 
80
  
 
81
  Item_func(Item *a,Item *b,Item *c);
 
82
  
 
83
  Item_func(Item *a,Item *b,Item *c,Item *d);
 
84
  
 
85
  Item_func(Item *a,Item *b,Item *c,Item *d,Item* e);
138
86
  
139
87
  Item_func(List<Item> &list);
140
88
  
175
123
  virtual void split_sum_func(Session *session, Item **ref_pointer_array,
176
124
                              List<Item> &fields);
177
125
 
178
 
  virtual void print(String *str, enum_query_type query_type);
179
 
  void print_op(String *str, enum_query_type query_type);
180
 
  void print_args(String *str, uint32_t from, enum_query_type query_type);
 
126
  virtual void print(String *str);
 
127
  void print_op(String *str);
 
128
  void print_args(String *str, uint32_t from);
181
129
  virtual void fix_num_length_and_dec();
182
130
  void count_only_length();
183
131
  void count_real_length();
184
132
  void count_decimal_length();
185
133
 
186
 
  bool get_arg0_date(DRIZZLE_TIME *ltime, uint32_t fuzzy_date);
187
 
  bool get_arg0_time(DRIZZLE_TIME *ltime);
 
134
  bool get_arg0_date(type::Time &ltime, uint32_t fuzzy_date);
 
135
  bool get_arg0_time(type::Time &ltime);
188
136
 
189
137
  bool is_null();
190
138
 
 
139
  virtual bool deterministic() const
 
140
  {
 
141
    return false;
 
142
  }
 
143
 
191
144
  void signal_divide_by_null();
192
145
 
193
146
  virtual Field *tmp_table_field() { return result_field; }
195
148
 
196
149
  Item *get_tmp_table_item(Session *session);
197
150
 
198
 
  my_decimal *val_decimal(my_decimal *);
 
151
  type::Decimal *val_decimal(type::Decimal *);
199
152
 
200
153
  bool agg_arg_collations(DTCollation &c, Item **items, uint32_t nitems,
201
154
                          uint32_t flags);
227
180
} /* namespace drizzled */
228
181
 
229
182
 
230
 
#endif /* DRIZZLED_FUNCTION_FUNC_H */