540
538
if (field_item->field->can_be_compared_as_int64_t() &&
541
539
!(field_item->is_datetime() && args[1]->result_type() == STRING_RESULT))
543
if (convert_constant_item(session, field_item, &args[1]))
541
if (convert_constant_item(&getSession(), field_item, &args[1]))
545
543
cmp.set_cmp_func(this, tmp_arg, tmp_arg+1,
546
544
INT_RESULT); // Works for all types.
556
554
!(field_item->is_datetime() &&
557
555
args[0]->result_type() == STRING_RESULT))
559
if (convert_constant_item(session, field_item, &args[0]))
557
if (convert_constant_item(&getSession(), field_item, &args[0]))
561
559
cmp.set_cmp_func(this, tmp_arg, tmp_arg+1,
562
560
INT_RESULT); // Works for all types.
696
694
converted value. 0 on error and on zero-dates -- check 'failure'
700
get_date_from_str(Session *session, String *str, enum enum_drizzle_timestamp_type warn_type,
698
get_date_from_str(Session *session, String *str, type::timestamp_t warn_type,
701
699
char *warn_name, bool *error_arg)
702
type::cut_t error= type::VALID;
705
703
type::Time l_time;
706
enum enum_drizzle_timestamp_type ret;
708
ret= str_to_datetime(str->ptr(), str->length(), &l_time,
709
(TIME_FUZZY_DATE | MODE_INVALID_DATES |
710
(session->variables.sql_mode & MODE_NO_ZERO_DATE)),
713
if (ret == DRIZZLE_TIMESTAMP_DATETIME || ret == DRIZZLE_TIMESTAMP_DATE)
704
type::timestamp_t ret;
706
ret= l_time.store(str->ptr(), str->length(),
707
(TIME_FUZZY_DATE | MODE_INVALID_DATES | (session->variables.sql_mode & MODE_NO_ZERO_DATE)),
710
if (ret == type::DRIZZLE_TIMESTAMP_DATETIME || ret == type::DRIZZLE_TIMESTAMP_DATE)
716
713
Do not return yet, we may still want to throw a "trailing garbage"
719
716
*error_arg= false;
720
value= TIME_to_uint64_t_datetime(&l_time);
717
l_time.convert(value);
724
721
*error_arg= true;
725
error= 1; /* force warning */
722
error= type::CUT; /* force warning */
725
if (error != type::VALID)
730
727
make_truncated_value_warning(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
731
728
str->ptr(), str->length(),
771
768
enum Arg_comparator::enum_date_cmp_type
772
769
Arg_comparator::can_compare_as_dates(Item *in_a, Item *in_b,
773
uint64_t *const_value)
770
int64_t *const_value)
775
772
enum enum_date_cmp_type cmp_type= CMP_DATE_DFLT;
776
773
Item *str_arg= 0, *date_arg= 0;
865
862
Item **a1, Item **a2,
866
863
Item_result type)
868
enum enum_date_cmp_type cmp_type;
869
uint64_t const_value= (uint64_t)-1;
865
enum_date_cmp_type cmp_type;
866
int64_t const_value= -1;
873
870
if ((cmp_type= can_compare_as_dates(*a, *b, &const_value)))
875
session= current_session;
876
872
owner= owner_arg;
877
873
a_type= (*a)->field_type();
878
874
b_type= (*b)->field_type();
882
if (const_value != (uint64_t)-1)
878
if (const_value != -1)
884
880
Item_cache_int *cache= new Item_cache_int();
885
881
/* Mark the cache as non-const to prevent re-caching. */
995
993
enum_field_types f_type= warn_item->field_type();
996
enum enum_drizzle_timestamp_type t_type= f_type ==
997
DRIZZLE_TYPE_DATE ? DRIZZLE_TIMESTAMP_DATE : DRIZZLE_TIMESTAMP_DATETIME;
994
type::timestamp_t t_type= f_type == DRIZZLE_TYPE_DATE ? type::DRIZZLE_TIMESTAMP_DATE : type::DRIZZLE_TIMESTAMP_DATETIME;
998
995
value= get_date_from_str(session, str, t_type, warn_item->name, &error);
1000
997
If str did not contain a valid date according to the current
1668
1666
change records at each execution.
1670
1668
if ((*args) != new_item)
1671
current_session->change_item_tree(args, new_item);
1669
getSession().change_item_tree(args, new_item);
1674
1672
Transform the right IN operand which should be an Item_in_subselect or a
2049
2046
The following can't be recoded with || as convert_constant_item
2050
2047
changes the argument
2052
if (convert_constant_item(session, field_item, &args[1]))
2049
if (convert_constant_item(&getSession(), field_item, &args[1]))
2053
2050
cmp_type=INT_RESULT; // Works for all types.
2054
if (convert_constant_item(session, field_item, &args[2]))
2051
if (convert_constant_item(&getSession(), field_item, &args[2]))
2055
2052
cmp_type=INT_RESULT; // Works for all types.
3184
in_int64_t::in_int64_t(uint32_t elements)
3185
:in_vector(elements,sizeof(packed_int64_t),(qsort2_cmp) cmp_int64_t, 0)
3181
in_int64_t::in_int64_t(uint32_t elements) :
3182
in_vector(elements, sizeof(packed_int64_t),(qsort2_cmp) cmp_int64_t, 0)
3188
3185
void in_int64_t::set(uint32_t pos,Item *item)
3700
3696
bool all_converted= true;
3701
3697
for (arg=args+1, arg_end=args+arg_count; arg != arg_end ; arg++)
3703
if (!convert_constant_item (session, field_item, &arg[0]))
3699
if (!convert_constant_item (&getSession(), field_item, &arg[0]))
3704
3700
all_converted= false;
3706
3702
if (all_converted)
4027
4023
change records at each execution.
4029
4025
if (new_item != item)
4030
current_session->change_item_tree(li.ref(), new_item);
4026
getSession().change_item_tree(li.ref(), new_item);
4032
4028
return Item_func::transform(transformer, arg);
4486
4482
Item_bool_func2::cleanup();
4485
static unsigned char likeconv(const CHARSET_INFO *cs, unsigned char a)
4489
4487
#ifdef LIKE_CMP_TOUPPER
4490
#define likeconv(cs,A) (unsigned char) (cs)->toupper(A)
4488
return cs->toupper(a);
4492
#define likeconv(cs,A) (unsigned char) (cs)->sort_order[(unsigned char) (A)]
4490
return cs->sort_order[a];
4497
4495
Precomputation dependent only on pattern_len.
5113
5111
List_iterator_fast<Item_field> it(fields);
5114
5112
Item *item= const_item ? const_item : it++;
5113
eval_item->store_value(item);
5115
5114
if ((null_value= item->null_value))
5117
eval_item->store_value(item);
5118
5116
while ((item_field= it++))
5120
5118
/* Skip fields of non-const tables. They haven't been read yet */
5121
5119
if (item_field->field->getTable()->const_table)
5123
if ((null_value= item_field->null_value) || eval_item->cmp(item_field))
5121
if (eval_item->cmp(item_field) || (null_value= item_field->null_value))
5163
5161
change records at each execution.
5165
5163
if (new_item != item)
5166
current_session->change_item_tree((Item **) it.ref(), new_item);
5164
getSession().change_item_tree((Item **) it.ref(), new_item);
5168
5166
return Item_func::transform(transformer, arg);