17
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
22
#include <drizzled/function/set_user_var.h>
23
23
#include <drizzled/field/num.h>
24
24
#include <drizzled/session.h>
25
25
#include <drizzled/plugin/client.h>
26
#include <drizzled/user_var_entry.h>
142
141
switch (cached_result_type) {
143
142
case REAL_RESULT:
145
save_result.vreal= use_result_field ? result_field->val_real() :
144
save_result.vreal= use_result_field ? result_field->val_real() :
151
save_result.vint= use_result_field ? result_field->val_int() :
153
unsigned_flag= use_result_field ? ((Field_num*)result_field)->unsigned_flag:
154
args[0]->unsigned_flag;
150
save_result.vint= use_result_field ? result_field->val_int() :
152
unsigned_flag= use_result_field ? ((Field_num*)result_field)->unsigned_flag:
153
args[0]->unsigned_flag;
157
156
case STRING_RESULT:
159
save_result.vstr= use_result_field ? result_field->val_str_internal(&value) :
160
args[0]->val_str(&value);
158
save_result.vstr= use_result_field ? result_field->val_str(&value) :
159
args[0]->val_str(&value);
163
162
case DECIMAL_RESULT:
165
save_result.vdec= use_result_field ?
166
result_field->val_decimal(&decimal_buff) :
167
args[0]->val_decimal(&decimal_buff);
164
save_result.vdec= use_result_field ?
165
result_field->val_decimal(&decimal_buff) :
166
args[0]->val_decimal(&decimal_buff);
171
171
// This case should never be chosen
199
198
switch (cached_result_type) {
200
199
case REAL_RESULT:
202
res= update_hash((void*) &save_result.vreal,sizeof(save_result.vreal),
203
REAL_RESULT, &my_charset_bin, DERIVATION_IMPLICIT, 0);
201
res= update_hash((void*) &save_result.vreal,sizeof(save_result.vreal),
202
REAL_RESULT, &my_charset_bin, DERIVATION_IMPLICIT, 0);
209
res= update_hash((void*) &save_result.vint, sizeof(save_result.vint),
210
INT_RESULT, &my_charset_bin, DERIVATION_IMPLICIT,
207
res= update_hash((void*) &save_result.vint, sizeof(save_result.vint),
208
INT_RESULT, &my_charset_bin, DERIVATION_IMPLICIT,
215
212
case STRING_RESULT:
217
if (!save_result.vstr) // Null value
218
res= update_hash((void*) 0, 0, STRING_RESULT, &my_charset_bin,
219
DERIVATION_IMPLICIT, 0);
221
res= update_hash((void*) save_result.vstr->ptr(),
222
save_result.vstr->length(), STRING_RESULT,
223
save_result.vstr->charset(),
224
DERIVATION_IMPLICIT, 0);
214
if (!save_result.vstr) // Null value
215
res= update_hash((void*) 0, 0, STRING_RESULT, &my_charset_bin,
216
DERIVATION_IMPLICIT, 0);
218
res= update_hash((void*) save_result.vstr->ptr(),
219
save_result.vstr->length(), STRING_RESULT,
220
save_result.vstr->charset(),
221
DERIVATION_IMPLICIT, 0);
228
224
case DECIMAL_RESULT:
230
if (!save_result.vdec) // Null value
231
res= update_hash((void*) 0, 0, DECIMAL_RESULT, &my_charset_bin,
232
DERIVATION_IMPLICIT, 0);
234
res= update_hash((void*) save_result.vdec,
235
sizeof(type::Decimal), DECIMAL_RESULT,
236
&my_charset_bin, DERIVATION_IMPLICIT, 0);
226
if (!save_result.vdec) // Null value
227
res= update_hash((void*) 0, 0, DECIMAL_RESULT, &my_charset_bin,
228
DERIVATION_IMPLICIT, 0);
230
res= update_hash((void*) save_result.vdec,
231
sizeof(my_decimal), DECIMAL_RESULT,
232
&my_charset_bin, DERIVATION_IMPLICIT, 0);
241
237
// This case should never be chosen