[MDEV-16884] Remove tests for field_type() in Item_cache_temporal Created: 2018-08-02  Updated: 2018-11-01  Resolved: 2018-08-02

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

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

 Description   

Item_cache_temporal has the following methods with tests for field_type():

longlong Item_cache_temporal::val_datetime_packed()
{
  if (Item_cache_temporal::field_type() == MYSQL_TYPE_TIME)
    return Item::val_datetime_packed(); // TIME-to-DATETIME conversion needed
  if ((!value_cached && !cache_value()) || null_value)
  {
    null_value= TRUE;
    return 0;
  }
  return value;
}

longlong Item_cache_temporal::val_time_packed()
{
  if (Item_cache_temporal::field_type() != MYSQL_TYPE_TIME)
    return Item::val_time_packed(); // DATETIME-to-TIME conversion needed
  if ((!value_cached && !cache_value()) || null_value)
  {
    null_value= TRUE;
    return 0;
  }
  return value;
}

Tests for field_type() are not friendly for user defined data types (plugins) and should all be eventually gone.

Under terms of this task we'll move implementations of val_datetime_packed() and val_time_packed() from Item_cache_temporal to its descendants:

  • Item_cache_date
  • Item_cache_time
  • Item_catche_datetime

and thus remove the need to test field_type().


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