Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Paul Graydon
slapos
Commits
81203b2e
Commit
81203b2e
authored
Jan 31, 2012
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update patch from the oficial repository.
parent
45dcf1f8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
108 additions
and
20 deletions
+108
-20
component/mariadb/buildout.cfg
component/mariadb/buildout.cfg
+3
-1
component/mariadb/mroonga-1.20-mariadb.patch
component/mariadb/mroonga-1.20-mariadb.patch
+105
-19
No files found.
component/mariadb/buildout.cfg
View file @
81203b2e
...
@@ -62,7 +62,7 @@ environment =
...
@@ -62,7 +62,7 @@ environment =
[mroonga-1.20-mariadb.patch]
[mroonga-1.20-mariadb.patch]
recipe = hexagonit.recipe.download
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename}
url = ${:_profile_base_location_}/${:filename}
md5sum = 2
b34c0d0ca3368bc985520bb6dadf02e
md5sum = 2
1972670ff9fc1bc5edc6932fcae1800
filename = ${:_buildout_section_name_}
filename = ${:_buildout_section_name_}
download-only = true
download-only = true
...
@@ -76,6 +76,8 @@ configure-options =
...
@@ -76,6 +76,8 @@ configure-options =
patch-options = -p1
patch-options = -p1
patches =
patches =
${mroonga-1.20-mariadb.patch:location}/${mroonga-1.20-mariadb.patch:filename}
${mroonga-1.20-mariadb.patch:location}/${mroonga-1.20-mariadb.patch:filename}
depends =
${mroonga-1.20-mariadb.patch:md5sum}
environment =
environment =
PATH=${groonga:location}/bin:${pkgconfig:location}/bin:%(PATH)s
PATH=${groonga:location}/bin:${pkgconfig:location}/bin:%(PATH)s
CPPFLAGS=-I${groonga:location}/include/groonga
CPPFLAGS=-I${groonga:location}/include/groonga
...
...
component/mariadb/mroonga-1.20-mariadb.patch
View file @
81203b2e
diff --git a/ha_mroonga.cc b/ha_mroonga.cc
diff --git a/ha_mroonga.cc b/ha_mroonga.cc
index 722d686..
9fa7168
100644
index 722d686..
4710eda
100644
--- a/ha_mroonga.cc
--- a/ha_mroonga.cc
+++ b/ha_mroonga.cc
+++ b/ha_mroonga.cc
@@ -6930,9 +6930,14 @@
int ha_mroonga::generic_store_bulk_timestamp(Field *field, grn_obj *buf)
@@ -249,7 +249,7 @@
static void mrn_init_encoding_map()
DBUG_VOID_RETURN;
}
-static int mrn_change_encoding(grn_ctx *ctx, CHARSET_INFO *charset)
+static int mrn_change_encoding(grn_ctx *ctx, const CHARSET_INFO *charset)
{
MRN_DBUG_ENTER_FUNCTION();
if (!charset)
@@ -6926,14 +6926,36 @@
int ha_mroonga::generic_store_bulk_float(Field *field, grn_obj *buf)
DBUG_RETURN(error);
}
+long long int ha_mroonga::get_grn_time_from_timestamp_field(Field_timestamp *field)
+{
+ MRN_DBUG_ENTER_METHOD();
+ long long int grn_time = 0;
+#ifdef MRN_TIMESTAMP_USE_TIMEVAL
+ int warnings = 0;
+ struct timeval time_value;
+ if (field->get_timestamp(&time_value, &warnings)) {
+ // XXX: Should we report warnings or MySQL does?
+ } else {
+ grn_time = GRN_TIME_PACK(time_value.tv_sec, time_value.tv_usec);
+ }
+#elif defined(MRN_TIMESTAMP_USE_MY_TIME_T)
+ unsigned long int micro_seconds;
+ my_time_t seconds = field->get_timestamp(µ_seconds);
+ grn_time = GRN_TIME_PACK(seconds, micro_seconds);
+#else
+ my_bool is_null_value;
+ long seconds = field->get_timestamp(&is_null_value);
+ grn_time = GRN_TIME_PACK(seconds, 0);
+#endif
+ DBUG_RETURN(grn_time);
+}
+
int ha_mroonga::generic_store_bulk_timestamp(Field *field, grn_obj *buf)
{
{
MRN_DBUG_ENTER_METHOD();
MRN_DBUG_ENTER_METHOD();
int error = 0;
int error = 0;
- my_bool is_null_value;
- my_bool is_null_value;
Field_timestamp *timestamp_field = (Field_timestamp *)field;
Field_timestamp *timestamp_field = (Field_timestamp *)field;
+#ifndef MRN_MARIADB_P
- long seconds = timestamp_field->get_timestamp(&is_null_value);
+ my_bool is_null_value;
- long long int time = GRN_TIME_PACK(seconds, 0);
long seconds = timestamp_field->get_timestamp(&is_null_value);
+ long long int time = get_grn_time_from_timestamp_field(timestamp_field);
+#else
+ ulong second_part;
+ long seconds = timestamp_field->get_timestamp(&second_part);
+#endif
long long int time = GRN_TIME_PACK(seconds, 0);
grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0);
grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0);
GRN_TIME_SET(ctx, buf, time);
GRN_TIME_SET(ctx, buf, time);
@@ -7231,7 +7236,11 @@
void ha_mroonga::storage_store_field_timestamp(Field *field,
DBUG_RETURN(error);
@@ -7228,10 +7250,20 @@
void ha_mroonga::storage_store_field_timestamp(Field *field,
uint value_length)
{
long long int time = *((long long int *)value);
+ Field_timestamp *timestamp_field = (Field_timestamp *)field;
+#ifdef MRN_TIMESTAMP_USE_TIMEVAL
+ struct timeval time_value;
+ GRN_TIME_UNPACK(time, time_value.tv_sec, time_value.tv_usec);
+ timestamp_field->store_timestamp(&time_value);
+#elif defined(MRN_TIMESTAMP_USE_MY_TIME_T)
+ int32 sec, usec;
+ GRN_TIME_UNPACK(time, sec, usec);
+ timestamp_field->store_TIME(sec, usec);
+#else
int32 sec, usec __attribute__((unused));
int32 sec, usec __attribute__((unused));
GRN_TIME_UNPACK(time, sec, usec);
GRN_TIME_UNPACK(time, sec, usec);
Field_timestamp *timestamp_field = (Field_timestamp *)field;
- Field_timestamp *timestamp_field = (Field_timestamp *)field;
+#ifndef MRN_MARIADB_P
timestamp_field->store_timestamp(sec);
timestamp_field->store_timestamp(sec);
+#else
+ timestamp_field->store_TIME(sec, 0);
+#endif
+#endif
}
}
void ha_mroonga::storage_store_field_date(Field *field,
void ha_mroonga::storage_store_field_date(Field *field,
@@ -7283,7 +7292,11 @@
void ha_mroonga::storage_store_field_datetime(Field *field,
@@ -7268,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;
@@ -7282,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.minute = date.tm_min;
mysql_date.second = date.tm_sec;
mysql_date.second = date.tm_sec;
+ mysql_date.second_part = usec;
Field_datetime *datetime_field = (Field_datetime *)field;
Field_datetime *datetime_field = (Field_datetime *)field;
+#if
ndef MRN_MARIADB_P
+#if
def MRN_FIELD_STORE_TIME_NEED_TYPE
datetime_field->store_time(&mysql_date, MYSQL_TIMESTAMP_DATETIME);
datetime_field->store_time(&mysql_date, MYSQL_TIMESTAMP_DATETIME);
+#else
+#else
+ datetime_field->store_time(&mysql_date);
+ datetime_field->store_time(&mysql_date);
...
@@ -42,11 +96,11 @@ index 722d686..9fa7168 100644
...
@@ -42,11 +96,11 @@ index 722d686..9fa7168 100644
}
}
void ha_mroonga::storage_store_field_new_date(Field *field,
void ha_mroonga::storage_store_field_new_date(Field *field,
@@ -7303,7 +73
16
,11 @@
void ha_mroonga::storage_store_field_new_date(Field *field,
@@ -7303,7 +73
40
,11 @@
void ha_mroonga::storage_store_field_new_date(Field *field,
mysql_date.month = date.tm_mon + 1;
mysql_date.month = date.tm_mon + 1;
mysql_date.day = date.tm_mday;
mysql_date.day = date.tm_mday;
Field_newdate *newdate_field = (Field_newdate *)field;
Field_newdate *newdate_field = (Field_newdate *)field;
+#if
ndef MRN_MARIADB_P
+#if
def MRN_FIELD_STORE_TIME_NEED_TYPE
newdate_field->store_time(&mysql_date, MYSQL_TIMESTAMP_DATE);
newdate_field->store_time(&mysql_date, MYSQL_TIMESTAMP_DATE);
+#else
+#else
+ newdate_field->store_time(&mysql_date);
+ newdate_field->store_time(&mysql_date);
...
@@ -54,3 +108,35 @@ index 722d686..9fa7168 100644
...
@@ -54,3 +108,35 @@ index 722d686..9fa7168 100644
}
}
void ha_mroonga::storage_store_field_blob(Field *field,
void ha_mroonga::storage_store_field_blob(Field *field,
diff --git a/ha_mroonga.h b/ha_mroonga.h
index 4e6c8ff..0642d33 100644
--- a/ha_mroonga.h
+++ b/ha_mroonga.h
@@ -106,6 +106,18 @@
extern "C" {
# define MRN_HAVE_HA_EXTRA_PREPARE_FOR_FORCED_CLOSE
#endif
+#if MYSQL_VERSION_ID >= 50604
+# define MRN_TIMESTAMP_USE_TIMEVAL
+#elif defined(MRN_MARIADB_P)
+# define MRN_TIMESTAMP_USE_MY_TIME_T
+#else
+# 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 */
@@ -402,6 +414,8 @@
private:
longlong *limit,
grn_obj *target_table, grn_obj *score_column);
+ long long int get_grn_time_from_timestamp_field(Field_timestamp *field);
+
int generic_store_bulk_string(Field *field, grn_obj *buf);
int generic_store_bulk_integer(Field *field, grn_obj *buf);
int generic_store_bulk_float(Field *field, grn_obj *buf);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment