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

Replace member Item::fixed to virtual method is_fixed()

    Details

      Description

      Many Item descendants do not really need Item::fixed, because they get fixed at constructor call time.

      This includes (list#1):

      • Item_basic_constant
      • Item_param (it still can change its Item::type() when the exact value is bound, but does not really need Item::fixed)
      • Item_ident_for_show
      • Item_copy
      • Item_type_holder
      • Item_sum_field
      • Item_proc

      Items that need Item::fixed are limited only to (list#2):

      • Item_user_var_as_out_param
      • Item_sp_variable
      • Item_name_const
      • Item_result_field

      Under terms of this task we'll create a common parent Item_fixed_hybrid, move items from list#2 into it, and introduce a virtual method Item::is_fixed() as a replacement for the member Item::fixed.

      The top level Item::is_fixed() will return true by default, which will cover list#1.

      Rationale:

      • Simplify simple items (like literals) as much as possible and reduce their size gradually. This will make it easier to create Item_cache and Item_basic_constant (for literals) for new data types.
      • Simplify the code for Item_param, which now has to maintain three things in sync: state, item_type, fixed. After this change there will be only state and item_time (and the latter will be gone after MDEV-14630).
      • Preparation to MDEV-14630, to make its patch easier.

      Additionally, at once we'll collect all literals under a new class Item_literal:

      • Item_num
      • Item_string
      • Item_hex_constant
      • Item_temporal_literal

      They now have some duplicate code. Also, a separate pointer type Item_literal* will be useful for the data type API.

        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: