[MDEV-12687] Split Item::send() into virtual method in Type_handler Created: 2017-05-04  Updated: 2017-05-04  Resolved: 2017-05-04

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

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

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

 Description   

Item::send has a switch on field_type():

bool Item::send(Protocol *protocol, String *buffer)
{
  ...
  switch ((f_type=field_type())) {
  default:
  case MYSQL_TYPE_NULL:
  case MYSQL_TYPE_DECIMAL:
  ...
};

This is not friendly to pluggable data types.

We'll introduce a new in Type_handler instead:

virtual bool Item_send(Item *item, Protocol *p, st_value *buf) const= 0;

The default implementation of Item::send will look like:

virtual bool send(Protocol *protocol, st_value *buffer)
{
  return type_handler()->Item_send(this, protocol, buffer);
}


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