summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2020-01-15 07:58:50 +0400
committerAlexander Barkov <bar@mariadb.com>2020-01-16 09:59:39 +0400
commit497ee3384889ce4a3974f50a0c187304cb96c803 (patch)
tree3b144a3bef4e07f56b87cc11b6088fd995a33a72 /sql
parentcc3135cf83c07971665cd0c2225c40b74c5d2778 (diff)
downloadmariadb-git-497ee3384889ce4a3974f50a0c187304cb96c803.tar.gz
MDEV-21497 Make Field_time, Field_datetime, Field_timestamp abstract
- Making classes Field_time, Field_datetime, Field_timestamp abstract - Adding instantiable Field_time0, Field_datetime0, Field_timestamp0 classes - Removing redundant cast in field_conv.cc, item_timefunc.cc, sp.cc in calls for set_time() and get_timestamp() - Replacing store_TIME() to store_timestamp() in log.cc and removing redundant cast
Diffstat (limited to 'sql')
-rw-r--r--sql/field.cc61
-rw-r--r--sql/field.h157
-rw-r--r--sql/field_conv.cc4
-rw-r--r--sql/item_timefunc.cc6
-rw-r--r--sql/log.cc4
-rw-r--r--sql/sp.cc6
6 files changed, 133 insertions, 105 deletions
diff --git a/sql/field.cc b/sql/field.cc
index baf6748fb14..01376029833 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -5026,8 +5026,8 @@ int Field_timestamp::save_in_field(Field *to)
return to->store_timestamp_dec(Timeval(ts, sec_part), decimals());
}
-my_time_t Field_timestamp::get_timestamp(const uchar *pos,
- ulong *sec_part) const
+my_time_t Field_timestamp0::get_timestamp(const uchar *pos,
+ ulong *sec_part) const
{
DBUG_ASSERT(marked_for_read());
*sec_part= 0;
@@ -5035,7 +5035,7 @@ my_time_t Field_timestamp::get_timestamp(const uchar *pos,
}
-bool Field_timestamp::val_native(Native *to)
+bool Field_timestamp0::val_native(Native *to)
{
DBUG_ASSERT(marked_for_read());
my_time_t sec= (my_time_t) sint4korr(ptr);
@@ -5200,12 +5200,6 @@ int Field_timestamp::store_native(const Native &value)
}
-double Field_timestamp::val_real(void)
-{
- return (double) Field_timestamp::val_int();
-}
-
-
longlong Field_timestamp::val_int(void)
{
MYSQL_TIME ltime;
@@ -5309,15 +5303,15 @@ bool Field_timestamp::get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate)
}
-bool Field_timestamp::send_binary(Protocol *protocol)
+bool Field_timestamp0::send_binary(Protocol *protocol)
{
MYSQL_TIME ltime;
- Field_timestamp::get_date(&ltime, date_mode_t(0));
+ Field_timestamp0::get_date(&ltime, date_mode_t(0));
return protocol->store(&ltime, 0);
}
-int Field_timestamp::cmp(const uchar *a_ptr, const uchar *b_ptr) const
+int Field_timestamp0::cmp(const uchar *a_ptr, const uchar *b_ptr) const
{
int32 a,b;
a=sint4korr(a_ptr);
@@ -5326,7 +5320,7 @@ int Field_timestamp::cmp(const uchar *a_ptr, const uchar *b_ptr) const
}
-void Field_timestamp::sort_string(uchar *to,uint length __attribute__((unused)))
+void Field_timestamp0::sort_string(uchar *to,uint length __attribute__((unused)))
{
to[0] = ptr[3];
to[1] = ptr[2];
@@ -5348,7 +5342,7 @@ void Field_timestamp::sql_type(String &res) const
}
-int Field_timestamp::set_time()
+int Field_timestamp0::set_time()
{
set_notnull();
store_TIMESTAMP(Timestamp(get_thd()->query_start(), 0));
@@ -5808,7 +5802,7 @@ int Field_time::store_TIME_with_warning(const Time *t,
}
-void Field_time::store_TIME(const MYSQL_TIME *ltime)
+void Field_time0::store_TIME(const MYSQL_TIME *ltime)
{
DBUG_ASSERT(ltime->year == 0);
DBUG_ASSERT(ltime->month == 0);
@@ -5896,14 +5890,14 @@ Field *Field_time::new_key_field(MEM_ROOT *root, TABLE *new_table,
}
-double Field_time::val_real(void)
+double Field_time0::val_real(void)
{
DBUG_ASSERT(marked_for_read());
uint32 j= (uint32) uint3korr(ptr);
return (double) j;
}
-longlong Field_time::val_int(void)
+longlong Field_time0::val_int(void)
{
DBUG_ASSERT(marked_for_read());
return (longlong) sint3korr(ptr);
@@ -5952,7 +5946,7 @@ bool Field_time::check_zero_in_date_with_warn(date_mode_t fuzzydate)
DATE_FORMAT(time, "%l.%i %p")
*/
-bool Field_time::get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate)
+bool Field_time0::get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate)
{
if (check_zero_in_date_with_warn(fuzzydate))
return true;
@@ -5982,7 +5976,7 @@ bool Field_time::send_binary(Protocol *protocol)
}
-int Field_time::cmp(const uchar *a_ptr, const uchar *b_ptr) const
+int Field_time0::cmp(const uchar *a_ptr, const uchar *b_ptr) const
{
int32 a,b;
a=(int32) sint3korr(a_ptr);
@@ -5990,7 +5984,7 @@ int Field_time::cmp(const uchar *a_ptr, const uchar *b_ptr) const
return (a < b) ? -1 : (a > b) ? 1 : 0;
}
-void Field_time::sort_string(uchar *to,uint length __attribute__((unused)))
+void Field_time0::sort_string(uchar *to,uint length __attribute__((unused)))
{
to[0] = (uchar) (ptr[2] ^ 128);
to[1] = ptr[1];
@@ -6695,7 +6689,7 @@ Item *Field_newdate::get_equal_const_item(THD *thd, const Context &ctx,
** Stored as a 8 byte unsigned int. Should sometimes be change to a 6 byte int.
****************************************************************************/
-void Field_datetime::store_TIME(const MYSQL_TIME *ltime)
+void Field_datetime0::store_TIME(const MYSQL_TIME *ltime)
{
ulonglong tmp= TIME_to_ulonglong_datetime(ltime);
int8store(ptr,tmp);
@@ -6710,20 +6704,15 @@ Field_datetime::conversion_depends_on_sql_mode(THD *thd, Item *expr) const
}
-bool Field_datetime::send_binary(Protocol *protocol)
+bool Field_datetime0::send_binary(Protocol *protocol)
{
MYSQL_TIME tm;
- Field_datetime::get_date(&tm, date_mode_t(0));
+ Field_datetime0::get_date(&tm, date_mode_t(0));
return protocol->store(&tm, 0);
}
-double Field_datetime::val_real(void)
-{
- return (double) Field_datetime::val_int();
-}
-
-longlong Field_datetime::val_int(void)
+longlong Field_datetime0::val_int(void)
{
DBUG_ASSERT(marked_for_read());
longlong j;
@@ -6732,8 +6721,8 @@ longlong Field_datetime::val_int(void)
}
-String *Field_datetime::val_str(String *val_buffer,
- String *val_ptr __attribute__((unused)))
+String *Field_datetime0::val_str(String *val_buffer,
+ String *val_ptr __attribute__((unused)))
{
val_buffer->alloc(field_length);
val_buffer->length(field_length);
@@ -6744,7 +6733,7 @@ String *Field_datetime::val_str(String *val_buffer,
char *pos;
int part3;
- tmp= Field_datetime::val_int();
+ tmp= Field_datetime0::val_int();
/*
Avoid problem with slow longlong arithmetic and sprintf
@@ -6778,8 +6767,8 @@ String *Field_datetime::val_str(String *val_buffer,
return val_buffer;
}
-bool Field_datetime::get_TIME(MYSQL_TIME *ltime, const uchar *pos,
- date_mode_t fuzzydate) const
+bool Field_datetime0::get_TIME(MYSQL_TIME *ltime, const uchar *pos,
+ date_mode_t fuzzydate) const
{
DBUG_ASSERT(marked_for_read());
longlong tmp= sint8korr(pos);
@@ -6800,7 +6789,7 @@ bool Field_datetime::get_TIME(MYSQL_TIME *ltime, const uchar *pos,
}
-int Field_datetime::cmp(const uchar *a_ptr, const uchar *b_ptr) const
+int Field_datetime0::cmp(const uchar *a_ptr, const uchar *b_ptr) const
{
longlong a,b;
a=sint8korr(a_ptr);
@@ -6809,7 +6798,7 @@ int Field_datetime::cmp(const uchar *a_ptr, const uchar *b_ptr) const
((ulonglong) a > (ulonglong) b) ? 1 : 0;
}
-void Field_datetime::sort_string(uchar *to,uint length __attribute__((unused)))
+void Field_datetime0::sort_string(uchar *to,uint length __attribute__((unused)))
{
to[0] = ptr[7];
to[1] = ptr[6];
diff --git a/sql/field.h b/sql/field.h
index 911fe430371..eb3c87c1849 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -3040,10 +3040,7 @@ class Field_timestamp :public Field_temporal {
protected:
int store_TIME_with_warning(THD *, const Datetime *,
const ErrConv *, int warn);
- virtual void store_TIMEVAL(const timeval &tv)
- {
- int4store(ptr, tv.tv_sec);
- }
+ virtual void store_TIMEVAL(const timeval &tv)= 0;
void store_TIMESTAMP(const Timestamp &ts)
{
store_TIMEVAL(ts.tv());
@@ -3057,8 +3054,6 @@ public:
TABLE_SHARE *share);
const Type_handler *type_handler() const override
{ return &type_handler_timestamp; }
- enum ha_base_keytype key_type() const override
- { return HA_KEYTYPE_ULONG_INT; }
enum_conv_type rpl_conv_type_from(const Conv_source &source,
const Relay_log_info *rli,
const Conv_param &param) const override;
@@ -3071,22 +3066,10 @@ public:
int store_decimal(const my_decimal *) override;
int store_timestamp_dec(const timeval &ts, uint dec) override;
int save_in_field(Field *to) override;
- double val_real() override;
longlong val_int() override;
String *val_str(String *, String *) override;
- bool send_binary(Protocol *protocol) override;
- int cmp(const uchar *,const uchar *) const override;
- void sort_string(uchar *buff,uint length) override;
- uint32 pack_length() const override { return 4; }
void sql_type(String &str) const override;
bool zero_pack() const override { return false; }
- int set_time() override;
- /* Get TIMESTAMP field value as seconds since begging of Unix Epoch */
- my_time_t get_timestamp(const uchar *pos, ulong *sec_part) const override;
- my_time_t get_timestamp(ulong *sec_part) const
- {
- return get_timestamp(ptr, sec_part);
- }
/*
This method is used by storage/perfschema and
Item_func_now_local::save_in_field().
@@ -3099,6 +3082,45 @@ public:
}
bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
int store_native(const Native &value) override;
+ bool validate_value_in_record(THD *thd, const uchar *record) const override;
+ Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item)
+ override
+ {
+ return get_equal_const_item_datetime(thd, ctx, const_item);
+ }
+ bool load_data_set_null(THD *thd) override;
+ bool load_data_set_no_data(THD *thd, bool fixed_format) override;
+};
+
+
+class Field_timestamp0 :public Field_timestamp
+{
+ void store_TIMEVAL(const timeval &tv) override
+ {
+ int4store(ptr, tv.tv_sec);
+ }
+public:
+ Field_timestamp0(uchar *ptr_arg, uint32 len_arg,
+ uchar *null_ptr_arg, uchar null_bit_arg,
+ enum utype unireg_check_arg,
+ const LEX_CSTRING *field_name_arg,
+ TABLE_SHARE *share)
+ :Field_timestamp(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
+ unireg_check_arg, field_name_arg, share)
+ { }
+ enum ha_base_keytype key_type() const override
+ { return HA_KEYTYPE_ULONG_INT; }
+ double val_real() override
+ {
+ return (double) Field_timestamp0::val_int();
+ }
+ bool send_binary(Protocol *protocol) override;
+ int cmp(const uchar *,const uchar *) const override;
+ void sort_string(uchar *buff,uint length) override;
+ uint32 pack_length() const override { return 4; }
+ int set_time() override;
+ /* Get TIMESTAMP field value as seconds since begging of Unix Epoch */
+ my_time_t get_timestamp(const uchar *pos, ulong *sec_part) const override;
bool val_native(Native *to) override;
uchar *pack(uchar *to, const uchar *from, uint) override
{
@@ -3109,14 +3131,6 @@ public:
{
return unpack_int32(to, from, from_end);
}
- bool validate_value_in_record(THD *thd, const uchar *record) const override;
- Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item)
- override
- {
- return get_equal_const_item_datetime(thd, ctx, const_item);
- }
- bool load_data_set_null(THD *thd) override;
- bool load_data_set_no_data(THD *thd, bool fixed_format) override;
uint size_of() const override { return sizeof *this; }
};
@@ -3226,10 +3240,6 @@ public:
void set_max() override;
bool is_max() override;
my_time_t get_timestamp(const uchar *pos, ulong *sec_part) const override;
- my_time_t get_timestamp(ulong *sec_part) const
- {
- return get_timestamp(ptr, sec_part);
- }
bool val_native(Native *to) override;
uint size_of() const override { return sizeof *this; }
Binlog_type_info binlog_type_info() const override;
@@ -3405,7 +3415,7 @@ class Field_time :public Field_temporal {
*/
long curdays;
protected:
- virtual void store_TIME(const MYSQL_TIME *ltime);
+ virtual void store_TIME(const MYSQL_TIME *ltime)= 0;
void store_TIME(const Time &t) { return store_TIME(t.get_mysql_time()); }
int store_TIME_with_warning(const Time *ltime, const ErrConv *str, int warn);
bool check_zero_in_date_with_warn(date_mode_t fuzzydate);
@@ -3421,7 +3431,6 @@ public:
const Item_equal *item_equal) override;
const Type_handler *type_handler() const override
{ return &type_handler_time; }
- enum ha_base_keytype key_type() const override { return HA_KEYTYPE_INT24; }
enum_conv_type rpl_conv_type_from(const Conv_source &source,
const Relay_log_info *rli,
const Conv_param &param) const override;
@@ -3444,16 +3453,9 @@ public:
int store(double nr) override;
int store(longlong nr, bool unsigned_val) override;
int store_decimal(const my_decimal *) override;
- double val_real() override;
- longlong val_int() override;
String *val_str(String *, String *) override;
- bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
bool send_binary(Protocol *protocol) override;
- int cmp(const uchar *,const uchar *) const override;
- void sort_string(uchar *buff,uint length) override;
- uint32 pack_length() const override { return 3; }
void sql_type(String &str) const override;
- uint size_of() const override { return sizeof *this; }
void set_curdays(THD *thd);
Field *new_key_field(MEM_ROOT *root, TABLE *new_table,
uchar *new_ptr, uint32 length,
@@ -3463,6 +3465,28 @@ public:
};
+class Field_time0: public Field_time
+{
+protected:
+ void store_TIME(const MYSQL_TIME *ltime) override;
+public:
+ Field_time0(uchar *ptr_arg, uint length_arg, uchar *null_ptr_arg,
+ uchar null_bit_arg, enum utype unireg_check_arg,
+ const LEX_CSTRING *field_name_arg)
+ :Field_time(ptr_arg, length_arg, null_ptr_arg, null_bit_arg,
+ unireg_check_arg, field_name_arg)
+ { }
+ enum ha_base_keytype key_type() const override { return HA_KEYTYPE_INT24; }
+ double val_real() override;
+ longlong val_int() override;
+ bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
+ int cmp(const uchar *,const uchar *) const override;
+ void sort_string(uchar *buff,uint length) override;
+ uint32 pack_length() const override { return 3; }
+ uint size_of() const override { return sizeof *this; }
+};
+
+
/**
Abstract class for:
- TIME(1..6)
@@ -3567,9 +3591,6 @@ public:
class Field_datetime :public Field_temporal_with_date {
- void store_TIME(const MYSQL_TIME *ltime) override;
- bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate)
- const override;
protected:
int store_TIME_with_warning(const Datetime *ltime, const ErrConv *str,
int was_cut);
@@ -3586,8 +3607,6 @@ public:
}
const Type_handler *type_handler() const override
{ return &type_handler_datetime; }
- enum ha_base_keytype key_type() const override
- { return HA_KEYTYPE_ULONGLONG; }
sql_mode_t conversion_depends_on_sql_mode(THD *, Item *) const override;
enum_conv_type rpl_conv_type_from(const Conv_source &source,
const Relay_log_info *rli,
@@ -3597,17 +3616,42 @@ public:
int store(longlong nr, bool unsigned_val) override;
int store_time_dec(const MYSQL_TIME *ltime, uint dec) override;
int store_decimal(const my_decimal *) override;
- double val_real() override;
+ void sql_type(String &str) const override;
+ int set_time() override;
+ Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item)
+ override
+ {
+ return get_equal_const_item_datetime(thd, ctx, const_item);
+ }
+};
+
+
+class Field_datetime0 :public Field_datetime
+{
+ void store_TIME(const MYSQL_TIME *ltime) override;
+ bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate)
+ const override;
+public:
+ Field_datetime0(uchar *ptr_arg, uint length_arg, uchar *null_ptr_arg,
+ uchar null_bit_arg, enum utype unireg_check_arg,
+ const LEX_CSTRING *field_name_arg)
+ :Field_datetime(ptr_arg, length_arg, null_ptr_arg, null_bit_arg,
+ unireg_check_arg, field_name_arg)
+ {}
+ enum ha_base_keytype key_type() const override
+ { return HA_KEYTYPE_ULONGLONG; }
+ double val_real() override
+ {
+ return (double) Field_datetime0::val_int();
+ }
longlong val_int() override;
String *val_str(String *, String *) override;
bool send_binary(Protocol *protocol) override;
int cmp(const uchar *,const uchar *) const override;
void sort_string(uchar *buff,uint length) override;
uint32 pack_length() const override { return 8; }
- void sql_type(String &str) const override;
bool get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate) override
- { return Field_datetime::get_TIME(ltime, ptr, fuzzydate); }
- int set_time() override;
+ { return Field_datetime0::get_TIME(ltime, ptr, fuzzydate); }
uchar *pack(uchar* to, const uchar *from, uint) override
{
return pack_int64(to, from);
@@ -3617,11 +3661,6 @@ public:
{
return unpack_int64(to, from, from_end);
}
- Item *get_equal_const_item(THD *thd, const Context &ctx, Item *const_item)
- override
- {
- return get_equal_const_item_datetime(thd, ctx, const_item);
- }
uint size_of() const override { return sizeof *this; }
};
@@ -3741,8 +3780,8 @@ new_Field_timestamp(MEM_ROOT *root,uchar *ptr, uchar *null_ptr, uchar null_bit,
{
if (dec==0)
return new (root)
- Field_timestamp(ptr, MAX_DATETIME_WIDTH, null_ptr,
- null_bit, unireg_check, field_name, share);
+ Field_timestamp0(ptr, MAX_DATETIME_WIDTH, null_ptr,
+ null_bit, unireg_check, field_name, share);
if (dec >= FLOATING_POINT_DECIMALS)
dec= MAX_DATETIME_PRECISION;
return new (root)
@@ -3757,8 +3796,8 @@ new_Field_time(MEM_ROOT *root, uchar *ptr, uchar *null_ptr, uchar null_bit,
{
if (dec == 0)
return new (root)
- Field_time(ptr, MIN_TIME_WIDTH, null_ptr, null_bit, unireg_check,
- field_name);
+ Field_time0(ptr, MIN_TIME_WIDTH, null_ptr, null_bit, unireg_check,
+ field_name);
if (dec >= FLOATING_POINT_DECIMALS)
dec= MAX_DATETIME_PRECISION;
return new (root)
@@ -3772,8 +3811,8 @@ new_Field_datetime(MEM_ROOT *root, uchar *ptr, uchar *null_ptr, uchar null_bit,
{
if (dec == 0)
return new (root)
- Field_datetime(ptr, MAX_DATETIME_WIDTH, null_ptr, null_bit,
- unireg_check, field_name);
+ Field_datetime0(ptr, MAX_DATETIME_WIDTH, null_ptr, null_bit,
+ unireg_check, field_name);
if (dec >= FLOATING_POINT_DECIMALS)
dec= MAX_DATETIME_PRECISION;
return new (root)
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index f975597cf70..80a2ee1b06e 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -168,7 +168,7 @@ int convert_null_to_field_value_or_error(Field *field)
{
if (field->type() == MYSQL_TYPE_TIMESTAMP)
{
- ((Field_timestamp*) field)->set_time();
+ field->set_time();
return 0;
}
@@ -315,7 +315,7 @@ static void do_copy_timestamp(Copy_field *copy)
if (*copy->from_null_ptr & copy->from_bit)
{
/* Same as in set_field_to_null_with_conversions() */
- ((Field_timestamp*) copy->to_field)->set_time();
+ copy->to_field->set_time();
}
else
(copy->do_copy2)(copy);
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index c73db2f7ed1..b999035705c 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -1214,7 +1214,7 @@ bool Item_func_unix_timestamp::get_timestamp_value(my_time_t *seconds,
{
if ((null_value= field->is_null()))
return 1;
- *seconds= ((Field_timestamp*)field)->get_timestamp(second_part);
+ *seconds= field->get_timestamp(second_part);
return 0;
}
}
@@ -1270,7 +1270,7 @@ longlong Item_func_unix_timestamp::val_int_endpoint(bool left_endp, bool *incl_e
DBUG_ASSERT(arg_count == 1 &&
args[0]->type() == Item::FIELD_ITEM &&
args[0]->field_type() == MYSQL_TYPE_TIMESTAMP);
- Field_timestamp *field=(Field_timestamp *)(((Item_field*)args[0])->field);
+ Field *field= ((Item_field*)args[0])->field;
/* Leave the incl_endp intact */
ulong unused;
my_time_t ts= field->get_timestamp(&unused);
@@ -1644,7 +1644,7 @@ int Item_func_now_local::save_in_field(Field *field, bool no_conversions)
ulong sec_part= decimals ? thd->query_start_sec_part() : 0;
sec_part-= my_time_fraction_remainder(sec_part, decimals);
field->set_notnull();
- ((Field_timestamp*)field)->store_TIME(ts, sec_part);
+ field->store_timestamp(ts, sec_part);
return 0;
}
else
diff --git a/sql/log.cc b/sql/log.cc
index 997434aa66b..c0dbfa6ba5d 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -768,7 +768,7 @@ bool Log_to_csv_event_handler::
DBUG_ASSERT(table->field[0]->type() == MYSQL_TYPE_TIMESTAMP);
- ((Field_timestamp*) table->field[0])->store_TIME(
+ table->field[0]->store_timestamp(
hrtime_to_my_time(event_time), hrtime_sec_part(event_time));
/* do a write */
@@ -909,7 +909,7 @@ bool Log_to_csv_event_handler::
/* store the time and user values */
DBUG_ASSERT(table->field[0]->type() == MYSQL_TYPE_TIMESTAMP);
- ((Field_timestamp*) table->field[0])->store_TIME(
+ table->field[0]->store_timestamp(
hrtime_to_my_time(current_time), hrtime_sec_part(current_time));
if (table->field[1]->store(user_host, user_host_len, client_cs))
goto err;
diff --git a/sql/sp.cc b/sql/sp.cc
index 058a29e65f7..3768b883921 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -1360,8 +1360,8 @@ Sp_handler::sp_create_routine(THD *thd, const sp_head *sp) const
table->field[MYSQL_PROC_FIELD_DEFINER]->
store(definer, system_charset_info);
- ((Field_timestamp *)table->field[MYSQL_PROC_FIELD_CREATED])->set_time();
- ((Field_timestamp *)table->field[MYSQL_PROC_FIELD_MODIFIED])->set_time();
+ table->field[MYSQL_PROC_FIELD_CREATED]->set_time();
+ table->field[MYSQL_PROC_FIELD_MODIFIED]->set_time();
store_failed= store_failed ||
table->field[MYSQL_PROC_FIELD_SQL_MODE]->
@@ -1651,7 +1651,7 @@ Sp_handler::sp_update_routine(THD *thd, const Database_qualified_name *name,
}
store_record(table,record[1]);
- ((Field_timestamp *)table->field[MYSQL_PROC_FIELD_MODIFIED])->set_time();
+ table->field[MYSQL_PROC_FIELD_MODIFIED]->set_time();
if (chistics->suid != SP_IS_DEFAULT_SUID)
table->field[MYSQL_PROC_FIELD_SECURITY_TYPE]->
store((longlong)chistics->suid, TRUE);