[Groonga-commit] groonga/groonga [master] load: clear load error for each column

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Nov 6 19:35:06 JST 2012


Kouhei Sutou	2012-11-06 19:35:06 +0900 (Tue, 06 Nov 2012)

  New Revision: 9d823f21c65872dcceb09db10202502bfb2f2de0
  https://github.com/groonga/groonga/commit/9d823f21c65872dcceb09db10202502bfb2f2de0

  Log:
    load: clear load error for each column

  Added files:
    test/command/suite/load/invalid/in_mid_brace.expected
    test/command/suite/load/invalid/in_mid_brace.test
    test/command/suite/load/invalid/in_mid_bracket.expected
    test/command/suite/load/invalid/in_mid_bracket.test
  Modified files:
    lib/db.c

  Modified: lib/db.c (+2 -0)
===================================================================
--- lib/db.c    2012-11-06 19:06:57 +0900 (8295425)
+++ lib/db.c    2012-11-06 19:35:06 +0900 (7e71215)
@@ -8996,6 +8996,7 @@ bracket_close(grn_ctx *ctx, grn_loader *loader)
               report_set_column_value_failure(ctx, key_value,
                                               column_name, column_name_size,
                                               value);
+              ERRCLR(ctx);
             }
           }
           value = values_next(ctx, value);
@@ -9099,6 +9100,7 @@ brace_close(grn_ctx *ctx, grn_loader *loader)
               if (rc != GRN_SUCCESS) {
                 report_set_column_value_failure(ctx, key_value,
                                                 name, name_size, value);
+                ERRCLR(ctx);
               }
             }
             grn_obj_unlink(ctx, col);

  Added: test/command/suite/load/invalid/in_mid_brace.expected (+66 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/load/invalid/in_mid_brace.expected    2012-11-06 19:35:06 +0900 (5accfea)
@@ -0,0 +1,66 @@
+table_create Tags TABLE_HASH_KEY ShortText --default_tokenizer TokenDelimit
+[[0,0.0,0.0],true]
+table_create Users TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Users name COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Users birthday COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Users tags COLUMN_VECTOR Tags
+[[0,0.0,0.0],true]
+column_create Tags usrs_tags COLUMN_INDEX Users tags
+[[0,0.0,0.0],true]
+load --table Users
+[
+{"_key": "alice", "name": "Alice", "birthday": "2012-02-29 GARBAGE", "tags": "girl wonder"}
+]
+[[0,0.0,0.0],1]
+#|e| <Users.birthday>: failed to cast to <Time>: <"2012-02-29 GARBAGE">
+#|e| [table][load] failed to set column value: <Users.birthday>: failed to cast to <Time>: <"2012-02-29 GARBAGE">: key: <"alice">, column: <birthday>, value: <"2012-02-29 GARBAGE">
+select Users
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        1
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "birthday",
+          "Time"
+        ],
+        [
+          "name",
+          "ShortText"
+        ],
+        [
+          "tags",
+          "Tags"
+        ]
+      ],
+      [
+        1,
+        "alice",
+        0.0,
+        "Alice",
+        [
+          "girl",
+          "wonder"
+        ]
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/load/invalid/in_mid_brace.test (+15 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/load/invalid/in_mid_brace.test    2012-11-06 19:35:06 +0900 (86a6294)
@@ -0,0 +1,15 @@
+table_create Tags TABLE_HASH_KEY ShortText --default_tokenizer TokenDelimit
+
+table_create Users TABLE_HASH_KEY ShortText
+column_create Users name COLUMN_SCALAR ShortText
+column_create Users birthday COLUMN_SCALAR Time
+column_create Users tags COLUMN_VECTOR Tags
+
+column_create Tags usrs_tags COLUMN_INDEX Users tags
+
+load --table Users
+[
+{"_key": "alice", "name": "Alice", "birthday": "2012-02-29 GARBAGE", "tags": "girl wonder"}
+]
+
+select Users

  Added: test/command/suite/load/invalid/in_mid_bracket.expected (+67 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/load/invalid/in_mid_bracket.expected    2012-11-06 19:35:06 +0900 (37d7e16)
@@ -0,0 +1,67 @@
+table_create Tags TABLE_HASH_KEY ShortText --default_tokenizer TokenDelimit
+[[0,0.0,0.0],true]
+table_create Users TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Users name COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+column_create Users birthday COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Users tags COLUMN_VECTOR Tags
+[[0,0.0,0.0],true]
+column_create Tags usrs_tags COLUMN_INDEX Users tags
+[[0,0.0,0.0],true]
+load --table Users
+[
+["_key", "name", "birthday", "tags"],
+["alice", "Alice", "2012-02-29 GARBAGE", "girl wonder"]
+]
+[[0,0.0,0.0],1]
+#|e| <Users.birthday>: failed to cast to <Time>: <"2012-02-29 GARBAGE">
+#|e| [table][load] failed to set column value: <Users.birthday>: failed to cast to <Time>: <"2012-02-29 GARBAGE">: key: <"alice">, column: <Users.birthday>, value: <"2012-02-29 GARBAGE">
+select Users
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        1
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "birthday",
+          "Time"
+        ],
+        [
+          "name",
+          "ShortText"
+        ],
+        [
+          "tags",
+          "Tags"
+        ]
+      ],
+      [
+        1,
+        "alice",
+        0.0,
+        "Alice",
+        [
+          "girl",
+          "wonder"
+        ]
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/load/invalid/in_mid_bracket.test (+16 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/load/invalid/in_mid_bracket.test    2012-11-06 19:35:06 +0900 (beb8b90)
@@ -0,0 +1,16 @@
+table_create Tags TABLE_HASH_KEY ShortText --default_tokenizer TokenDelimit
+
+table_create Users TABLE_HASH_KEY ShortText
+column_create Users name COLUMN_SCALAR ShortText
+column_create Users birthday COLUMN_SCALAR Time
+column_create Users tags COLUMN_VECTOR Tags
+
+column_create Tags usrs_tags COLUMN_INDEX Users tags
+
+load --table Users
+[
+["_key", "name", "birthday", "tags"],
+["alice", "Alice", "2012-02-29 GARBAGE", "girl wonder"]
+]
+
+select Users
-------------- next part --------------
HTML����������������������������...
Download 



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