142
Set value to user variable.
144
@param entry pointer to structure representing variable
145
@param set_null should we set NULL value ?
146
@param ptr pointer to buffer with new value
147
@param length length of new value
148
@param type type of new value
149
@param cs charset info for new value
150
@param dv derivation for new value
151
@param unsigned_arg indiates if a value of type INT_RESULT is unsigned
153
@note Sets error and fatal error if allocation fails.
161
#define extra_size sizeof(double)
163
bool user_var_entry::update_hash(bool set_null, void *ptr, uint32_t arg_length,
164
Item_result arg_type, const CHARSET_INFO * const cs, Derivation dv,
171
assert(length && size);
180
size_t needed_size= arg_length + ((arg_type == STRING_RESULT) ? 1 : 0);
182
if (needed_size > size)
186
new_ptr= (char *)realloc(value, needed_size);
195
if (arg_type == STRING_RESULT)
196
value[arg_length]= 0; // Store end \0
198
memcpy(value, ptr, arg_length);
199
if (arg_type == DECIMAL_RESULT)
200
((my_decimal*)value)->fix_buffer_pointer();
202
collation.set(cs, dv);
203
unsigned_flag= unsigned_arg;