[Groonga-commit] groonga/groonga [master] Report error for Bool -> TokyoGeoPoint cast

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Feb 13 23:48:42 JST 2013


Kouhei Sutou	2013-02-13 23:48:42 +0900 (Wed, 13 Feb 2013)

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

  Log:
    Report error for Bool -> TokyoGeoPoint cast

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

  Modified: lib/db.c (+3 -0)
===================================================================
--- lib/db.c    2013-02-13 23:44:25 +0900 (428468e)
+++ lib/db.c    2013-02-13 23:48:42 +0900 (af55ece)
@@ -4251,6 +4251,9 @@ grn_obj_cast_bool(grn_ctx *ctx, grn_obj *src, grn_obj *dest, grn_bool addp)
       GRN_TEXT_PUTS(ctx, dest, bool_text);
     }
     break;
+  case GRN_DB_TOKYO_GEO_POINT :
+    rc = GRN_INVALID_ARGUMENT;
+    break;
   default :
     SRC2RECORD();
     break;

  Added: test/command/suite/load/bool/cast/tokyo_geo_point.expected (+53 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/load/bool/cast/tokyo_geo_point.expected    2013-02-13 23:48:42 +0900 (cfd3ff2)
@@ -0,0 +1,53 @@
+table_create  Entries          TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Entries location COLUMN_SCALAR  TokyoGeoPoint
+[[0,0.0,0.0],true]
+load --table Entries
+[
+{"_key": "Special news!",  "location": true},
+{"_key": "Surprise news!", "location": false}
+]
+[[0,0.0,0.0],2]
+#|e| <Entries.location>: failed to cast to <TokyoGeoPoint>: <true>
+#|e| [table][load] failed to set column value: <Entries.location>: failed to cast to <TokyoGeoPoint>: <true>: key: <"Special news!">, column: <location>, value: <true>
+#|e| <Entries.location>: failed to cast to <TokyoGeoPoint>: <false>
+#|e| [table][load] failed to set column value: <Entries.location>: failed to cast to <TokyoGeoPoint>: <false>: key: <"Surprise news!">, column: <location>, value: <false>
+select Entries
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        2
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "location",
+          "TokyoGeoPoint"
+        ]
+      ],
+      [
+        1,
+        "Special news!",
+        "0x0"
+      ],
+      [
+        2,
+        "Surprise news!",
+        "0x0"
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/load/bool/cast/tokyo_geo_point.test (+10 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/load/bool/cast/tokyo_geo_point.test    2013-02-13 23:48:42 +0900 (5850705)
@@ -0,0 +1,10 @@
+table_create  Entries          TABLE_HASH_KEY ShortText
+column_create Entries location COLUMN_SCALAR  TokyoGeoPoint
+
+load --table Entries
+[
+{"_key": "Special news!",  "location": true},
+{"_key": "Surprise news!", "location": false}
+]
+
+select Entries
-------------- next part --------------
HTML����������������������������...
Download 



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