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

Split Create_field

    XMLWordPrintable

Details

    • Task
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • None
    • None

    Description

      Create_field is a big class and some of its parts are not really used in many contexts.
      Before adding pluggable data types under terms of MDEV-4912, it would be nice to clean-up use of Create_field.

      Under terms of this task we will:

      1. Move members of Create_field that are needed only at ALTER time into a separate class Alter_column_specification:

      class Alter_column_specification
      {
      public:
        const char *change;                   // If done with alter table
        const char *after;                    // Put column after this one
        Field *field;                         // For alter table
        TYPELIB *save_interval;               // Temporary copy for the above
                                              // Used only for UCS2 intervals
        uint offset;
        uint8 interval_id;                    // For rea_create_table
        bool create_if_not_exists;            // Used in ALTER TABLE IF NOT EXISTS
      };

      2. Move the rest of Create_field members (except field_name) into a separate class Column_specification.

      class Column_specification
      {
      public:
        LEX_STRING comment;
        Item *def, *on_update;
        enum  enum_field_types sql_type;
        ulonglong length;
        uint32 char_length;
        uint  decimals, flags, pack_length, key_length;
        Field::utype unireg_check;
        TYPELIB *interval;
        List<String> interval_list;
        CHARSET_INFO *charset;
        uint32 srid;
        Field::geometry_type geom_type;
        engine_option_value *option_list;
        ha_field_option_struct *option_struct;
        uint  pack_flag;
        Virtual_column_info *vcol_info;
        bool stored_in_db;
      };

      3. Derive Create_field from Column_specification and Alter_column_specification:

      class Create_field: public Column_specification,
                          public Alter_column_specification,
                          public Sql_alloc
      {
      public:
        LEX_CSTRING field_name;
      };

      Note, Create_field::field_name will be changed from "const char *" to LEX_CSTRING
      under terms of MDEV-8092.

      4. Change data type of sp_variable::field_def and sp_head::m_return_field_def
      from Create_field to Column_specification. These classes need neither the
      Alter_column_specification nor the "field_name" parts of Create_field.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:

                Git Integration

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