Commit 2ecf2f9b authored by Alexander Barkov's avatar Alexander Barkov

Adding "const" qualifier to the MYSQL_TIME* argument of Field::store_time_dec()

parent 705283f7
...@@ -2196,7 +2196,7 @@ bool Field::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate) ...@@ -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. 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; ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
char buff[MAX_DATE_STRING_REP_LENGTH]; char buff[MAX_DATE_STRING_REP_LENGTH];
...@@ -3241,7 +3241,7 @@ int Field_new_decimal::store_decimal(const my_decimal *decimal_value) ...@@ -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; my_decimal decimal_value;
return store_value(date2my_decimal(ltime, &decimal_value)); return store_value(date2my_decimal(ltime, &decimal_value));
...@@ -3480,7 +3480,7 @@ Item *Field_new_decimal::get_equal_const_item(THD *thd, const Context &ctx, ...@@ -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); longlong v= TIME_to_ulonglong(ltime);
if (ltime->neg == 0) if (ltime->neg == 0)
...@@ -4734,7 +4734,7 @@ int Field_real::store_decimal(const my_decimal *dm) ...@@ -4734,7 +4734,7 @@ int Field_real::store_decimal(const my_decimal *dm)
return store(dbl); 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)); return store(TIME_to_double(ltime));
} }
...@@ -5016,7 +5016,7 @@ copy_or_convert_to_datetime(THD *thd, const MYSQL_TIME *from, MYSQL_TIME *to) ...@@ -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; int unused;
ErrConvTime str(ltime); ErrConvTime str(ltime);
...@@ -5582,7 +5582,7 @@ int Field_temporal_with_date::store(longlong nr, bool unsigned_val) ...@@ -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; int error= 0, have_smth_to_conv= 1;
ErrConvTime str(ltime); ErrConvTime str(ltime);
...@@ -5774,7 +5774,7 @@ static void calc_datetime_days_diff(MYSQL_TIME *ltime, long days) ...@@ -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; MYSQL_TIME l_time= *ltime;
ErrConvTime str(ltime); ErrConvTime str(ltime);
...@@ -6234,7 +6234,7 @@ int Field_year::store(longlong nr, bool unsigned_val) ...@@ -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); ErrConvTime str(ltime);
if (Field_year::store(ltime->year, 0)) if (Field_year::store(ltime->year, 0))
......
...@@ -815,9 +815,9 @@ class Field: public Value_source ...@@ -815,9 +815,9 @@ class Field: public Value_source
virtual int store(double nr)=0; virtual int store(double nr)=0;
virtual int store(longlong nr, bool unsigned_val)=0; virtual int store(longlong nr, bool unsigned_val)=0;
virtual int store_decimal(const my_decimal *d)=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); 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); } { return store_time_dec(ltime, TIME_SECOND_PART_DIGITS); }
int store(const char *to, uint length, CHARSET_INFO *cs, int store(const char *to, uint length, CHARSET_INFO *cs,
enum_check_fields check_level); enum_check_fields check_level);
...@@ -1673,7 +1673,7 @@ class Field_num :public Field { ...@@ -1673,7 +1673,7 @@ class Field_num :public Field {
field_metadata, length)); field_metadata, length));
return 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) double pos_in_interval(Field *min, Field *max)
{ {
return pos_in_interval_val_real(min, max); return pos_in_interval_val_real(min, max);
...@@ -1813,7 +1813,7 @@ class Field_real :public Field_num { ...@@ -1813,7 +1813,7 @@ class Field_real :public Field_num {
field_length >= from->field_length; field_length >= from->field_length;
} }
int store_decimal(const my_decimal *); 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); bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
my_decimal *val_decimal(my_decimal *); my_decimal *val_decimal(my_decimal *);
bool val_bool() { return val_real() != 0e0; } bool val_bool() { return val_real() != 0e0; }
...@@ -1903,7 +1903,7 @@ class Field_new_decimal :public Field_num { ...@@ -1903,7 +1903,7 @@ class Field_new_decimal :public Field_num {
int store(const char *to, uint length, CHARSET_INFO *charset); int store(const char *to, uint length, CHARSET_INFO *charset);
int store(double nr); int store(double nr);
int store(longlong nr, bool unsigned_val); 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_decimal(const my_decimal *);
double val_real(void); double val_real(void);
longlong val_int(void); longlong val_int(void);
...@@ -2382,7 +2382,7 @@ class Field_temporal_with_date: public Field_temporal { ...@@ -2382,7 +2382,7 @@ class Field_temporal_with_date: public Field_temporal {
int store(const char *to, uint length, CHARSET_INFO *charset); int store(const char *to, uint length, CHARSET_INFO *charset);
int store(double nr); int store(double nr);
int store(longlong nr, bool unsigned_val); 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_decimal(const my_decimal *);
bool validate_value_in_record(THD *thd, const uchar *record) const; bool validate_value_in_record(THD *thd, const uchar *record) const;
}; };
...@@ -2404,7 +2404,7 @@ class Field_timestamp :public Field_temporal { ...@@ -2404,7 +2404,7 @@ class Field_timestamp :public Field_temporal {
int store(const char *to,uint length,CHARSET_INFO *charset); int store(const char *to,uint length,CHARSET_INFO *charset);
int store(double nr); int store(double nr);
int store(longlong nr, bool unsigned_val); 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_decimal(const my_decimal *);
int store_timestamp(my_time_t timestamp, ulong sec_part); int store_timestamp(my_time_t timestamp, ulong sec_part);
int save_in_field(Field *to); int save_in_field(Field *to);
...@@ -2601,7 +2601,7 @@ class Field_year :public Field_tiny { ...@@ -2601,7 +2601,7 @@ class Field_year :public Field_tiny {
int store(const char *to,uint length,CHARSET_INFO *charset); int store(const char *to,uint length,CHARSET_INFO *charset);
int store(double nr); int store(double nr);
int store(longlong nr, bool unsigned_val); 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); double val_real(void);
longlong val_int(void); longlong val_int(void);
String *val_str(String*,String *); String *val_str(String*,String *);
...@@ -2711,7 +2711,7 @@ class Field_time :public Field_temporal { ...@@ -2711,7 +2711,7 @@ class Field_time :public Field_temporal {
return real_type() == from->real_type() && return real_type() == from->real_type() &&
decimals() == from->decimals(); 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(const char *to,uint length,CHARSET_INFO *charset);
int store(double nr); int store(double nr);
int store(longlong nr, bool unsigned_val); int store(longlong nr, bool unsigned_val);
......
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