[Groonga-mysql-commit] mroonga/mroonga [fix-for-visual-studio] [mysql56][mariadb] support store_time(). fixes #1266

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Oct 4 10:47:05 JST 2012


Kouhei Sutou	2012-01-31 18:12:18 +0900 (Tue, 31 Jan 2012)

  New Revision: aaf4939e10226b271071cb979f1308a1c3480e33
  https://github.com/mroonga/mroonga/commit/aaf4939e10226b271071cb979f1308a1c3480e33

  Log:
    [mysql56][mariadb] support store_time(). fixes #1266
    
    Reported by Kazuhiko Shiozaki. Thanks!!!

  Modified files:
    ha_mroonga.cc
    ha_mroonga.h

  Modified: ha_mroonga.cc (+10 -1)
===================================================================
--- ha_mroonga.cc    2012-01-31 17:55:35 +0900 (6097879)
+++ ha_mroonga.cc    2012-01-31 18:12:18 +0900 (4710eda)
@@ -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;
@@ -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,
@@ -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,

  Modified: ha_mroonga.h (+4 -0)
===================================================================
--- ha_mroonga.h    2012-01-31 17:55:35 +0900 (8e984ee)
+++ ha_mroonga.h    2012-01-31 18:12:18 +0900 (0642d33)
@@ -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 */
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-mysql-commit mailing list
Back to archive index