From 64bfad6307ba93ad1e18f283d68c1c722cb7a6da Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 3 Oct 2017 13:27:52 +0400 Subject: [PATCH] Fixing Item_func_hybrid_field_type::date_op(,uint) to date_op(,ulonglong) Fixing the data type for the "fuzzydate" parameter to Item_func_hybrid_field_type::date_op() from uint to ulonglong, for consistency with Item::get_date(). --- sql/item.h | 7 ++++--- sql/item_cmpfunc.cc | 8 ++++---- sql/item_cmpfunc.h | 10 +++++----- sql/item_func.h | 10 +++++++--- sql/item_timefunc.h | 6 +++++- 5 files changed, 25 insertions(+), 16 deletions(-) diff --git a/sql/item.h b/sql/item.h index 56d103af168..a926ee9aa85 100644 --- a/sql/item.h +++ b/sql/item.h @@ -660,7 +660,8 @@ protected: return value; } bool get_date_with_conversion_from_item(Item *item, - MYSQL_TIME *ltime, uint fuzzydate) + MYSQL_TIME *ltime, + ulonglong fuzzydate) { DBUG_ASSERT(fixed == 1); return (null_value= item->get_date_with_conversion(ltime, fuzzydate)); @@ -1386,14 +1387,14 @@ public: virtual longlong val_datetime_packed() { MYSQL_TIME ltime; - uint fuzzydate= TIME_FUZZY_DATES | TIME_INVALID_DATES; + ulonglong fuzzydate= TIME_FUZZY_DATES | TIME_INVALID_DATES; return get_date_with_conversion(<ime, fuzzydate) ? 0 : pack_time(<ime); } // Get a TIME value in numeric packed format for comparison virtual longlong val_time_packed() { MYSQL_TIME ltime; - uint fuzzydate= TIME_FUZZY_DATES | TIME_INVALID_DATES | TIME_TIME_ONLY; + ulonglong fuzzydate= TIME_FUZZY_DATES | TIME_INVALID_DATES | TIME_TIME_ONLY; return get_date(<ime, fuzzydate) ? 0 : pack_time(<ime); } // Get a temporal value in packed DATE/DATETIME or TIME format diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 23b90235cdf..9954c66ebc2 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -2325,7 +2325,7 @@ Item_func_ifnull::str_op(String *str) } -bool Item_func_ifnull::date_op(MYSQL_TIME *ltime, uint fuzzydate) +bool Item_func_ifnull::date_op(MYSQL_TIME *ltime, ulonglong fuzzydate) { DBUG_ASSERT(fixed == 1); if (!args[0]->get_date_with_conversion(ltime, fuzzydate & ~TIME_FUZZY_DATES)) @@ -2798,7 +2798,7 @@ Item_func_nullif::decimal_op(my_decimal * decimal_value) bool -Item_func_nullif::date_op(MYSQL_TIME *ltime, uint fuzzydate) +Item_func_nullif::date_op(MYSQL_TIME *ltime, ulonglong fuzzydate) { DBUG_ASSERT(fixed == 1); if (!compare()) @@ -2938,7 +2938,7 @@ my_decimal *Item_func_case::decimal_op(my_decimal *decimal_value) } -bool Item_func_case::date_op(MYSQL_TIME *ltime, uint fuzzydate) +bool Item_func_case::date_op(MYSQL_TIME *ltime, ulonglong fuzzydate) { DBUG_ASSERT(fixed == 1); Item *item= find_item(); @@ -3349,7 +3349,7 @@ double Item_func_coalesce::real_op() } -bool Item_func_coalesce::date_op(MYSQL_TIME *ltime,uint fuzzydate) +bool Item_func_coalesce::date_op(MYSQL_TIME *ltime, ulonglong fuzzydate) { DBUG_ASSERT(fixed == 1); for (uint i= 0; i < arg_count; i++) diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 0cb66cd1d33..f0862608463 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -995,7 +995,7 @@ public: longlong int_op(); String *str_op(String *); my_decimal *decimal_op(my_decimal *); - bool date_op(MYSQL_TIME *ltime,uint fuzzydate); + bool date_op(MYSQL_TIME *ltime, ulonglong fuzzydate); void fix_length_and_dec() { if (!aggregate_for_result(func_name(), args, arg_count, true)) @@ -1067,7 +1067,7 @@ public: longlong int_op(); String *str_op(String *str); my_decimal *decimal_op(my_decimal *); - bool date_op(MYSQL_TIME *ltime,uint fuzzydate); + bool date_op(MYSQL_TIME *ltime, ulonglong fuzzydate); void fix_length_and_dec() { Item_func_case_abbreviation2::fix_length_and_dec2(args); @@ -1099,7 +1099,7 @@ public: :Item_func_case_abbreviation2(thd, a, b, c) { } - bool date_op(MYSQL_TIME *ltime, uint fuzzydate) + bool date_op(MYSQL_TIME *ltime, ulonglong fuzzydate) { return get_date_with_conversion_from_item(find_item(), ltime, fuzzydate); } @@ -1212,7 +1212,7 @@ public: Item_func_hybrid_field_type::cleanup(); arg_count= 2; // See the comment to the constructor } - bool date_op(MYSQL_TIME *ltime, uint fuzzydate); + bool date_op(MYSQL_TIME *ltime, ulonglong fuzzydate); double real_op(); longlong int_op(); String *str_op(String *str); @@ -2101,7 +2101,7 @@ public: longlong int_op(); String *str_op(String *); my_decimal *decimal_op(my_decimal *); - bool date_op(MYSQL_TIME *ltime, uint fuzzydate); + bool date_op(MYSQL_TIME *ltime, ulonglong fuzzydate); bool fix_fields(THD *thd, Item **ref); table_map not_null_tables() const { return 0; } const char *func_name() const { return "case"; } diff --git a/sql/item_func.h b/sql/item_func.h index 46e8562b268..409a712a5c5 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -489,7 +489,7 @@ public: bool get_date_from_date_op(MYSQL_TIME *ltime, ulonglong fuzzydate) { return date_op(ltime, - (uint)(fuzzydate | + (fuzzydate | (field_type() == MYSQL_TYPE_TIME ? TIME_TIME_ONLY : 0))); } @@ -610,7 +610,7 @@ public: field type is a temporal type. @return The result of the operation. */ - virtual bool date_op(MYSQL_TIME *res, uint fuzzy_date)= 0; + virtual bool date_op(MYSQL_TIME *res, ulonglong fuzzy_date)= 0; }; @@ -669,7 +669,11 @@ public: Item_func_hybrid_field_type(thd, list) { } String *str_op(String *str) { DBUG_ASSERT(0); return 0; } - bool date_op(MYSQL_TIME *ltime, uint fuzzydate) { DBUG_ASSERT(0); return true; } + bool date_op(MYSQL_TIME *ltime, ulonglong fuzzydate) + { + DBUG_ASSERT(0); + return true; + } }; diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 65057a71c4e..94794c6789d 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -493,7 +493,11 @@ public: } double real_op() { DBUG_ASSERT(0); return 0; } String *str_op(String *str) { DBUG_ASSERT(0); return 0; } - bool date_op(MYSQL_TIME *ltime, uint fuzzydate) { DBUG_ASSERT(0); return true; } + bool date_op(MYSQL_TIME *ltime, ulonglong fuzzydate) + { + DBUG_ASSERT(0); + return true; + } };