Kouhei Sutou
null+****@clear*****
Wed Apr 13 19:02:04 JST 2016
Kouhei Sutou 2016-04-13 19:02:04 +0900 (Wed, 13 Apr 2016) New Revision: e33abc5cd7223f315a6aaf0df2a917e4c015f6ad https://github.com/groonga/groonga/commit/e33abc5cd7223f315a6aaf0df2a917e4c015f6ad Message: Add table name to error message for invalid sort key Modified files: lib/db.c test/command/suite/select/drilldown/labeled/table/empty.expected Modified: lib/db.c (+28 -4) =================================================================== --- lib/db.c 2016-04-13 18:51:49 +0900 (96045d4) +++ lib/db.c 2016-04-13 19:02:04 +0900 (7338403) @@ -12621,13 +12621,37 @@ grn_table_sort_key_from_str(grn_ctx *ctx, const char *str, unsigned int str_size } else { if (r - p == GRN_COLUMN_NAME_SCORE_LEN && memcmp(p, GRN_COLUMN_NAME_SCORE, GRN_COLUMN_NAME_SCORE_LEN) == 0) { + char table_name[GRN_TABLE_MAX_KEY_SIZE]; + int table_name_size; + table_name_size = grn_obj_name(ctx, table, + table_name, + GRN_TABLE_MAX_KEY_SIZE); + if (table_name_size == 0) { + grn_strcpy(table_name, GRN_TABLE_MAX_KEY_SIZE, "(anonymous)"); + table_name_size = strlen(table_name); + } GRN_LOG(ctx, GRN_WARN, - "ignore invalid sort key: <%.*s>(<%.*s>)", - (int)(r - p), p, str_size, str); + "ignore invalid sort key: <%.*s>: " + "table:<%*.s> keys:<%.*s>", + (int)(r - p), p, + table_name_size, table_name, + str_size, str); } else { + char table_name[GRN_TABLE_MAX_KEY_SIZE]; + int table_name_size; + table_name_size = grn_obj_name(ctx, table, + table_name, + GRN_TABLE_MAX_KEY_SIZE); + if (table_name_size == 0) { + grn_strcpy(table_name, GRN_TABLE_MAX_KEY_SIZE, "(anonymous)"); + table_name_size = strlen(table_name); + } WARN(GRN_INVALID_ARGUMENT, - "invalid sort key: <%.*s>(<%.*s>)", - (int)(r - p), p, str_size, str); + "invalid sort key: <%.*s>: " + "table:<%.*s> keys:<%.*s>", + (int)(r - p), p, + table_name_size, table_name, + str_size, str); break; } } Modified: test/command/suite/select/drilldown/labeled/table/empty.expected (+1 -1) =================================================================== --- test/command/suite/select/drilldown/labeled/table/empty.expected 2016-04-13 18:51:49 +0900 (1524aa2) +++ test/command/suite/select/drilldown/labeled/table/empty.expected 2016-04-13 19:02:04 +0900 (6b14939) @@ -106,4 +106,4 @@ select Memos --drilldown[category].table '' --drilldown[category].keys categ } ] ] -#|w| invalid sort key: <category>(<category>) +#|w| invalid sort key: <category>: table:<Memos> keys:<category> -------------- next part -------------- HTML����������������������������...Download