88
89
#include <drizzled/functions/sign.h>
89
90
#include <drizzled/functions/signed.h>
90
91
#include <drizzled/functions/tan.h>
92
#include <drizzled/functions/update_hash.h>
93
#include <drizzled/functions/user_var_as_out_param.h>
91
94
#include <drizzled/functions/unsigned.h>
93
/* Handling of user definable variables */
97
class Item_func_set_user_var :public Item_func
99
enum Item_result cached_result_type;
100
user_var_entry *entry;
101
char buffer[MAX_FIELD_WIDTH];
103
my_decimal decimal_buff;
114
LEX_STRING name; // keep it public
115
Item_func_set_user_var(LEX_STRING a,Item *b)
116
:Item_func(b), cached_result_type(INT_RESULT), name(a)
118
enum Functype functype() const { return SUSERVAR_FUNC; }
121
String *val_str(String *str);
122
my_decimal *val_decimal(my_decimal *);
124
int64_t val_int_result();
125
String *str_result(String *str);
126
my_decimal *val_decimal_result(my_decimal *);
127
bool update_hash(void *ptr, uint32_t length, enum Item_result type,
128
const CHARSET_INFO * const cs, Derivation dv, bool unsigned_arg);
129
bool send(Protocol *protocol, String *str_arg);
130
void make_field(Send_field *tmp_field);
131
bool check(bool use_result_field);
133
enum Item_result result_type () const { return cached_result_type; }
134
bool fix_fields(Session *session, Item **ref);
135
void fix_length_and_dec();
136
virtual void print(String *str, enum_query_type query_type);
137
void print_as_stmt(String *str, enum_query_type query_type);
138
const char *func_name() const { return "set_user_var"; }
139
int save_in_field(Field *field, bool no_conversions,
140
bool can_use_result_field);
141
int save_in_field(Field *field, bool no_conversions)
143
return save_in_field(field, no_conversions, 1);
145
void save_org_in_field(Field *field) { (void)save_in_field(field, 1, 0); }
146
bool register_field_in_read_map(unsigned char *arg);
147
bool register_field_in_bitmap(unsigned char *arg);
152
This item represents user variable used as out parameter (e.g in LOAD DATA),
153
and it is supposed to be used only for this purprose. So it is simplified
154
a lot. Actually you should never obtain its value.
156
The only two reasons for this thing being an Item is possibility to store it
157
in List<Item> and desire to place this code somewhere near other functions
158
working with user variables.
160
class Item_user_var_as_out_param :public Item
163
user_var_entry *entry;
165
Item_user_var_as_out_param(LEX_STRING a) : name(a) {}
166
/* We should return something different from FIELD_ITEM here */
167
enum Type type() const { return STRING_ITEM;}
170
String *val_str(String *str);
171
my_decimal *val_decimal(my_decimal *decimal_buffer);
172
/* fix_fields() binds variable name with its entry structure */
173
bool fix_fields(Session *session, Item **ref);
174
virtual void print(String *str, enum_query_type query_type);
175
void set_null_value(const CHARSET_INFO * const cs);
176
void set_value(const char *str, uint32_t length, const CHARSET_INFO * const cs);
180
96
/* For type casts */