Skip to content

Commit 23d4c95

Browse files
author
Alexander Barkov
committed
MDEV-8896 Dead code in stored_field_cmp_to_item()
1 parent 9337173 commit 23d4c95

File tree

3 files changed

+0
-82
lines changed

3 files changed

+0
-82
lines changed

sql/item.cc

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8618,26 +8618,6 @@ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item)
86188618
if (item->null_value)
86198619
return 0;
86208620
String *field_result= field->val_str(&field_tmp);
8621-
8622-
enum_field_types field_type= field->type();
8623-
8624-
if (field_type == MYSQL_TYPE_DATE || field_type == MYSQL_TYPE_DATETIME ||
8625-
field_type == MYSQL_TYPE_TIMESTAMP)
8626-
{
8627-
enum_mysql_timestamp_type type= MYSQL_TIMESTAMP_ERROR;
8628-
8629-
if (field_type == MYSQL_TYPE_DATE)
8630-
type= MYSQL_TIMESTAMP_DATE;
8631-
else
8632-
type= MYSQL_TIMESTAMP_DATETIME;
8633-
8634-
const char *field_name= field->field_name;
8635-
MYSQL_TIME field_time, item_time;
8636-
get_mysql_time_from_str(thd, field_result, type, field_name, &field_time);
8637-
get_mysql_time_from_str(thd, item_result, type, field_name, &item_time);
8638-
8639-
return my_time_compare(&field_time, &item_time);
8640-
}
86418621
return sortcmp(field_result, item_result, field->charset());
86428622
}
86438623
if (res_type == INT_RESULT)

sql/item_cmpfunc.cc

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -596,64 +596,6 @@ int Arg_comparator::set_compare_func(Item_func_or_sum *item, Item_result type)
596596
return 0;
597597
}
598598

599-
/**
600-
Parse date provided in a string to a MYSQL_TIME.
601-
602-
@param[in] thd Thread handle
603-
@param[in] str A string to convert
604-
@param[in] warn_type Type of the timestamp for issuing the warning
605-
@param[in] warn_name Field name for issuing the warning
606-
@param[out] l_time The MYSQL_TIME objects is initialized.
607-
608-
Parses a date provided in the string str into a MYSQL_TIME object.
609-
The date is used for comparison, that is fuzzy dates are allowed
610-
independently of sql_mode.
611-
If the string contains an incorrect date or doesn't correspond to a date at
612-
all then a warning is issued. The warn_type and the warn_name arguments are
613-
used as the name and the type of the field when issuing the warning. If any
614-
input was discarded (trailing or non-timestamp-y characters), return value
615-
will be TRUE.
616-
617-
@return Status flag
618-
@retval FALSE Success.
619-
@retval True Indicates failure.
620-
*/
621-
622-
bool get_mysql_time_from_str(THD *thd, String *str, timestamp_type warn_type,
623-
const char *warn_name, MYSQL_TIME *l_time)
624-
{
625-
bool value;
626-
MYSQL_TIME_STATUS status;
627-
int flags= TIME_FUZZY_DATES | MODE_INVALID_DATES;
628-
ErrConvString err(str);
629-
630-
DBUG_ASSERT(warn_type != MYSQL_TIMESTAMP_TIME);
631-
632-
if (!str_to_datetime(str->charset(), str->ptr(), str->length(),
633-
l_time, flags, &status))
634-
{
635-
DBUG_ASSERT(l_time->time_type == MYSQL_TIMESTAMP_DATETIME ||
636-
l_time->time_type == MYSQL_TIMESTAMP_DATE);
637-
/*
638-
Do not return yet, we may still want to throw a "trailing garbage"
639-
warning.
640-
*/
641-
value= FALSE;
642-
}
643-
else
644-
{
645-
DBUG_ASSERT(l_time->time_type != MYSQL_TIMESTAMP_TIME);
646-
DBUG_ASSERT(status.warnings != 0); // Must be set by set_to_datetime()
647-
value= TRUE;
648-
}
649-
650-
if (status.warnings > 0)
651-
make_truncated_value_warning(thd, Sql_condition::WARN_LEVEL_WARN,
652-
&err, warn_type, warn_name);
653-
654-
return value;
655-
}
656-
657599

658600
/**
659601
Prepare the comparator (set the comparison function) for comparing

sql/item_cmpfunc.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2393,10 +2393,6 @@ longlong get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
23932393
enum_field_types f_type, bool *is_null);
23942394

23952395

2396-
bool get_mysql_time_from_str(THD *thd, String *str, timestamp_type warn_type,
2397-
const char *warn_name, MYSQL_TIME *l_time);
2398-
2399-
24002396
class Comp_creator
24012397
{
24022398
public:

0 commit comments

Comments
 (0)