[MDEV-9217] Split Item::tmp_table_field_from_field_type() into virtual methods in Type_handler Created: 2015-12-01 Updated: 2017-05-17 Resolved: 2017-04-24 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | OTHER |
| Fix Version/s: | 10.3.1 |
| Type: | Task | Priority: | Major |
| Reporter: | Alexander Barkov | Assignee: | Alexander Barkov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | refactoring | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
Currently Item::tmp_table_field_from_field_type() has this code:
This is not friendly to pluggable data types. We'll introduce a new method in Type_handler:
and move all switch pieces into implementations of make_table_field of the corresponding Type_handler_xxx. Note, the new method for now will be used to create only fields for temporary tables, but later we'll reuse it for make_field() purposes in field.cc. Therefore, the API for the new method contains a new class Record_addr which describes pointer and null-pointer of this field in the record.
Additionally we'll remove the fixed_length and set_blob_packlength parameters from Item::tmp_table_field_from_field_type. Removing fixed_length is easy: it's not really used, the code checking fixed_length in Item::tmp_table_field_from_field_type is dead code. Removing set_blob_packlength is less trivial. This parameter was needed to choose a proper blob type handler (type_handler_blob, type_handler_tiny_blob, type_handler_medium_blob, type_handler_long_blob) depending on max_length. So instead of choosing the exact data type during tmp_table_field_from_type(), we'll fix all affected Item_xxx::type_handler() to return a correct type handler, which is in sync with max_length. Some Item_xxx will need to fix type_handler() or field_type(), other will need to fix fix_length_and_dec(). |
| Comments |
| Comment by Oleksandr Byelkin [ 2017-04-24 ] |
|
OK to push after changing the constant and running all tests. |