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

Split Item_cache::get_cache() into virtual methods in Type_handler

    XMLWordPrintable

Details

    Description

      As a part of preparatory work for MDEV-4912, we'll add a new virtual method in Type_handler:

      virtual Item_cache *Item_get_cache(THD *thd, const Item *item) const;
      

      and split this code into implementations of the new virtual method:

      Item_cache* Item_cache::get_cache(THD *thd, const Item *item,
                                        const Item_result type)
      {
        MEM_ROOT *mem_root= thd->mem_root;
        switch (type) {
        case INT_RESULT:
          return new (mem_root) Item_cache_int(thd, item->field_type());
        case REAL_RESULT:
          return new (mem_root) Item_cache_real(thd);
        case DECIMAL_RESULT:
          return new (mem_root) Item_cache_decimal(thd);
        case STRING_RESULT:
          return new (mem_root) Item_cache_str(thd, item);
        case ROW_RESULT:
          return new (mem_root) Item_cache_row(thd);
        case TIME_RESULT:
          return new (mem_root) Item_cache_temporal(thd, item->field_type());
        }
        return 0;                                     // Impossible
      }
      

      This will allow data type plugins to create their own versions of Item_cache, to optimize comparison with constants.

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.