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().
This commit is contained in:
Alexander Barkov 2017-10-03 13:27:52 +04:00
parent c3a44c2701
commit 64bfad6307
5 changed files with 25 additions and 16 deletions

View File

@ -660,7 +660,8 @@ protected:
return value; return value;
} }
bool get_date_with_conversion_from_item(Item *item, bool get_date_with_conversion_from_item(Item *item,
MYSQL_TIME *ltime, uint fuzzydate) MYSQL_TIME *ltime,
ulonglong fuzzydate)
{ {
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
return (null_value= item->get_date_with_conversion(ltime, fuzzydate)); return (null_value= item->get_date_with_conversion(ltime, fuzzydate));
@ -1386,14 +1387,14 @@ public:
virtual longlong val_datetime_packed() virtual longlong val_datetime_packed()
{ {
MYSQL_TIME ltime; MYSQL_TIME ltime;
uint fuzzydate= TIME_FUZZY_DATES | TIME_INVALID_DATES; ulonglong fuzzydate= TIME_FUZZY_DATES | TIME_INVALID_DATES;
return get_date_with_conversion(&ltime, fuzzydate) ? 0 : pack_time(&ltime); return get_date_with_conversion(&ltime, fuzzydate) ? 0 : pack_time(&ltime);
} }
// Get a TIME value in numeric packed format for comparison // Get a TIME value in numeric packed format for comparison
virtual longlong val_time_packed() virtual longlong val_time_packed()
{ {
MYSQL_TIME ltime; 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(&ltime, fuzzydate) ? 0 : pack_time(&ltime); return get_date(&ltime, fuzzydate) ? 0 : pack_time(&ltime);
} }
// Get a temporal value in packed DATE/DATETIME or TIME format // Get a temporal value in packed DATE/DATETIME or TIME format

View File

@ -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); DBUG_ASSERT(fixed == 1);
if (!args[0]->get_date_with_conversion(ltime, fuzzydate & ~TIME_FUZZY_DATES)) 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 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); DBUG_ASSERT(fixed == 1);
if (!compare()) 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); DBUG_ASSERT(fixed == 1);
Item *item= find_item(); 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); DBUG_ASSERT(fixed == 1);
for (uint i= 0; i < arg_count; i++) for (uint i= 0; i < arg_count; i++)

View File

@ -995,7 +995,7 @@ public:
longlong int_op(); longlong int_op();
String *str_op(String *); String *str_op(String *);
my_decimal *decimal_op(my_decimal *); 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() void fix_length_and_dec()
{ {
if (!aggregate_for_result(func_name(), args, arg_count, true)) if (!aggregate_for_result(func_name(), args, arg_count, true))
@ -1067,7 +1067,7 @@ public:
longlong int_op(); longlong int_op();
String *str_op(String *str); String *str_op(String *str);
my_decimal *decimal_op(my_decimal *); 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() void fix_length_and_dec()
{ {
Item_func_case_abbreviation2::fix_length_and_dec2(args); Item_func_case_abbreviation2::fix_length_and_dec2(args);
@ -1099,7 +1099,7 @@ public:
:Item_func_case_abbreviation2(thd, a, b, c) :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); return get_date_with_conversion_from_item(find_item(), ltime, fuzzydate);
} }
@ -1212,7 +1212,7 @@ public:
Item_func_hybrid_field_type::cleanup(); Item_func_hybrid_field_type::cleanup();
arg_count= 2; // See the comment to the constructor 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(); double real_op();
longlong int_op(); longlong int_op();
String *str_op(String *str); String *str_op(String *str);
@ -2101,7 +2101,7 @@ public:
longlong int_op(); longlong int_op();
String *str_op(String *); String *str_op(String *);
my_decimal *decimal_op(my_decimal *); 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); bool fix_fields(THD *thd, Item **ref);
table_map not_null_tables() const { return 0; } table_map not_null_tables() const { return 0; }
const char *func_name() const { return "case"; } const char *func_name() const { return "case"; }

View File

@ -489,7 +489,7 @@ public:
bool get_date_from_date_op(MYSQL_TIME *ltime, ulonglong fuzzydate) bool get_date_from_date_op(MYSQL_TIME *ltime, ulonglong fuzzydate)
{ {
return date_op(ltime, return date_op(ltime,
(uint)(fuzzydate | (fuzzydate |
(field_type() == MYSQL_TYPE_TIME ? TIME_TIME_ONLY : 0))); (field_type() == MYSQL_TYPE_TIME ? TIME_TIME_ONLY : 0)));
} }
@ -610,7 +610,7 @@ public:
field type is a temporal type. field type is a temporal type.
@return The result of the operation. @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) Item_func_hybrid_field_type(thd, list)
{ } { }
String *str_op(String *str) { 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;
}
}; };

View File

@ -493,7 +493,11 @@ public:
} }
double real_op() { DBUG_ASSERT(0); return 0; } double real_op() { DBUG_ASSERT(0); return 0; }
String *str_op(String *str) { 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;
}
}; };