Skip to content

Commit

Permalink
Distinquish whether the table is actually grouped or not.
Browse files Browse the repository at this point in the history
  • Loading branch information
daijiro committed May 22, 2013
1 parent ba7e635 commit 8f8631c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/db.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@

#define NEXT_ADDR(p) (((byte *)(p)) + sizeof *(p))

#define GRN_TABLE_GROUPED 1
#define GRN_TABLE_IS_GROUPED(table)\
(((grn_hash *)(table))->obj.header.impl_flags & GRN_TABLE_GROUPED)
#define GRN_TABLE_GROUPED_ON(table)\
(((grn_hash *)(table))->obj.header.impl_flags |= GRN_TABLE_GROUPED)

#define WITH_NORMALIZE(table,key,key_size,block) do {\
if ((table)->normalizer && key && key_size > 0) {\
grn_obj *nstr;\
Expand Down Expand Up @@ -2897,6 +2903,7 @@ grn_table_group_with_range_gap(grn_ctx *ctx, grn_obj *table,
return 0;
}
grn_table_cursor_close(ctx, tc);
GRN_TABLE_GROUPED_ON(res);
return 1;
}
}
Expand Down Expand Up @@ -3016,6 +3023,7 @@ grn_table_group(grn_ctx *ctx, grn_obj *table,
}
grn_obj_close(ctx, &bulk);
}
GRN_TABLE_GROUPED_ON(results);
exit :
GRN_API_RETURN(rc);
}
Expand Down Expand Up @@ -4050,7 +4058,7 @@ grn_obj_get_accessor(grn_ctx *ctx, grn_obj *obj, const char *name, unsigned int
for (rp = &res; !done; rp = &(*rp)->next) {
*rp = accessor_new(ctx);
(*rp)->obj = obj;
if (DB_OBJ(obj)->header.flags & GRN_OBJ_WITH_SUBREC) {
if (GRN_TABLE_IS_GROUPED(obj)) {
(*rp)->action = GRN_ACCESSOR_GET_NSUBRECS;
done++;
} else {
Expand Down

0 comments on commit 8f8631c

Please sign in to comment.