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

Refactoring: Change Item_save_in_value() not to return SQL NULL

    XMLWordPrintable

Details

    • Task
    • Status: Stalled (View Workflow)
    • Major
    • Resolution: Unresolved
    • 12.2
    • Data types
    • None

    Description

      The return value for Type_handler::Item_save_in_value() is misleading. It currently returns:

      • true if the value evaluated to SQL NULL
      • false otherwise

      Similar functions return true if some error happened. So the code looks confusing.

      Let's change the return type from bool to void.

      Let's also add a new method st_value::is_null(), to make SQL NULL tests simpler, as follows:

        bool is_null() const
        {
          return m_type == DYN_COL_NULL;
        }
      

      so the callers, instead of testing the return value, can test value.is_null().

      The caller code will change, for example, like this:

         st_value tmp;
      -  if (!item->save_in_value(thd, &tmp))
      +  item->save_in_value(thd, &tmp);
      +  if (!tmp.is_null())
      

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:

              Git Integration

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