Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
Description
The method Item_type_holder::display_length(Item *) has this switch:
switch (item->field_type()) |
This is not friendly to pluggable data types.
We'll introduce a new Type_handler virtual method:
virtual uint32 max_display_length(const Item *item) const; |
and move the pieces from Item_type_holder::display_length(Item *) into implementations of various Type_handler_xxx::max_display_length().
Additionally, instead of doing cast to Item_field:
uint32 Item_type_holder::display_length(Item *item)
|
{
|
if (item->type() == Item::FIELD_ITEM) |
return ((Item_field *)item)->max_disp_length(); |
return ...; // the implementation for non-field Items |
}
|
we'll remove the method Item_type_holder::display_length() and introduce a new virtual method in Item:
virtual uint32 max_display_length() const |
{
|
return type_handler()->max_display_length(this); |
}
|
Notice the default implementation will use max_display_length() of the underlying data type handler.
Item_field will override this implementation and read the result from the underlying field:
uint32 max_display_length() const { return field->max_display_length(); } |
Attachments
Issue Links
- blocks
-
MDEV-4912 Data type plugin API version 1
- Closed