Navigation Menu

Skip to content

Commit

Permalink
schema: use array for sources
Browse files Browse the repository at this point in the history
Because order is important in sources.
  • Loading branch information
kou committed Oct 20, 2015
1 parent 1248740 commit 9516880
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 25 deletions.
10 changes: 2 additions & 8 deletions lib/proc.c
Expand Up @@ -7908,20 +7908,14 @@ proc_schema_column_output_sources(grn_ctx *ctx, grn_obj *column)
}

n_ids = GRN_BULK_VSIZE(&source_ids) / sizeof(grn_id);
GRN_OUTPUT_MAP_OPEN("sources", n_ids);
GRN_OUTPUT_ARRAY_OPEN("sources", n_ids);
for (i = 0; i < n_ids; i++) {
grn_id source_id;
grn_obj *source;

source_id = GRN_RECORD_VALUE_AT(&source_ids, i);
source = grn_ctx_at(ctx, source_id);

if (grn_obj_is_table(ctx, source)) {
GRN_OUTPUT_CSTR("_key");
} else {
proc_schema_output_column_name(ctx, source);
}

GRN_OUTPUT_MAP_OPEN("source", 3);

GRN_OUTPUT_CSTR("name");
Expand All @@ -7947,7 +7941,7 @@ proc_schema_column_output_sources(grn_ctx *ctx, grn_obj *column)

GRN_OUTPUT_MAP_CLOSE();
}
GRN_OUTPUT_MAP_CLOSE();
GRN_OUTPUT_ARRAY_CLOSE();

GRN_OBJ_FIN(ctx, &source_ids);
}
Expand Down
Expand Up @@ -203,8 +203,9 @@ schema
"section": false,
"weight": false,
"position": false,
"sources": {
},
"sources": [

],
"command": {
"name": "column_create",
"arguments": {
Expand Down
Expand Up @@ -203,8 +203,9 @@ schema
"section": false,
"weight": false,
"position": false,
"sources": {
},
"sources": [

],
"command": {
"name": "column_create",
"arguments": {
Expand Down
20 changes: 11 additions & 9 deletions test/command/suite/schema/tables/columns/type/index.expected
Expand Up @@ -213,8 +213,9 @@ schema
"section": false,
"weight": false,
"position": false,
"sources": {
},
"sources": [

],
"command": {
"name": "column_create",
"arguments": {
Expand All @@ -239,8 +240,9 @@ schema
"section": false,
"weight": false,
"position": false,
"sources": {
},
"sources": [

],
"command": {
"name": "column_create",
"arguments": {
Expand Down Expand Up @@ -296,23 +298,23 @@ schema
"section": true,
"weight": true,
"position": true,
"sources": {
"_key": {
"sources": [
{
"name": "_key",
"table": "Posts",
"full_name": "Posts._key"
},
"title": {
{
"name": "title",
"table": "Posts",
"full_name": "Posts.title"
},
"content": {
{
"name": "content",
"table": "Posts",
"full_name": "Posts.content"
}
},
],
"command": {
"name": "column_create",
"arguments": {
Expand Down
5 changes: 3 additions & 2 deletions test/command/suite/schema/tables/columns/type/scalar.expected
Expand Up @@ -203,8 +203,9 @@ schema
"section": false,
"weight": false,
"position": false,
"sources": {
},
"sources": [

],
"command": {
"name": "column_create",
"arguments": {
Expand Down
5 changes: 3 additions & 2 deletions test/command/suite/schema/tables/columns/type/vector.expected
Expand Up @@ -209,8 +209,9 @@ schema
"section": false,
"weight": false,
"position": false,
"sources": {
},
"sources": [

],
"command": {
"name": "column_create",
"arguments": {
Expand Down

0 comments on commit 9516880

Please sign in to comment.