Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-9216

Split field.cc:make_field() into virtual methods in Type_handler

Details

    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(&param, 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

          Activity

            bar Alexander Barkov created issue -
            bar Alexander Barkov made changes -
            Field Original Value New Value
            bar Alexander Barkov made changes -
            bar Alexander Barkov made changes -
            bar Alexander Barkov made changes -
            Summary Splite field.cc:make_field() into virtual methods in Type_handler Split field.cc:make_field() into virtual methods in Type_handler
            bar Alexander Barkov made changes -
            Labels refactoring
            bar Alexander Barkov made changes -
            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(&param, field_name);
            + }
            +

            {code}
            serg Sergei Golubchik made changes -
            Fix Version/s 10.2 [ 14601 ]
            bar Alexander Barkov made changes -
            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(&param, 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(&param, 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}
            bar Alexander Barkov made changes -
            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(&param, 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(&param, 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}
            bar Alexander Barkov made changes -
            bar Alexander Barkov made changes -
            issue.field.resolutiondate 2018-05-24 10:47:51.0 2018-05-24 10:47:51.543
            bar Alexander Barkov made changes -
            Component/s Data types [ 13906 ]
            Fix Version/s 10.4.0 [ 23115 ]
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Closed [ 6 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 72815 ] MariaDB v4 [ 132742 ]

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.