[MDEV-16388] Replace member Item::fixed to virtual method is_fixed() Created: 2018-06-04  Updated: 2018-06-06  Resolved: 2018-06-06

Status: Closed
Project: MariaDB Server
Component/s: Data types
Fix Version/s: 10.4.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
blocks MDEV-14630 Replace {STRING|INT|REAL|DECIMAL|DATE... Closed
is blocked by MDEV-16385 ROW SP variable is allowed in unexpec... Closed

 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.


Generated at Thu Feb 08 08:28:33 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.