~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/func.cc

  • Committer: Brian Aker
  • Date: 2011-02-14 06:32:03 UTC
  • mfrom: (2154.2.24 drizzle-build)
  • Revision ID: brian@tangent.org-20110214063203-vp3rlbednkovtegj
Merge in the last of the header fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
#include "config.h"
21
21
 
22
 
#include <drizzled/sql_string.h>
23
 
#include <drizzled/sql_list.h>
24
 
 
25
 
#include <drizzled/function/math/int.h>
 
22
#include <drizzled/check_stack_overrun.h>
 
23
#include <drizzled/current_session.h>
 
24
#include <drizzled/error.h>
 
25
#include <drizzled/field/decimal.h>
 
26
#include <drizzled/field/double.h>
26
27
#include <drizzled/field/int32.h>
27
28
#include <drizzled/field/int64.h>
28
 
#include <drizzled/field/decimal.h>
29
 
#include <drizzled/field/double.h>
30
29
#include <drizzled/field/size.h>
 
30
#include <drizzled/function/math/int.h>
31
31
#include <drizzled/session.h>
32
 
#include <drizzled/error.h>
33
 
#include <drizzled/check_stack_overrun.h>
 
32
#include <drizzled/sql_list.h>
 
33
#include <drizzled/sql_string.h>
 
34
 
34
35
#include <limits>
35
36
#include <algorithm>
36
37
 
40
41
{
41
42
 
42
43
 
 
44
Item_func::Item_func(void):
 
45
  _session(*current_session),
 
46
  allowed_arg_cols(1), arg_count(0),
 
47
  const_item_cache(false)
 
48
  {
 
49
    with_sum_func= 0;
 
50
    collation.set(DERIVATION_SYSCONST);
 
51
  }
 
52
 
 
53
Item_func::Item_func(Item *a):
 
54
  _session(*current_session),
 
55
  allowed_arg_cols(1), arg_count(1),
 
56
  const_item_cache(false)
 
57
  {
 
58
    args= tmp_arg;
 
59
    args[0]= a;
 
60
    with_sum_func= a->with_sum_func;
 
61
    collation.set(DERIVATION_SYSCONST);
 
62
  }
 
63
 
 
64
Item_func::Item_func(Item *a,Item *b):
 
65
  _session(*current_session),
 
66
  allowed_arg_cols(1), arg_count(2),
 
67
  const_item_cache(false)
 
68
  {
 
69
    args= tmp_arg;
 
70
    args[0]= a; args[1]= b;
 
71
    with_sum_func= a->with_sum_func || b->with_sum_func;
 
72
    collation.set(DERIVATION_SYSCONST);
 
73
  }
 
74
 
 
75
Item_func::Item_func(Item *a,Item *b,Item *c):
 
76
  _session(*current_session),
 
77
  allowed_arg_cols(1),
 
78
  const_item_cache(false)
 
79
  {
 
80
    arg_count= 0;
 
81
    if ((args= (Item**) memory::sql_alloc(sizeof(Item*)*3)))
 
82
    {
 
83
      arg_count= 3;
 
84
      args[0]= a; args[1]= b; args[2]= c;
 
85
      with_sum_func= a->with_sum_func || b->with_sum_func || c->with_sum_func;
 
86
    }
 
87
    collation.set(DERIVATION_SYSCONST);
 
88
  }
 
89
 
 
90
Item_func::Item_func(Item *a,Item *b,Item *c,Item *d):
 
91
  _session(*current_session),
 
92
  allowed_arg_cols(1),
 
93
  const_item_cache(false)
 
94
  {
 
95
    arg_count= 0;
 
96
    if ((args= (Item**) memory::sql_alloc(sizeof(Item*)*4)))
 
97
    {
 
98
      arg_count= 4;
 
99
      args[0]= a; args[1]= b; args[2]= c; args[3]= d;
 
100
      with_sum_func= a->with_sum_func || b->with_sum_func ||
 
101
        c->with_sum_func || d->with_sum_func;
 
102
    }
 
103
    collation.set(DERIVATION_SYSCONST);
 
104
  }
 
105
 
 
106
Item_func::Item_func(Item *a,Item *b,Item *c,Item *d,Item* e):
 
107
  _session(*current_session),
 
108
  allowed_arg_cols(1),
 
109
  const_item_cache(false)
 
110
  {
 
111
    arg_count= 5;
 
112
    if ((args= (Item**) memory::sql_alloc(sizeof(Item*)*5)))
 
113
    {
 
114
      args[0]= a; args[1]= b; args[2]= c; args[3]= d; args[4]= e;
 
115
      with_sum_func= a->with_sum_func || b->with_sum_func ||
 
116
        c->with_sum_func || d->with_sum_func || e->with_sum_func ;
 
117
    }
 
118
    collation.set(DERIVATION_SYSCONST);
 
119
  }
 
120
 
 
121
 
43
122
void Item_func::set_arguments(List<Item> &list)
44
123
{
45
124
  allowed_arg_cols= 1;