Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
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
- blocks
-
MDEV-4912 Data type plugin API version 1
- Closed