[Groonga-commit] pgroonga/pgroonga at 064c06f [master] jsonb: support key that includes special characters

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Sep 26 22:12:14 JST 2015


Kouhei Sutou	2015-09-26 22:12:14 +0900 (Sat, 26 Sep 2015)

  New Revision: 064c06fbf60991be2033bd24460267dbdb6d9bd5
  https://github.com/pgroonga/pgroonga/commit/064c06fbf60991be2033bd24460267dbdb6d9bd5

  Message:
    jsonb: support key that includes special characters

  Modified files:
    pgroonga.c

  Modified: pgroonga.c (+5 -7)
===================================================================
--- pgroonga.c    2015-09-26 22:01:40 +0900 (888320f)
+++ pgroonga.c    2015-09-26 22:12:14 +0900 (de7cbcf)
@@ -2122,9 +2122,9 @@ PGrnInsertJSONGenerateKey(PGrnInsertJSONData *data,
 											   &component,
 											   NULL,
 											   NULL);
-		if (i > 0)
-			GRN_TEXT_PUTS(ctx, &(data->key), ".");
-		GRN_TEXT_PUT(ctx, &(data->key), component, componentSize);
+		GRN_TEXT_PUTS(ctx, &(data->key), "[");
+		grn_text_esc(ctx, &(data->key), component, componentSize);
+		GRN_TEXT_PUTS(ctx, &(data->key), "]");
 	}
 
 	GRN_TEXT_PUTS(ctx, &(data->key), "|");
@@ -2720,12 +2720,10 @@ PGrnSearchBuildConditionJSONContainValue(PGrnSearchData *data,
 		if (value->val.string.len == 0) {
 			GRN_TEXT_PUTS(ctx, &buffer, "type == \"string\" && ");
 		}
-		GRN_TEXT_PUTS(ctx, &buffer, "string == \"");
-		/* TODO: escape double quote and backslash. */
-		GRN_TEXT_PUT(ctx, &buffer,
+		GRN_TEXT_PUTS(ctx, &buffer, "string == ");
+		grn_text_esc(ctx, &buffer,
 					 value->val.string.val,
 					 value->val.string.len);
-		GRN_TEXT_PUTS(ctx, &buffer, "\"");
 		break;
 	case jbvNumeric:
 	{
-------------- next part --------------
HTML����������������������������...
Descargar 



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