Commit dd4e9cdd authored by Sergey Vojtovich's avatar Sergey Vojtovich

Get rid of Field::do_save_field_metadata()

It doesn't serve any purpose, but generates extra virtual function call.
parent 41d89b7d
......@@ -238,11 +238,11 @@ DROP TABLE `t1`;
#
# Each varchar field takes up to 2 metadata bytes, see:
#
# Field_varstring::do_save_field_metadata (field.cc)
# Field_varstring::save_field_metadata (field.cc)
#
# The float field takes 1 byte, see:
#
# Field_float::do_save_field_metadata (field.cc)
# Field_float::save_field_metadata (field.cc)
#
-- let $generated_sql= $MYSQLTEST_VARDIR/tmp/b50018.sql
......
......@@ -3209,7 +3209,7 @@ void Field_new_decimal::sql_type(String &str) const
@returns number of bytes written to metadata_ptr
*/
int Field_new_decimal::do_save_field_metadata(uchar *metadata_ptr)
int Field_new_decimal::save_field_metadata(uchar *metadata_ptr)
{
*metadata_ptr= precision;
*(metadata_ptr + 1)= decimals();
......@@ -4418,7 +4418,7 @@ bool Field_float::send_binary(Protocol *protocol)
@returns number of bytes written to metadata_ptr
*/
int Field_float::do_save_field_metadata(uchar *metadata_ptr)
int Field_float::save_field_metadata(uchar *metadata_ptr)
{
*metadata_ptr= pack_length();
return 1;
......@@ -4726,7 +4726,7 @@ void Field_double::sort_string(uchar *to,uint length __attribute__((unused)))
@returns number of bytes written to metadata_ptr
*/
int Field_double::do_save_field_metadata(uchar *metadata_ptr)
int Field_double::save_field_metadata(uchar *metadata_ptr)
{
*metadata_ptr= pack_length();
return 1;
......@@ -7131,7 +7131,7 @@ uchar *Field_string::pack(uchar *to, const uchar *from, uint max_length)
the master.
@note For information about how the length is packed, see @c
Field_string::do_save_field_metadata
Field_string::save_field_metadata
@param to Destination of the data
@param from Source of the data
......@@ -7214,7 +7214,7 @@ Field_string::unpack(uchar *to, const uchar *from, const uchar *from_end,
@returns number of bytes written to metadata_ptr
*/
int Field_string::do_save_field_metadata(uchar *metadata_ptr)
int Field_string::save_field_metadata(uchar *metadata_ptr)
{
DBUG_ASSERT(field_length < 1024);
DBUG_ASSERT((real_type() & 0xF0) == 0xF0);
......@@ -7311,7 +7311,7 @@ const uint Field_varstring::MAX_SIZE= UINT_MAX16;
@returns number of bytes written to metadata_ptr
*/
int Field_varstring::do_save_field_metadata(uchar *metadata_ptr)
int Field_varstring::save_field_metadata(uchar *metadata_ptr)
{
DBUG_ASSERT(field_length <= 65535);
int2store((char*)metadata_ptr, field_length);
......@@ -8105,9 +8105,9 @@ Field *Field_blob::new_key_field(MEM_ROOT *root, TABLE *new_table,
@returns number of bytes written to metadata_ptr
*/
int Field_blob::do_save_field_metadata(uchar *metadata_ptr)
int Field_blob::save_field_metadata(uchar *metadata_ptr)
{
DBUG_ENTER("Field_blob::do_save_field_metadata");
DBUG_ENTER("Field_blob::save_field_metadata");
*metadata_ptr= pack_length_no_ptr();
DBUG_PRINT("debug", ("metadata: %u (pack_length_no_ptr)", *metadata_ptr));
DBUG_RETURN(1);
......@@ -8635,7 +8635,7 @@ longlong Field_enum::val_int(void)
@returns number of bytes written to metadata_ptr
*/
int Field_enum::do_save_field_metadata(uchar *metadata_ptr)
int Field_enum::save_field_metadata(uchar *metadata_ptr)
{
*metadata_ptr= real_type();
*(metadata_ptr + 1)= pack_length();
......@@ -9354,9 +9354,9 @@ uint Field_bit::get_key_image(uchar *buff, uint length, imagetype type_arg)
@returns number of bytes written to metadata_ptr
*/
int Field_bit::do_save_field_metadata(uchar *metadata_ptr)
int Field_bit::save_field_metadata(uchar *metadata_ptr)
{
DBUG_ENTER("Field_bit::do_save_field_metadata");
DBUG_ENTER("Field_bit::save_field_metadata");
DBUG_PRINT("debug", ("bit_len: %d, bytes_in_rec: %d",
bit_len, bytes_in_rec));
/*
......
......@@ -897,8 +897,21 @@ class Field: public Value_source
DBUG_RETURN(field_metadata);
}
virtual uint row_pack_length() const { return 0; }
/**
Retrieve the field metadata for fields.
This default implementation returns 0 and saves 0 in the first_byte value.
@param first_byte First byte of field metadata
@returns 0 no bytes written.
*/
virtual int save_field_metadata(uchar *first_byte)
{ return do_save_field_metadata(first_byte); }
{ return 0; }
/*
data_length() return the "real size" of the data in memory.
......@@ -1523,19 +1536,6 @@ class Field: public Value_source
*/
virtual size_t do_last_null_byte() const;
/**
Retrieve the field metadata for fields.
This default implementation returns 0 and saves 0 in the metadata_ptr
value.
@param metadata_ptr First byte of field metadata
@returns 0 no bytes written.
*/
virtual int do_save_field_metadata(uchar *metadata_ptr)
{ return 0; }
protected:
uchar *pack_int(uchar *to, const uchar *from, size_t size)
{
......@@ -1834,7 +1834,7 @@ class Field_decimal :public Field_real {
/* New decimal/numeric field which use fixed point arithmetic */
class Field_new_decimal :public Field_num {
private:
int do_save_field_metadata(uchar *first_byte);
int save_field_metadata(uchar *first_byte);
public:
/* The maximum number of decimal digits can be stored */
uint precision;
......@@ -2156,7 +2156,7 @@ class Field_float :public Field_real {
uint row_pack_length() const { return pack_length(); }
void sql_type(String &str) const;
private:
int do_save_field_metadata(uchar *first_byte);
int save_field_metadata(uchar *first_byte);
};
......@@ -2213,7 +2213,7 @@ class Field_double :public Field_real {
uint row_pack_length() const { return pack_length(); }
void sql_type(String &str) const;
private:
int do_save_field_metadata(uchar *first_byte);
int save_field_metadata(uchar *first_byte);
};
......@@ -2498,7 +2498,7 @@ class Field_timestamp_hires :public Field_timestamp_with_dec {
TIMESTAMP(0..6) - MySQL56 version
*/
class Field_timestampf :public Field_timestamp_with_dec {
int do_save_field_metadata(uchar *metadata_ptr)
int save_field_metadata(uchar *metadata_ptr)
{
*metadata_ptr= decimals();
return 1;
......@@ -2766,7 +2766,7 @@ class Field_time_hires :public Field_time_with_dec {
*/
class Field_timef :public Field_time_with_dec {
void store_TIME(MYSQL_TIME *ltime);
int do_save_field_metadata(uchar *metadata_ptr)
int save_field_metadata(uchar *metadata_ptr)
{
*metadata_ptr= decimals();
return 1;
......@@ -2928,7 +2928,7 @@ class Field_datetime_hires :public Field_datetime_with_dec {
class Field_datetimef :public Field_datetime_with_dec {
void store_TIME(MYSQL_TIME *ltime);
bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, ulonglong fuzzydate) const;
int do_save_field_metadata(uchar *metadata_ptr)
int save_field_metadata(uchar *metadata_ptr)
{
*metadata_ptr= decimals();
return 1;
......@@ -3093,7 +3093,7 @@ class Field_string :public Field_longstr {
Field *make_new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type);
virtual uint get_key_image(uchar *buff,uint length, imagetype type);
private:
int do_save_field_metadata(uchar *first_byte);
int save_field_metadata(uchar *first_byte);
};
......@@ -3189,7 +3189,7 @@ class Field_varstring :public Field_longstr {
void hash(ulong *nr, ulong *nr2);
uint length_size() { return length_bytes; }
private:
int do_save_field_metadata(uchar *first_byte);
int save_field_metadata(uchar *first_byte);
};
......@@ -3429,7 +3429,7 @@ class Field_blob :public Field_longstr {
uint32 char_length() const;
uint is_equal(Create_field *new_field);
private:
int do_save_field_metadata(uchar *first_byte);
int save_field_metadata(uchar *first_byte);
};
......@@ -3593,7 +3593,7 @@ class Field_enum :public Field_str {
const Item *item,
bool is_eq_func) const;
private:
int do_save_field_metadata(uchar *first_byte);
int save_field_metadata(uchar *first_byte);
uint is_equal(Create_field *new_field);
};
......@@ -3771,7 +3771,7 @@ class Field_bit :public Field {
private:
virtual size_t do_last_null_byte() const;
int do_save_field_metadata(uchar *first_byte);
int save_field_metadata(uchar *first_byte);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment