Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
Description
The code in the following methods:
Item::make_string_field()
|
Item::tmp_table_field_from_field_type()
|
Item_type_holder::make_field_by_type()
|
is not friendly to new data types, because it has conditions on field_type.
To make the code more friendly, we'll add two new virtual methods in Type_handler:
virtual const Type_handler *type_handler_for_tmp_table(const Item *) const; |
virtual const Type_handler *type_handler_for_union(const Item *) const; |
This will simplify the code a lot:
- Item::make_string_field() will be gone
- Item_func_group_concat::make_string_field() will be gone
- Item::tmp_table_field_from_field_type() will simplify to:
Field *tmp_table_field_from_field_type(TABLE *table)
{
const Type_handler *h= type_handler()->type_handler_for_tmp_table(this);
return h->make_and_init_table_field(&name, Record_addr(maybe_null),
*this, table);
}
- Item_type_holder::make_field_by_type() will be renamed to create_tmp_field} and simplify to:
Field *create_tmp_field(bool group, TABLE *table)
{
return Item_type_holder::type_handler()->
make_and_init_table_field(&name, Record_addr(maybe_null),
*this, table);
}
- The TIME_RESULT, STRING_RESULT, DECIMAL_RESULT branches in Item::create_tmp_field() will be simplified to:
case TIME_RESULT:
case DECIMAL_RESULT:
case STRING_RESULT:
new_field= tmp_table_field_from_field_type(table);
Attachments
Issue Links
- blocks
-
MDEV-4912 Data type plugin API version 1
- Closed
- relates to
-
MDEV-12656 Crash in CREATE..SELECT..UNION with a ENUM column and NULL
- Closed