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
-
Activity
Description |
The method {{Item_type_holder::display_length(Item *)}} has this {{switch}}:
{code:cpp} switch (item->field_type()) {code} This is not friendly to pluggable data types. We'll introduce a new virtual method: {code:cpp} virtual uint32 max_display_length(const Item *item) const; {code} and move the pieces from {{Item_type_holder::display_length(Item *)}} into implementations of various {{Type_handler_xxx::max_display_length}}. |
The method {{Item_type_holder::display_length(Item *)}} has this {{switch}}:
{code:cpp} switch (item->field_type()) {code} This is not friendly to pluggable data types. We'll introduce a new Type_handler virtual method: {code:cpp} virtual uint32 max_display_length(const Item *item) const; {code} and move the pieces from {{Item_type_holder::display_length(Item *)}} into implementations of various {{Type_handler_xxx::max_display_length}}. |
Description |
The method {{Item_type_holder::display_length(Item *)}} has this {{switch}}:
{code:cpp} switch (item->field_type()) {code} This is not friendly to pluggable data types. We'll introduce a new Type_handler virtual method: {code:cpp} virtual uint32 max_display_length(const Item *item) const; {code} and move the pieces from {{Item_type_holder::display_length(Item *)}} into implementations of various {{Type_handler_xxx::max_display_length}}. |
The method {{Item_type_holder::display_length(Item *)}} has this {{switch}}:
{code:cpp} switch (item->field_type()) {code} This is not friendly to pluggable data types. We'll introduce a new Type_handler virtual method: {code:cpp} virtual uint32 max_display_length(const Item *item) const; {code} and move the pieces from {{Item_type_holder::display_length(Item *)}} into implementations of various {{Type_handler_xxx::max_display_length()}}. |
Description |
The method {{Item_type_holder::display_length(Item *)}} has this {{switch}}:
{code:cpp} switch (item->field_type()) {code} This is not friendly to pluggable data types. We'll introduce a new Type_handler virtual method: {code:cpp} virtual uint32 max_display_length(const Item *item) const; {code} and move the pieces from {{Item_type_holder::display_length(Item *)}} into implementations of various {{Type_handler_xxx::max_display_length()}}. |
The method {{Item_type_holder::display_length(Item *)}} has this {{switch}}:
{code:cpp} switch (item->field_type()) {code} This is not friendly to pluggable data types. We'll introduce a new Type_handler virtual method: {code:cpp} virtual uint32 max_display_length(const Item *item) const; {code} 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}}: {code:cpp} uint32 Item_type_holder::display_length(Item *item) { if (item->type() == Item::FIELD_ITEM) return ((Item_field *)item)->max_disp_length(); // the implementation non-field Items } {code} we'll remove the method {{Item_type_holder::display_length()}} and introduce a new virtual method in Item: {code:cpp} virtual uint32 max_display_length() const { return type_handler()->max_display_length(this); } {code} 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: {code:cpp} uint32 max_display_length() const { return field->max_display_length(); } {code} |
Status | Open [ 1 ] | In Progress [ 3 ] |
Description |
The method {{Item_type_holder::display_length(Item *)}} has this {{switch}}:
{code:cpp} switch (item->field_type()) {code} This is not friendly to pluggable data types. We'll introduce a new Type_handler virtual method: {code:cpp} virtual uint32 max_display_length(const Item *item) const; {code} 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}}: {code:cpp} uint32 Item_type_holder::display_length(Item *item) { if (item->type() == Item::FIELD_ITEM) return ((Item_field *)item)->max_disp_length(); // the implementation non-field Items } {code} we'll remove the method {{Item_type_holder::display_length()}} and introduce a new virtual method in Item: {code:cpp} virtual uint32 max_display_length() const { return type_handler()->max_display_length(this); } {code} 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: {code:cpp} uint32 max_display_length() const { return field->max_display_length(); } {code} |
The method {{Item_type_holder::display_length(Item *)}} has this {{switch}}:
{code:cpp} switch (item->field_type()) {code} This is not friendly to pluggable data types. We'll introduce a new Type_handler virtual method: {code:cpp} virtual uint32 max_display_length(const Item *item) const; {code} 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}}: {code:cpp} 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 } {code} we'll remove the method {{Item_type_holder::display_length()}} and introduce a new virtual method in Item: {code:cpp} virtual uint32 max_display_length() const { return type_handler()->max_display_length(this); } {code} 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: {code:cpp} uint32 max_display_length() const { return field->max_display_length(); } {code} |
Assignee | Alexander Barkov [ bar ] | Nirbhay Choubey [ nirbhay_c ] |
Status | In Progress [ 3 ] | In Review [ 10002 ] |
Assignee | Nirbhay Choubey [ nirbhay_c ] | Alexander Barkov [ bar ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Fix Version/s | 10.3.0 [ 22127 ] | |
Fix Version/s | 10.3 [ 22126 ] | |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
Labels | datatype |
Workflow | MariaDB v3 [ 78754 ] | MariaDB v4 [ 133072 ] |