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

Split the code for CHARACTER_OCTET_LENGTH and CHARACTER_MAXIMUM_LENGTH into methods in Field

    Details

      Description

      The code in sql_show.cc displaying INFORMATION_SCHEMA.COLUMNS.CHARACTER_OCTET_LENGTH and INFORMATION_SCHEMA.COLUMNS.CHARACTER_MAXIMUM_LENGTH:

      • tests field->type() and field->real_type() for various hard-coded constant MYSQL_TYPE_XXX
      • uses max_display_length() with special tricks for the BLOB data types, e.g.:

          uint32 octet_max_length= field->max_display_length();
          if (is_blob && octet_max_length != (uint32) UINT_MAX32)
            octet_max_length /= field->charset()->mbmaxlen;
        

        where the test for UINT_MAX32 is a workaround to address a special behavior of Field_blob::max_display_length() for LONGBLOB.

      • Uses has_charset() to detect data types which need NULL to be displayed in the mentioned I_S columns.

      This is non friendly to pluggable data types.

      Also, this makes it hard to fix bugs in max_display_length().

      Under terms of this task we'll move the code in sql_show.cc into a new virtual method in Field:

        virtual Information_schema_character_attributes
          information_schema_character_attributes();
      

      where Information_schema_character_attributes is a new class with approximately this structure:

      class Information_schema_character_attributes
      {
        uint32 m_octet_length;
        uint32 m_char_length;
        bool m_has_octet_length;
        bool m_has_char_length;
      public:
        .. constructors and access 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: