Skip to content

Commit 2ecf2f9

Browse files
author
Alexander Barkov
committed
Adding "const" qualifier to the MYSQL_TIME* argument of Field::store_time_dec()
1 parent 705283f commit 2ecf2f9

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

sql/field.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2196,7 +2196,7 @@ bool Field::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
21962196
Needs to be changed if/when we want to support different time formats.
21972197
*/
21982198

2199-
int Field::store_time_dec(MYSQL_TIME *ltime, uint dec)
2199+
int Field::store_time_dec(const MYSQL_TIME *ltime, uint dec)
22002200
{
22012201
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
22022202
char buff[MAX_DATE_STRING_REP_LENGTH];
@@ -3241,7 +3241,7 @@ int Field_new_decimal::store_decimal(const my_decimal *decimal_value)
32413241
}
32423242

32433243

3244-
int Field_new_decimal::store_time_dec(MYSQL_TIME *ltime, uint dec_arg)
3244+
int Field_new_decimal::store_time_dec(const MYSQL_TIME *ltime, uint dec_arg)
32453245
{
32463246
my_decimal decimal_value;
32473247
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,
34803480
}
34813481

34823482

3483-
int Field_num::store_time_dec(MYSQL_TIME *ltime, uint dec_arg)
3483+
int Field_num::store_time_dec(const MYSQL_TIME *ltime, uint dec_arg)
34843484
{
34853485
longlong v= TIME_to_ulonglong(ltime);
34863486
if (ltime->neg == 0)
@@ -4734,7 +4734,7 @@ int Field_real::store_decimal(const my_decimal *dm)
47344734
return store(dbl);
47354735
}
47364736

4737-
int Field_real::store_time_dec(MYSQL_TIME *ltime, uint dec_arg)
4737+
int Field_real::store_time_dec(const MYSQL_TIME *ltime, uint dec_arg)
47384738
{
47394739
return store(TIME_to_double(ltime));
47404740
}
@@ -5016,7 +5016,7 @@ copy_or_convert_to_datetime(THD *thd, const MYSQL_TIME *from, MYSQL_TIME *to)
50165016
}
50175017

50185018

5019-
int Field_timestamp::store_time_dec(MYSQL_TIME *ltime, uint dec)
5019+
int Field_timestamp::store_time_dec(const MYSQL_TIME *ltime, uint dec)
50205020
{
50215021
int unused;
50225022
ErrConvTime str(ltime);
@@ -5582,7 +5582,7 @@ int Field_temporal_with_date::store(longlong nr, bool unsigned_val)
55825582
}
55835583

55845584

5585-
int Field_temporal_with_date::store_time_dec(MYSQL_TIME *ltime, uint dec)
5585+
int Field_temporal_with_date::store_time_dec(const MYSQL_TIME *ltime, uint dec)
55865586
{
55875587
int error= 0, have_smth_to_conv= 1;
55885588
ErrConvTime str(ltime);
@@ -5774,7 +5774,7 @@ static void calc_datetime_days_diff(MYSQL_TIME *ltime, long days)
57745774
}
57755775

57765776

5777-
int Field_time::store_time_dec(MYSQL_TIME *ltime, uint dec)
5777+
int Field_time::store_time_dec(const MYSQL_TIME *ltime, uint dec)
57785778
{
57795779
MYSQL_TIME l_time= *ltime;
57805780
ErrConvTime str(ltime);
@@ -6234,7 +6234,7 @@ int Field_year::store(longlong nr, bool unsigned_val)
62346234
}
62356235

62366236

6237-
int Field_year::store_time_dec(MYSQL_TIME *ltime, uint dec_arg)
6237+
int Field_year::store_time_dec(const MYSQL_TIME *ltime, uint dec_arg)
62386238
{
62396239
ErrConvTime str(ltime);
62406240
if (Field_year::store(ltime->year, 0))

sql/field.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -815,9 +815,9 @@ class Field: public Value_source
815815
virtual int store(double nr)=0;
816816
virtual int store(longlong nr, bool unsigned_val)=0;
817817
virtual int store_decimal(const my_decimal *d)=0;
818-
virtual int store_time_dec(MYSQL_TIME *ltime, uint dec);
818+
virtual int store_time_dec(const MYSQL_TIME *ltime, uint dec);
819819
virtual int store_timestamp(my_time_t timestamp, ulong sec_part);
820-
int store_time(MYSQL_TIME *ltime)
820+
int store_time(const MYSQL_TIME *ltime)
821821
{ return store_time_dec(ltime, TIME_SECOND_PART_DIGITS); }
822822
int store(const char *to, uint length, CHARSET_INFO *cs,
823823
enum_check_fields check_level);
@@ -1673,7 +1673,7 @@ class Field_num :public Field {
16731673
field_metadata, length));
16741674
return length;
16751675
}
1676-
int store_time_dec(MYSQL_TIME *ltime, uint dec);
1676+
int store_time_dec(const MYSQL_TIME *ltime, uint dec);
16771677
double pos_in_interval(Field *min, Field *max)
16781678
{
16791679
return pos_in_interval_val_real(min, max);
@@ -1813,7 +1813,7 @@ class Field_real :public Field_num {
18131813
field_length >= from->field_length;
18141814
}
18151815
int store_decimal(const my_decimal *);
1816-
int store_time_dec(MYSQL_TIME *ltime, uint dec);
1816+
int store_time_dec(const MYSQL_TIME *ltime, uint dec);
18171817
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
18181818
my_decimal *val_decimal(my_decimal *);
18191819
bool val_bool() { return val_real() != 0e0; }
@@ -1903,7 +1903,7 @@ class Field_new_decimal :public Field_num {
19031903
int store(const char *to, uint length, CHARSET_INFO *charset);
19041904
int store(double nr);
19051905
int store(longlong nr, bool unsigned_val);
1906-
int store_time_dec(MYSQL_TIME *ltime, uint dec);
1906+
int store_time_dec(const MYSQL_TIME *ltime, uint dec);
19071907
int store_decimal(const my_decimal *);
19081908
double val_real(void);
19091909
longlong val_int(void);
@@ -2382,7 +2382,7 @@ class Field_temporal_with_date: public Field_temporal {
23822382
int store(const char *to, uint length, CHARSET_INFO *charset);
23832383
int store(double nr);
23842384
int store(longlong nr, bool unsigned_val);
2385-
int store_time_dec(MYSQL_TIME *ltime, uint dec);
2385+
int store_time_dec(const MYSQL_TIME *ltime, uint dec);
23862386
int store_decimal(const my_decimal *);
23872387
bool validate_value_in_record(THD *thd, const uchar *record) const;
23882388
};
@@ -2404,7 +2404,7 @@ class Field_timestamp :public Field_temporal {
24042404
int store(const char *to,uint length,CHARSET_INFO *charset);
24052405
int store(double nr);
24062406
int store(longlong nr, bool unsigned_val);
2407-
int store_time_dec(MYSQL_TIME *ltime, uint dec);
2407+
int store_time_dec(const MYSQL_TIME *ltime, uint dec);
24082408
int store_decimal(const my_decimal *);
24092409
int store_timestamp(my_time_t timestamp, ulong sec_part);
24102410
int save_in_field(Field *to);
@@ -2601,7 +2601,7 @@ class Field_year :public Field_tiny {
26012601
int store(const char *to,uint length,CHARSET_INFO *charset);
26022602
int store(double nr);
26032603
int store(longlong nr, bool unsigned_val);
2604-
int store_time_dec(MYSQL_TIME *ltime, uint dec);
2604+
int store_time_dec(const MYSQL_TIME *ltime, uint dec);
26052605
double val_real(void);
26062606
longlong val_int(void);
26072607
String *val_str(String*,String *);
@@ -2711,7 +2711,7 @@ class Field_time :public Field_temporal {
27112711
return real_type() == from->real_type() &&
27122712
decimals() == from->decimals();
27132713
}
2714-
int store_time_dec(MYSQL_TIME *ltime, uint dec);
2714+
int store_time_dec(const MYSQL_TIME *ltime, uint dec);
27152715
int store(const char *to,uint length,CHARSET_INFO *charset);
27162716
int store(double nr);
27172717
int store(longlong nr, bool unsigned_val);

0 commit comments

Comments
 (0)