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

Add Field::store_hex_hybrid()

    XMLWordPrintable

    Details

      Description

      This method in item.cc:

      int Item_hex_hybrid::save_in_field(Field *field, bool no_conversions)
      {
      ..
      }

      depends on the data type. It should be split apart into virtual methods in Field, so the user-defined data types and the standard data types look similar.

      For example, the INET6 data type will need its own conversion, which is not compatible with the current behavior of Item_hex_hybrid::save_in_field().

      The relevant pieces of the code in the original type handler patch:

      -int Item_hex_hybrid::save_in_field(Field *field, bool no_conversions)
      +int Item_hex_hybrid::save_in_field_as_string(Field *field)
       {
         field->set_notnull();
      -  if (field->result_type() == STRING_RESULT)
      -    return field->store(str_value.ptr(), str_value.length(), 
      -                        collation.collation);
      +  return field->store(str_value.ptr(), str_value.length(), 
      +                      collation.collation);
      +}
       
      +
      +int Item_hex_hybrid::save_in_field_as_number(Field *field)
      +{
      +  field->set_notnull();
       
      @@ -6413,6 +6466,15 @@ int Item_hex_hybrid::save_in_field(Field
       }
      +int Item_hex_hybrid::save_in_field(Field *field, bool no_conversions)
      +{
      +  if (const Type_handler *handler= Type_handlers.handler(field->type()))
      +    return handler->save_in_field(this, field);
      +  return field->result_type() == STRING_RESULT ?
      +         save_in_field_as_string(field) : save_in_field_as_number(field);
      +}
      +

        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: