Skip to content

Commit

Permalink
Adding "const" qualifier to the MYSQL_TIME* argument of Field::store_…
Browse files Browse the repository at this point in the history
…time_dec()
  • Loading branch information
Alexander Barkov committed Feb 3, 2018
1 parent 705283f commit 2ecf2f9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
16 changes: 8 additions & 8 deletions sql/field.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2196,7 +2196,7 @@ bool Field::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
Needs to be changed if/when we want to support different time formats.
*/

int Field::store_time_dec(MYSQL_TIME *ltime, uint dec)
int Field::store_time_dec(const MYSQL_TIME *ltime, uint dec)
{
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
char buff[MAX_DATE_STRING_REP_LENGTH];
Expand Down Expand Up @@ -3241,7 +3241,7 @@ int Field_new_decimal::store_decimal(const my_decimal *decimal_value)
}


int Field_new_decimal::store_time_dec(MYSQL_TIME *ltime, uint dec_arg)
int Field_new_decimal::store_time_dec(const MYSQL_TIME *ltime, uint dec_arg)
{
my_decimal decimal_value;
return store_value(date2my_decimal(ltime, &decimal_value));
Expand Down Expand Up @@ -3480,7 +3480,7 @@ Item *Field_new_decimal::get_equal_const_item(THD *thd, const Context &ctx,
}


int Field_num::store_time_dec(MYSQL_TIME *ltime, uint dec_arg)
int Field_num::store_time_dec(const MYSQL_TIME *ltime, uint dec_arg)
{
longlong v= TIME_to_ulonglong(ltime);
if (ltime->neg == 0)
Expand Down Expand Up @@ -4734,7 +4734,7 @@ int Field_real::store_decimal(const my_decimal *dm)
return store(dbl);
}

int Field_real::store_time_dec(MYSQL_TIME *ltime, uint dec_arg)
int Field_real::store_time_dec(const MYSQL_TIME *ltime, uint dec_arg)
{
return store(TIME_to_double(ltime));
}
Expand Down Expand Up @@ -5016,7 +5016,7 @@ copy_or_convert_to_datetime(THD *thd, const MYSQL_TIME *from, MYSQL_TIME *to)
}


int Field_timestamp::store_time_dec(MYSQL_TIME *ltime, uint dec)
int Field_timestamp::store_time_dec(const MYSQL_TIME *ltime, uint dec)
{
int unused;
ErrConvTime str(ltime);
Expand Down Expand Up @@ -5582,7 +5582,7 @@ int Field_temporal_with_date::store(longlong nr, bool unsigned_val)
}


int Field_temporal_with_date::store_time_dec(MYSQL_TIME *ltime, uint dec)
int Field_temporal_with_date::store_time_dec(const MYSQL_TIME *ltime, uint dec)
{
int error= 0, have_smth_to_conv= 1;
ErrConvTime str(ltime);
Expand Down Expand Up @@ -5774,7 +5774,7 @@ static void calc_datetime_days_diff(MYSQL_TIME *ltime, long days)
}


int Field_time::store_time_dec(MYSQL_TIME *ltime, uint dec)
int Field_time::store_time_dec(const MYSQL_TIME *ltime, uint dec)
{
MYSQL_TIME l_time= *ltime;
ErrConvTime str(ltime);
Expand Down Expand Up @@ -6234,7 +6234,7 @@ int Field_year::store(longlong nr, bool unsigned_val)
}


int Field_year::store_time_dec(MYSQL_TIME *ltime, uint dec_arg)
int Field_year::store_time_dec(const MYSQL_TIME *ltime, uint dec_arg)
{
ErrConvTime str(ltime);
if (Field_year::store(ltime->year, 0))
Expand Down
18 changes: 9 additions & 9 deletions sql/field.h
Original file line number Diff line number Diff line change
Expand Up @@ -815,9 +815,9 @@ class Field: public Value_source
virtual int store(double nr)=0;
virtual int store(longlong nr, bool unsigned_val)=0;
virtual int store_decimal(const my_decimal *d)=0;
virtual int store_time_dec(MYSQL_TIME *ltime, uint dec);
virtual int store_time_dec(const MYSQL_TIME *ltime, uint dec);
virtual int store_timestamp(my_time_t timestamp, ulong sec_part);
int store_time(MYSQL_TIME *ltime)
int store_time(const MYSQL_TIME *ltime)
{ return store_time_dec(ltime, TIME_SECOND_PART_DIGITS); }
int store(const char *to, uint length, CHARSET_INFO *cs,
enum_check_fields check_level);
Expand Down Expand Up @@ -1673,7 +1673,7 @@ class Field_num :public Field {
field_metadata, length));
return length;
}
int store_time_dec(MYSQL_TIME *ltime, uint dec);
int store_time_dec(const MYSQL_TIME *ltime, uint dec);
double pos_in_interval(Field *min, Field *max)
{
return pos_in_interval_val_real(min, max);
Expand Down Expand Up @@ -1813,7 +1813,7 @@ class Field_real :public Field_num {
field_length >= from->field_length;
}
int store_decimal(const my_decimal *);
int store_time_dec(MYSQL_TIME *ltime, uint dec);
int store_time_dec(const MYSQL_TIME *ltime, uint dec);
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
my_decimal *val_decimal(my_decimal *);
bool val_bool() { return val_real() != 0e0; }
Expand Down Expand Up @@ -1903,7 +1903,7 @@ class Field_new_decimal :public Field_num {
int store(const char *to, uint length, CHARSET_INFO *charset);
int store(double nr);
int store(longlong nr, bool unsigned_val);
int store_time_dec(MYSQL_TIME *ltime, uint dec);
int store_time_dec(const MYSQL_TIME *ltime, uint dec);
int store_decimal(const my_decimal *);
double val_real(void);
longlong val_int(void);
Expand Down Expand Up @@ -2382,7 +2382,7 @@ class Field_temporal_with_date: public Field_temporal {
int store(const char *to, uint length, CHARSET_INFO *charset);
int store(double nr);
int store(longlong nr, bool unsigned_val);
int store_time_dec(MYSQL_TIME *ltime, uint dec);
int store_time_dec(const MYSQL_TIME *ltime, uint dec);
int store_decimal(const my_decimal *);
bool validate_value_in_record(THD *thd, const uchar *record) const;
};
Expand All @@ -2404,7 +2404,7 @@ class Field_timestamp :public Field_temporal {
int store(const char *to,uint length,CHARSET_INFO *charset);
int store(double nr);
int store(longlong nr, bool unsigned_val);
int store_time_dec(MYSQL_TIME *ltime, uint dec);
int store_time_dec(const MYSQL_TIME *ltime, uint dec);
int store_decimal(const my_decimal *);
int store_timestamp(my_time_t timestamp, ulong sec_part);
int save_in_field(Field *to);
Expand Down Expand Up @@ -2601,7 +2601,7 @@ class Field_year :public Field_tiny {
int store(const char *to,uint length,CHARSET_INFO *charset);
int store(double nr);
int store(longlong nr, bool unsigned_val);
int store_time_dec(MYSQL_TIME *ltime, uint dec);
int store_time_dec(const MYSQL_TIME *ltime, uint dec);
double val_real(void);
longlong val_int(void);
String *val_str(String*,String *);
Expand Down Expand Up @@ -2711,7 +2711,7 @@ class Field_time :public Field_temporal {
return real_type() == from->real_type() &&
decimals() == from->decimals();
}
int store_time_dec(MYSQL_TIME *ltime, uint dec);
int store_time_dec(const MYSQL_TIME *ltime, uint dec);
int store(const char *to,uint length,CHARSET_INFO *charset);
int store(double nr);
int store(longlong nr, bool unsigned_val);
Expand Down

0 comments on commit 2ecf2f9

Please sign in to comment.