null+****@clear*****
null+****@clear*****
2012年 7月 17日 (火) 23:48:32 JST
Kouhei Sutou 2012-07-17 23:48:32 +0900 (Tue, 17 Jul 2012) New Revision: 2ba18fe994d239946db5ddaf366edab27f3688c4 https://github.com/groonga/groonga/commit/2ba18fe994d239946db5ddaf366edab27f3688c4 Log: load: stop load command for invalid --columns value Added files: test/function/suite/load/columns/nonexistent.expected test/function/suite/load/columns/nonexistent.test Modified files: lib/db.c test/unit/core/test-command-load.c Modified: lib/db.c (+1 -0) =================================================================== --- lib/db.c 2012-07-17 23:26:23 +0900 (da62371) +++ lib/db.c 2012-07-17 23:48:32 +0900 (84384cd) @@ -9408,6 +9408,7 @@ grn_load_(grn_ctx *ctx, grn_content_type input_type, GRN_PTR_INIT(&parsed_columns, GRN_OBJ_VECTOR, GRN_ID_NIL); if (parse_load_columns(ctx, loader->table, columns, columns_len, &parsed_columns)) { + loader->stat = GRN_LOADER_END; return; } n_columns = GRN_BULK_VSIZE(&parsed_columns) / sizeof(grn_obj *); Added: test/function/suite/load/columns/nonexistent.expected (+9 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/load/columns/nonexistent.expected 2012-07-17 23:48:32 +0900 (9385760) @@ -0,0 +1,9 @@ +table_create Users TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Users name COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +load --table Users --columns nonexistent --values '[["nonexistent column value"]]' +[[[-22,0.0,0.0],"nonexistent column: <nonexistent>"],0] +#|e| nonexistent column: <nonexistent> +select Users +[[0,0.0,0.0],[[[0],[["_id","UInt32"],["name","ShortText"]]]]] Added: test/function/suite/load/columns/nonexistent.test (+9 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/load/columns/nonexistent.test 2012-07-17 23:48:32 +0900 (cdea9af) @@ -0,0 +1,9 @@ +table_create Users TABLE_NO_KEY +column_create Users name COLUMN_SCALAR ShortText + +load \ + --table Users \ + --columns nonexistent \ + --values '[["nonexistent column value"]]' + +select Users Modified: test/unit/core/test-command-load.c (+0 -17) =================================================================== --- test/unit/core/test-command-load.c 2012-07-17 23:26:23 +0900 (c0497db) +++ test/unit/core/test-command-load.c 2012-07-17 23:48:32 +0900 (0276e32) @@ -32,7 +32,6 @@ void test_time_float(void); void data_null(void); void test_null(gconstpointer data); void test_index_geo_point(void); -void test_nonexistent_columns(void); void test_no_key_table(void); void test_two_bigram_indexes_to_key(void); void test_invalid_start_with_symbol(void); @@ -308,22 +307,6 @@ test_null(gconstpointer data) send_command("select Students")); } - -void -test_nonexistent_columns(void) -{ - assert_send_command("table_create Users TABLE_NO_KEY"); - assert_send_command("column_create Users name COLUMN_SCALAR ShortText"); - grn_test_assert_send_command_error(context, - GRN_INVALID_ARGUMENT, - "nonexistent column: <nonexistent>", - "load " - "--table Users " - "--columns nonexistent " - "--values " - "'[[\"nonexistent column value\"]]'"); -} - void test_no_key_table(void) { -------------- next part -------------- HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...下载