Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
Description
In order to make built-in and pluggable data types look similar inside the server, this function should be split into a new virtual method in Type_handler:
Field *make_field(TABLE_SHARE *share,
|
MEM_ROOT *mem_root,
|
uchar *ptr, uint32 field_length,
|
uchar *null_pos, uchar null_bit,
|
uint pack_flag,
|
enum_field_types field_type,
|
CHARSET_INFO *field_charset,
|
Field::geometry_type geom_type, uint srid,
|
Field::utype unireg_check,
|
TYPELIB *interval,
|
const char *field_name)
|
The relevant piece of the code in the original type handler patch:
@@ -9721,6 +9829,14 @@ Field *make_field(TABLE_SHARE *share, uc
|
}
|
}
|
|
+ if (const Type_handler *handler= Type_handlers.handler(field_type))
|
+ {
|
+ Field::Create_param param(share, ptr,
|
+ field_length, null_pos, null_bit, pack_flag, field_charset,
|
+ geom_type, unireg_check, interval);
|
+ return handler->make_field(¶m, field_name);
|
+ }
|
+
|
A tentative new virtual Type_handler method prototype:
virtual Field *
|
make_table_field_from_def(TABLE_SHARE *share,
|
MEM_ROOT *mem_root,
|
const LEX_CSTRING *name, |
const Record_addr *addr,
|
const Bit_addr *bit, |
const Column_definition_attributes *attr,
|
uint32 flags) const= 0;
|
where:
- Bit_addr is a new class representing the position and the offset of the extra bits (e.g. for the BIT(N) data type)
- Column_definition_attributes is a new class collecting all attribute parameters:
class Column_definition_attributes |
{
|
public: |
ulonglong length;
|
Field::utype unireg_check;
|
TYPELIB *interval;
|
CHARSET_INFO *charset;
|
uint32 srid;
|
Field::geometry_type geom_type;
|
uint pack_flag;
|
...
|
// methods |
...
|
};
|
|
Attachments
Issue Links
- blocks
-
MDEV-4912 Data type plugin API version 1
-
- Closed
-
- is blocked by
-
MDEV-16280 Add class Bit_addr
-
- Closed
-
Activity
Summary | Splite field.cc:make_field() into virtual methods in Type_handler | Split field.cc:make_field() into virtual methods in Type_handler |
Labels | refactoring |
Description |
In order to make built-in and pluggable data types look similar inside the server, this function should be split into a new virtual method in Type_handler: {code} Field *make_field(TABLE_SHARE *share, MEM_ROOT *mem_root, uchar *ptr, uint32 field_length, uchar *null_pos, uchar null_bit, uint pack_flag, enum_field_types field_type, CHARSET_INFO *field_charset, Field::geometry_type geom_type, uint srid, Field::utype unireg_check, TYPELIB *interval, const char *field_name) {code} |
In order to make built-in and pluggable data types look similar inside the server, this function should be split into a new virtual method in Type_handler: {code} Field *make_field(TABLE_SHARE *share, MEM_ROOT *mem_root, uchar *ptr, uint32 field_length, uchar *null_pos, uchar null_bit, uint pack_flag, enum_field_types field_type, CHARSET_INFO *field_charset, Field::geometry_type geom_type, uint srid, Field::utype unireg_check, TYPELIB *interval, const char *field_name) {code} The relevant piece of the code in the original type handler patch: {code} @@ -9721,6 +9829,14 @@ Field *make_field(TABLE_SHARE *share, uc } } + if (const Type_handler *handler= Type_handlers.handler(field_type)) + { + Field::Create_param param(share, ptr, + field_length, null_pos, null_bit, pack_flag, field_charset, + geom_type, unireg_check, interval); + return handler->make_field(¶m, field_name); + } + {code} |
Fix Version/s | 10.2 [ 14601 ] |
Description |
In order to make built-in and pluggable data types look similar inside the server, this function should be split into a new virtual method in Type_handler: {code} Field *make_field(TABLE_SHARE *share, MEM_ROOT *mem_root, uchar *ptr, uint32 field_length, uchar *null_pos, uchar null_bit, uint pack_flag, enum_field_types field_type, CHARSET_INFO *field_charset, Field::geometry_type geom_type, uint srid, Field::utype unireg_check, TYPELIB *interval, const char *field_name) {code} The relevant piece of the code in the original type handler patch: {code} @@ -9721,6 +9829,14 @@ Field *make_field(TABLE_SHARE *share, uc } } + if (const Type_handler *handler= Type_handlers.handler(field_type)) + { + Field::Create_param param(share, ptr, + field_length, null_pos, null_bit, pack_flag, field_charset, + geom_type, unireg_check, interval); + return handler->make_field(¶m, field_name); + } + {code} |
In order to make built-in and pluggable data types look similar inside the server, this function should be split into a new virtual method in Type_handler:
{code} Field *make_field(TABLE_SHARE *share, MEM_ROOT *mem_root, uchar *ptr, uint32 field_length, uchar *null_pos, uchar null_bit, uint pack_flag, enum_field_types field_type, CHARSET_INFO *field_charset, Field::geometry_type geom_type, uint srid, Field::utype unireg_check, TYPELIB *interval, const char *field_name) {code} The relevant piece of the code in the original type handler patch: {code} @@ -9721,6 +9829,14 @@ Field *make_field(TABLE_SHARE *share, uc } } + if (const Type_handler *handler= Type_handlers.handler(field_type)) + { + Field::Create_param param(share, ptr, + field_length, null_pos, null_bit, pack_flag, field_charset, + geom_type, unireg_check, interval); + return handler->make_field(¶m, field_name); + } + {code} A tentative new virtual Type_handler method prototype: {code:sql} virtual Field * make_table_field_from_def(TABLE_SHARE *share, MEM_ROOT *mem_root, const LEX_CSTRING *name, const Record_addr *addr, const Bit_addr *bit, const Column_definition_attributes *attr, uint32 flags) const= 0; {code} where: - {{Bit_addr}} is a new class representing the position and offset of the extra bits (e.g. for the BIT(N) data type) - {{Column_definition_attributes}} is a new class collecting all attribute parameters: {code:cpp} class Column_definition_attributes { public: ulonglong length; Field::utype unireg_check; TYPELIB *interval; CHARSET_INFO *charset; uint32 srid; Field::geometry_type geom_type; uint pack_flag; ... // methods ... }; {code} |
Description |
In order to make built-in and pluggable data types look similar inside the server, this function should be split into a new virtual method in Type_handler:
{code} Field *make_field(TABLE_SHARE *share, MEM_ROOT *mem_root, uchar *ptr, uint32 field_length, uchar *null_pos, uchar null_bit, uint pack_flag, enum_field_types field_type, CHARSET_INFO *field_charset, Field::geometry_type geom_type, uint srid, Field::utype unireg_check, TYPELIB *interval, const char *field_name) {code} The relevant piece of the code in the original type handler patch: {code} @@ -9721,6 +9829,14 @@ Field *make_field(TABLE_SHARE *share, uc } } + if (const Type_handler *handler= Type_handlers.handler(field_type)) + { + Field::Create_param param(share, ptr, + field_length, null_pos, null_bit, pack_flag, field_charset, + geom_type, unireg_check, interval); + return handler->make_field(¶m, field_name); + } + {code} A tentative new virtual Type_handler method prototype: {code:sql} virtual Field * make_table_field_from_def(TABLE_SHARE *share, MEM_ROOT *mem_root, const LEX_CSTRING *name, const Record_addr *addr, const Bit_addr *bit, const Column_definition_attributes *attr, uint32 flags) const= 0; {code} where: - {{Bit_addr}} is a new class representing the position and offset of the extra bits (e.g. for the BIT(N) data type) - {{Column_definition_attributes}} is a new class collecting all attribute parameters: {code:cpp} class Column_definition_attributes { public: ulonglong length; Field::utype unireg_check; TYPELIB *interval; CHARSET_INFO *charset; uint32 srid; Field::geometry_type geom_type; uint pack_flag; ... // methods ... }; {code} |
In order to make built-in and pluggable data types look similar inside the server, this function should be split into a new virtual method in Type_handler:
{code} Field *make_field(TABLE_SHARE *share, MEM_ROOT *mem_root, uchar *ptr, uint32 field_length, uchar *null_pos, uchar null_bit, uint pack_flag, enum_field_types field_type, CHARSET_INFO *field_charset, Field::geometry_type geom_type, uint srid, Field::utype unireg_check, TYPELIB *interval, const char *field_name) {code} The relevant piece of the code in the original type handler patch: {code} @@ -9721,6 +9829,14 @@ Field *make_field(TABLE_SHARE *share, uc } } + if (const Type_handler *handler= Type_handlers.handler(field_type)) + { + Field::Create_param param(share, ptr, + field_length, null_pos, null_bit, pack_flag, field_charset, + geom_type, unireg_check, interval); + return handler->make_field(¶m, field_name); + } + {code} A tentative new virtual Type_handler method prototype: {code:sql} virtual Field * make_table_field_from_def(TABLE_SHARE *share, MEM_ROOT *mem_root, const LEX_CSTRING *name, const Record_addr *addr, const Bit_addr *bit, const Column_definition_attributes *attr, uint32 flags) const= 0; {code} where: - {{Bit_addr}} is a new class representing the position and the offset of the extra bits (e.g. for the BIT(N) data type) - {{Column_definition_attributes}} is a new class collecting all attribute parameters: {code:cpp} class Column_definition_attributes { public: ulonglong length; Field::utype unireg_check; TYPELIB *interval; CHARSET_INFO *charset; uint32 srid; Field::geometry_type geom_type; uint pack_flag; ... // methods ... }; {code} |
Link |
This issue is blocked by |
issue.field.resolutiondate | 2018-05-24 10:47:51.0 | 2018-05-24 10:47:51.543 |
Component/s | Data types [ 13906 ] | |
Fix Version/s | 10.4.0 [ 23115 ] | |
Resolution | Fixed [ 1 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |
Workflow | MariaDB v3 [ 72815 ] | MariaDB v4 [ 132742 ] |