840
Retrieves correct TIME value from the given item.
844
session thread handle
845
item_arg [in/out] item to retrieve TIME value from
846
cache_arg [in/out] pointer to place to store the cache item to
847
warn_item [in] unused
848
is_null [out] true <=> the item_arg is null
851
Retrieves the correct TIME value from given item for comparison by the
852
compare_datetime() function.
853
If item's result can be compared as int64_t then its int value is used
854
and a value returned by get_time function is used otherwise.
855
If an item is a constant one then its value is cached and it isn't
856
get parsed again. An Item_cache_int object is used for for cached values.
857
It seamlessly substitutes the original item. The cache item is marked as
858
non-constant to prevent re-caching it again.
865
get_time_value(Session *,
866
Item ***item_arg, Item **cache_arg,
867
Item *, bool *is_null)
870
Item *item= **item_arg;
873
if (item->result_as_int64_t())
875
value= item->val_int();
876
*is_null= item->null_value;
880
*is_null= item->get_time(<ime);
881
value= !*is_null ? TIME_to_uint64_t_datetime(<ime) : 0;
884
Do not cache GET_USER_VAR() function as its const_item() may return true
885
for the current thread but it still may change during the execution.
887
if (item->const_item() && cache_arg && (item->type() != Item::FUNC_ITEM ||
888
((Item_func*)item)->functype() != Item_func::GUSERVAR_FUNC))
890
Item_cache_int *cache= new Item_cache_int();
891
/* Mark the cache as non-const to prevent re-caching. */
892
cache->set_used_tables(1);
893
cache->store(item, value);
895
*item_arg= cache_arg;
901
839
int Arg_comparator::set_cmp_func(Item_bool_func2 *owner_arg,
902
840
Item **a1, Item **a2,
903
841
Item_result type)