[MDEV-11298] Split Item_func_hex::val_str_ascii() into virtual methods in Type_handler Created: 2016-11-16  Updated: 2017-04-07  Resolved: 2016-12-01

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Fix Version/s: 10.3.0

Type: Task Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: datatype

Issue Links:
Blocks
blocks MDEV-4912 Data type plugin API version 1 Closed

 Description   

Item_func_hex::val_str_ascii() has a few tests on args[0]->result_type().

   if (args[0]->result_type() == REAL_RESULT ||
       args[0]->result_type() == DECIMAL_RESULT)

We'll move the data type specific code to the corresponding Type_handler_xxx, and rewrite Item_func_hex::val_str_ascii() to call a virtual method in Type_handler, e.g. about like this:

 String *val_str_ascii(String *str)
 {
   return args[0]->type_handler()->Item_func_hex_val_str_ascii(this, str);
 }

Note, the value of args[0]->type_handler() can be cached at fix_length_and_dec() time, to have fewer virtual calls at run time:

 String *val_str_ascii(String *str)
 {
   return m_handler->Item_func_hex_val_str_ascii(this, str);
 }


Generated at Thu Feb 08 07:48:52 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.