21
21
This file defines all compare functions
26
#include <drizzled/cached_item.h>
27
#include <drizzled/check_stack_overrun.h>
28
#include <drizzled/current_session.h>
29
#include <drizzled/error.h>
30
#include <drizzled/internal/my_sys.h>
31
#include <drizzled/item/cache_int.h>
32
#include <drizzled/item/cmpfunc.h>
33
#include <drizzled/item/int_with_ref.h>
34
#include <drizzled/item/subselect.h>
35
#include <drizzled/session.h>
36
#include <drizzled/sql_select.h>
37
#include <drizzled/temporal.h>
38
#include <drizzled/time_functions.h>
25
#include "drizzled/sql_select.h"
26
#include "drizzled/error.h"
27
#include "drizzled/temporal.h"
28
#include "drizzled/item/cmpfunc.h"
29
#include "drizzled/cached_item.h"
30
#include "drizzled/item/cache_int.h"
31
#include "drizzled/item/int_with_ref.h"
32
#include "drizzled/check_stack_overrun.h"
33
#include "drizzled/time_functions.h"
34
#include "drizzled/internal/my_sys.h"
41
36
#include <algorithm>
468
463
the call to save_in_field below overrides that value.
470
465
if (field_item->depended_from)
472
466
orig_field_val= field->val_int();
475
467
if (!(*item)->is_null() && !(*item)->save_in_field(field, 1))
477
469
Item *tmp= new Item_int_with_ref(field->val_int(), *item,
480
472
session->change_item_tree(item, tmp);
481
473
result= 1; // Item was replaced
484
475
/* Restore the original field value. */
485
476
if (field_item->depended_from)
487
result= field->store(orig_field_val, field->isUnsigned());
478
result= field->store(orig_field_val, true);
488
479
/* orig_field_val must be a valid value that can be restored back. */
543
536
if (field_item->field->can_be_compared_as_int64_t() &&
544
537
!(field_item->is_datetime() && args[1]->result_type() == STRING_RESULT))
546
if (convert_constant_item(&getSession(), field_item, &args[1]))
539
if (convert_constant_item(session, field_item, &args[1]))
548
541
cmp.set_cmp_func(this, tmp_arg, tmp_arg+1,
549
542
INT_RESULT); // Works for all types.
559
552
!(field_item->is_datetime() &&
560
553
args[0]->result_type() == STRING_RESULT))
562
if (convert_constant_item(&getSession(), field_item, &args[0]))
555
if (convert_constant_item(session, field_item, &args[0]))
564
557
cmp.set_cmp_func(this, tmp_arg, tmp_arg+1,
565
558
INT_RESULT); // Works for all types.
575
Arg_comparator::Arg_comparator():
576
session(current_session),
581
Arg_comparator::Arg_comparator(Item **a1, Item **a2):
584
session(current_session),
589
569
int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type)
712
692
converted value. 0 on error and on zero-dates -- check 'failure'
716
get_date_from_str(Session *session, String *str, type::timestamp_t warn_type,
696
get_date_from_str(Session *session, String *str, enum enum_drizzle_timestamp_type warn_type,
717
697
char *warn_name, bool *error_arg)
720
type::cut_t error= type::VALID;
722
type::timestamp_t ret;
724
ret= l_time.store(str->ptr(), str->length(),
725
(TIME_FUZZY_DATE | MODE_INVALID_DATES | (session->variables.sql_mode & MODE_NO_ZERO_DATE)),
728
if (ret == type::DRIZZLE_TIMESTAMP_DATETIME || ret == type::DRIZZLE_TIMESTAMP_DATE)
702
enum enum_drizzle_timestamp_type ret;
704
ret= str_to_datetime(str->ptr(), str->length(), &l_time,
705
(TIME_FUZZY_DATE | MODE_INVALID_DATES |
706
(session->variables.sql_mode & MODE_NO_ZERO_DATE)),
709
if (ret == DRIZZLE_TIMESTAMP_DATETIME || ret == DRIZZLE_TIMESTAMP_DATE)
731
712
Do not return yet, we may still want to throw a "trailing garbage"
734
715
*error_arg= false;
735
l_time.convert(value);
716
value= TIME_to_uint64_t_datetime(&l_time);
739
720
*error_arg= true;
740
error= type::CUT; /* force warning */
721
error= 1; /* force warning */
743
if (error != type::VALID)
745
726
make_truncated_value_warning(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
746
727
str->ptr(), str->length(),
786
767
enum Arg_comparator::enum_date_cmp_type
787
768
Arg_comparator::can_compare_as_dates(Item *in_a, Item *in_b,
788
int64_t *const_value)
769
uint64_t *const_value)
790
771
enum enum_date_cmp_type cmp_type= CMP_DATE_DFLT;
791
772
Item *str_arg= 0, *date_arg= 0;
880
861
Item **a1, Item **a2,
881
862
Item_result type)
883
enum_date_cmp_type cmp_type;
884
int64_t const_value= -1;
864
enum enum_date_cmp_type cmp_type;
865
uint64_t const_value= (uint64_t)-1;
888
869
if ((cmp_type= can_compare_as_dates(*a, *b, &const_value)))
871
session= current_session;
890
872
owner= owner_arg;
891
873
a_type= (*a)->field_type();
892
874
b_type= (*b)->field_type();
896
if (const_value != -1)
878
if (const_value != (uint64_t)-1)
898
880
Item_cache_int *cache= new Item_cache_int();
899
881
/* Mark the cache as non-const to prevent re-caching. */
1011
991
enum_field_types f_type= warn_item->field_type();
1012
type::timestamp_t t_type= f_type == DRIZZLE_TYPE_DATE ? type::DRIZZLE_TIMESTAMP_DATE : type::DRIZZLE_TIMESTAMP_DATETIME;
992
enum enum_drizzle_timestamp_type t_type= f_type ==
993
DRIZZLE_TYPE_DATE ? DRIZZLE_TIMESTAMP_DATE : DRIZZLE_TIMESTAMP_DATETIME;
1013
994
value= get_date_from_str(session, str, t_type, warn_item->name, &error);
1015
996
If str did not contain a valid date according to the current
1190
1170
int Arg_comparator::compare_decimal()
1192
type::Decimal value1;
1193
type::Decimal *val1= (*a)->val_decimal(&value1);
1173
my_decimal *val1= (*a)->val_decimal(&value1);
1194
1174
if (!(*a)->null_value)
1196
type::Decimal value2;
1197
type::Decimal *val2= (*b)->val_decimal(&value2);
1177
my_decimal *val2= (*b)->val_decimal(&value2);
1198
1178
if (!(*b)->null_value)
1200
1180
owner->null_value= 0;
1201
return class_decimal_cmp(val1, val2);
1181
return my_decimal_cmp(val1, val2);
1204
1184
owner->null_value= 1;
1217
1197
int Arg_comparator::compare_e_decimal()
1219
type::Decimal value1, value2;
1220
type::Decimal *val1= (*a)->val_decimal(&value1);
1221
type::Decimal *val2= (*b)->val_decimal(&value2);
1199
my_decimal value1, value2;
1200
my_decimal *val1= (*a)->val_decimal(&value1);
1201
my_decimal *val2= (*b)->val_decimal(&value2);
1222
1202
if ((*a)->null_value || (*b)->null_value)
1223
1203
return test((*a)->null_value && (*b)->null_value);
1224
return test(class_decimal_cmp(val1, val2) == 0);
1204
return test(my_decimal_cmp(val1, val2) == 0);
1684
1664
change records at each execution.
1686
1666
if ((*args) != new_item)
1687
getSession().change_item_tree(args, new_item);
1667
current_session->change_item_tree(args, new_item);
1690
1670
Transform the right IN operand which should be an Item_in_subselect or a
1897
1877
dec= row->element_index(0)->val_decimal(&dec_buf);
1898
1878
if (row->element_index(0)->null_value)
1900
class_decimal2double(E_DEC_FATAL_ERROR, dec, &value);
1880
my_decimal2double(E_DEC_FATAL_ERROR, dec, &value);
1922
1902
and we are comparing against a decimal
1924
1904
if (dec && range->type == DECIMAL_RESULT)
1925
cmp_result= class_decimal_cmp(&range->dec, dec) <= 0;
1905
cmp_result= my_decimal_cmp(&range->dec, dec) <= 0;
1927
1907
cmp_result= (range->dbl <= value);
1928
1908
if (cmp_result)
1933
1913
interval_range *range= intervals+start;
1934
1914
return ((dec && range->type == DECIMAL_RESULT) ?
1935
class_decimal_cmp(dec, &range->dec) < 0 :
1915
my_decimal_cmp(dec, &range->dec) < 0 :
1936
1916
value < range->dbl) ? 0 : start + 1;
1943
1923
((el->result_type() == DECIMAL_RESULT) ||
1944
1924
(el->result_type() == INT_RESULT)))
1946
type::Decimal e_dec_buf, *e_dec= el->val_decimal(&e_dec_buf);
1926
my_decimal e_dec_buf, *e_dec= el->val_decimal(&e_dec_buf);
1947
1927
/* Skip NULL ranges. */
1948
1928
if (el->null_value)
1950
if (class_decimal_cmp(e_dec, dec) > 0)
1930
if (my_decimal_cmp(e_dec, dec) > 0)
1997
1977
if (Item_func_opt_neg::fix_fields(session, ref))
2000
session->getLex()->current_select->between_count++;
1980
session->lex->current_select->between_count++;
2002
1982
/* not_null_tables_cache == union(T1(e),T1(e1),T1(e2)) */
2003
1983
if (pred_level && !negated)
2064
2045
The following can't be recoded with || as convert_constant_item
2065
2046
changes the argument
2067
if (convert_constant_item(&getSession(), field_item, &args[1]))
2048
if (convert_constant_item(session, field_item, &args[1]))
2068
2049
cmp_type=INT_RESULT; // Works for all types.
2069
if (convert_constant_item(&getSession(), field_item, &args[2]))
2050
if (convert_constant_item(session, field_item, &args[2]))
2070
2051
cmp_type=INT_RESULT; // Works for all types.
2144
2125
else if (cmp_type == DECIMAL_RESULT)
2146
type::Decimal dec_buf, *dec= args[0]->val_decimal(&dec_buf),
2127
my_decimal dec_buf, *dec= args[0]->val_decimal(&dec_buf),
2147
2128
a_buf, *a_dec, b_buf, *b_dec;
2148
2129
if ((null_value=args[0]->null_value))
2150
2131
a_dec= args[1]->val_decimal(&a_buf);
2151
2132
b_dec= args[2]->val_decimal(&b_buf);
2152
2133
if (!args[1]->null_value && !args[2]->null_value)
2153
return (int64_t) ((class_decimal_cmp(dec, a_dec) >= 0 &&
2154
class_decimal_cmp(dec, b_dec) <= 0) != negated);
2134
return (int64_t) ((my_decimal_cmp(dec, a_dec) >= 0 &&
2135
my_decimal_cmp(dec, b_dec) <= 0) != negated);
2155
2136
if (args[1]->null_value && args[2]->null_value)
2157
2138
else if (args[1]->null_value)
2158
null_value= (class_decimal_cmp(dec, b_dec) <= 0);
2139
null_value= (my_decimal_cmp(dec, b_dec) <= 0);
2160
null_value= (class_decimal_cmp(dec, a_dec) >= 0);
2141
null_value= (my_decimal_cmp(dec, a_dec) >= 0);
2294
type::Decimal *Item_func_ifnull::decimal_op(type::Decimal *decimal_value)
2275
my_decimal *Item_func_ifnull::decimal_op(my_decimal *decimal_value)
2296
2277
assert(fixed == 1);
2297
type::Decimal *value= args[0]->val_decimal(decimal_value);
2278
my_decimal *value= args[0]->val_decimal(decimal_value);
2298
2279
if (!args[0]->null_value)
2468
Item_func_if::val_decimal(type::Decimal *decimal_value)
2449
Item_func_if::val_decimal(my_decimal *decimal_value)
2470
2451
assert(fixed == 1);
2471
2452
Item *arg= args[0]->val_bool() ? args[1] : args[2];
2472
type::Decimal *value= arg->val_decimal(decimal_value);
2453
my_decimal *value= arg->val_decimal(decimal_value);
2473
2454
null_value= arg->null_value;
2689
type::Decimal *Item_func_case::val_decimal(type::Decimal *decimal_value)
2670
my_decimal *Item_func_case::val_decimal(my_decimal *decimal_value)
2691
2672
assert(fixed == 1);
2692
2673
char buff[MAX_FIELD_WIDTH];
2693
2674
String dummy_str(buff, sizeof(buff), default_charset());
2694
2675
Item *item= find_item(&dummy_str);
2736
2717
void Item_func_case::agg_num_lengths(Item *arg)
2738
uint32_t len= class_decimal_length_to_precision(arg->max_length, arg->decimals,
2719
uint32_t len= my_decimal_length_to_precision(arg->max_length, arg->decimals,
2739
2720
arg->unsigned_flag) - arg->decimals;
2740
2721
set_if_bigger(max_length, len);
2741
2722
set_if_bigger(decimals, arg->decimals);
2818
2799
agg_num_lengths(args[i + 1]);
2819
2800
if (else_expr_num != -1)
2820
2801
agg_num_lengths(args[else_expr_num]);
2821
max_length= class_decimal_precision_to_length(max_length + decimals, decimals,
2802
max_length= my_decimal_precision_to_length(max_length + decimals, decimals,
2822
2803
unsigned_flag);
2928
type::Decimal *Item_func_coalesce::decimal_op(type::Decimal *decimal_value)
2909
my_decimal *Item_func_coalesce::decimal_op(my_decimal *decimal_value)
2930
2911
assert(fixed == 1);
2932
2913
for (uint32_t i= 0; i < arg_count; i++)
2934
type::Decimal *res= args[i]->val_decimal(decimal_value);
2915
my_decimal *res= args[i]->val_decimal(decimal_value);
2935
2916
if (!args[i]->null_value)
3083
static int cmp_decimal(void *, type::Decimal *a, type::Decimal *b)
3064
static int cmp_decimal(void *, my_decimal *a, my_decimal *b)
3086
3067
We need call of fixing buffer pointer, because fast sort just copy
3199
in_int64_t::in_int64_t(uint32_t elements) :
3200
in_vector(elements, sizeof(packed_int64_t),(qsort2_cmp) cmp_int64_t, 0)
3180
in_int64_t::in_int64_t(uint32_t elements)
3181
:in_vector(elements,sizeof(packed_int64_t),(qsort2_cmp) cmp_int64_t, 0)
3203
3184
void in_int64_t::set(uint32_t pos,Item *item)
3217
3198
return (unsigned char*) &tmp;
3220
in_datetime::in_datetime(Item *warn_item_arg, uint32_t elements) :
3221
in_int64_t(elements),
3222
session(current_session),
3223
warn_item(warn_item_arg),
3227
void in_datetime::set(uint32_t pos, Item *item)
3201
void in_datetime::set(uint32_t pos,Item *item)
3229
3203
Item **tmp_item= &item;
3266
3240
in_decimal::in_decimal(uint32_t elements)
3267
:in_vector(elements, sizeof(type::Decimal),(qsort2_cmp) cmp_decimal, 0)
3241
:in_vector(elements, sizeof(my_decimal),(qsort2_cmp) cmp_decimal, 0)
3271
3245
void in_decimal::set(uint32_t pos, Item *item)
3273
/* as far as 'item' is constant, we can store reference on type::Decimal */
3274
type::Decimal *dec= ((type::Decimal *)base) + pos;
3247
/* as far as 'item' is constant, we can store reference on my_decimal */
3248
my_decimal *dec= ((my_decimal *)base) + pos;
3275
3249
dec->len= DECIMAL_BUFF_LENGTH;
3276
3250
dec->fix_buffer_pointer();
3277
type::Decimal *res= item->val_decimal(dec);
3251
my_decimal *res= item->val_decimal(dec);
3278
3252
/* if item->val_decimal() is evaluated to NULL then res == 0 */
3279
3253
if (!item->null_value && res != dec)
3280
class_decimal2decimal(res, dec);
3254
my_decimal2decimal(res, dec);
3284
3258
unsigned char *in_decimal::get_value(Item *item)
3286
type::Decimal *result= item->val_decimal(&val);
3260
my_decimal *result= item->val_decimal(&val);
3287
3261
if (item->null_value)
3289
3263
return (unsigned char *)result;
3443
3417
void cmp_item_decimal::store_value(Item *item)
3445
type::Decimal *val= item->val_decimal(&value);
3419
my_decimal *val= item->val_decimal(&value);
3446
3420
/* val may be zero if item is nnull */
3447
3421
if (val && val != &value)
3448
class_decimal2decimal(val, &value);
3422
my_decimal2decimal(val, &value);
3452
3426
int cmp_item_decimal::cmp(Item *arg)
3454
type::Decimal tmp_buf, *tmp= arg->val_decimal(&tmp_buf);
3428
my_decimal tmp_buf, *tmp= arg->val_decimal(&tmp_buf);
3455
3429
if (arg->null_value)
3457
return class_decimal_cmp(&value, tmp);
3431
return my_decimal_cmp(&value, tmp);
3461
3435
int cmp_item_decimal::compare(cmp_item *arg)
3463
3437
cmp_item_decimal *l_cmp= (cmp_item_decimal*) arg;
3464
return class_decimal_cmp(&value, &l_cmp->value);
3438
return my_decimal_cmp(&value, &l_cmp->value);
3721
3696
bool all_converted= true;
3722
3697
for (arg=args+1, arg_end=args+arg_count; arg != arg_end ; arg++)
3724
if (!convert_constant_item (&getSession(), field_item, &arg[0]))
3699
if (!convert_constant_item (session, field_item, &arg[0]))
3725
3700
all_converted= false;
3727
3702
if (all_converted)
3876
3851
Item_cond::Item_cond(Session *session, Item_cond *item)
3877
:item::function::Boolean(session, item),
3852
:Item_bool_func(session, item),
3878
3853
abort_on_null(item->abort_on_null),
3879
3854
and_tables_cache(item->and_tables_cache)
3887
3862
void Item_cond::copy_andor_arguments(Session *session, Item_cond *item)
3889
List<Item>::iterator li(item->list.begin());
3864
List_iterator_fast<Item> li(item->list);
3890
3865
while (Item *it= li++)
3891
3866
list.push_back(it->copy_andor_structure(session));
3896
3871
Item_cond::fix_fields(Session *session, Item **)
3898
3873
assert(fixed == 0);
3899
List<Item>::iterator li(list.begin());
3874
List_iterator<Item> li(list);
3901
3876
void *orig_session_marker= session->session_marker;
3902
3877
unsigned char buff[sizeof(char*)]; // Max local vars in function
3903
3878
not_null_tables_cache= used_tables_cache= 0;
3904
const_item_cache= true;
3879
const_item_cache= 1;
3906
3881
if (functype() == COND_OR_FUNC)
3907
3882
session->session_marker= 0;
3936
3911
!((Item_cond*) item)->list.is_empty())
3937
3912
{ // Identical function
3938
3913
li.replace(((Item_cond*) item)->list);
3939
((Item_cond*) item)->list.clear();
3914
((Item_cond*) item)->list.empty();
3940
3915
item= *li.ref(); // new current item
3942
3917
if (abort_on_null)
3973
3948
void Item_cond::fix_after_pullout(Select_Lex *new_parent, Item **)
3975
List<Item>::iterator li(list.begin());
3950
List_iterator<Item> li(list);
3978
3953
used_tables_cache=0;
3979
const_item_cache= true;
3981
3956
and_tables_cache= ~(table_map) 0; // Here and below we do as fix_fields does
3982
3957
not_null_tables_cache= 0;
4005
3980
bool Item_cond::walk(Item_processor processor, bool walk_subquery, unsigned char *arg)
4007
List<Item>::iterator li(list.begin());
3982
List_iterator_fast<Item> li(list);
4009
3984
while ((item= li++))
4010
3985
if (item->walk(processor, walk_subquery, arg))
4048
4023
change records at each execution.
4050
4025
if (new_item != item)
4051
getSession().change_item_tree(li.ref(), new_item);
4026
current_session->change_item_tree(li.ref(), new_item);
4053
4028
return Item_func::transform(transformer, arg);
4103
4078
void Item_cond::traverse_cond(Cond_traverser traverser,
4104
4079
void *arg, traverse_order order)
4106
List<Item>::iterator li(list.begin());
4081
List_iterator<Item> li(list);
4109
4084
switch (order) {
4144
4119
void Item_cond::split_sum_func(Session *session, Item **ref_pointer_array,
4145
4120
List<Item> &fields)
4147
List<Item>::iterator li(list.begin());
4122
List_iterator<Item> li(list);
4149
4124
while ((item= li++))
4150
4125
item->split_sum_func(session, ref_pointer_array,
4178
4153
void Item_cond::print(String *str, enum_query_type query_type)
4180
4155
str->append('(');
4181
List<Item>::iterator li(list.begin());
4156
List_iterator_fast<Item> li(list);
4183
4158
if ((item=li++))
4184
4159
item->print(str, query_type);
4489
4464
pattern = first + 1;
4490
4465
pattern_len = (int) len - 2;
4491
int *suff = (int*) session->getMemRoot()->allocate((int) (sizeof(int)*
4492
((pattern_len + 1)*2+
4466
int *suff = (int*) session->alloc((int) (sizeof(int)*
4467
((pattern_len + 1)*2+
4494
4469
bmGs = suff + pattern_len + 1;
4495
4470
bmBc = bmGs + pattern_len + 1;
4496
4471
turboBM_compute_good_suffix_shifts(suff);
4507
4482
Item_bool_func2::cleanup();
4510
static unsigned char likeconv(const CHARSET_INFO *cs, unsigned char a)
4512
4485
#ifdef LIKE_CMP_TOUPPER
4513
return cs->toupper(a);
4486
#define likeconv(cs,A) (unsigned char) (cs)->toupper(A)
4515
return cs->sort_order[a];
4488
#define likeconv(cs,A) (unsigned char) (cs)->sort_order[(unsigned char) (A)]
4520
4493
Precomputation dependent only on pattern_len.
4911
4884
Item_equal::Item_equal(Item_field *f1, Item_field *f2)
4912
: item::function::Boolean(), const_item(0), eval_item(0), cond_false(0)
4885
: Item_bool_func(), const_item(0), eval_item(0), cond_false(0)
4914
const_item_cache= false;
4887
const_item_cache= 0;
4915
4888
fields.push_back(f1);
4916
4889
fields.push_back(f2);
4919
4892
Item_equal::Item_equal(Item *c, Item_field *f)
4920
: item::function::Boolean(), eval_item(0), cond_false(0)
4893
: Item_bool_func(), eval_item(0), cond_false(0)
4922
const_item_cache= false;
4895
const_item_cache= 0;
4923
4896
fields.push_back(f);
4928
4901
Item_equal::Item_equal(Item_equal *item_equal)
4929
: item::function::Boolean(), eval_item(0), cond_false(0)
4902
: Item_bool_func(), eval_item(0), cond_false(0)
4931
const_item_cache= false;
4932
List<Item_field>::iterator li(item_equal->fields.begin());
4904
const_item_cache= 0;
4905
List_iterator_fast<Item_field> li(item_equal->fields);
4933
4906
Item_field *item;
4934
4907
while ((item= li++))
5096
5069
bool Item_equal::fix_fields(Session *, Item **)
5098
List<Item_field>::iterator li(fields.begin());
5071
List_iterator_fast<Item_field> li(fields);
5100
5073
not_null_tables_cache= used_tables_cache= 0;
5101
const_item_cache= false;
5074
const_item_cache= 0;
5102
5075
while ((item= li++))
5104
5077
table_map tmp_table_map;
5116
5089
void Item_equal::update_used_tables()
5118
List<Item_field>::iterator li(fields.begin());
5091
List_iterator_fast<Item_field> li(fields);
5120
5093
not_null_tables_cache= used_tables_cache= 0;
5121
5094
if ((const_item_cache= cond_false))
5133
5106
Item_field *item_field;
5134
5107
if (cond_false)
5136
List<Item_field>::iterator it(fields.begin());
5109
List_iterator_fast<Item_field> it(fields);
5137
5110
Item *item= const_item ? const_item : it++;
5111
if ((null_value= item->null_value))
5138
5113
eval_item->store_value(item);
5139
if ((null_value= item->null_value))
5141
5114
while ((item_field= it++))
5143
5116
/* Skip fields of non-const tables. They haven't been read yet */
5144
5117
if (item_field->field->getTable()->const_table)
5146
if (eval_item->cmp(item_field) || (null_value= item_field->null_value))
5119
if ((null_value= item_field->null_value) || eval_item->cmp(item_field))
5186
5159
change records at each execution.
5188
5161
if (new_item != item)
5189
getSession().change_item_tree((Item **) it.ref(), new_item);
5162
current_session->change_item_tree((Item **) it.ref(), new_item);
5191
5164
return Item_func::transform(transformer, arg);
5196
5169
str->append(func_name());
5197
5170
str->append('(');
5198
List<Item_field>::iterator it(fields.begin());
5171
List_iterator_fast<Item_field> it(fields);
5200
5173
if (const_item)
5201
5174
const_item->print(str, query_type);
5213
5186
str->append(')');
5216
cmp_item_datetime::cmp_item_datetime(Item *warn_item_arg) :
5217
session(current_session),
5218
warn_item(warn_item_arg),
5222
5189
} /* namespace drizzled */