23
23
#include <drizzled/sql_list.h>
25
25
#include <drizzled/function/math/int.h>
26
#include <drizzled/field/int32.h>
27
#include <drizzled/field/int64.h>
26
#include <drizzled/field/int64_t.h>
27
#include <drizzled/field/long.h>
28
28
#include <drizzled/field/double.h>
29
29
#include <drizzled/field/decimal.h>
30
30
#include <drizzled/session.h>
59
59
list.empty(); // Fields are used
62
Item_func::Item_func(List<Item> &list) :
63
_session(*current_session),
62
Item_func::Item_func(List<Item> &list)
66
collation.set(DERIVATION_SYSCONST);
67
65
set_arguments(list);
70
Item_func::Item_func(Session *session, Item_func *item) :
71
Item_result_field(session, item),
72
_session(*current_session),
73
allowed_arg_cols(item->allowed_arg_cols),
74
arg_count(item->arg_count),
75
used_tables_cache(item->used_tables_cache),
76
not_null_tables_cache(item->not_null_tables_cache),
77
const_item_cache(item->const_item_cache)
68
Item_func::Item_func(Session *session, Item_func *item)
69
:Item_result_field(session, item),
70
allowed_arg_cols(item->allowed_arg_cols),
71
arg_count(item->arg_count),
72
used_tables_cache(item->used_tables_cache),
73
not_null_tables_cache(item->not_null_tables_cache),
74
const_item_cache(item->const_item_cache)
283
279
change records at each execution.
285
281
if (*arg != new_item)
286
getSession().change_item_tree(arg, new_item);
282
current_session->change_item_tree(arg, new_item);
289
285
return (this->*transformer)(argument);
455
451
Field *Item_func::tmp_table_field(Table *table)
459
455
switch (result_type()) {
461
457
if (max_length > MY_INT32_NUM_DECIMAL_DIGITS)
462
field= new field::Int64(max_length, maybe_null, name, unsigned_flag);
458
field= new Field_int64_t(max_length, maybe_null, name, unsigned_flag);
464
field= new field::Int32(max_length, maybe_null, name, unsigned_flag);
460
field= new Field_long(max_length, maybe_null, name, unsigned_flag);
467
462
case REAL_RESULT:
468
463
field= new Field_double(max_length, maybe_null, name, decimals);
471
465
case STRING_RESULT:
472
466
return make_string_field(table);
474
467
case DECIMAL_RESULT:
475
468
field= new Field_decimal(my_decimal_precision_to_length(decimal_precision(),
626
619
void Item_func::signal_divide_by_null()
628
my_error(ER_DIVISION_BY_ZERO, MYF(0));
621
Session *session= current_session;
622
push_warning(session, DRIZZLE_ERROR::WARN_LEVEL_ERROR, ER_DIVISION_BY_ZERO, ER(ER_DIVISION_BY_ZERO));