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

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: