[Groonga-commit] groonga/groonga at b3f3934 [master] Support value output with correct type

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Oct 29 13:57:41 JST 2013


Kouhei Sutou	2013-10-29 13:57:41 +0900 (Tue, 29 Oct 2013)

  New Revision: b3f3934a45b4c55e22e54486bc949ec515b05490
  https://github.com/groonga/groonga/commit/b3f3934a45b4c55e22e54486bc949ec515b05490

  Message:
    Support value output with correct type
    
    https://gist.github.com/anonymous/7208905
    
    Reported by Genki Takiuchi. Thanks!!!

  Added files:
    test/command/suite/select/output/value/uint64.expected
    test/command/suite/select/output/value/uint64.test
  Modified files:
    lib/db.c
    lib/output.c

  Modified: lib/db.c (+5 -1)
===================================================================
--- lib/db.c    2013-10-28 19:35:59 +0900 (c469ebf)
+++ lib/db.c    2013-10-29 13:57:41 +0900 (bfdfb39)
@@ -4383,7 +4383,11 @@ grn_obj_get_range_info(grn_ctx *ctx, grn_obj *obj,
       case GRN_ACCESSOR_GET_ID :
         *range_id = GRN_DB_UINT32;
         break;
-      case GRN_ACCESSOR_GET_VALUE :/* fix me */
+      case GRN_ACCESSOR_GET_VALUE :
+        if (GRN_DB_OBJP(a->obj)) {
+          *range_id = DB_OBJ(a->obj)->range;
+        }
+        break;
       case GRN_ACCESSOR_GET_SCORE :
       case GRN_ACCESSOR_GET_NSUBRECS :
         *range_id = GRN_DB_INT32;

  Modified: lib/output.c (+1 -1)
===================================================================
--- lib/output.c    2013-10-28 19:35:59 +0900 (ffa5cb9)
+++ lib/output.c    2013-10-29 13:57:41 +0900 (91156f3)
@@ -518,7 +518,7 @@ grn_text_atoj(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type,
         break;
       case GRN_ACCESSOR_GET_VALUE :
         grn_obj_get_value(ctx, a->obj, id, &buf);
-        buf.header.domain = GRN_DB_INT32; /* fix me */
+        buf.header.domain = DB_OBJ(a->obj)->range;
         break;
       case GRN_ACCESSOR_GET_SCORE :
         grn_obj_get_value(ctx, a->obj, id, &buf);

  Added: test/command/suite/select/output/value/uint64.expected (+9 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/output/value/uint64.expected    2013-10-29 13:57:41 +0900 (07b17a4)
@@ -0,0 +1,9 @@
+table_create Values TABLE_NO_KEY --value_type UInt64
+[[0,0.0,0.0],true]
+load --table Values
+[
+{"_value": 2147583647}
+]
+[[0,0.0,0.0],1]
+select Values --output_columns _value
+[[0,0.0,0.0],[[[1],[["_value","UInt64"]],[2147583647]]]]

  Added: test/command/suite/select/output/value/uint64.test (+7 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/output/value/uint64.test    2013-10-29 13:57:41 +0900 (2e3dbdf)
@@ -0,0 +1,7 @@
+table_create Values TABLE_NO_KEY --value_type UInt64
+load --table Values
+[
+{"_value": 2147583647}
+]
+
+select Values --output_columns _value
-------------- next part --------------
HTML����������������������������...
Download 



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