~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/set_user_var.h

Renamed more stuff to drizzle.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems
5
 
 *
6
 
 *  This program is free software; you can redistribute it and/or modify
7
 
 *  it under the terms of the GNU General Public License as published by
8
 
 *  the Free Software Foundation; version 2 of the License.
9
 
 *
10
 
 *  This program is distributed in the hope that it will be useful,
11
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 *  GNU General Public License for more details.
14
 
 *
15
 
 *  You should have received a copy of the GNU General Public License
16
 
 *  along with this program; if not, write to the Free Software
17
 
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 
 */
19
 
 
20
 
#ifndef DRIZZLED_FUNCTION_SET_USER_VAR_H
21
 
#define DRIZZLED_FUNCTION_SET_USER_VAR_H
22
 
 
23
 
#include <drizzled/function/func.h>
24
 
 
25
 
namespace drizzled
26
 
{
27
 
 
28
 
/* Handling of user definable variables */
29
 
 
30
 
class user_var_entry;
31
 
 
32
 
class Item_func_set_user_var :public Item_func
33
 
{
34
 
  enum Item_result cached_result_type;
35
 
  user_var_entry *entry;
36
 
  char buffer[MAX_FIELD_WIDTH];
37
 
  String value;
38
 
  my_decimal decimal_buff;
39
 
  bool null_item;
40
 
  union
41
 
  {
42
 
    int64_t vint;
43
 
    double vreal;
44
 
    String *vstr;
45
 
    my_decimal *vdec;
46
 
  } save_result;
47
 
 
48
 
public:
49
 
  LEX_STRING name; // keep it public
50
 
  Item_func_set_user_var(LEX_STRING a,Item *b)
51
 
    :Item_func(b), cached_result_type(INT_RESULT), name(a)
52
 
  {}
53
 
  enum Functype functype() const { return SUSERVAR_FUNC; }
54
 
  double val_real();
55
 
  int64_t val_int();
56
 
  String *val_str(String *str);
57
 
  my_decimal *val_decimal(my_decimal *);
58
 
  double val_result();
59
 
  int64_t val_int_result();
60
 
  String *str_result(String *str);
61
 
  my_decimal *val_decimal_result(my_decimal *);
62
 
  bool update_hash(void *ptr, uint32_t length, enum Item_result type,
63
 
                   const CHARSET_INFO * const cs, Derivation dv, bool unsigned_arg);
64
 
  bool send(plugin::Client *client, String *str_arg);
65
 
  void make_field(SendField *tmp_field);
66
 
  bool check(bool use_result_field);
67
 
  bool update();
68
 
  enum Item_result result_type () const { return cached_result_type; }
69
 
  bool fix_fields(Session *session, Item **ref);
70
 
  void fix_length_and_dec();
71
 
  virtual void print(String *str, enum_query_type query_type);
72
 
 
73
 
  const char *func_name() const { return "set_user_var"; }
74
 
  int save_in_field(Field *field, bool no_conversions,
75
 
                    bool can_use_result_field);
76
 
  int save_in_field(Field *field, bool no_conversions)
77
 
  {
78
 
    return save_in_field(field, no_conversions, 1);
79
 
  }
80
 
  void save_org_in_field(Field *field) { (void)save_in_field(field, 1, 0); }
81
 
  bool register_field_in_read_map(unsigned char *arg);
82
 
};
83
 
 
84
 
} /* namespace drizzled */
85
 
 
86
 
#endif /* DRIZZLED_FUNCTION_SET_USER_VAR_H */