~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/func.h

  • Committer: Stewart Smith
  • Date: 2010-11-07 04:22:31 UTC
  • mto: (1911.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1912.
  • Revision ID: stewart@flamingspork.com-20101107042231-ola4sl7j0qvg58tz
fix ARCHIVE storage engine calling exit (lintian warning). Was because we were linking in libinternal into libazio, which links into archive plugin. Just link libinternal into the command line utilities.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
 
21
 
 
22
20
#ifndef DRIZZLED_FUNCTION_FUNC_H
23
21
#define DRIZZLED_FUNCTION_FUNC_H
24
22
 
25
23
/// TODO: Rename this file - func.h is stupid.
26
24
 
27
 
#include <drizzled/charset_info.h>
28
25
#include <drizzled/item.h>
 
26
#include <drizzled/sql_list.h>
29
27
#include <drizzled/item/bin_string.h>
30
 
#include <drizzled/lex_string.h>
31
 
#include <drizzled/sql_list.h>
32
 
#include <drizzled/type/decimal.h>
33
 
 
34
 
#include <drizzled/visibility.h>
 
28
#include "drizzled/current_session.h"
35
29
 
36
30
namespace drizzled
37
31
{
38
32
 
39
 
class DRIZZLED_API Item_func :
40
 
  public Item_result_field
 
33
class Item_func :public Item_result_field
41
34
{
42
35
  Session &_session;
43
36
 
48
41
    0 means get this number from first argument
49
42
  */
50
43
  uint32_t allowed_arg_cols;
51
 
 
52
44
public:
53
45
 
54
46
  using Item::split_sum_func;
73
65
  virtual enum Functype functype() const   { return UNKNOWN_FUNC; }
74
66
  virtual ~Item_func() {}
75
67
 
76
 
  Item_func(void);
 
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
  }
77
75
 
78
 
  Item_func(Item *a);
79
 
  
80
 
  Item_func(Item *a,Item *b);
81
 
  
82
 
  Item_func(Item *a,Item *b,Item *c);
83
 
  
84
 
  Item_func(Item *a,Item *b,Item *c,Item *d);
85
 
  
86
 
  Item_func(Item *a,Item *b,Item *c,Item *d,Item* e);
 
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
  }
87
138
  
88
139
  Item_func(List<Item> &list);
89
140
  
132
183
  void count_real_length();
133
184
  void count_decimal_length();
134
185
 
135
 
  bool get_arg0_date(type::Time &ltime, uint32_t fuzzy_date);
136
 
  bool get_arg0_time(type::Time &ltime);
 
186
  bool get_arg0_date(DRIZZLE_TIME *ltime, uint32_t fuzzy_date);
 
187
  bool get_arg0_time(DRIZZLE_TIME *ltime);
137
188
 
138
189
  bool is_null();
139
190
 
140
 
  virtual bool deterministic() const
141
 
  {
142
 
    return false;
143
 
  }
144
 
 
145
191
  void signal_divide_by_null();
146
192
 
147
193
  virtual Field *tmp_table_field() { return result_field; }
149
195
 
150
196
  Item *get_tmp_table_item(Session *session);
151
197
 
152
 
  type::Decimal *val_decimal(type::Decimal *);
 
198
  my_decimal *val_decimal(my_decimal *);
153
199
 
154
200
  bool agg_arg_collations(DTCollation &c, Item **items, uint32_t nitems,
155
201
                          uint32_t flags);