[Groonga-commit] groonga/groonga [master] Support Bool -> UInt32 cast

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Wed Feb 13 22:57:33 JST 2013


Kouhei Sutou	2013-02-13 22:57:33 +0900 (Wed, 13 Feb 2013)

  New Revision: 7a55828f48dddafbd263d9e5a059d04aa627c614
  https://github.com/groonga/groonga/commit/7a55828f48dddafbd263d9e5a059d04aa627c614

  Log:
    Support Bool -> UInt32 cast

  Added files:
    test/command/suite/load/bool/cast/uint32.expected
    test/command/suite/load/bool/cast/uint32.test
  Modified files:
    lib/db.c

  Modified: lib/db.c (+3 -0)
===================================================================
--- lib/db.c    2013-02-13 22:56:30 +0900 (69d6f0a)
+++ lib/db.c    2013-02-13 22:57:33 +0900 (96d26a2)
@@ -4227,6 +4227,9 @@ grn_obj_cast_bool(grn_ctx *ctx, grn_obj *src, grn_obj *dest, grn_bool addp)
   case GRN_DB_INT32 :
     GRN_INT32_SET(ctx, dest, GRN_BOOL_VALUE(src));
     break;
+  case GRN_DB_UINT32 :
+    GRN_UINT32_SET(ctx, dest, GRN_BOOL_VALUE(src));
+    break;
   default :
     SRC2RECORD();
   }

  Added: test/command/suite/load/bool/cast/uint32.expected (+49 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/load/bool/cast/uint32.expected    2013-02-13 22:57:33 +0900 (8f2a801)
@@ -0,0 +1,49 @@
+table_create  Entries       TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Entries score COLUMN_SCALAR  UInt32
+[[0,0.0,0.0],true]
+load --table Entries
+[
+{"_key": "Special news!",  "score": true},
+{"_key": "Surprise news!", "score": false}
+]
+[[0,0.0,0.0],2]
+select Entries
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        2
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "score",
+          "UInt32"
+        ]
+      ],
+      [
+        1,
+        "Special news!",
+        1
+      ],
+      [
+        2,
+        "Surprise news!",
+        0
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/load/bool/cast/uint32.test (+10 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/load/bool/cast/uint32.test    2013-02-13 22:57:33 +0900 (0476e40)
@@ -0,0 +1,10 @@
+table_create  Entries       TABLE_HASH_KEY ShortText
+column_create Entries score COLUMN_SCALAR  UInt32
+
+load --table Entries
+[
+{"_key": "Special news!",  "score": true},
+{"_key": "Surprise news!", "score": false}
+]
+
+select Entries
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る