diff options
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r-- | sql/item_func.cc | 52 |
1 files changed, 42 insertions, 10 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index 3796beebc13..f2dabf74060 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -704,6 +704,7 @@ my_decimal *Item_real_func::val_decimal(my_decimal *decimal_value) } +#ifdef HAVE_DLOPEN void Item_udf_func::fix_num_length_and_dec() { uint fl_length= 0; @@ -720,6 +721,7 @@ void Item_udf_func::fix_num_length_and_dec() max_length= float_length(NOT_FIXED_DEC); } } +#endif void Item_func::signal_divide_by_null() @@ -2703,7 +2705,7 @@ bool Item_func_min_max::get_date_native(MYSQL_TIME *ltime, ulonglong fuzzy_date) for (uint i=0; i < arg_count ; i++) { - longlong res= args[i]->val_temporal_packed(Item_func_min_max::field_type()); + longlong res= args[i]->val_datetime_packed(); /* Check if we need to stop (because of error or KILL) and stop the loop */ if (args[i]->null_value) @@ -2719,15 +2721,6 @@ bool Item_func_min_max::get_date_native(MYSQL_TIME *ltime, ulonglong fuzzy_date) ltime->time_type= MYSQL_TIMESTAMP_DATE; ltime->hour= ltime->minute= ltime->second= ltime->second_part= 0; } - else if (Item_func_min_max::field_type() == MYSQL_TYPE_TIME) - { - ltime->time_type= MYSQL_TIMESTAMP_TIME; - ltime->hour+= (ltime->month * 32 + ltime->day) * 24; - ltime->year= ltime->month= ltime->day= 0; - if (adjust_time_range_with_warn(ltime, - MY_MIN(decimals, TIME_SECOND_PART_DIGITS))) - return (null_value= true); - } if (!(fuzzy_date & TIME_TIME_ONLY) && ((null_value= check_date_with_warn(ltime, fuzzy_date, @@ -2738,6 +2731,29 @@ bool Item_func_min_max::get_date_native(MYSQL_TIME *ltime, ulonglong fuzzy_date) } +bool Item_func_min_max::get_time_native(MYSQL_TIME *ltime) +{ + DBUG_ASSERT(fixed == 1); + + Time value(args[0]); + if (!value.is_valid_time()) + return (null_value= true); + + for (uint i= 1; i < arg_count ; i++) + { + Time tmp(args[i]); + if (!tmp.is_valid_time()) + return (null_value= true); + + int cmp= value.cmp(&tmp); + if ((cmp_sign < 0 ? cmp : -cmp) < 0) + value= tmp; + } + value.copy_to_mysql_time(ltime); + return (null_value= 0); +} + + String *Item_func_min_max::val_str_native(String *str) { String *UNINIT_VAR(res); @@ -5538,6 +5554,13 @@ my_decimal* Item_user_var_as_out_param::val_decimal(my_decimal *decimal_buffer) } +bool Item_user_var_as_out_param::get_date(MYSQL_TIME *ltime, ulonglong fuzzy) +{ + DBUG_ASSERT(0); + return true; +} + + void Item_user_var_as_out_param::print_for_load(THD *thd, String *str) { str->append('@'); @@ -6623,6 +6646,15 @@ my_decimal *Item_func_last_value::val_decimal(my_decimal *decimal_value) } +bool Item_func_last_value::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) +{ + evaluate_sideeffects(); + bool tmp= last_value->get_date(ltime, fuzzydate); + null_value= last_value->null_value; + return tmp; +} + + void Item_func_last_value::fix_length_and_dec() { last_value= args[arg_count -1]; |