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

Fix Item_cache constructors to accept Type_handler instead of enum_field_types

    Details

      Description

      Item_cache and its descendants have this style constructors:

        Item_cache(THD *thd, enum_field_types field_type_arg):
          Item_basic_constant(thd),
          Type_handler_hybrid_field_type(field_type_arg),
          example(0), cached_field(0),
          value_cached(0)
        {
          fixed= 1;
          maybe_null= 1;
          null_value= 1;
        }
      

      Making a cache involves calls for field_type(), e.g.:

      new (thd->mem_root) Item_cache_int(thd, item->field_type());
      new (thd->mem_root) Item_cache_temporal(thd, item->field_type());
      

      This is not friendly to pluggable data types, which will return existing type codes in field_type().

      We'll change all Item_cache* constructors to accept a Type_handler pointer instead:

        Item_cache(THD *thd, const Type_handler *):
          Item_basic_constant(thd),
          Type_handler_hybrid_field_type(handler),
          example(0), cached_field(0),
          value_cached(0)
        {
          ...
        }
      

      And replace constructor calls to:

      new (thd->mem_root) Item_cache_int(thd, item->type_handler());
      new (thd->mem_root) Item_cache_temporal(thd, item->type_handler());
      

        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: