[MDEV-20696] Remove Column_definition::key_length Created: 2019-09-29  Updated: 2019-09-30  Resolved: 2019-09-30

Status: Closed
Project: MariaDB Server
Component/s: Data types
Fix Version/s: 10.5.0

Type: Task Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-4912 Data type plugin API version 1 Closed

 Description   

Let's remove the member Column_definition::key_length and introduce a new virtual method in Type_handler instead:

virtual uint calc_key_length(const Column_definition &def) const;

Note, key_length is a redundant member. It can be unambiguously calculated, depending on the data type, from:

  • Column_definition::pack_length
  • Column_definition::length
  • Column_definition::interval

There is no a need to copy this member around the code.

Removing key_length will simplify the job being done in Type_handler methods:

  • Column_definition_prepare_stage1()
  • Column_definition_redefine_stage1()

which will give a simpler data type API.

Also, later this change will simplify to unify these Type_handler methods:

   virtual Field *make_table_field(MEM_ROOT *root,
                                  const LEX_CSTRING *name,
                                  const Record_addr &addr,
                                  const Type_all_attributes &attr,
                                  TABLE *table) const= 0;

and

  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;

into a single method.


Generated at Thu Feb 08 09:01:29 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.