17
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
#ifndef DRIZZLED_FUNCTION_SET_USER_VAR_H
21
#define DRIZZLED_FUNCTION_SET_USER_VAR_H
23
22
#include <drizzled/function/func.h>
25
26
/* Handling of user definable variables */
29
class Item_func_set_user_var :public Item_func
28
class Item_func_set_user_var : public Item_func
31
30
enum Item_result cached_result_type;
32
31
user_var_entry *entry;
33
32
char buffer[MAX_FIELD_WIDTH];
35
my_decimal decimal_buff;
34
type::Decimal decimal_buff;
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)
50
enum Functype functype() const { return SUSERVAR_FUNC; }
49
Functype functype() const { return SUSERVAR_FUNC; }
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);
65
enum Item_result result_type () const { return cached_result_type; }
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);
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);