~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/set_user_var.h

Fix merge issues with 1.0 CC fix.

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
 
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
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
 
#ifndef DRIZZLED_FUNCTION_SET_USER_VAR_H
21
 
#define DRIZZLED_FUNCTION_SET_USER_VAR_H
 
20
#pragma once
22
21
 
23
22
#include <drizzled/function/func.h>
24
23
 
 
24
namespace drizzled {
 
25
 
25
26
/* Handling of user definable variables */
26
27
 
27
 
class user_var_entry;
28
 
 
29
 
class Item_func_set_user_var :public Item_func
 
28
class Item_func_set_user_var : public Item_func
30
29
{
31
30
  enum Item_result cached_result_type;
32
31
  user_var_entry *entry;
33
32
  char buffer[MAX_FIELD_WIDTH];
34
33
  String value;
35
 
  my_decimal decimal_buff;
 
34
  type::Decimal decimal_buff;
36
35
  bool null_item;
37
36
  union
38
37
  {
39
38
    int64_t vint;
40
39
    double vreal;
41
40
    String *vstr;
42
 
    my_decimal *vdec;
 
41
    type::Decimal *vdec;
43
42
  } save_result;
44
43
 
45
44
public:
46
 
  LEX_STRING name; // keep it public
47
 
  Item_func_set_user_var(LEX_STRING a,Item *b)
48
 
    :Item_func(b), cached_result_type(INT_RESULT), name(a)
 
45
  str_ref name; // keep it public
 
46
  Item_func_set_user_var(str_ref a,Item *b) :
 
47
    Item_func(b), cached_result_type(INT_RESULT), name(a)
49
48
  {}
50
 
  enum Functype functype() const { return SUSERVAR_FUNC; }
 
49
  Functype functype() const { return SUSERVAR_FUNC; }
51
50
  double val_real();
52
51
  int64_t val_int();
53
52
  String *val_str(String *str);
54
 
  my_decimal *val_decimal(my_decimal *);
 
53
  type::Decimal *val_decimal(type::Decimal *);
55
54
  double val_result();
56
55
  int64_t val_int_result();
57
56
  String *str_result(String *str);
58
 
  my_decimal *val_decimal_result(my_decimal *);
59
 
  bool update_hash(void *ptr, uint32_t length, enum Item_result type,
60
 
                   const CHARSET_INFO * const cs, Derivation dv, bool unsigned_arg);
61
 
  bool send(Protocol *protocol, String *str_arg);
62
 
  void make_field(Send_field *tmp_field);
 
57
  type::Decimal *val_decimal_result(type::Decimal *);
 
58
  void update_hash(data_ref, Item_result type, const charset_info_st* cs, Derivation dv, bool unsigned_arg);
 
59
  void send(plugin::Client *client, String *str_arg);
 
60
  void make_field(SendField *tmp_field);
63
61
  bool check(bool use_result_field);
64
 
  bool update();
65
 
  enum Item_result result_type () const { return cached_result_type; }
 
62
  void update();
 
63
  Item_result result_type () const { return cached_result_type; }
66
64
  bool fix_fields(Session *session, Item **ref);
67
65
  void fix_length_and_dec();
68
 
  virtual void print(String *str, enum_query_type query_type);
69
 
  void print_as_stmt(String *str, enum_query_type query_type);
 
66
  virtual void print(String *str);
 
67
 
70
68
  const char *func_name() const { return "set_user_var"; }
71
69
  int save_in_field(Field *field, bool no_conversions,
72
70
                    bool can_use_result_field);
76
74
  }
77
75
  void save_org_in_field(Field *field) { (void)save_in_field(field, 1, 0); }
78
76
  bool register_field_in_read_map(unsigned char *arg);
79
 
  bool register_field_in_bitmap(unsigned char *arg);
80
77
};
81
78
 
82
 
#endif /* DRIZZLED_FUNCTION_SET_USER_VAR_H */
 
79
} /* namespace drizzled */
 
80