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

Spider: add new query building helper function

    XMLWordPrintable

Details

    Description

      We do see the following anywhere in the Spider codebase.

      if (str->reserve(SPIDER_SQL_WHERE_LEN))
        DBUG_RETURN(HA_ERR_OUT_OF_MEM);
      str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN);
      

      This is messy and makes the code less readable. It would be better if we could write like this:

      if (int err = str->append(SPIDER_SQL_WHERE_STR))
        DBUG_RETURN(err);
       
      // multiple string can be appended at once
      if (int err = str->append(SPIDER_SQL_IN_STR, SPIDER_SQL_OPEN_PAREN_STR))
        DBUG_RETURN(err);
      

      The memory allocation should be automatically done in the append function. This automatic memory allocation should care about the performance. Possibly, it would allocate extra memory and reallocate memory only when it is necessary.

      Attachments

        Issue Links

          Activity

            People

              nayuta-yanagisawa Nayuta Yanagisawa (Inactive)
              nayuta-yanagisawa Nayuta Yanagisawa (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.