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