[MDEV-14467] Item_param: replace {INT|DECIMAL|REAL|STRING|TIME}_VALUE with Type_handler Created: 2017-11-22  Updated: 2017-11-29  Resolved: 2017-11-29

Status: Closed
Project: MariaDB Server
Component/s: Data types
Fix Version/s: 10.3.3

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

Issue Links:
Blocks
blocks MDEV-4912 Data type plugin API version 1 Closed
blocks MDEV-14270 Dynamic CREATE TABLE does not preserv... Open
Relates
relates to MDEV-14476 Integer overflow when using 922337203... Open
relates to MDEV-14494 Move set_param_xxx() in sql_prepare.c... Closed
relates to MDEV-14498 PS: Wrong value for CAST(? AS DOUBLE)... Open

 Description   

Item_param has two parallel systems to maintain the data type:

  • Type_handler_hybrid_field_type, which is used externally, like for a regular Item.
  • enum_item_param_state constants INT_VALUE, DECIMAL_VALUE, REAL_VALUE, STRING_VALUE, TIME_VALUE, which are used internally, to maintain the data stored inside Item_param::value.

We'll do the following:

  • Remove the data type specific constants from enum_item_param_state
  • Add a new value SHORT_DATA_VALUE instead, for all data types.
  • Start using Type_handler_hybrid_field_type to maintain Item_param::value internally.

After this change, enum_item_param_state will look like this:

enum enum_item_param_state
{
  NO_VALUE, NULL_VALUE, SHORT_DATA_VALUE, LONG_DATA_VALUE,
  DEFAULT_VALUE, IGNORE_VALUE
} state;

Note, SHORT_DATA_VALUE is needed to distinguish the state from LONG_DATA_VALUE.

These changes are needed to simplify further work for:

  • MDEV-14270 Dynamic CREATE TABLE does not preserve the data type of SP variables with NULL value
  • MDEV-4912 Add a plugin to field types (column types)

Generated at Thu Feb 08 08:13:47 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.