1 | /* -*- c-basic-offset: 2 -*- */ |
2 | /* |
3 | Copyright(C) 2009-2016 Brazil |
4 | |
5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public |
7 | License version 2.1 as published by the Free Software Foundation. |
8 | |
9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Lesser General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU Lesser General Public |
15 | License along with this library; if not, write to the Free Software |
16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
17 | */ |
18 | |
19 | #include "grn.h" |
20 | #include "grn_store.h" |
21 | #include "grn_ii.h" |
22 | |
23 | grn_column_flags |
24 | grn_column_get_flags(grn_ctx *ctx, grn_obj *column) |
25 | { |
26 | grn_column_flags flags = 0; |
27 | |
28 | GRN_API_ENTER; |
29 | |
30 | if (!column) { |
31 | GRN_API_RETURN(0); |
32 | } |
33 | |
34 | switch (column->header.type) { |
35 | case GRN_COLUMN_FIX_SIZE : |
36 | flags = column->header.flags; |
37 | break; |
38 | case GRN_COLUMN_VAR_SIZE : |
39 | flags = grn_ja_get_flags(ctx, (grn_ja *)column); |
40 | break; |
41 | case GRN_COLUMN_INDEX : |
42 | flags = grn_ii_get_flags(ctx, (grn_ii *)column); |
43 | break; |
44 | default : |
45 | break; |
46 | } |
47 | |
48 | GRN_API_RETURN(flags); |
49 | } |
50 | |