Created
June 5, 2012 22:47
-
-
Save tmtysk/2878628 to your computer and use it in GitHub Desktop.
forcible patch to enable utf8mb4 encoding on mroonga
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- ha_mroonga.cpp.orig 2012-04-29 09:51:15.000000000 +0900 | |
+++ ha_mroonga.cpp 2012-06-05 17:33:45.000000000 +0900 | |
@@ -117,6 +117,7 @@ | |
static grn_hash *mrn_hash; | |
static CHARSET_INFO *mrn_charset_utf8 = NULL; | |
+static CHARSET_INFO *mrn_charset_utf8mb4 = NULL; | |
static CHARSET_INFO *mrn_charset_binary = NULL; | |
static CHARSET_INFO *mrn_charset_ascii = NULL; | |
static CHARSET_INFO *mrn_charset_latin1_1 = NULL; | |
@@ -147,6 +148,16 @@ | |
DBUG_ASSERT(0); | |
continue; | |
} | |
+ if (!strcmp(cs[0]->csname, "utf8mb4")) | |
+ { | |
+ DBUG_PRINT("info", ("mroonga: %s is %s [%p]", | |
+ cs[0]->name, cs[0]->csname, cs[0]->cset)); | |
+ if (!mrn_charset_utf8mb4) | |
+ mrn_charset_utf8mb4 = cs[0]; | |
+ else if (mrn_charset_utf8mb4->cset != cs[0]->cset) | |
+ DBUG_ASSERT(0); | |
+ continue; | |
+ } | |
if (!strcmp(cs[0]->csname, "binary")) | |
{ | |
DBUG_PRINT("info", ("mroonga: %s is %s [%p]", | |
@@ -251,6 +262,11 @@ | |
GRN_CTX_SET_ENCODING(ctx, GRN_ENC_UTF8); | |
DBUG_RETURN(0); | |
} | |
+ if (charset->cset == mrn_charset_utf8mb4->cset) | |
+ { | |
+ GRN_CTX_SET_ENCODING(ctx, GRN_ENC_UTF8); | |
+ DBUG_RETURN(0); | |
+ } | |
if (charset->cset == mrn_charset_cp932->cset) | |
{ | |
GRN_CTX_SET_ENCODING(ctx, GRN_ENC_SJIS); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment