Navigation Menu

Skip to content

Commit

Permalink
[mysql56][mariadb] support store_time(). fixes #1266
Browse files Browse the repository at this point in the history
Reported by Kazuhiko Shiozaki. Thanks!!!
  • Loading branch information
kou committed Jan 31, 2012
1 parent 429a7c9 commit aaf4939
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ha_mroonga.cc
Expand Up @@ -7300,7 +7300,7 @@ void ha_mroonga::storage_store_field_datetime(Field *field,
uint value_length)
{
long long int time = *((long long int *)value);
int32 sec, usec __attribute__((unused));
int32 sec, usec;
GRN_TIME_UNPACK(time, sec, usec);
struct tm date;
time_t sec_t = sec;
Expand All @@ -7314,8 +7314,13 @@ void ha_mroonga::storage_store_field_datetime(Field *field,
mysql_date.hour = date.tm_hour;
mysql_date.minute = date.tm_min;
mysql_date.second = date.tm_sec;
mysql_date.second_part = usec;
Field_datetime *datetime_field = (Field_datetime *)field;
#ifdef MRN_FIELD_STORE_TIME_NEED_TYPE
datetime_field->store_time(&mysql_date, MYSQL_TIMESTAMP_DATETIME);
#else
datetime_field->store_time(&mysql_date);
#endif
}

void ha_mroonga::storage_store_field_new_date(Field *field,
Expand All @@ -7335,7 +7340,11 @@ void ha_mroonga::storage_store_field_new_date(Field *field,
mysql_date.month = date.tm_mon + 1;
mysql_date.day = date.tm_mday;
Field_newdate *newdate_field = (Field_newdate *)field;
#ifdef MRN_FIELD_STORE_TIME_NEED_TYPE
newdate_field->store_time(&mysql_date, MYSQL_TIMESTAMP_DATE);
#else
newdate_field->store_time(&mysql_date);
#endif
}

void ha_mroonga::storage_store_field_blob(Field *field,
Expand Down
4 changes: 4 additions & 0 deletions ha_mroonga.h
Expand Up @@ -114,6 +114,10 @@ extern "C" {
# define MRN_TIMESTAMP_USE_LONG
#endif

#if 50500 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50604
# define MRN_FIELD_STORE_TIME_NEED_TYPE
#endif

class ha_mroonga;

/* structs */
Expand Down

0 comments on commit aaf4939

Please sign in to comment.