Skip to content

Commit

Permalink
Move vers_type_timestamp within the CC file
Browse files Browse the repository at this point in the history
It's a virtual method and it can't be inlined anyway. This allows type
plugins (mysql_json in particular) to use Type_handler_blob and / or
subclass it, without needing to explicitly expose the
vers_type_timestamp object.
  • Loading branch information
cvicentiu committed Oct 29, 2020
1 parent 76fabe8 commit a041b94
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
18 changes: 18 additions & 0 deletions sql/sql_type.cc
Expand Up @@ -6958,6 +6958,24 @@ bool Type_handler_string_result::

/***************************************************************************/

const Vers_type_handler* Type_handler_temporal_result::vers() const
{
return &vers_type_timestamp;
}

const Vers_type_handler* Type_handler_string_result::vers() const
{
return &vers_type_timestamp;
}

const Vers_type_handler* Type_handler_blob_common::vers() const

{
return &vers_type_timestamp;
}

/***************************************************************************/

uint Type_handler::Item_time_precision(THD *thd, Item *item) const
{
return MY_MIN(item->decimals, TIME_SECOND_PART_DIGITS);
Expand Down
8 changes: 4 additions & 4 deletions sql/sql_type.h
Expand Up @@ -3498,7 +3498,7 @@ class Vers_type_timestamp: public Vers_type_handler
const Column_definition *row_start,
const Column_definition *row_end) const;
};
extern MYSQL_PLUGIN_IMPORT Vers_type_timestamp vers_type_timestamp;
extern Vers_type_timestamp vers_type_timestamp;


class Vers_type_trx: public Vers_type_handler
Expand Down Expand Up @@ -5249,7 +5249,7 @@ class Type_handler_temporal_result: public Type_handler
bool Item_func_mul_fix_length_and_dec(Item_func_mul *) const override;
bool Item_func_div_fix_length_and_dec(Item_func_div *) const override;
bool Item_func_mod_fix_length_and_dec(Item_func_mod *) const override;
const Vers_type_handler *vers() const override { return &vers_type_timestamp; }
const Vers_type_handler *vers() const override;
};


Expand Down Expand Up @@ -5416,7 +5416,7 @@ class Type_handler_string_result: public Type_handler
bool Item_func_mul_fix_length_and_dec(Item_func_mul *) const override;
bool Item_func_div_fix_length_and_dec(Item_func_div *) const override;
bool Item_func_mod_fix_length_and_dec(Item_func_mod *) const override;
const Vers_type_handler *vers() const override { return &vers_type_timestamp; }
const Vers_type_handler *vers() const override;
};


Expand Down Expand Up @@ -7039,7 +7039,7 @@ class Type_handler_blob_common: public Type_handler_longstr
const Bit_addr &bit,
const Column_definition_attributes *attr,
uint32 flags) const override;
const Vers_type_handler *vers() const override { return &vers_type_timestamp; }
const Vers_type_handler *vers() const override;
};


Expand Down

0 comments on commit a041b94

Please sign in to comment.