summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2017-05-25 17:19:35 +0400
committerAlexander Barkov <bar@mariadb.org>2017-05-25 17:19:35 +0400
commite1f81822c399e07d771ce6b8504da084765e430b (patch)
tree36ca2ac88662e79728c0c64eaa32605ee282d8c0 /sql/item_cmpfunc.cc
parent109bc47084c72164130fc2e735ffe371713ede43 (diff)
downloadmariadb-git-e1f81822c399e07d771ce6b8504da084765e430b.tar.gz
A cleanup for MDEV-11514, MDEV-11497, MDEV-11554, MDEV-11555 - IN and CASE type aggregation problems
Removing cmp_item::get_comparator() and calling instead Type_handler::make_cmp_item(), which was earlier introduced by this patch: 74891ed257c431e5e8b4bc9479ca6456563d592f
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r--sql/item_cmpfunc.cc38
1 files changed, 8 insertions, 30 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index b6c0fe9febe..07b5f90bf69 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -3738,30 +3738,6 @@ bool Predicant_to_list_comparator::make_unique_cmp_items(THD *thd,
}
-cmp_item* cmp_item::get_comparator(Item_result type, Item *warn_item,
- CHARSET_INFO *cs)
-{
- switch (type) {
- case STRING_RESULT:
- return new cmp_item_sort_string(cs);
- case INT_RESULT:
- return new cmp_item_int;
- case REAL_RESULT:
- return new cmp_item_real;
- case ROW_RESULT:
- return new cmp_item_row;
- case DECIMAL_RESULT:
- return new cmp_item_decimal;
- case TIME_RESULT:
- DBUG_ASSERT(warn_item);
- return warn_item->field_type() == MYSQL_TYPE_TIME ?
- (cmp_item *) new cmp_item_time() :
- (cmp_item *) new cmp_item_datetime();
- }
- return 0; // to satisfy compiler :)
-}
-
-
cmp_item* cmp_item_sort_string::make_same()
{
return new cmp_item_sort_string_in_static(cmp_charset);
@@ -3814,7 +3790,8 @@ bool cmp_item_row::alloc_comparators(THD *thd, uint cols)
void cmp_item_row::store_value(Item *item)
{
DBUG_ENTER("cmp_item_row::store_value");
- if (!alloc_comparators(current_thd, item->cols()))
+ THD *thd= current_thd;
+ if (!alloc_comparators(thd, item->cols()))
{
item->bring_value();
item->null_value= 0;
@@ -3836,10 +3813,11 @@ void cmp_item_row::store_value(Item *item)
- predicate0, value00, value01
- predicate1, value10, value11
*/
- DBUG_ASSERT(item->element_index(i)->cmp_type() != TIME_RESULT);
+ Item *elem= item->element_index(i);
+ const Type_handler *handler= elem->type_handler();
+ DBUG_ASSERT(elem->cmp_type() != TIME_RESULT);
if (!(comparators[i]=
- cmp_item::get_comparator(item->element_index(i)->result_type(), 0,
- item->element_index(i)->collation.collation)))
+ handler->make_cmp_item(thd, elem->collation.collation)))
break; // new failed
}
comparators[i]->store_value(item->element_index(i));
@@ -6551,8 +6529,8 @@ longlong Item_equal::val_int()
void Item_equal::fix_length_and_dec()
{
Item *item= get_first(NO_PARTICULAR_TAB, NULL);
- eval_item= cmp_item::get_comparator(item->cmp_type(), item,
- item->collation.collation);
+ const Type_handler *handler= item->type_handler();
+ eval_item= handler->make_cmp_item(current_thd, item->collation.collation);
}