Debian Codegraph @

lib/load.c

raw symbols SCIP
1 /*
2 Copyright (C) 2009-2017 Brazil
3 Copyright (C) 2018-2025 Sutou Kouhei <[email protected]>
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 as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 #include "grn_cast.h"cxx . . $ `<file>/lib/grn_cast.h`/
21 #include "grn_column.h"cxx . . $ `<file>/lib/grn_column.h`/
22 #include "grn_ctx_impl.h"cxx . . $ `<file>/lib/grn_ctx_impl.h`/
23 #include "grn_db.h"cxx . . $ `<file>/lib/grn_db.h`/
24 #include "grn_load.h"cxx . . $ `<file>/lib/grn_load.h`/
25 #include "grn_obj.h"cxx . . $ `<file>/lib/grn_obj.h`/
26 #include "grn_table.h"cxx . . $ `<file>/lib/grn_table.h`/
27 #include "grn_util.h"cxx . . $ `<file>/lib/grn_util.h`/
28
29 #include <stdio.h>
30
31 void
32 grn_loader_save_errorcxx . . $ grn_loader_save_error(4e8e4ed50d4bb15).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_loadercxx . . $ grn_loader# *loader)
33 {
34 loader->errorcxx . . $ $anonymous_type_504cda2014046ec0_2#error..rccxx . . $ $anonymous_type_504cda2014046ec0_2#$anonymous_type_3#rc. = ctx->rccxx . . $ _grn_ctx#rc.;
35 grn_strcpycxx . . $ `include/groonga/portability.h:101:11`!(loader->error.buffer, GRN_CTX_MSGSIZE, ctx->errbuf);
36 loader->errorcxx . . $ $anonymous_type_504cda2014046ec0_2#error..linecxx . . $ $anonymous_type_504cda2014046ec0_2#$anonymous_type_3#line. = ctx->errlinecxx . . $ _grn_ctx#errline.;
37 loader->errorcxx . . $ $anonymous_type_504cda2014046ec0_2#error..filecxx . . $ $anonymous_type_504cda2014046ec0_2#$anonymous_type_3#file. = ctx->errfilecxx . . $ _grn_ctx#errfile.;
38 loader->errorcxx . . $ $anonymous_type_504cda2014046ec0_2#error..funccxx . . $ $anonymous_type_504cda2014046ec0_2#$anonymous_type_3#func. = ctx->errfunccxx . . $ _grn_ctx#errfunc.;
39 }
40
41 void
42 grn_loader_on_record_addedcxx . . $ grn_loader_on_record_added(e9b016172514d9b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_loadercxx . . $ grn_loader# *loader, grn_idcxx . . $ grn_id# id)
43 {
44 if (id == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
45 grn_loader_save_errorcxx . . $ grn_loader_save_error(4e8e4ed50d4bb15).(ctx, loader);
46 loader->n_record_errorscxx . . $ $anonymous_type_504cda2014046ec0_2#n_record_errors.++;
47 } else {
48 loader->n_recordscxx . . $ $anonymous_type_504cda2014046ec0_2#n_records.++;
49 }
50 if (loader->output_idscxx . . $ $anonymous_type_504cda2014046ec0_2#output_ids.) {
51 GRN_UINT32_PUTcxx . . $ `include/groonga/groonga.h:3182:9`!(ctx, &(loader->ids), id);
52 }
53 if (loader->output_errorscxx . . $ $anonymous_type_504cda2014046ec0_2#output_errors.) {
54 GRN_INT32_PUTcxx . . $ `include/groonga/groonga.h:3177:9`!(ctx, &(loader->return_codes), ctx->rc);
55 grn_vector_add_elementcxx . . $ grn_vector_add_element(d170aee3d3986928).(ctx,
56 &(loader->error_messagescxx . . $ $anonymous_type_504cda2014046ec0_2#error_messages.),
57 ctx->errbufcxx . . $ _grn_ctx#errbuf.,
58 (uint32_tcxx . . $ uint32_t#)strlencxx . . $ strlen(751346f8406fd082).(ctx->errbufcxx . . $ _grn_ctx#errbuf.),
59 0,
60 GRN_DB_TEXTcxx . . $ GRN_DB_TEXT.);
61 }
62 ERRCLRcxx . . $ `lib/grn_error.h:37:9`!(ctx);
63 }
64
65 void
66 grn_loader_on_column_setcxx . . $ grn_loader_on_column_set(73ac9b8657a38d1d).(grn_ctxcxx . . $ grn_ctx# *ctx,
67 grn_loadercxx . . $ grn_loader# *loader,
68 grn_loader_add_record_datacxx . . $ grn_loader_add_record_data# *data)
69 {
70 if (ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
71 return;
72 }
73
74 grn_loader_save_errorcxx . . $ grn_loader_save_error(4e8e4ed50d4bb15).(ctx, loader);
75
76 grn_objcxx . . $ grn_obj# key_inspected;
77 grn_objcxx . . $ grn_obj# value_inspected;
78 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&key_inspected, 0);
79 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&value_inspected, 0);
80 if (data->keycxx . . $ $anonymous_type_504cda2014046ec0_4#key.) {
81 grn_inspect_limitedcxx . . $ grn_inspect_limited(88456f97fe0d41a).(ctx, &key_inspected, data->keycxx . . $ $anonymous_type_504cda2014046ec0_4#key.);
82 } else {
83 if (grn_obj_is_table_with_keycxx . . $ grn_obj_is_table_with_key(a5760e5c319a06ee).(ctx, data->tablecxx . . $ $anonymous_type_504cda2014046ec0_4#table.)) {
84 grn_objcxx . . $ grn_obj# key_value;
85 GRN_OBJ_INITcxx . . $ `include/groonga/groonga.h:947:9`!(&key_value, GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`!, 0, data->table->header.domain);
86 grn_table_get_key2cxx . . $ grn_table_get_key2(bd0cb75328e85567).(ctx, data->tablecxx . . $ $anonymous_type_504cda2014046ec0_4#table., data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id., &key_value);
87 grn_inspect_limitedcxx . . $ grn_inspect_limited(88456f97fe0d41a).(ctx, &key_inspected, &key_value);
88 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &key_value);
89 }
90 }
91 grn_inspect_limitedcxx . . $ grn_inspect_limited(88456f97fe0d41a).(ctx, &value_inspected, data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..valuecxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#value.);
92 if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&key_inspected) > 0) {
93 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(data->table);
94 GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx,
95 GRN_LOG_ERROR,
96 "[table][load][%.*s][%.*s] failed to set column value: %s: "
97 "key: <%.*s>, value: <%.*s>",
98 name_size,
99 name,
100 (int)(data->current.column_name_size),
101 data->current.column_name,
102 ctx->errbuf,
103 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&key_inspected),
104 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&key_inspected),
105 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&value_inspected),
106 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&value_inspected));
107 } else {
108 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(data->table);
109 GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx,
110 GRN_LOG_ERROR,
111 "[table][load][%.*s][%.*s] failed to set column value: %s: "
112 "id: <%u>: value: <%.*s>",
113 name_size,
114 name,
115 (int)(data->current.column_name_size),
116 data->current.column_name,
117 ctx->errbuf,
118 data->id,
119 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&value_inspected),
120 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&value_inspected));
121 }
122 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &key_inspected);
123 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &value_inspected);
124
125 loader->n_column_errorscxx . . $ $anonymous_type_504cda2014046ec0_2#n_column_errors.++;
126 ERRCLRcxx . . $ `lib/grn_error.h:37:9`!(ctx);
127 }
128
129 void
130 grn_loader_on_no_identifier_errorcxx . . $ grn_loader_on_no_identifier_error(df34f5a449543ed6).(grn_ctxcxx . . $ grn_ctx# *ctx,
131 grn_loadercxx . . $ grn_loader# *loader,
132 grn_objcxx . . $ grn_obj# *table)
133 {
134 if (!table) {
135 table = loader->tablecxx . . $ $anonymous_type_504cda2014046ec0_2#table.;
136 }
137 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(table);
138 if (table->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type. == GRN_TABLE_NO_KEYcxx . . $ `include/groonga/groonga.h:898:9`!) {
139 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
140 "[table][load][%.*s] <_id> isn't specified",
141 name_size,
142 name);
143 } else {
144 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
145 "[table][load][%.*s] neither <_key> nor <_id> is specified",
146 name_size,
147 name);
148 }
149 }
150
151 void
152 grn_loader_mergecxx . . $ grn_loader_merge(5ebbd2847b8db70e).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_loadercxx . . $ grn_loader# *loader, grn_loadercxx . . $ grn_loader# *loader_other)
153 {
154 /* TODO: information updated by grn_loader_on_record_added() such as
155 * loader->n_record_ids are not supported yet. */
156 loader->n_column_errorscxx . . $ $anonymous_type_504cda2014046ec0_2#n_column_errors. += loader_other->n_column_errorscxx . . $ $anonymous_type_504cda2014046ec0_2#n_column_errors.;
157 if (loader->errorcxx . . $ $anonymous_type_504cda2014046ec0_2#error..rccxx . . $ $anonymous_type_504cda2014046ec0_2#$anonymous_type_3#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS. &&
158 loader_other->errorcxx . . $ $anonymous_type_504cda2014046ec0_2#error..rccxx . . $ $anonymous_type_504cda2014046ec0_2#$anonymous_type_3#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
159 loader->errorcxx . . $ $anonymous_type_504cda2014046ec0_2#error..rccxx . . $ $anonymous_type_504cda2014046ec0_2#$anonymous_type_3#rc. = loader_other->errorcxx . . $ $anonymous_type_504cda2014046ec0_2#error..rccxx . . $ $anonymous_type_504cda2014046ec0_2#$anonymous_type_3#rc.;
160 grn_strcpycxx . . $ `include/groonga/portability.h:101:11`!(loader->error.buffer,
161 GRN_CTX_MSGSIZE,
162 loader_other->error.buffer);
163 loader->errorcxx . . $ $anonymous_type_504cda2014046ec0_2#error..linecxx . . $ $anonymous_type_504cda2014046ec0_2#$anonymous_type_3#line. = loader_other->errorcxx . . $ $anonymous_type_504cda2014046ec0_2#error..linecxx . . $ $anonymous_type_504cda2014046ec0_2#$anonymous_type_3#line.;
164 loader->errorcxx . . $ $anonymous_type_504cda2014046ec0_2#error..filecxx . . $ $anonymous_type_504cda2014046ec0_2#$anonymous_type_3#file. = loader_other->errorcxx . . $ $anonymous_type_504cda2014046ec0_2#error..filecxx . . $ $anonymous_type_504cda2014046ec0_2#$anonymous_type_3#file.;
165 loader->errorcxx . . $ $anonymous_type_504cda2014046ec0_2#error..funccxx . . $ $anonymous_type_504cda2014046ec0_2#$anonymous_type_3#func. = loader_other->errorcxx . . $ $anonymous_type_504cda2014046ec0_2#error..funccxx . . $ $anonymous_type_504cda2014046ec0_2#$anonymous_type_3#func.;
166 }
167 }
168
169 grn_objcxx . . $ grn_obj# *
170 grn_loader_get_columncxx . . $ grn_loader_get_column(dc36a02eec0a0be5).(grn_ctxcxx . . $ grn_ctx# *ctx,
171 grn_loadercxx . . $ grn_loader# *loader,
172 const char *name,
173 size_t name_length)
174 {
175 if (!loader->columnscxx . . $ $anonymous_type_504cda2014046ec0_2#columns.) {
176 loader->columnscxx . . $ $anonymous_type_504cda2014046ec0_2#columns. = grn_hash_createcxx . . $ grn_hash_create(db1bba7e0d64660).(ctx,
177 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!,
178 GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!,
179 sizeof(grn_objcxx . . $ grn_obj# *),
180 GRN_OBJ_TABLE_HASH_KEYcxx . . $ `include/groonga/groonga.h:688:9`! |
181 GRN_OBJ_KEY_VAR_SIZEcxx . . $ `include/groonga/groonga.h:820:9`! | GRN_HASH_TINYcxx . . $ `include/groonga/hash.h:26:9`!);
182 }
183
184 void *value;
185 grn_idcxx . . $ grn_id# id =
186 grn_hash_getcxx . . $ grn_hash_get(4e868e5367e71b67).(ctx, loader->columnscxx . . $ $anonymous_type_504cda2014046ec0_2#columns., name, (unsigned int)name_length, &value);
187 if (id != GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
188 return *((grn_objcxx . . $ grn_obj# **)value);
189 }
190
191 grn_objcxx . . $ grn_obj# *column =
192 grn_obj_columncxx . . $ grn_obj_column(c00e49795c44129a).(ctx, loader->tablecxx . . $ $anonymous_type_504cda2014046ec0_2#table., name, (uint32_tcxx . . $ uint32_t#)name_length);
193 if (!column) {
194 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
195 }
196
197 id = grn_hash_addcxx . . $ grn_hash_add(251a256fc515235e).(ctx,
198 loader->columnscxx . . $ $anonymous_type_504cda2014046ec0_2#columns.,
199 name,
200 (unsigned int)name_length,
201 &value,
202 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
203 grn_memcpycxx . . $ `include/groonga/portability.h:32:13`!(value, &column, sizeof(grn_obj *));
204 grn_objcxx . . $ grn_obj# *range = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, DB_OBJcxx . . $ `lib/grn_db.h:62:9`!(column)->rangecxx . . $ $anonymous_type_4a7c1014017e4c5d_0#range.);
205 if (grn_obj_is_tablecxx . . $ grn_obj_is_table(a5760e5c319a06ee).(ctx, range)) {
206 GRN_PTR_PUTcxx . . $ `include/groonga/groonga.h:3218:9`!(ctx, &(loader->ranges), range);
207 grn_column_get_all_index_columnscxx . . $ grn_column_get_all_index_columns(d825b4ed5bf12304).(ctx, range, &(loader->indexescxx . . $ $anonymous_type_504cda2014046ec0_2#indexes.));
208 }
209 grn_column_get_all_index_columnscxx . . $ grn_column_get_all_index_columns(d825b4ed5bf12304).(ctx, column, &(loader->indexescxx . . $ $anonymous_type_504cda2014046ec0_2#indexes.));
210
211 return column;
212 }
213
214 static grn_objcxx . . $ grn_obj# *
215 values_addcxx . . $ values_add(12ec504980c850a1).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_loadercxx . . $ grn_loader# *loader)
216 {
217 grn_objcxx . . $ grn_obj# *res;
218 uint32_tcxx . . $ uint32_t# curr_size = loader->values_sizecxx . . $ $anonymous_type_504cda2014046ec0_2#values_size. * sizeof(grn_objcxx . . $ grn_obj#);
219 if (curr_size < GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&loader->values)) {
220 res = (grn_objcxx . . $ grn_obj# *)(GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&loader->values) + curr_size);
221 res->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. = GRN_DB_TEXTcxx . . $ GRN_DB_TEXT.;
222 GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(res);
223 } else {
224 if (grn_bulk_spacecxx . . $ grn_bulk_space(f9a66385f261f61d).(ctx, &loader->valuescxx . . $ $anonymous_type_504cda2014046ec0_2#values., sizeof(grn_objcxx . . $ grn_obj#))) {
225 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
226 }
227 res = (grn_objcxx . . $ grn_obj# *)(GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&loader->values) + curr_size);
228 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(res, 0);
229 }
230 loader->values_sizecxx . . $ $anonymous_type_504cda2014046ec0_2#values_size.++;
231 loader->lastcxx . . $ $anonymous_type_504cda2014046ec0_2#last. = res;
232 return res;
233 }
234
235 static grn_objcxx . . $ grn_obj# *
236 values_nextcxx . . $ values_next(e9f40e4080908c1e).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *value)
237 {
238 if (value->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == GRN_JSON_LOAD_OPEN_BRACKETcxx . . $ `lib/grn_load.h:28:9`! ||
239 value->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == GRN_JSON_LOAD_OPEN_BRACEcxx . . $ `lib/grn_load.h:29:9`!) {
240 value += GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(value);
241 }
242 return value + 1;
243 }
244
245 static uint32_tcxx . . $ uint32_t#
246 grn_loader_bracket_countcxx . . $ grn_loader_bracket_count(8dd58acc9865e889).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *bracket_value)
247 {
248 uint32_tcxx . . $ uint32_t# size;
249 grn_objcxx . . $ grn_obj# *head = bracket_value + 1;
250 grn_objcxx . . $ grn_obj# *tail = head + GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(bracket_value);
251 for (size = 0; head < tail; head = values_nextcxx . . $ values_next(e9f40e4080908c1e).(ctx, head), size++) {
252 }
253 return size;
254 }
255
256 static grn_objcxx . . $ grn_obj# *
257 grn_loader_bracket_getcxx . . $ grn_loader_bracket_get(fe791abc79590565).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *bracket_value, uint32_tcxx . . $ uint32_t# offset)
258 {
259 uint32_tcxx . . $ uint32_t# i;
260 grn_objcxx . . $ grn_obj# *head = bracket_value + 1;
261 grn_objcxx . . $ grn_obj# *tail = head + GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(bracket_value);
262 for (i = 0; head < tail; head = values_nextcxx . . $ values_next(e9f40e4080908c1e).(ctx, head), i++) {
263 if (i == offset) {
264 return head;
265 }
266 }
267 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
268 }
269
270 grn_idcxx . . $ grn_id#
271 grn_loader_add_recordcxx . . $ grn_loader_add_record(450b3b927d098ef4).(grn_ctxcxx . . $ grn_ctx# *ctx,
272 grn_loadercxx . . $ grn_loader# *loader,
273 grn_loader_add_record_datacxx . . $ grn_loader_add_record_data# *data)
274 {
275 if (data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id. != GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
276 if (grn_table_atcxx . . $ grn_table_at(c0317bb03c33a3cb).(ctx, data->tablecxx . . $ $anonymous_type_504cda2014046ec0_4#table., data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id.) == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
277 if (ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
278 data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id. = grn_table_addcxx . . $ grn_table_add(8041cb9a4866097e).(ctx, data->tablecxx . . $ $anonymous_type_504cda2014046ec0_4#table., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
279 }
280 }
281 } else if (data->keycxx . . $ $anonymous_type_504cda2014046ec0_4#key.) {
282 grn_table_add_optionscxx . . $ grn_table_add_options# options = {0};
283 data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id. = grn_table_add_by_keycxx . . $ grn_table_add_by_key(3453c0da39889e85).(ctx, data->tablecxx . . $ $anonymous_type_504cda2014046ec0_4#table., data->keycxx . . $ $anonymous_type_504cda2014046ec0_4#key., &options);
284 if (data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id. == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
285 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
286 }
287 if (!options.addedcxx . . $ $anonymous_type_5d6f2f2d27272fbe_3#added. && loader->ifexistscxx . . $ $anonymous_type_504cda2014046ec0_2#ifexists.) {
288 grn_objcxx . . $ grn_obj# *v = grn_expr_get_var_by_offsetcxx . . $ grn_expr_get_var_by_offset(fe791abc79590565).(ctx, loader->ifexistscxx . . $ $anonymous_type_504cda2014046ec0_2#ifexists., 0);
289 GRN_RECORD_SETcxx . . $ `include/groonga/groonga.h:2940:9`!(ctx, v, data->id);
290 grn_objcxx . . $ grn_obj# *result = grn_expr_execcxx . . $ grn_expr_exec(e5f715bd58cd6451).(ctx, loader->ifexistscxx . . $ $anonymous_type_504cda2014046ec0_2#ifexists., 0);
291 if (!grn_obj_is_truecxx . . $ grn_obj_is_true(a5760e5c319a06ee).(ctx, result)) {
292 data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id. = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
293 }
294 }
295 } else {
296 data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id. = grn_table_addcxx . . $ grn_table_add(8041cb9a4866097e).(ctx, data->tablecxx . . $ $anonymous_type_504cda2014046ec0_4#table., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
297 }
298 return data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id.;
299 }
300
301 static void
302 grn_loader_brace_add_weight_vector_elementcxx . . $ grn_loader_brace_add_weight_vector_element(88a5faec9b573fee).(grn_ctxcxx . . $ grn_ctx# *ctx,
303 grn_loadercxx . . $ grn_loader# *loader,
304 grn_loader_add_record_datacxx . . $ grn_loader_add_record_data# *data,
305 grn_objcxx . . $ grn_obj# *vector,
306 grn_objcxx . . $ grn_obj# *brace_value)
307 {
308 grn_objcxx . . $ grn_obj# weight_buffer;
309 GRN_FLOAT32_INITcxx . . $ `include/groonga/groonga.h:2862:9`!(&weight_buffer, 0);
310
311 grn_objcxx . . $ grn_obj# *value = brace_value + 1;
312 grn_objcxx . . $ grn_obj# *value_end = value + GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(brace_value);
313 for (; value < value_end; value = values_nextcxx . . $ values_next(e9f40e4080908c1e).(ctx, value)) {
314 grn_objcxx . . $ grn_obj# *key = value;
315 if (value >= value_end) {
316 /* TODO: Report no weight error. */
317 break;
318 }
319 value = values_nextcxx . . $ values_next(e9f40e4080908c1e).(ctx, value);
320 grn_objcxx . . $ grn_obj# *weight = value;
321
322 GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&weight_buffer);
323 grn_rccxx . . $ grn_rc# rc = grn_obj_castcxx . . $ grn_obj_cast(a6fd93da1614eccd).(ctx, weight, &weight_buffer, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!);
324 if (rc != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
325 grn_objcxx . . $ grn_obj# *range;
326 range = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, weight_buffer.headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.);
327 ERR_CASTcxx . . $ `lib/grn_cast.h:63:9`!(data->current.column, range, weight);
328 grn_obj_unlinkcxx . . $ grn_obj_unlink(4865d068a46d0f83).(ctx, range);
329 break;
330 }
331 grn_vector_add_element_floatcxx . . $ grn_vector_add_element_float(d14ed80b83bcdc3d).(ctx,
332 vector,
333 GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(key),
334 (uint32_tcxx . . $ uint32_t#)GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(key),
335 GRN_FLOAT32_VALUEcxx . . $ `include/groonga/groonga.h:3107:9`!(&weight_buffer),
336 key->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.);
337 }
338 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &weight_buffer);
339 }
340
341 static void
342 grn_loader_brace_add_recordcxx . . $ grn_loader_brace_add_record(73ac9b8657a38d1d).(grn_ctxcxx . . $ grn_ctx# *ctx,
343 grn_loadercxx . . $ grn_loader# *loader,
344 grn_loader_add_record_datacxx . . $ grn_loader_add_record_data# *data);
345
346 static void
347 grn_loader_bracket_set_value_referencecxx . . $ grn_loader_bracket_set_value_reference(73ac9b8657a38d1d).(grn_ctxcxx . . $ grn_ctx# *ctx,
348 grn_loadercxx . . $ grn_loader# *loader,
349 grn_loader_add_record_datacxx . . $ grn_loader_add_record_data# *data)
350 {
351 grn_objcxx . . $ grn_obj# *bracket_element = data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..valuecxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#value.;
352 grn_objcxx . . $ grn_obj# *element = bracket_element + 1;
353 grn_objcxx . . $ grn_obj# *element_end = element + GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(bracket_element);
354
355 grn_idcxx . . $ grn_id# range_id = DB_OBJcxx . . $ `lib/grn_db.h:62:9`!(data->current.column)->rangecxx . . $ $anonymous_type_4a7c1014017e4c5d_0#range.;
356 grn_objcxx . . $ grn_obj# *range = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, range_id);
357
358 grn_objcxx . . $ grn_obj# vector;
359 GRN_RECORD_INITcxx . . $ `include/groonga/groonga.h:2868:9`!(&vector, GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!, range_id);
360 for (; element < element_end; element = values_nextcxx . . $ values_next(e9f40e4080908c1e).(ctx, element)) {
361 if (element->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == GRN_JSON_LOAD_OPEN_BRACEcxx . . $ `lib/grn_load.h:29:9`!) {
362 grn_loader_add_record_datacxx . . $ grn_loader_add_record_data# sub_data;
363 sub_data.tablecxx . . $ $anonymous_type_504cda2014046ec0_4#table. = range;
364 sub_data.depthcxx . . $ $anonymous_type_504cda2014046ec0_4#depth. = data->depthcxx . . $ $anonymous_type_504cda2014046ec0_4#depth. + 1;
365 sub_data.record_valuecxx . . $ $anonymous_type_504cda2014046ec0_4#record_value. = element;
366 sub_data.idcxx . . $ $anonymous_type_504cda2014046ec0_4#id. = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
367 sub_data.keycxx . . $ $anonymous_type_504cda2014046ec0_4#key. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
368 grn_loader_brace_add_recordcxx . . $ grn_loader_brace_add_record(73ac9b8657a38d1d).(ctx, loader, &sub_data);
369 if (sub_data.idcxx . . $ $anonymous_type_504cda2014046ec0_4#id. == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
370 goto exit;
371 }
372 GRN_RECORD_PUTcxx . . $ `include/groonga/groonga.h:3213:9`!(ctx, &vector, sub_data.id);
373 } else if (element->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == GRN_JSON_LOAD_OPEN_BRACKETcxx . . $ `lib/grn_load.h:28:9`!) {
374 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(data->table);
375 grn_objcxx . . $ grn_obj# inspected;
376 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0);
377 grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, &inspected, element);
378 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
379 "[table][load][%.*s][%.*s] can't use [...] for reference column: "
380 "%.*s",
381 name_size,
382 name,
383 data->current.column_name_size,
384 data->current.column_name,
385 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected),
386 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected));
387 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected);
388 goto exit;
389 } else if (element->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == range_id) {
390 GRN_RECORD_PUTcxx . . $ `include/groonga/groonga.h:3213:9`!(ctx, &vector, GRN_RECORD_VALUEcxx . . $ `include/groonga/groonga.h:3110:9`!(element));
391 } else {
392 grn_objcxx . . $ grn_obj# values;
393 if (grn_obj_is_text_family_bulkcxx . . $ grn_obj_is_text_family_bulk(a5760e5c319a06ee).(ctx, element)) {
394 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&values, GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!);
395 grn_vector_add_element_floatcxx . . $ grn_vector_add_element_float(d14ed80b83bcdc3d).(ctx,
396 &values,
397 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(element),
398 (uint32_tcxx . . $ uint32_t#)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(element),
399 0.0,
400 element->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.);
401 } else {
402 GRN_VALUE_FIX_SIZE_INITcxx . . $ `include/groonga/groonga.h:2738:9`!(&values,
403 GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!,
404 element->header.domain);
405 grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx,
406 &values,
407 GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(element),
408 GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(element));
409 }
410 grn_objcxx . . $ grn_obj# records;
411 GRN_RECORD_INITcxx . . $ `include/groonga/groonga.h:2868:9`!(&records, 0, range_id);
412 grn_objcxx . . $ grn_obj# *casted_records = grn_column_cast_valuecxx . . $ grn_column_cast_value(81ab0320238f2fe0).(ctx,
413 data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..columncxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#column.,
414 &values,
415 &records,
416 GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!);
417 if (casted_records) {
418 grn_uvector_copycxx . . $ grn_uvector_copy(d825b4ed5bf12304).(ctx, &records, &vector);
419 }
420 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &values);
421 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &records);
422 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
423 goto exit;
424 }
425 }
426 }
427
428 grn_obj_set_valuecxx . . $ grn_obj_set_value(16170250441fe8eb).(ctx, data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..columncxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#column., data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id., &vector, GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!);
429
430 exit:
431 grn_obj_unlinkcxx . . $ grn_obj_unlink(4865d068a46d0f83).(ctx, range);
432 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &vector);
433 }
434
435 static void
436 grn_loader_bracket_set_value_textcxx . . $ grn_loader_bracket_set_value_text(73ac9b8657a38d1d).(grn_ctxcxx . . $ grn_ctx# *ctx,
437 grn_loadercxx . . $ grn_loader# *loader,
438 grn_loader_add_record_datacxx . . $ grn_loader_add_record_data# *data)
439 {
440 grn_objcxx . . $ grn_obj# *bracket_element = data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..valuecxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#value.;
441 grn_objcxx . . $ grn_obj# *element = bracket_element + 1;
442 grn_objcxx . . $ grn_obj# *element_end = element + GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(bracket_element);
443
444 grn_idcxx . . $ grn_id# range_id = DB_OBJcxx . . $ `lib/grn_db.h:62:9`!(data->current.column)->rangecxx . . $ $anonymous_type_4a7c1014017e4c5d_0#range.;
445
446 grn_objcxx . . $ grn_obj# vector;
447 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&vector, GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!);
448 for (; element < element_end; element = values_nextcxx . . $ values_next(e9f40e4080908c1e).(ctx, element)) {
449 if (element->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == GRN_JSON_LOAD_OPEN_BRACEcxx . . $ `lib/grn_load.h:29:9`!) {
450 grn_loader_brace_add_weight_vector_elementcxx . . $ grn_loader_brace_add_weight_vector_element(88a5faec9b573fee).(ctx,
451 loader,
452 data,
453 &vector,
454 element);
455 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
456 goto exit;
457 }
458 } else if (element->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == GRN_JSON_LOAD_OPEN_BRACKETcxx . . $ `lib/grn_load.h:28:9`!) {
459 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(data->table);
460 grn_objcxx . . $ grn_obj# inspected;
461 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0);
462 grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, &inspected, element);
463 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
464 "[table][load][%.*s][%.*s] "
465 "can't use [...] for variable size data column: "
466 "%.*s",
467 name_size,
468 name,
469 data->current.column_name_size,
470 data->current.column_name,
471 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected),
472 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected));
473 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected);
474 goto exit;
475 } else if (grn_obj_is_text_family_bulkcxx . . $ grn_obj_is_text_family_bulk(a5760e5c319a06ee).(ctx, element)) {
476 grn_vector_add_elementcxx . . $ grn_vector_add_element(d170aee3d3986928).(ctx,
477 &vector,
478 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(element),
479 (uint32_tcxx . . $ uint32_t#)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(element),
480 0,
481 range_id);
482 } else {
483 grn_objcxx . . $ grn_obj# values;
484 GRN_VALUE_FIX_SIZE_INITcxx . . $ `include/groonga/groonga.h:2738:9`!(&values, GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!, element->header.domain);
485 grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx,
486 &values,
487 GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(element),
488 GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(element));
489 grn_objcxx . . $ grn_obj# buffer;
490 GRN_VOID_INITcxx . . $ `include/groonga/groonga.h:2749:9`!(&buffer);
491 grn_objcxx . . $ grn_obj# *casted_values = grn_column_cast_valuecxx . . $ grn_column_cast_value(81ab0320238f2fe0).(ctx,
492 data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..columncxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#column.,
493 &values,
494 &buffer,
495 GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!);
496 if (casted_values) {
497 grn_vector_copycxx . . $ grn_vector_copy(d825b4ed5bf12304).(ctx, casted_values, &vector);
498 }
499 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &values);
500 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &buffer);
501 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
502 grn_loader_save_errorcxx . . $ grn_loader_save_error(4e8e4ed50d4bb15).(ctx, loader);
503 ERRCLRcxx . . $ `lib/grn_error.h:37:9`!(ctx);
504 }
505 }
506 }
507
508 grn_obj_set_valuecxx . . $ grn_obj_set_value(16170250441fe8eb).(ctx, data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..columncxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#column., data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id., &vector, GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!);
509
510 exit:
511 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &vector);
512 }
513
514 static void
515 grn_loader_bracket_set_value_fix_sizecxx . . $ grn_loader_bracket_set_value_fix_size(73ac9b8657a38d1d).(grn_ctxcxx . . $ grn_ctx# *ctx,
516 grn_loadercxx . . $ grn_loader# *loader,
517 grn_loader_add_record_datacxx . . $ grn_loader_add_record_data# *data)
518 {
519 grn_objcxx . . $ grn_obj# *bracket_element = data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..valuecxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#value.;
520 grn_objcxx . . $ grn_obj# *element = bracket_element + 1;
521 grn_objcxx . . $ grn_obj# *element_end = element + GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(bracket_element);
522
523 grn_idcxx . . $ grn_id# range_id = DB_OBJcxx . . $ `lib/grn_db.h:62:9`!(data->current.column)->rangecxx . . $ $anonymous_type_4a7c1014017e4c5d_0#range.;
524
525 grn_objcxx . . $ grn_obj# vector;
526 GRN_VALUE_FIX_SIZE_INITcxx . . $ `include/groonga/groonga.h:2738:9`!(&vector, GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!, range_id);
527 for (; element < element_end; element = values_nextcxx . . $ values_next(e9f40e4080908c1e).(ctx, element)) {
528 if (element->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == GRN_JSON_LOAD_OPEN_BRACEcxx . . $ `lib/grn_load.h:29:9`! ||
529 element->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == GRN_JSON_LOAD_OPEN_BRACKETcxx . . $ `lib/grn_load.h:28:9`!) {
530 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(data->table);
531 grn_objcxx . . $ grn_obj# inspected;
532 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0);
533 grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, &inspected, element);
534 const char *example;
535 if (element->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == GRN_JSON_LOAD_OPEN_BRACEcxx . . $ `lib/grn_load.h:29:9`!) {
536 example = "{...}";
537 } else {
538 example = "[...]";
539 }
540 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
541 "[table][load][%.*s][%.*s] "
542 "can't use %s for fixed size data column: "
543 "%.*s",
544 name_size,
545 name,
546 data->current.column_name_size,
547 data->current.column_name,
548 example,
549 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected),
550 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected));
551 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected);
552 goto exit;
553 } else if (element->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == range_id) {
554 grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx,
555 &vector,
556 GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(element),
557 GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(element));
558 } else {
559 grn_objcxx . . $ grn_obj# values;
560 if (grn_obj_is_text_family_bulkcxx . . $ grn_obj_is_text_family_bulk(a5760e5c319a06ee).(ctx, element)) {
561 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&values, GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!);
562 grn_vector_add_element_floatcxx . . $ grn_vector_add_element_float(d14ed80b83bcdc3d).(ctx,
563 &values,
564 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(element),
565 (uint32_tcxx . . $ uint32_t#)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(element),
566 0.0,
567 element->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.);
568 } else {
569 GRN_VALUE_FIX_SIZE_INITcxx . . $ `include/groonga/groonga.h:2738:9`!(&values,
570 GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!,
571 element->header.domain);
572 grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx,
573 &values,
574 GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(element),
575 GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(element));
576 }
577 grn_objcxx . . $ grn_obj# buffer;
578 GRN_VOID_INITcxx . . $ `include/groonga/groonga.h:2749:9`!(&buffer);
579 grn_objcxx . . $ grn_obj# *casted_values = grn_column_cast_valuecxx . . $ grn_column_cast_value(81ab0320238f2fe0).(ctx,
580 data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..columncxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#column.,
581 &values,
582 &buffer,
583 GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!);
584 if (casted_values) {
585 grn_uvector_copycxx . . $ grn_uvector_copy(d825b4ed5bf12304).(ctx, casted_values, &vector);
586 }
587 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &values);
588 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &buffer);
589 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
590 grn_loader_save_errorcxx . . $ grn_loader_save_error(4e8e4ed50d4bb15).(ctx, loader);
591 ERRCLRcxx . . $ `lib/grn_error.h:37:9`!(ctx);
592 }
593 }
594 }
595
596 grn_obj_set_valuecxx . . $ grn_obj_set_value(16170250441fe8eb).(ctx, data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..columncxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#column., data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id., &vector, GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!);
597
598 exit:
599 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &vector);
600 }
601
602 static void
603 grn_loader_bracket_set_valuecxx . . $ grn_loader_bracket_set_value(73ac9b8657a38d1d).(grn_ctxcxx . . $ grn_ctx# *ctx,
604 grn_loadercxx . . $ grn_loader# *loader,
605 grn_loader_add_record_datacxx . . $ grn_loader_add_record_data# *data)
606 {
607 if (!grn_obj_is_vector_columncxx . . $ grn_obj_is_vector_column(a5760e5c319a06ee).(ctx, data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..columncxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#column.)) {
608 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(data->table);
609 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
610 "[table][load][%.*s][%.*s] [...] is only for vector column",
611 name_size,
612 name,
613 (int)(data->current.column_name_size),
614 data->current.column_name);
615 return;
616 }
617
618 grn_idcxx . . $ grn_id# range_id = DB_OBJcxx . . $ `lib/grn_db.h:62:9`!(data->current.column)->rangecxx . . $ $anonymous_type_4a7c1014017e4c5d_0#range.;
619 if (grn_id_maybe_tablecxx . . $ grn_id_maybe_table(a2a496425acc5b40).(ctx, range_id)) {
620 grn_loader_bracket_set_value_referencecxx . . $ grn_loader_bracket_set_value_reference(73ac9b8657a38d1d).(ctx, loader, data);
621 } else if (grn_type_id_is_text_familycxx . . $ grn_type_id_is_text_family(a2a496425acc5b40).(ctx, range_id)) {
622 grn_loader_bracket_set_value_textcxx . . $ grn_loader_bracket_set_value_text(73ac9b8657a38d1d).(ctx, loader, data);
623 } else {
624 grn_loader_bracket_set_value_fix_sizecxx . . $ grn_loader_bracket_set_value_fix_size(73ac9b8657a38d1d).(ctx, loader, data);
625 }
626 }
627
628 static void
629 grn_loader_brace_set_valuecxx . . $ grn_loader_brace_set_value(73ac9b8657a38d1d).(grn_ctxcxx . . $ grn_ctx# *ctx,
630 grn_loadercxx . . $ grn_loader# *loader,
631 grn_loader_add_record_datacxx . . $ grn_loader_add_record_data# *data)
632 {
633 if (grn_obj_is_weight_vector_columncxx . . $ grn_obj_is_weight_vector_column(a5760e5c319a06ee).(ctx, data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..columncxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#column.)) {
634 grn_objcxx . . $ grn_obj# vector;
635 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&vector, GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!);
636 grn_loader_brace_add_weight_vector_elementcxx . . $ grn_loader_brace_add_weight_vector_element(88a5faec9b573fee).(ctx,
637 loader,
638 data,
639 &vector,
640 data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..valuecxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#value.);
641 if (ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
642 grn_obj_set_valuecxx . . $ grn_obj_set_value(16170250441fe8eb).(ctx,
643 data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..columncxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#column.,
644 data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id.,
645 &vector,
646 GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!);
647 }
648 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &vector);
649 } else if (grn_obj_is_reference_columncxx . . $ grn_obj_is_reference_column(a5760e5c319a06ee).(ctx, data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..columncxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#column.) &&
650 !grn_obj_is_vector_columncxx . . $ grn_obj_is_vector_column(a5760e5c319a06ee).(ctx, data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..columncxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#column.)) {
651 grn_idcxx . . $ grn_id# range_id = DB_OBJcxx . . $ `lib/grn_db.h:62:9`!(data->current.column)->rangecxx . . $ $anonymous_type_4a7c1014017e4c5d_0#range.;
652 grn_loader_add_record_datacxx . . $ grn_loader_add_record_data# sub_data;
653 sub_data.tablecxx . . $ $anonymous_type_504cda2014046ec0_4#table. = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, range_id);
654 sub_data.depthcxx . . $ $anonymous_type_504cda2014046ec0_4#depth. = data->depthcxx . . $ $anonymous_type_504cda2014046ec0_4#depth. + 1;
655 sub_data.record_valuecxx . . $ $anonymous_type_504cda2014046ec0_4#record_value. = data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..valuecxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#value.;
656 sub_data.idcxx . . $ $anonymous_type_504cda2014046ec0_4#id. = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
657 sub_data.keycxx . . $ $anonymous_type_504cda2014046ec0_4#key. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
658 grn_loader_brace_add_recordcxx . . $ grn_loader_brace_add_record(73ac9b8657a38d1d).(ctx, loader, &sub_data);
659 if (sub_data.idcxx . . $ $anonymous_type_504cda2014046ec0_4#id. != GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
660 grn_objcxx . . $ grn_obj# record;
661 GRN_RECORD_INITcxx . . $ `include/groonga/groonga.h:2868:9`!(&record, 0, range_id);
662 GRN_RECORD_SETcxx . . $ `include/groonga/groonga.h:2940:9`!(ctx, &record, sub_data.id);
663 grn_obj_set_valuecxx . . $ grn_obj_set_value(16170250441fe8eb).(ctx,
664 data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..columncxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#column.,
665 data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id.,
666 &record,
667 GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!);
668 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &record);
669 }
670 grn_obj_unlinkcxx . . $ grn_obj_unlink(4865d068a46d0f83).(ctx, sub_data.tablecxx . . $ $anonymous_type_504cda2014046ec0_4#table.);
671 } else {
672 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(data->table);
673 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
674 "[table][load][%.*s][%.*s] {...} is only for "
675 "weight vector column or reference column",
676 name_size,
677 name,
678 (int)(data->current.column_name_size),
679 data->current.column_name);
680 }
681 }
682
683 static inline int
684 name_equalcxx . . $ name_equal(6ef988fe2eca6e65).(const char *p, size_t size, const char *name)
685 {
686 if (strlencxx . . $ strlen(751346f8406fd082).(name) != size) {
687 return 0;
688 }
689 if (*p != GRN_DB_PSEUDO_COLUMN_PREFIXcxx . . $ `lib/grn_db.h:43:9`!) {
690 return 0;
691 }
692 return !memcmpcxx . . $ memcmp(36f949851efa3055).(p + 1, name + 1, size - 1);
693 }
694
695 static void
696 grn_loader_brace_set_valuescxx . . $ grn_loader_brace_set_values(73ac9b8657a38d1d).(grn_ctxcxx . . $ grn_ctx# *ctx,
697 grn_loadercxx . . $ grn_loader# *loader,
698 grn_loader_add_record_datacxx . . $ grn_loader_add_record_data# *data)
699 {
700 grn_objcxx . . $ grn_obj# *brace_value = data->record_valuecxx . . $ $anonymous_type_504cda2014046ec0_4#record_value.;
701 grn_objcxx . . $ grn_obj# *value = brace_value + 1;
702 grn_objcxx . . $ grn_obj# *value_end = value + GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(brace_value);
703
704 for (; value < value_end; value = values_nextcxx . . $ values_next(e9f40e4080908c1e).(ctx, value)) {
705 const char *name = data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..column_namecxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#column_name. = GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(value);
706 size_t name_size = GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(value);
707 data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..column_name_sizecxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#column_name_size. = (uint32_tcxx . . $ uint32_t#)name_size;
708 value++;
709 data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..valuecxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#value. = value;
710 if (name_equalcxx . . $ name_equal(6ef988fe2eca6e65).(name, name_size, GRN_COLUMN_NAME_IDcxx . . $ `include/groonga/column.h:41:9`!) ||
711 name_equalcxx . . $ name_equal(6ef988fe2eca6e65).(name, name_size, GRN_COLUMN_NAME_KEYcxx . . $ `include/groonga/column.h:63:9`!)) {
712 /* Skip _id and _key, because it's already used to get id. */
713 continue;
714 }
715 grn_objcxx . . $ grn_obj# *column = data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..columncxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#column. =
716 grn_obj_columncxx . . $ grn_obj_column(c00e49795c44129a).(ctx, data->tablecxx . . $ $anonymous_type_504cda2014046ec0_4#table., name, (uint32_tcxx . . $ uint32_t#)name_size);
717 if (!column) {
718 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(data->table);
719 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
720 "[table][load][%.*s] nonexistent column: <%.*s>",
721 (int)name_size,
722 name,
723 (int)(data->current.column_name_size),
724 data->current.column_name);
725 grn_loader_on_column_setcxx . . $ grn_loader_on_column_set(73ac9b8657a38d1d).(ctx, loader, data);
726 continue;
727 /* Automatic column creation is disabled. */
728 /*
729 if (value->header.domain == GRN_JSON_LOAD_OPEN_BRACKET) {
730 grn_obj *v = value + 1;
731 col = grn_column_create(ctx, loader->table, name, name_size,
732 NULL, GRN_OBJ_PERSISTENT|GRN_OBJ_COLUMN_VECTOR,
733 grn_ctx_at(ctx, v->header.domain));
734 } else {
735 col = grn_column_create(ctx, loader->table, name, name_size,
736 NULL, GRN_OBJ_PERSISTENT,
737 grn_ctx_at(ctx, value->header.domain));
738 }
739 */
740 }
741
742 if (value->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == GRN_JSON_LOAD_OPEN_BRACKETcxx . . $ `lib/grn_load.h:28:9`!) {
743 grn_loader_bracket_set_valuecxx . . $ grn_loader_bracket_set_value(73ac9b8657a38d1d).(ctx, loader, data);
744 } else if (value->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == GRN_JSON_LOAD_OPEN_BRACEcxx . . $ `lib/grn_load.h:29:9`!) {
745 grn_loader_brace_set_valuecxx . . $ grn_loader_brace_set_value(73ac9b8657a38d1d).(ctx, loader, data);
746 } else {
747 grn_obj_set_valuecxx . . $ grn_obj_set_value(16170250441fe8eb).(ctx, column, data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id., value, GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!);
748 }
749 grn_loader_on_column_setcxx . . $ grn_loader_on_column_set(73ac9b8657a38d1d).(ctx, loader, data);
750 grn_obj_unlinkcxx . . $ grn_obj_unlink(4865d068a46d0f83).(ctx, column);
751 }
752 }
753
754 static void
755 grn_loader_parse_id_valuecxx . . $ grn_loader_parse_id_value(af8271ca5a90ce8b).(grn_ctxcxx . . $ grn_ctx# *ctx,
756 grn_loadercxx . . $ grn_loader# *loader,
757 grn_loader_add_record_datacxx . . $ grn_loader_add_record_data# *data,
758 grn_objcxx . . $ grn_obj# *value)
759 {
760 switch (value->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.) {
761 case GRN_DB_UINT32cxx . . $ GRN_DB_UINT32.:
762 data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id. = GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(value);
763 break;
764 case GRN_DB_INT32cxx . . $ GRN_DB_INT32.:
765 data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id. = (grn_idcxx . . $ grn_id#)GRN_INT32_VALUEcxx . . $ `include/groonga/groonga.h:3102:9`!(value);
766 break;
767 default:
768 {
769 grn_objcxx . . $ grn_obj# casted_value;
770 GRN_UINT32_INITcxx . . $ `include/groonga/groonga.h:2854:9`!(&casted_value, 0);
771 if (grn_obj_castcxx . . $ grn_obj_cast(a6fd93da1614eccd).(ctx, value, &casted_value, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
772 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(data->table);
773 grn_objcxx . . $ grn_obj# inspected;
774 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0);
775 grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, &inspected, value);
776 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
777 "[table][load][%.*s][%s] failed to cast to <UInt32>: <%.*s>",
778 name_size,
779 name,
780 GRN_COLUMN_NAME_IDcxx . . $ `include/groonga/column.h:41:9`!,
781 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected),
782 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected));
783 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected);
784 } else {
785 data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id. = GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(&casted_value);
786 }
787 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &casted_value);
788 break;
789 }
790 }
791 }
792
793 static inline void
794 grn_loader_brace_add_record_internalcxx . . $ grn_loader_brace_add_record_internal(73ac9b8657a38d1d).(grn_ctxcxx . . $ grn_ctx# *ctx,
795 grn_loadercxx . . $ grn_loader# *loader,
796 grn_loader_add_record_datacxx . . $ grn_loader_add_record_data# *data)
797 {
798 grn_objcxx . . $ grn_obj# *brace_value = data->record_valuecxx . . $ $anonymous_type_504cda2014046ec0_4#record_value.;
799 grn_objcxx . . $ grn_obj# *value = brace_value + 1;
800 grn_objcxx . . $ grn_obj# *value_end = value + GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(brace_value);
801 grn_objcxx . . $ grn_obj# *id_bulk = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
802 grn_objcxx . . $ grn_obj# *key = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
803
804 /* Scan values to find _id or _key. */
805 for (; value < value_end; value = values_nextcxx . . $ values_next(e9f40e4080908c1e).(ctx, value)) {
806 if (!grn_obj_is_text_family_bulkcxx . . $ grn_obj_is_text_family_bulk(a5760e5c319a06ee).(ctx, value)) {
807 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(data->table);
808 grn_objcxx . . $ grn_obj# inspected;
809 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0);
810 grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, &inspected, value);
811 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
812 "[table][load][%.*s] column name must be string: <%.*s>",
813 name_size,
814 name,
815 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected),
816 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected));
817 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected);
818 return;
819 }
820
821 const char *name = GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(value);
822 size_t name_size = GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(value);
823 value = values_nextcxx . . $ values_next(e9f40e4080908c1e).(ctx, value);
824 if (name_equalcxx . . $ name_equal(6ef988fe2eca6e65).(name, name_size, GRN_COLUMN_NAME_IDcxx . . $ `include/groonga/column.h:41:9`!)) {
825 if (id_bulk || key) {
826 if (data->tablecxx . . $ $anonymous_type_504cda2014046ec0_4#table.->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type. == GRN_TABLE_NO_KEYcxx . . $ `include/groonga/groonga.h:898:9`!) {
827 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(data->table);
828 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
829 "[table][load][%.*s] duplicated <%s> columns",
830 name_size,
831 name,
832 GRN_COLUMN_NAME_IDcxx . . $ `include/groonga/column.h:41:9`!);
833 return;
834 } else {
835 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(data->table);
836 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
837 "[table][load][%.*s] duplicated identifier columns: <%s>:<%s>",
838 name_size,
839 name,
840 id_bulk ? GRN_COLUMN_NAME_IDcxx . . $ `include/groonga/column.h:41:9`! : GRN_COLUMN_NAME_KEYcxx . . $ `include/groonga/column.h:63:9`!,
841 GRN_COLUMN_NAME_IDcxx . . $ `include/groonga/column.h:41:9`!);
842 return;
843 }
844 }
845 id_bulk = value;
846 } else if (name_equalcxx . . $ name_equal(6ef988fe2eca6e65).(name, name_size, GRN_COLUMN_NAME_KEYcxx . . $ `include/groonga/column.h:63:9`!)) {
847 if (data->tablecxx . . $ $anonymous_type_504cda2014046ec0_4#table.->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type. == GRN_TABLE_NO_KEYcxx . . $ `include/groonga/groonga.h:898:9`!) {
848 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(data->table);
849 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
850 "[table][load][%.*s] TABLE_NO_KEY doesn't accept <%s> column",
851 name_size,
852 name,
853 GRN_COLUMN_NAME_KEYcxx . . $ `include/groonga/column.h:63:9`!);
854 return;
855 }
856 if (id_bulk || key) {
857 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(data->table);
858 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
859 "[table][load][%.*s] duplicated identifier columns: <%s>:<%s>",
860 name_size,
861 name,
862 id_bulk ? GRN_COLUMN_NAME_IDcxx . . $ `include/groonga/column.h:41:9`! : GRN_COLUMN_NAME_KEYcxx . . $ `include/groonga/column.h:63:9`!,
863 GRN_COLUMN_NAME_KEYcxx . . $ `include/groonga/column.h:63:9`!);
864 return;
865 }
866 key = value;
867 }
868 }
869
870 switch (data->tablecxx . . $ $anonymous_type_504cda2014046ec0_4#table.->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.) {
871 case GRN_TABLE_HASH_KEYcxx . . $ `include/groonga/groonga.h:895:9`!:
872 case GRN_TABLE_PAT_KEYcxx . . $ `include/groonga/groonga.h:896:9`!:
873 case GRN_TABLE_DAT_KEYcxx . . $ `include/groonga/groonga.h:897:9`!:
874 /* The target table requires _id or _key. */
875 if (!id_bulk && !key) {
876 grn_loader_on_no_identifier_errorcxx . . $ grn_loader_on_no_identifier_error(df34f5a449543ed6).(ctx, loader, data->tablecxx . . $ $anonymous_type_504cda2014046ec0_4#table.);
877 return;
878 }
879 break;
880 default:
881 break;
882 }
883
884 if (id_bulk) {
885 grn_loader_parse_id_valuecxx . . $ grn_loader_parse_id_value(af8271ca5a90ce8b).(ctx, loader, data, id_bulk);
886 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
887 return;
888 }
889 } else if (key) {
890 data->keycxx . . $ $anonymous_type_504cda2014046ec0_4#key. = key;
891 }
892 grn_loader_add_recordcxx . . $ grn_loader_add_record(450b3b927d098ef4).(ctx, loader, data);
893 if (data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id. == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
894 /* Target record is not available. */
895 return;
896 }
897
898 /* TODO: support recursive lock */
899 if (data->depthcxx . . $ $anonymous_type_504cda2014046ec0_4#depth. == 0 && loader->lock_tablecxx . . $ $anonymous_type_504cda2014046ec0_2#lock_table.) {
900 GRN_TABLE_LOCK_BEGINcxx . . $ `lib/grn_table.h:56:9`!(ctx, data->table)
901 {
902 if (grn_table_atcxx . . $ grn_table_at(c0317bb03c33a3cb).(ctx, data->tablecxx . . $ $anonymous_type_504cda2014046ec0_4#table., data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id.) == data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id.) {
903 grn_loader_brace_set_valuescxx . . $ grn_loader_brace_set_values(73ac9b8657a38d1d).(ctx, loader, data);
904 if (data->depthcxx . . $ $anonymous_type_504cda2014046ec0_4#depth. == 0) {
905 grn_loader_apply_eachcxx . . $ grn_loader_apply_each(e9b016172514d9b).(ctx, loader, data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id.);
906 }
907 } else {
908 data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id. = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
909 }
910 }
911 GRN_TABLE_LOCK_ENDcxx . . $ `lib/grn_table.h:69:9`!(ctx);
912 } else {
913 grn_loader_brace_set_valuescxx . . $ grn_loader_brace_set_values(73ac9b8657a38d1d).(ctx, loader, data);
914 if (data->depthcxx . . $ $anonymous_type_504cda2014046ec0_4#depth. == 0) {
915 grn_loader_apply_eachcxx . . $ grn_loader_apply_each(e9b016172514d9b).(ctx, loader, data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id.);
916 }
917 }
918
919 return;
920 }
921
922 static void
923 grn_loader_brace_add_recordcxx . . $ grn_loader_brace_add_record(73ac9b8657a38d1d).(grn_ctxcxx . . $ grn_ctx# *ctx,
924 grn_loadercxx . . $ grn_loader# *loader,
925 grn_loader_add_record_datacxx . . $ grn_loader_add_record_data# *data)
926 {
927 GRN_SLOW_LOG_PUSHcxx . . $ `include/groonga/groonga.h:2512:9`!(ctx, GRN_LOG_DEBUG);
928 grn_loader_brace_add_record_internalcxx . . $ grn_loader_brace_add_record_internal(73ac9b8657a38d1d).(ctx, loader, data);
929 GRN_SLOW_LOG_POP_BEGINcxx . . $ `include/groonga/groonga.h:2519:9`!(ctx, GRN_LOG_DEBUG, elapsed_time)
930 {
931 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(loader->table);
932 GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx,
933 GRN_LOG_DEBUG,
934 "[loader][brace][add-record][slow][%f] "
935 "<%.*s>(%u)",
936 elapsed_time,
937 name_size,
938 name,
939 data->id);
940 }
941 GRN_SLOW_LOG_POP_ENDcxx . . $ `include/groonga/groonga.h:2525:9`!(ctx);
942 }
943
944 void
945 grn_loader_apply_eachcxx . . $ grn_loader_apply_each(e9b016172514d9b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_loadercxx . . $ grn_loader# *loader, grn_idcxx . . $ grn_id# id)
946 {
947 grn_objcxx . . $ grn_obj# *var;
948
949 if (!loader->eachcxx . . $ $anonymous_type_504cda2014046ec0_2#each.) {
950 return;
951 }
952
953 var = grn_expr_get_var_by_offsetcxx . . $ grn_expr_get_var_by_offset(fe791abc79590565).(ctx, loader->eachcxx . . $ $anonymous_type_504cda2014046ec0_2#each., 0);
954 GRN_RECORD_SETcxx . . $ `include/groonga/groonga.h:2940:9`!(ctx, var, id);
955 grn_expr_execcxx . . $ grn_expr_exec(e5f715bd58cd6451).(ctx, loader->eachcxx . . $ $anonymous_type_504cda2014046ec0_2#each., 0);
956 }
957
958 static void
959 grn_loader_bracket_set_columnscxx . . $ grn_loader_bracket_set_columns(df34f5a449543ed6).(grn_ctxcxx . . $ grn_ctx# *ctx,
960 grn_loadercxx . . $ grn_loader# *loader,
961 grn_objcxx . . $ grn_obj# *bracket_value)
962 {
963 grn_objcxx . . $ grn_obj# *value = bracket_value + 1;
964 grn_objcxx . . $ grn_obj# *value_end = value + GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(bracket_value);
965 uint32_tcxx . . $ uint32_t# i = 0;
966 for (; value < value_end; value = values_nextcxx . . $ values_next(e9f40e4080908c1e).(ctx, value), i++) {
967 if (!grn_obj_is_text_family_bulkcxx . . $ grn_obj_is_text_family_bulk(a5760e5c319a06ee).(ctx, value)) {
968 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(loader->table);
969 grn_objcxx . . $ grn_obj# inspected;
970 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0);
971 grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, &inspected, value);
972 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
973 "[table][load][%.*s] column name must be string: <%.*s>",
974 name_size,
975 name,
976 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected),
977 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected));
978 grn_loader_save_errorcxx . . $ grn_loader_save_error(4e8e4ed50d4bb15).(ctx, loader);
979 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected);
980 loader->columns_statuscxx . . $ $anonymous_type_504cda2014046ec0_2#columns_status. = GRN_LOADER_COLUMNS_BROKENcxx . . $ GRN_LOADER_COLUMNS_BROKEN.;
981 return;
982 }
983
984 const char *column_name = GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(value);
985 size_t column_name_size = GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(value);
986 if (name_equalcxx . . $ name_equal(6ef988fe2eca6e65).(column_name, column_name_size, GRN_COLUMN_NAME_IDcxx . . $ `include/groonga/column.h:41:9`!)) {
987 if (loader->id_offsetcxx . . $ $anonymous_type_504cda2014046ec0_2#id_offset. != -1 || loader->key_offsetcxx . . $ $anonymous_type_504cda2014046ec0_2#key_offset. != -1) {
988 /* _id and _key must not appear more than once. */
989 if (loader->tablecxx . . $ $anonymous_type_504cda2014046ec0_2#table.->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type. == GRN_TABLE_NO_KEYcxx . . $ `include/groonga/groonga.h:898:9`!) {
990 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(loader->table);
991 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
992 "[table][load][%.*s] duplicated <%s> columns: %d and %d",
993 name_size,
994 name,
995 GRN_COLUMN_NAME_IDcxx . . $ `include/groonga/column.h:41:9`!,
996 loader->id_offset,
997 i);
998 } else {
999 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(loader->table);
1000 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
1001 "[table][load][%.*s] duplicated identifier columns: <%s>:<%s>",
1002 name_size,
1003 name,
1004 loader->id_offset != -1 ? GRN_COLUMN_NAME_IDcxx . . $ `include/groonga/column.h:41:9`!
1005 : GRN_COLUMN_NAME_KEYcxx . . $ `include/groonga/column.h:63:9`!,
1006 GRN_COLUMN_NAME_IDcxx . . $ `include/groonga/column.h:41:9`!);
1007 }
1008 grn_loader_save_errorcxx . . $ grn_loader_save_error(4e8e4ed50d4bb15).(ctx, loader);
1009 loader->columns_statuscxx . . $ $anonymous_type_504cda2014046ec0_2#columns_status. = GRN_LOADER_COLUMNS_BROKENcxx . . $ GRN_LOADER_COLUMNS_BROKEN.;
1010 return;
1011 }
1012 loader->id_offsetcxx . . $ $anonymous_type_504cda2014046ec0_2#id_offset. = (int32_tcxx . . $ int32_t#)i;
1013 } else if (name_equalcxx . . $ name_equal(6ef988fe2eca6e65).(column_name, column_name_size, GRN_COLUMN_NAME_KEYcxx . . $ `include/groonga/column.h:63:9`!)) {
1014 if (loader->tablecxx . . $ $anonymous_type_504cda2014046ec0_2#table.->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type. == GRN_TABLE_NO_KEYcxx . . $ `include/groonga/groonga.h:898:9`!) {
1015 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(loader->table);
1016 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
1017 "[table][load][%.*s] TABLE_NO_KEY doesn't accept <%s> column",
1018 name_size,
1019 name,
1020 GRN_COLUMN_NAME_KEYcxx . . $ `include/groonga/column.h:63:9`!);
1021 grn_loader_save_errorcxx . . $ grn_loader_save_error(4e8e4ed50d4bb15).(ctx, loader);
1022 loader->columns_statuscxx . . $ $anonymous_type_504cda2014046ec0_2#columns_status. = GRN_LOADER_COLUMNS_BROKENcxx . . $ GRN_LOADER_COLUMNS_BROKEN.;
1023 return;
1024 }
1025 if (loader->id_offsetcxx . . $ $anonymous_type_504cda2014046ec0_2#id_offset. != -1 || loader->key_offsetcxx . . $ $anonymous_type_504cda2014046ec0_2#key_offset. != -1) {
1026 /* _id and _key must not appear more than once. */
1027 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(loader->table);
1028 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
1029 "[table][load][%.*s] duplicated identifier columns: <%s>:<%s>",
1030 name_size,
1031 name,
1032 loader->id_offset != -1 ? GRN_COLUMN_NAME_IDcxx . . $ `include/groonga/column.h:41:9`! : GRN_COLUMN_NAME_KEYcxx . . $ `include/groonga/column.h:63:9`!,
1033 GRN_COLUMN_NAME_KEYcxx . . $ `include/groonga/column.h:63:9`!);
1034 grn_loader_save_errorcxx . . $ grn_loader_save_error(4e8e4ed50d4bb15).(ctx, loader);
1035 loader->columns_statuscxx . . $ $anonymous_type_504cda2014046ec0_2#columns_status. = GRN_LOADER_COLUMNS_BROKENcxx . . $ GRN_LOADER_COLUMNS_BROKEN.;
1036 return;
1037 }
1038 loader->key_offsetcxx . . $ $anonymous_type_504cda2014046ec0_2#key_offset. = (int32_tcxx . . $ int32_t#)i;
1039 }
1040 grn_objcxx . . $ grn_obj# *column =
1041 grn_loader_get_columncxx . . $ grn_loader_get_column(dc36a02eec0a0be5).(ctx, loader, column_name, column_name_size);
1042 if (!column) {
1043 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(loader->table);
1044 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
1045 "[table][load][%.*s] nonexistent column: <%.*s>",
1046 name_size,
1047 name,
1048 (int)column_name_size,
1049 column_name);
1050 grn_loader_save_errorcxx . . $ grn_loader_save_error(4e8e4ed50d4bb15).(ctx, loader);
1051 loader->columns_statuscxx . . $ $anonymous_type_504cda2014046ec0_2#columns_status. = GRN_LOADER_COLUMNS_BROKENcxx . . $ GRN_LOADER_COLUMNS_BROKEN.;
1052 return;
1053 }
1054 }
1055
1056 switch (loader->tablecxx . . $ $anonymous_type_504cda2014046ec0_2#table.->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.) {
1057 case GRN_TABLE_HASH_KEYcxx . . $ `include/groonga/groonga.h:895:9`!:
1058 case GRN_TABLE_PAT_KEYcxx . . $ `include/groonga/groonga.h:896:9`!:
1059 case GRN_TABLE_DAT_KEYcxx . . $ `include/groonga/groonga.h:897:9`!:
1060 if (loader->id_offsetcxx . . $ $anonymous_type_504cda2014046ec0_2#id_offset. == -1 && loader->key_offsetcxx . . $ $anonymous_type_504cda2014046ec0_2#key_offset. == -1) {
1061 grn_loader_on_no_identifier_errorcxx . . $ grn_loader_on_no_identifier_error(df34f5a449543ed6).(ctx, loader, loader->tablecxx . . $ $anonymous_type_504cda2014046ec0_2#table.);
1062 grn_loader_save_errorcxx . . $ grn_loader_save_error(4e8e4ed50d4bb15).(ctx, loader);
1063 loader->columns_statuscxx . . $ $anonymous_type_504cda2014046ec0_2#columns_status. = GRN_LOADER_COLUMNS_BROKENcxx . . $ GRN_LOADER_COLUMNS_BROKEN.;
1064 return;
1065 }
1066 break;
1067 default:
1068 break;
1069 }
1070
1071 loader->columns_statuscxx . . $ $anonymous_type_504cda2014046ec0_2#columns_status. = GRN_LOADER_COLUMNS_SETcxx . . $ GRN_LOADER_COLUMNS_SET.;
1072 }
1073
1074 static void
1075 grn_loader_bracket_set_valuescxx . . $ grn_loader_bracket_set_values(73ac9b8657a38d1d).(grn_ctxcxx . . $ grn_ctx# *ctx,
1076 grn_loadercxx . . $ grn_loader# *loader,
1077 grn_loader_add_record_datacxx . . $ grn_loader_add_record_data# *data)
1078 {
1079 grn_objcxx . . $ grn_obj# *bracket_value = data->record_valuecxx . . $ $anonymous_type_504cda2014046ec0_4#record_value.;
1080 grn_objcxx . . $ grn_obj# *value = bracket_value + 1;
1081 grn_objcxx . . $ grn_obj# *value_end = value + GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(bracket_value);
1082 int32_tcxx . . $ int32_t# i = 0;
1083 GRN_HASH_EACH_BEGINcxx . . $ `include/groonga/hash.h:141:9`!(ctx, loader->columns, cursor, cursor_id)
1084 {
1085 if (value >= value_end) {
1086 break;
1087 }
1088
1089 if (i == loader->id_offsetcxx . . $ $anonymous_type_504cda2014046ec0_2#id_offset. || i == loader->key_offsetcxx . . $ $anonymous_type_504cda2014046ec0_2#key_offset.) {
1090 i++;
1091 value = values_nextcxx . . $ values_next(e9f40e4080908c1e).(ctx, value);
1092 continue;
1093 }
1094
1095 void *cursor_value;
1096 grn_hash_cursor_get_valuecxx . . $ grn_hash_cursor_get_value(248c0d78df691c42).(ctx, cursor, &cursor_value);
1097 data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..columncxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#column. = *((grn_objcxx . . $ grn_obj# **)cursor_value);
1098 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(data->current.column);
1099 const char *column_only_name = name;
1100 for (; column_only_name < name + name_size; column_only_name++) {
1101 if (column_only_name[0] == '.') {
1102 column_only_name++;
1103 break;
1104 }
1105 }
1106 data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..column_namecxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#column_name. = column_only_name;
1107 data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..column_name_sizecxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#column_name_size. =
1108 (uint32_tcxx . . $ uint32_t#)(name_size - (column_only_name - name));
1109 data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..valuecxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#value. = value;
1110
1111 if (value->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == GRN_JSON_LOAD_OPEN_BRACKETcxx . . $ `lib/grn_load.h:28:9`!) {
1112 grn_loader_bracket_set_valuecxx . . $ grn_loader_bracket_set_value(73ac9b8657a38d1d).(ctx, loader, data);
1113 } else if (value->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == GRN_JSON_LOAD_OPEN_BRACEcxx . . $ `lib/grn_load.h:29:9`!) {
1114 grn_loader_brace_set_valuecxx . . $ grn_loader_brace_set_value(73ac9b8657a38d1d).(ctx, loader, data);
1115 } else {
1116 grn_obj_set_valuecxx . . $ grn_obj_set_value(16170250441fe8eb).(ctx,
1117 data->currentcxx . . $ $anonymous_type_504cda2014046ec0_4#current..columncxx . . $ $anonymous_type_504cda2014046ec0_4#$anonymous_type_5#column.,
1118 data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id.,
1119 value,
1120 GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!);
1121 }
1122 grn_loader_on_column_setcxx . . $ grn_loader_on_column_set(73ac9b8657a38d1d).(ctx, loader, data);
1123
1124 i++;
1125 value = values_nextcxx . . $ values_next(e9f40e4080908c1e).(ctx, value);
1126 }
1127 GRN_HASH_EACH_ENDcxx . . $ `include/groonga/hash.h:159:9`!(ctx, cursor);
1128 }
1129
1130 static inline void
1131 grn_loader_bracket_add_record_internalcxx . . $ grn_loader_bracket_add_record_internal(73ac9b8657a38d1d).(grn_ctxcxx . . $ grn_ctx# *ctx,
1132 grn_loadercxx . . $ grn_loader# *loader,
1133 grn_loader_add_record_datacxx . . $ grn_loader_add_record_data# *data)
1134 {
1135 grn_objcxx . . $ grn_obj# *bracket_value = data->record_valuecxx . . $ $anonymous_type_504cda2014046ec0_4#record_value.;
1136 uint32_tcxx . . $ uint32_t# n_values = grn_loader_bracket_countcxx . . $ grn_loader_bracket_count(8dd58acc9865e889).(ctx, bracket_value);
1137 if (n_values == 0) {
1138 switch (loader->tablecxx . . $ $anonymous_type_504cda2014046ec0_2#table.->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.) {
1139 case GRN_TABLE_NO_KEYcxx . . $ `include/groonga/groonga.h:898:9`!:
1140 /*
1141 * Accept empty arrays because a dump command may output a load command
1142 * which contains empty arrays for a table with deleted records.
1143 */
1144 data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id. = grn_table_addcxx . . $ grn_table_add(8041cb9a4866097e).(ctx, loader->tablecxx . . $ $anonymous_type_504cda2014046ec0_2#table., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
1145 return;
1146 default:
1147 grn_loader_on_no_identifier_errorcxx . . $ grn_loader_on_no_identifier_error(df34f5a449543ed6).(ctx, loader, data->tablecxx . . $ $anonymous_type_504cda2014046ec0_4#table.);
1148 return;
1149 }
1150 }
1151
1152 uint32_tcxx . . $ uint32_t# expected_n_values = grn_hash_sizecxx . . $ grn_hash_size(f05d4ba70b6338a4).(ctx, loader->columnscxx . . $ $anonymous_type_504cda2014046ec0_2#columns.);
1153 if (n_values != expected_n_values) {
1154 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(data->table);
1155 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
1156 "[table][load][%*.s] "
1157 "unexpected the number of values: expected:%u, actual:%u",
1158 name_size,
1159 name,
1160 expected_n_values,
1161 n_values);
1162 return;
1163 }
1164
1165 grn_objcxx . . $ grn_obj# *value = bracket_value + 1;
1166 if (loader->id_offsetcxx . . $ $anonymous_type_504cda2014046ec0_2#id_offset. != -1) {
1167 grn_objcxx . . $ grn_obj# *id_bulk =
1168 grn_loader_bracket_getcxx . . $ grn_loader_bracket_get(fe791abc79590565).(ctx, bracket_value, (uint32_tcxx . . $ uint32_t#)(loader->id_offsetcxx . . $ $anonymous_type_504cda2014046ec0_2#id_offset.));
1169 grn_loader_parse_id_valuecxx . . $ grn_loader_parse_id_value(af8271ca5a90ce8b).(ctx, loader, data, id_bulk);
1170 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
1171 return;
1172 }
1173 } else if (loader->key_offsetcxx . . $ $anonymous_type_504cda2014046ec0_2#key_offset. != -1) {
1174 data->keycxx . . $ $anonymous_type_504cda2014046ec0_4#key. = value + loader->key_offsetcxx . . $ $anonymous_type_504cda2014046ec0_2#key_offset.;
1175 }
1176 grn_loader_add_recordcxx . . $ grn_loader_add_record(450b3b927d098ef4).(ctx, loader, data);
1177 if (data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id. == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
1178 /* Target record is not available. */
1179 return;
1180 }
1181
1182 /* TODO: support recursive lock */
1183 if (data->depthcxx . . $ $anonymous_type_504cda2014046ec0_4#depth. == 0 && loader->lock_tablecxx . . $ $anonymous_type_504cda2014046ec0_2#lock_table.) {
1184 GRN_TABLE_LOCK_BEGINcxx . . $ `lib/grn_table.h:56:9`!(ctx, data->table)
1185 {
1186 if (grn_table_atcxx . . $ grn_table_at(c0317bb03c33a3cb).(ctx, data->tablecxx . . $ $anonymous_type_504cda2014046ec0_4#table., data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id.) == data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id.) {
1187 grn_loader_bracket_set_valuescxx . . $ grn_loader_bracket_set_values(73ac9b8657a38d1d).(ctx, loader, data);
1188 if (data->depthcxx . . $ $anonymous_type_504cda2014046ec0_4#depth. == 0) {
1189 grn_loader_apply_eachcxx . . $ grn_loader_apply_each(e9b016172514d9b).(ctx, loader, data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id.);
1190 }
1191 }
1192 }
1193 GRN_TABLE_LOCK_ENDcxx . . $ `lib/grn_table.h:69:9`!(ctx);
1194 } else {
1195 grn_loader_bracket_set_valuescxx . . $ grn_loader_bracket_set_values(73ac9b8657a38d1d).(ctx, loader, data);
1196 if (data->depthcxx . . $ $anonymous_type_504cda2014046ec0_4#depth. == 0) {
1197 grn_loader_apply_eachcxx . . $ grn_loader_apply_each(e9b016172514d9b).(ctx, loader, data->idcxx . . $ $anonymous_type_504cda2014046ec0_4#id.);
1198 }
1199 }
1200 }
1201
1202 static void
1203 grn_loader_bracket_add_recordcxx . . $ grn_loader_bracket_add_record(73ac9b8657a38d1d).(grn_ctxcxx . . $ grn_ctx# *ctx,
1204 grn_loadercxx . . $ grn_loader# *loader,
1205 grn_loader_add_record_datacxx . . $ grn_loader_add_record_data# *data)
1206 {
1207 GRN_SLOW_LOG_PUSHcxx . . $ `include/groonga/groonga.h:2512:9`!(ctx, GRN_LOG_DEBUG);
1208 grn_loader_bracket_add_record_internalcxx . . $ grn_loader_bracket_add_record_internal(73ac9b8657a38d1d).(ctx, loader, data);
1209 GRN_SLOW_LOG_POP_BEGINcxx . . $ `include/groonga/groonga.h:2519:9`!(ctx, GRN_LOG_DEBUG, elapsed_time)
1210 {
1211 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(loader->table);
1212 GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx,
1213 GRN_LOG_DEBUG,
1214 "[loader][bracket][add-record][slow][%f] "
1215 "<%.*s>(%u)",
1216 elapsed_time,
1217 name_size,
1218 name,
1219 data->id);
1220 }
1221 GRN_SLOW_LOG_POP_ENDcxx . . $ `include/groonga/groonga.h:2525:9`!(ctx);
1222 }
1223
1224 static void
1225 bracket_closecxx . . $ bracket_close(4e8e4ed50d4bb15).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_loadercxx . . $ grn_loader# *loader)
1226 {
1227 uint32_tcxx . . $ uint32_t# begin;
1228 GRN_UINT32_POPcxx . . $ `include/groonga/groonga.h:3240:9`!(&loader->level, begin);
1229 grn_objcxx . . $ grn_obj# *values = (grn_objcxx . . $ grn_obj# *)GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&loader->values);
1230 grn_objcxx . . $ grn_obj# *bracket_value = values + begin;
1231 GRN_ASSERTcxx . . $ `lib/grn_ctx.h:70:11`!(bracket_value->header.domain == GRN_JSON_LOAD_OPEN_BRACKET);
1232 GRN_UINT32_SETcxx . . $ `include/groonga/groonga.h:2909:9`!(ctx, bracket_value, loader->values_size - begin - 1);
1233 size_t depth = GRN_UINT32_VECTOR_SIZEcxx . . $ `include/groonga/groonga.h:3257:9`!(&(loader->level));
1234 if (depth > loader->emit_levelcxx . . $ $anonymous_type_504cda2014046ec0_2#emit_level.) {
1235 return;
1236 }
1237
1238 if (depth == 0 || !loader->tablecxx . . $ $anonymous_type_504cda2014046ec0_2#table. ||
1239 loader->columns_statuscxx . . $ $anonymous_type_504cda2014046ec0_2#columns_status. == GRN_LOADER_COLUMNS_BROKENcxx . . $ GRN_LOADER_COLUMNS_BROKEN.) {
1240 goto exit;
1241 }
1242
1243 if (loader->columns_statuscxx . . $ $anonymous_type_504cda2014046ec0_2#columns_status. == GRN_LOADER_COLUMNS_UNSETcxx . . $ GRN_LOADER_COLUMNS_UNSET.) {
1244 /*
1245 * Target columns and _id or _key are not specified yet and values are
1246 * handled as column names and "_id" or "_key".
1247 */
1248 grn_loader_bracket_set_columnscxx . . $ grn_loader_bracket_set_columns(df34f5a449543ed6).(ctx, loader, bracket_value);
1249 goto exit;
1250 }
1251
1252 grn_loader_add_record_datacxx . . $ grn_loader_add_record_data# data;
1253 data.tablecxx . . $ $anonymous_type_504cda2014046ec0_4#table. = loader->tablecxx . . $ $anonymous_type_504cda2014046ec0_2#table.;
1254 data.depthcxx . . $ $anonymous_type_504cda2014046ec0_4#depth. = 0;
1255 data.record_valuecxx . . $ $anonymous_type_504cda2014046ec0_4#record_value. = bracket_value;
1256 data.idcxx . . $ $anonymous_type_504cda2014046ec0_4#id. = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
1257 data.keycxx . . $ $anonymous_type_504cda2014046ec0_4#key. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
1258 grn_loader_bracket_add_recordcxx . . $ grn_loader_bracket_add_record(73ac9b8657a38d1d).(ctx, loader, &data);
1259 grn_loader_on_record_addedcxx . . $ grn_loader_on_record_added(e9b016172514d9b).(ctx, loader, data.idcxx . . $ $anonymous_type_504cda2014046ec0_4#id.);
1260
1261 exit:
1262 loader->values_sizecxx . . $ $anonymous_type_504cda2014046ec0_2#values_size. = begin;
1263 ERRCLRcxx . . $ `lib/grn_error.h:37:9`!(ctx);
1264 }
1265
1266 static void
1267 brace_closecxx . . $ brace_close(4e8e4ed50d4bb15).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_loadercxx . . $ grn_loader# *loader)
1268 {
1269 uint32_tcxx . . $ uint32_t# begin;
1270 GRN_UINT32_POPcxx . . $ `include/groonga/groonga.h:3240:9`!(&loader->level, begin);
1271 grn_objcxx . . $ grn_obj# *values = (grn_objcxx . . $ grn_obj# *)GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&loader->values);
1272 grn_objcxx . . $ grn_obj# *brace_value = values + begin;
1273 GRN_ASSERTcxx . . $ `lib/grn_ctx.h:70:11`!(brace_value->header.domain == GRN_JSON_LOAD_OPEN_BRACE);
1274 GRN_UINT32_SETcxx . . $ `include/groonga/groonga.h:2909:9`!(ctx, brace_value, loader->values_size - begin - 1);
1275 size_t depth = GRN_UINT32_VECTOR_SIZEcxx . . $ `include/groonga/groonga.h:3257:9`!(&(loader->level));
1276 if (depth > loader->emit_levelcxx . . $ $anonymous_type_504cda2014046ec0_2#emit_level.) {
1277 return;
1278 }
1279
1280 grn_idcxx . . $ grn_id# id = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
1281 if (loader->tablecxx . . $ $anonymous_type_504cda2014046ec0_2#table.) {
1282 grn_loader_add_record_datacxx . . $ grn_loader_add_record_data# data;
1283 data.tablecxx . . $ $anonymous_type_504cda2014046ec0_4#table. = loader->tablecxx . . $ $anonymous_type_504cda2014046ec0_2#table.;
1284 data.depthcxx . . $ $anonymous_type_504cda2014046ec0_4#depth. = 0;
1285 data.record_valuecxx . . $ $anonymous_type_504cda2014046ec0_4#record_value. = brace_value;
1286 data.idcxx . . $ $anonymous_type_504cda2014046ec0_4#id. = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
1287 data.keycxx . . $ $anonymous_type_504cda2014046ec0_4#key. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
1288 grn_loader_brace_add_recordcxx . . $ grn_loader_brace_add_record(73ac9b8657a38d1d).(ctx, loader, &data);
1289 id = data.idcxx . . $ $anonymous_type_504cda2014046ec0_4#id.;
1290 }
1291 grn_loader_on_record_addedcxx . . $ grn_loader_on_record_added(e9b016172514d9b).(ctx, loader, id);
1292 loader->values_sizecxx . . $ $anonymous_type_504cda2014046ec0_2#values_size. = begin;
1293 ERRCLRcxx . . $ `lib/grn_error.h:37:9`!(ctx);
1294 }
1295
1296 #define JSON_READ_OPEN_BRACKETcxx . . $ `lib/load.c:1296:9`!() \
1297 do { \
1298 GRN_UINT32_PUTcxx . . $ `include/groonga/groonga.h:3182:9`!(ctx, &loader->level, loader->values_size); \
1299 values_add(ctx, loader); \
1300 loader->last->header.domain = GRN_JSON_LOAD_OPEN_BRACKETcxx . . $ `lib/grn_load.h:28:9`!; \
1301 loader->stat = GRN_LOADER_TOKEN; \
1302 str++; \
1303 } while (0)
1304
1305 #define JSON_READ_OPEN_BRACEcxx . . $ `lib/load.c:1305:9`!() \
1306 do { \
1307 GRN_UINT32_PUTcxx . . $ `include/groonga/groonga.h:3182:9`!(ctx, &loader->level, loader->values_size); \
1308 values_add(ctx, loader); \
1309 loader->last->header.domain = GRN_JSON_LOAD_OPEN_BRACEcxx . . $ `lib/grn_load.h:29:9`!; \
1310 loader->stat = GRN_LOADER_TOKEN; \
1311 str++; \
1312 } while (0)
1313
1314 static void
1315 json_readcxx . . $ json_read(b4021d86ac065b28).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_loadercxx . . $ grn_loader# *loader, const char *str, size_t str_len)
1316 {
1317 const char *const beg = str;
1318 char c;
1319 int len;
1320 const char *se = str + str_len;
1321 while (str < se) {
1322 c = *str;
1323 switch (loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat.) {
1324 case GRN_LOADER_BEGINcxx . . $ GRN_LOADER_BEGIN.:
1325 if ((len = grn_isspacecxx . . $ grn_isspace(f8f88a86d74aa1ba).(str, ctx->encodingcxx . . $ _grn_ctx#encoding.))) {
1326 str += len;
1327 continue;
1328 }
1329 switch (c) {
1330 case '[':
1331 JSON_READ_OPEN_BRACKETcxx . . $ `lib/load.c:1296:9`!();
1332 break;
1333 case '{':
1334 JSON_READ_OPEN_BRACEcxx . . $ `lib/load.c:1305:9`!();
1335 break;
1336 default:
1337 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
1338 "JSON must start with '[' or '{': <%.*s>",
1339 (int)str_len,
1340 beg);
1341 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. = GRN_LOADER_ENDcxx . . $ GRN_LOADER_END.;
1342 break;
1343 }
1344 break;
1345 case GRN_LOADER_TOKENcxx . . $ GRN_LOADER_TOKEN.:
1346 if ((len = grn_isspacecxx . . $ grn_isspace(f8f88a86d74aa1ba).(str, ctx->encodingcxx . . $ _grn_ctx#encoding.))) {
1347 str += len;
1348 continue;
1349 }
1350 switch (c) {
1351 case '"':
1352 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. = GRN_LOADER_STRINGcxx . . $ GRN_LOADER_STRING.;
1353 values_addcxx . . $ values_add(12ec504980c850a1).(ctx, loader);
1354 str++;
1355 break;
1356 case '[':
1357 JSON_READ_OPEN_BRACKETcxx . . $ `lib/load.c:1296:9`!();
1358 break;
1359 case '{':
1360 JSON_READ_OPEN_BRACEcxx . . $ `lib/load.c:1305:9`!();
1361 break;
1362 case ':':
1363 str++;
1364 break;
1365 case ',':
1366 str++;
1367 break;
1368 case ']':
1369 bracket_closecxx . . $ bracket_close(4e8e4ed50d4bb15).(ctx, loader);
1370 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. =
1371 GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(&loader->level) ? GRN_LOADER_TOKENcxx . . $ GRN_LOADER_TOKEN. : GRN_LOADER_ENDcxx . . $ GRN_LOADER_END.;
1372 if (ctx->rccxx . . $ _grn_ctx#rc. == GRN_CANCELcxx . . $ GRN_CANCEL.) {
1373 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. = GRN_LOADER_ENDcxx . . $ GRN_LOADER_END.;
1374 }
1375 str++;
1376 break;
1377 case '}':
1378 brace_closecxx . . $ brace_close(4e8e4ed50d4bb15).(ctx, loader);
1379 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. =
1380 GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(&loader->level) ? GRN_LOADER_TOKENcxx . . $ GRN_LOADER_TOKEN. : GRN_LOADER_ENDcxx . . $ GRN_LOADER_END.;
1381 if (ctx->rccxx . . $ _grn_ctx#rc. == GRN_CANCELcxx . . $ GRN_CANCEL.) {
1382 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. = GRN_LOADER_ENDcxx . . $ GRN_LOADER_END.;
1383 }
1384 str++;
1385 break;
1386 case '+':
1387 case '-':
1388 case '0':
1389 case '1':
1390 case '2':
1391 case '3':
1392 case '4':
1393 case '5':
1394 case '6':
1395 case '7':
1396 case '8':
1397 case '9':
1398 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. = GRN_LOADER_NUMBERcxx . . $ GRN_LOADER_NUMBER.;
1399 values_addcxx . . $ values_add(12ec504980c850a1).(ctx, loader);
1400 break;
1401 default:
1402 if (('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z') || ('_' == c)) {
1403 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. = GRN_LOADER_SYMBOLcxx . . $ GRN_LOADER_SYMBOL.;
1404 values_addcxx . . $ values_add(12ec504980c850a1).(ctx, loader);
1405 } else {
1406 if ((len = grn_charlencxx . . $ grn_charlen(d229e8bf7c87f0f0).(ctx, str, se))) {
1407 GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, GRN_LOG_ERROR, "ignored invalid char('%c') at", c);
1408 GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, GRN_LOG_ERROR, "%.*s", (int)(str - beg) + len, beg);
1409 GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, GRN_LOG_ERROR, "%*s", (int)(str - beg) + 1, "^");
1410 str += len;
1411 } else {
1412 GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx,
1413 GRN_LOG_ERROR,
1414 "ignored invalid char(\\x%.2x) after",
1415 c);
1416 GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, GRN_LOG_ERROR, "%.*s", (int)(str - beg), beg);
1417 str = se;
1418 }
1419 }
1420 break;
1421 }
1422 break;
1423 case GRN_LOADER_SYMBOLcxx . . $ GRN_LOADER_SYMBOL.:
1424 if (('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z') ||
1425 ('0' <= c && c <= '9') || ('_' == c)) {
1426 GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, loader->last, c);
1427 str++;
1428 } else {
1429 char *v = GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(loader->last);
1430 switch (*v) {
1431 case 'n':
1432 if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(loader->last) == 4 && !memcmpcxx . . $ memcmp(36f949851efa3055).(v, "null", 4)) {
1433 loader->lastcxx . . $ $anonymous_type_504cda2014046ec0_2#last.->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. = GRN_DB_VOIDcxx . . $ GRN_DB_VOID.;
1434 GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(loader->last);
1435 }
1436 break;
1437 case 't':
1438 if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(loader->last) == 4 && !memcmpcxx . . $ memcmp(36f949851efa3055).(v, "true", 4)) {
1439 loader->lastcxx . . $ $anonymous_type_504cda2014046ec0_2#last.->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. = GRN_DB_BOOLcxx . . $ GRN_DB_BOOL.;
1440 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, loader->last, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!);
1441 }
1442 break;
1443 case 'f':
1444 if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(loader->last) == 5 && !memcmpcxx . . $ memcmp(36f949851efa3055).(v, "false", 5)) {
1445 loader->lastcxx . . $ $anonymous_type_504cda2014046ec0_2#last.->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. = GRN_DB_BOOLcxx . . $ GRN_DB_BOOL.;
1446 GRN_BOOL_SETcxx . . $ `include/groonga/groonga.h:2879:9`!(ctx, loader->last, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!);
1447 }
1448 break;
1449 default:
1450 break;
1451 }
1452 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. =
1453 GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(&loader->level) ? GRN_LOADER_TOKENcxx . . $ GRN_LOADER_TOKEN. : GRN_LOADER_ENDcxx . . $ GRN_LOADER_END.;
1454 }
1455 break;
1456 case GRN_LOADER_NUMBERcxx . . $ GRN_LOADER_NUMBER.:
1457 switch (c) {
1458 case '+':
1459 case '-':
1460 case '.':
1461 case 'e':
1462 case 'E':
1463 case '0':
1464 case '1':
1465 case '2':
1466 case '3':
1467 case '4':
1468 case '5':
1469 case '6':
1470 case '7':
1471 case '8':
1472 case '9':
1473 GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, loader->last, c);
1474 str++;
1475 break;
1476 default:
1477 {
1478 const char *cur, *str = GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(loader->last);
1479 const char *str_end = GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!(loader->last);
1480 int64_tcxx . . $ int64_t# i = grn_atollcxx . . $ grn_atoll(e3438c906dd00acd).(str, str_end, &cur);
1481 if (cur == str_end) {
1482 loader->lastcxx . . $ $anonymous_type_504cda2014046ec0_2#last.->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. = GRN_DB_INT64cxx . . $ GRN_DB_INT64.;
1483 GRN_INT64_SETcxx . . $ `include/groonga/groonga.h:2914:9`!(ctx, loader->last, i);
1484 } else if (cur != str) {
1485 uint64_tcxx . . $ uint64_t# i = grn_atoullcxx . . $ grn_atoull(bd2852887cfac9d6).(str, str_end, &cur);
1486 if (cur == str_end) {
1487 loader->lastcxx . . $ $anonymous_type_504cda2014046ec0_2#last.->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. = GRN_DB_UINT64cxx . . $ GRN_DB_UINT64.;
1488 GRN_UINT64_SETcxx . . $ `include/groonga/groonga.h:2919:9`!(ctx, loader->last, i);
1489 } else if (cur != str) {
1490 double d;
1491 char *end;
1492 grn_objcxx . . $ grn_obj# buf;
1493 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&buf, 0);
1494 GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, &buf, str, GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(loader->last));
1495 GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, &buf, '\0');
1496 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = 0;
1497 d = strtodcxx . . $ strtod(3dfe5620a0d3160e).(GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&buf), &end);
1498 if (!errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! && end + 1 == GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!(&buf)) {
1499 loader->lastcxx . . $ $anonymous_type_504cda2014046ec0_2#last.->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. = GRN_DB_FLOATcxx . . $ GRN_DB_FLOAT.;
1500 GRN_FLOAT_SETcxx . . $ `include/groonga/groonga.h:2934:9`!(ctx, loader->last, d);
1501 }
1502 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &buf);
1503 }
1504 }
1505 }
1506 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. =
1507 GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(&loader->level) ? GRN_LOADER_TOKENcxx . . $ GRN_LOADER_TOKEN. : GRN_LOADER_ENDcxx . . $ GRN_LOADER_END.;
1508 break;
1509 }
1510 break;
1511 case GRN_LOADER_STRINGcxx . . $ GRN_LOADER_STRING.:
1512 switch (c) {
1513 case '\\':
1514 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. = GRN_LOADER_STRING_ESCcxx . . $ GRN_LOADER_STRING_ESC.;
1515 str++;
1516 break;
1517 case '"':
1518 str++;
1519 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. =
1520 GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(&loader->level) ? GRN_LOADER_TOKENcxx . . $ GRN_LOADER_TOKEN. : GRN_LOADER_ENDcxx . . $ GRN_LOADER_END.;
1521 /*
1522 *(GRN_BULK_CURR(loader->last)) = '\0';
1523 GRN_LOG(ctx, GRN_LOG_ALERT, "read str(%s)",
1524 GRN_TEXT_VALUE(loader->last));
1525 */
1526 break;
1527 default:
1528 if ((len = grn_charlencxx . . $ grn_charlen(d229e8bf7c87f0f0).(ctx, str, se))) {
1529 GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, loader->last, str, len);
1530 str += len;
1531 } else {
1532 GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, GRN_LOG_ERROR, "ignored invalid char(\\x%.2x) after", c);
1533 GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, GRN_LOG_ERROR, "%.*s", (int)(str - beg), beg);
1534 str = se;
1535 }
1536 break;
1537 }
1538 break;
1539 case GRN_LOADER_STRING_ESCcxx . . $ GRN_LOADER_STRING_ESC.:
1540 switch (c) {
1541 case 'b':
1542 GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, loader->last, '\b');
1543 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. = GRN_LOADER_STRINGcxx . . $ GRN_LOADER_STRING.;
1544 break;
1545 case 'f':
1546 GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, loader->last, '\f');
1547 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. = GRN_LOADER_STRINGcxx . . $ GRN_LOADER_STRING.;
1548 break;
1549 case 'n':
1550 GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, loader->last, '\n');
1551 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. = GRN_LOADER_STRINGcxx . . $ GRN_LOADER_STRING.;
1552 break;
1553 case 'r':
1554 GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, loader->last, '\r');
1555 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. = GRN_LOADER_STRINGcxx . . $ GRN_LOADER_STRING.;
1556 break;
1557 case 't':
1558 GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, loader->last, '\t');
1559 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. = GRN_LOADER_STRINGcxx . . $ GRN_LOADER_STRING.;
1560 break;
1561 case 'u':
1562 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. = GRN_LOADER_UNICODE0cxx . . $ GRN_LOADER_UNICODE0.;
1563 break;
1564 default:
1565 GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, loader->last, c);
1566 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. = GRN_LOADER_STRINGcxx . . $ GRN_LOADER_STRING.;
1567 break;
1568 }
1569 str++;
1570 break;
1571 case GRN_LOADER_UNICODE0cxx . . $ GRN_LOADER_UNICODE0.:
1572 switch (c) {
1573 case '0':
1574 case '1':
1575 case '2':
1576 case '3':
1577 case '4':
1578 case '5':
1579 case '6':
1580 case '7':
1581 case '8':
1582 case '9':
1583 loader->unicharcxx . . $ $anonymous_type_504cda2014046ec0_2#unichar. = (uint32_tcxx . . $ uint32_t#)((c - '0') * 0x1000);
1584 break;
1585 case 'a':
1586 case 'b':
1587 case 'c':
1588 case 'd':
1589 case 'e':
1590 case 'f':
1591 loader->unicharcxx . . $ $anonymous_type_504cda2014046ec0_2#unichar. = (uint32_tcxx . . $ uint32_t#)((c - 'a' + 10) * 0x1000);
1592 break;
1593 case 'A':
1594 case 'B':
1595 case 'C':
1596 case 'D':
1597 case 'E':
1598 case 'F':
1599 loader->unicharcxx . . $ $anonymous_type_504cda2014046ec0_2#unichar. = (uint32_tcxx . . $ uint32_t#)((c - 'A' + 10) * 0x1000);
1600 break;
1601 default:; // todo : error
1602 }
1603 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. = GRN_LOADER_UNICODE1cxx . . $ GRN_LOADER_UNICODE1.;
1604 str++;
1605 break;
1606 case GRN_LOADER_UNICODE1cxx . . $ GRN_LOADER_UNICODE1.:
1607 switch (c) {
1608 case '0':
1609 case '1':
1610 case '2':
1611 case '3':
1612 case '4':
1613 case '5':
1614 case '6':
1615 case '7':
1616 case '8':
1617 case '9':
1618 loader->unicharcxx . . $ $anonymous_type_504cda2014046ec0_2#unichar. += (uint32_tcxx . . $ uint32_t#)((c - '0') * 0x100);
1619 break;
1620 case 'a':
1621 case 'b':
1622 case 'c':
1623 case 'd':
1624 case 'e':
1625 case 'f':
1626 loader->unicharcxx . . $ $anonymous_type_504cda2014046ec0_2#unichar. += (uint32_tcxx . . $ uint32_t#)((c - 'a' + 10) * 0x100);
1627 break;
1628 case 'A':
1629 case 'B':
1630 case 'C':
1631 case 'D':
1632 case 'E':
1633 case 'F':
1634 loader->unicharcxx . . $ $anonymous_type_504cda2014046ec0_2#unichar. += (uint32_tcxx . . $ uint32_t#)((c - 'A' + 10) * 0x100);
1635 break;
1636 default:; // todo : error
1637 }
1638 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. = GRN_LOADER_UNICODE2cxx . . $ GRN_LOADER_UNICODE2.;
1639 str++;
1640 break;
1641 case GRN_LOADER_UNICODE2cxx . . $ GRN_LOADER_UNICODE2.:
1642 switch (c) {
1643 case '0':
1644 case '1':
1645 case '2':
1646 case '3':
1647 case '4':
1648 case '5':
1649 case '6':
1650 case '7':
1651 case '8':
1652 case '9':
1653 loader->unicharcxx . . $ $anonymous_type_504cda2014046ec0_2#unichar. += (uint32_tcxx . . $ uint32_t#)((c - '0') * 0x10);
1654 break;
1655 case 'a':
1656 case 'b':
1657 case 'c':
1658 case 'd':
1659 case 'e':
1660 case 'f':
1661 loader->unicharcxx . . $ $anonymous_type_504cda2014046ec0_2#unichar. += (uint32_tcxx . . $ uint32_t#)((c - 'a' + 10) * 0x10);
1662 break;
1663 case 'A':
1664 case 'B':
1665 case 'C':
1666 case 'D':
1667 case 'E':
1668 case 'F':
1669 loader->unicharcxx . . $ $anonymous_type_504cda2014046ec0_2#unichar. += (uint32_tcxx . . $ uint32_t#)((c - 'A' + 10) * 0x10);
1670 break;
1671 default:; // todo : error
1672 }
1673 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. = GRN_LOADER_UNICODE3cxx . . $ GRN_LOADER_UNICODE3.;
1674 str++;
1675 break;
1676 case GRN_LOADER_UNICODE3cxx . . $ GRN_LOADER_UNICODE3.:
1677 switch (c) {
1678 case '0':
1679 case '1':
1680 case '2':
1681 case '3':
1682 case '4':
1683 case '5':
1684 case '6':
1685 case '7':
1686 case '8':
1687 case '9':
1688 loader->unicharcxx . . $ $anonymous_type_504cda2014046ec0_2#unichar. += (uint32_tcxx . . $ uint32_t#)(c - '0');
1689 break;
1690 case 'a':
1691 case 'b':
1692 case 'c':
1693 case 'd':
1694 case 'e':
1695 case 'f':
1696 loader->unicharcxx . . $ $anonymous_type_504cda2014046ec0_2#unichar. += (uint32_tcxx . . $ uint32_t#)(c - 'a' + 10);
1697 break;
1698 case 'A':
1699 case 'B':
1700 case 'C':
1701 case 'D':
1702 case 'E':
1703 case 'F':
1704 loader->unicharcxx . . $ $anonymous_type_504cda2014046ec0_2#unichar. += (uint32_tcxx . . $ uint32_t#)(c - 'A' + 10);
1705 break;
1706 default:; // todo : error
1707 }
1708 {
1709 uint32_tcxx . . $ uint32_t# u = loader->unicharcxx . . $ $anonymous_type_504cda2014046ec0_2#unichar.;
1710 if (u >= 0xd800 && u <= 0xdbff) { /* High-surrogate code points */
1711 loader->unichar_hicxx . . $ $anonymous_type_504cda2014046ec0_2#unichar_hi. = u;
1712 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. = GRN_LOADER_STRINGcxx . . $ GRN_LOADER_STRING.;
1713 str++;
1714 break;
1715 }
1716 if (u >= 0xdc00 && u <= 0xdfff) { /* Low-surrogate code points */
1717 u = 0x10000 + (loader->unichar_hicxx . . $ $anonymous_type_504cda2014046ec0_2#unichar_hi. - 0xd800) * 0x400 + u - 0xdc00;
1718 }
1719 if (u < 0x80) {
1720 GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, loader->last, (char)u);
1721 } else {
1722 if (u < 0x800) {
1723 GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, loader->last, (char)((u >> 6) | 0xc0));
1724 } else {
1725 if (u < 0x10000) {
1726 GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, loader->last, (char)((u >> 12) | 0xe0));
1727 } else {
1728 GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, loader->last, (char)((u >> 18) | 0xf0));
1729 GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx,
1730 loader->last,
1731 (char)(((u >> 12) & 0x3f) | 0x80));
1732 }
1733 GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, loader->last, (char)(((u >> 6) & 0x3f) | 0x80));
1734 }
1735 GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, loader->last, (char)((u & 0x3f) | 0x80));
1736 }
1737 }
1738 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. = GRN_LOADER_STRINGcxx . . $ GRN_LOADER_STRING.;
1739 str++;
1740 break;
1741 case GRN_LOADER_ENDcxx . . $ GRN_LOADER_END.:
1742 str = se;
1743 break;
1744 }
1745 }
1746 }
1747
1748 #undef JSON_READ_OPEN_BRACKETcxx . . $ `lib/load.c:1296:9`!
1749 #undef JSON_READ_OPEN_BRACEcxx . . $ `lib/load.c:1305:9`!
1750
1751 /*
1752 * grn_loader_parse_columns parses a columns parameter.
1753 * Columns except _id and _key are appended to loader->columns.
1754 * If it contains _id or _key, loader->id_offset or loader->key_offset is set.
1755 */
1756 static grn_rccxx . . $ grn_rc#
1757 grn_loader_parse_columnscxx . . $ grn_loader_parse_columns(faa02e3271696914).(grn_ctxcxx . . $ grn_ctx# *ctx,
1758 grn_loadercxx . . $ grn_loader# *loader,
1759 const char *str,
1760 unsigned int str_size)
1761 {
1762 const char *ptr = str, *ptr_end = ptr + str_size, *rest;
1763 const char *tokens[256], *token_end;
1764 while (ptr < ptr_end) {
1765 int i, n = grn_tokenizecxx . . $ grn_tokenize(ae40da7dfd614746).(ptr, (size_t)(ptr_end - ptr), tokens, 256, &rest);
1766 for (i = 0; i < n; i++) {
1767 grn_objcxx . . $ grn_obj# *column;
1768 token_end = tokens[i];
1769 while (ptr < token_end && (' ' == *ptr || ',' == *ptr)) {
1770 ptr++;
1771 }
1772 if (name_equalcxx . . $ name_equal(6ef988fe2eca6e65).(ptr, (size_t)(token_end - ptr), GRN_COLUMN_NAME_IDcxx . . $ `include/groonga/column.h:41:9`!)) {
1773 if (loader->id_offsetcxx . . $ $anonymous_type_504cda2014046ec0_2#id_offset. != -1 || loader->key_offsetcxx . . $ $anonymous_type_504cda2014046ec0_2#key_offset. != -1) {
1774 /* _id and _key must not appear more than once. */
1775 if (loader->id_offsetcxx . . $ $anonymous_type_504cda2014046ec0_2#id_offset. != -1) {
1776 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
1777 "duplicated id and key columns: <%s> at %d and <%s> at %d",
1778 GRN_COLUMN_NAME_IDcxx . . $ `include/groonga/column.h:41:9`!,
1779 i,
1780 GRN_COLUMN_NAME_IDcxx . . $ `include/groonga/column.h:41:9`!,
1781 loader->id_offset);
1782 } else {
1783 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
1784 "duplicated id and key columns: <%s> at %d and <%s> at %d",
1785 GRN_COLUMN_NAME_IDcxx . . $ `include/groonga/column.h:41:9`!,
1786 i,
1787 GRN_COLUMN_NAME_KEYcxx . . $ `include/groonga/column.h:63:9`!,
1788 loader->key_offset);
1789 }
1790 return ctx->rccxx . . $ _grn_ctx#rc.;
1791 }
1792 loader->id_offsetcxx . . $ $anonymous_type_504cda2014046ec0_2#id_offset. = i;
1793 } else if (name_equalcxx . . $ name_equal(6ef988fe2eca6e65).(ptr,
1794 (size_t)(token_end - ptr),
1795 GRN_COLUMN_NAME_KEYcxx . . $ `include/groonga/column.h:63:9`!)) {
1796 if (loader->id_offsetcxx . . $ $anonymous_type_504cda2014046ec0_2#id_offset. != -1 || loader->key_offsetcxx . . $ $anonymous_type_504cda2014046ec0_2#key_offset. != -1) {
1797 /* _id and _key must not appear more than once. */
1798 if (loader->id_offsetcxx . . $ $anonymous_type_504cda2014046ec0_2#id_offset. != -1) {
1799 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
1800 "duplicated id and key columns: <%s> at %d and <%s> at %d",
1801 GRN_COLUMN_NAME_KEYcxx . . $ `include/groonga/column.h:63:9`!,
1802 i,
1803 GRN_COLUMN_NAME_IDcxx . . $ `include/groonga/column.h:41:9`!,
1804 loader->id_offset);
1805 } else {
1806 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
1807 "duplicated id and key columns: <%s> at %d and <%s> at %d",
1808 GRN_COLUMN_NAME_KEYcxx . . $ `include/groonga/column.h:63:9`!,
1809 i,
1810 GRN_COLUMN_NAME_KEYcxx . . $ `include/groonga/column.h:63:9`!,
1811 loader->key_offset);
1812 }
1813 return ctx->rccxx . . $ _grn_ctx#rc.;
1814 }
1815 loader->key_offsetcxx . . $ $anonymous_type_504cda2014046ec0_2#key_offset. = i;
1816 }
1817 column =
1818 grn_loader_get_columncxx . . $ grn_loader_get_column(dc36a02eec0a0be5).(ctx, loader, ptr, (size_t)(token_end - ptr));
1819 if (!column) {
1820 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
1821 "nonexistent column: <%.*s>",
1822 (int)(token_end - ptr),
1823 ptr);
1824 return ctx->rccxx . . $ _grn_ctx#rc.;
1825 }
1826 ptr = token_end;
1827 }
1828 ptr = rest;
1829 }
1830 switch (loader->tablecxx . . $ $anonymous_type_504cda2014046ec0_2#table.->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.) {
1831 case GRN_TABLE_HASH_KEYcxx . . $ `include/groonga/groonga.h:895:9`!:
1832 case GRN_TABLE_PAT_KEYcxx . . $ `include/groonga/groonga.h:896:9`!:
1833 case GRN_TABLE_DAT_KEYcxx . . $ `include/groonga/groonga.h:897:9`!:
1834 if (loader->id_offsetcxx . . $ $anonymous_type_504cda2014046ec0_2#id_offset. == -1 && loader->key_offsetcxx . . $ $anonymous_type_504cda2014046ec0_2#key_offset. == -1) {
1835 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, "missing id or key column");
1836 return ctx->rccxx . . $ _grn_ctx#rc.;
1837 }
1838 break;
1839 }
1840 return ctx->rccxx . . $ _grn_ctx#rc.;
1841 }
1842
1843 void
1844 grn_load_internalcxx . . $ grn_load_internal(31cfdf7af6a9a4ca).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_load_inputcxx . . $ grn_load_input# *input)
1845 {
1846 grn_loadercxx . . $ grn_loader# *loader = &ctx->implcxx . . $ _grn_ctx#impl.->loadercxx . . $ _grn_ctx_impl#loader.;
1847
1848 loader->emit_levelcxx . . $ $anonymous_type_504cda2014046ec0_2#emit_level. = input->emit_levelcxx . . $ grn_load_input_#emit_level.;
1849 if (input->tablecxx . . $ grn_load_input_#table..lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length. > 0) {
1850 grn_ctx_loader_clearcxx . . $ grn_ctx_loader_clear(b578cd6e53d5fe91).(ctx);
1851 loader->input_typecxx . . $ $anonymous_type_504cda2014046ec0_2#input_type. = input->typecxx . . $ grn_load_input_#type.;
1852 if (grn_db_check_namecxx . . $ grn_db_check_name(4388e0a4766c49a1).(ctx,
1853 input->tablecxx . . $ grn_load_input_#table..valuecxx . . $ $anonymous_type_7f733dd816802915_0#value.,
1854 (unsigned int)(input->tablecxx . . $ grn_load_input_#table..lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length.))) {
1855 GRN_DB_CHECK_NAME_ERRcxx . . $ `lib/grn_db.h:610:9`!("[table][load]",
1856 input->table.value,
1857 (int)(input->table.length));
1858 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. = GRN_LOADER_ENDcxx . . $ GRN_LOADER_END.;
1859 return;
1860 }
1861 loader->tablecxx . . $ $anonymous_type_504cda2014046ec0_2#table. =
1862 grn_ctx_getcxx . . $ grn_ctx_get(70fde0087014f9ea).(ctx, input->tablecxx . . $ grn_load_input_#table..valuecxx . . $ $anonymous_type_7f733dd816802915_0#value., (int)(input->tablecxx . . $ grn_load_input_#table..lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length.));
1863 if (!loader->tablecxx . . $ $anonymous_type_504cda2014046ec0_2#table.) {
1864 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
1865 "nonexistent table: <%.*s>",
1866 (int)(input->table.length),
1867 input->table.value);
1868 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. = GRN_LOADER_ENDcxx . . $ GRN_LOADER_END.;
1869 return;
1870 }
1871 if (input->columnscxx . . $ grn_load_input_#columns..lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length. > 0) {
1872 grn_rccxx . . $ grn_rc# rc =
1873 grn_loader_parse_columnscxx . . $ grn_loader_parse_columns(faa02e3271696914).(ctx,
1874 loader,
1875 input->columnscxx . . $ grn_load_input_#columns..valuecxx . . $ $anonymous_type_7f733dd816802915_0#value.,
1876 (unsigned int)(input->columnscxx . . $ grn_load_input_#columns..lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length.));
1877 if (rc != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
1878 loader->columns_statuscxx . . $ $anonymous_type_504cda2014046ec0_2#columns_status. = GRN_LOADER_COLUMNS_BROKENcxx . . $ GRN_LOADER_COLUMNS_BROKEN.;
1879 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. = GRN_LOADER_ENDcxx . . $ GRN_LOADER_END.;
1880 return;
1881 }
1882 loader->columns_statuscxx . . $ $anonymous_type_504cda2014046ec0_2#columns_status. = GRN_LOADER_COLUMNS_SETcxx . . $ GRN_LOADER_COLUMNS_SET.;
1883 }
1884 if (input->if_existscxx . . $ grn_load_input_#if_exists..lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length. > 0) {
1885 grn_objcxx . . $ grn_obj# *v;
1886 GRN_EXPR_CREATE_FOR_QUERYcxx . . $ `include/groonga/expr.h:216:9`!(ctx, loader->table, loader->ifexists, v);
1887 if (loader->ifexistscxx . . $ $anonymous_type_504cda2014046ec0_2#ifexists. && v) {
1888 grn_expr_parsecxx . . $ grn_expr_parse(9934d963d400828).(ctx,
1889 loader->ifexistscxx . . $ $anonymous_type_504cda2014046ec0_2#ifexists.,
1890 input->if_existscxx . . $ grn_load_input_#if_exists..valuecxx . . $ $anonymous_type_7f733dd816802915_0#value.,
1891 (unsigned int)(input->if_existscxx . . $ grn_load_input_#if_exists..lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length.),
1892 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!,
1893 GRN_OP_EQUALcxx . . $ GRN_OP_EQUAL.,
1894 GRN_OP_ANDcxx . . $ GRN_OP_AND.,
1895 GRN_EXPR_SYNTAX_SCRIPTcxx . . $ `include/groonga/expr.h:29:9`! | GRN_EXPR_ALLOW_UPDATEcxx . . $ `include/groonga/expr.h:38:9`!);
1896 }
1897 }
1898 if (input->eachcxx . . $ grn_load_input_#each..lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length. > 0) {
1899 grn_objcxx . . $ grn_obj# *v;
1900 GRN_EXPR_CREATE_FOR_QUERYcxx . . $ `include/groonga/expr.h:216:9`!(ctx, loader->table, loader->each, v);
1901 if (loader->eachcxx . . $ $anonymous_type_504cda2014046ec0_2#each. && v) {
1902 grn_expr_parsecxx . . $ grn_expr_parse(9934d963d400828).(ctx,
1903 loader->eachcxx . . $ $anonymous_type_504cda2014046ec0_2#each.,
1904 input->eachcxx . . $ grn_load_input_#each..valuecxx . . $ $anonymous_type_7f733dd816802915_0#value.,
1905 (unsigned int)(input->eachcxx . . $ grn_load_input_#each..lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length.),
1906 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!,
1907 GRN_OP_EQUALcxx . . $ GRN_OP_EQUAL.,
1908 GRN_OP_ANDcxx . . $ GRN_OP_AND.,
1909 GRN_EXPR_SYNTAX_SCRIPTcxx . . $ `include/groonga/expr.h:29:9`! | GRN_EXPR_ALLOW_UPDATEcxx . . $ `include/groonga/expr.h:38:9`!);
1910 }
1911 }
1912 loader->output_idscxx . . $ $anonymous_type_504cda2014046ec0_2#output_ids. = input->output_idscxx . . $ grn_load_input_#output_ids.;
1913 loader->output_errorscxx . . $ $anonymous_type_504cda2014046ec0_2#output_errors. = input->output_errorscxx . . $ grn_load_input_#output_errors.;
1914 loader->lock_tablecxx . . $ $anonymous_type_504cda2014046ec0_2#lock_table. = input->lock_tablecxx . . $ grn_load_input_#lock_table.;
1915 } else {
1916 if (!loader->tablecxx . . $ $anonymous_type_504cda2014046ec0_2#table.) {
1917 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, "mandatory \"table\" parameter is absent");
1918 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. = GRN_LOADER_ENDcxx . . $ GRN_LOADER_END.;
1919 return;
1920 }
1921 }
1922 switch (loader->input_typecxx . . $ $anonymous_type_504cda2014046ec0_2#input_type.) {
1923 case GRN_CONTENT_JSONcxx . . $ GRN_CONTENT_JSON.:
1924 json_readcxx . . $ json_read(b4021d86ac065b28).(ctx, loader, input->valuescxx . . $ grn_load_input_#values..valuecxx . . $ $anonymous_type_7f733dd816802915_0#value., input->valuescxx . . $ grn_load_input_#values..lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length.);
1925 break;
1926 case GRN_CONTENT_APACHE_ARROWcxx . . $ GRN_CONTENT_APACHE_ARROW.:
1927 #ifdef GRN_WITH_APACHE_ARROW
1928 if (!ctx->impl->arrow_stream_loader) {
1929 ctx->impl->arrow_stream_loader =
1930 grn_arrow_stream_loader_open(ctx, &(ctx->impl->loader));
1931 }
1932 grn_arrow_stream_loader_consume(ctx,
1933 ctx->impl->arrow_stream_loader,
1934 input->values.value,
1935 input->values.length);
1936 #else
1937 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_FUNCTION_NOT_IMPLEMENTED,
1938 "[load][arrow] Apache Arrow support isn't enabled");
1939 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. = GRN_LOADER_ENDcxx . . $ GRN_LOADER_END.;
1940 #endif
1941 break;
1942 case GRN_CONTENT_NONEcxx . . $ GRN_CONTENT_NONE.:
1943 case GRN_CONTENT_TSVcxx . . $ GRN_CONTENT_TSV.:
1944 case GRN_CONTENT_XMLcxx . . $ GRN_CONTENT_XML.:
1945 case GRN_CONTENT_MSGPACKcxx . . $ GRN_CONTENT_MSGPACK.:
1946 case GRN_CONTENT_GROONGA_COMMAND_LISTcxx . . $ GRN_CONTENT_GROONGA_COMMAND_LIST.:
1947 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_FUNCTION_NOT_IMPLEMENTED, "unsupported input_type");
1948 loader->statcxx . . $ $anonymous_type_504cda2014046ec0_2#stat. = GRN_LOADER_ENDcxx . . $ GRN_LOADER_END.;
1949 // todo
1950 break;
1951 }
1952 }
1953
1954 grn_rccxx . . $ grn_rc#
1955 grn_loadcxx . . $ grn_load(4392300ff8804868).(grn_ctxcxx . . $ grn_ctx# *ctx,
1956 grn_content_typecxx . . $ grn_content_type# input_type,
1957 const char *table,
1958 unsigned int table_len,
1959 const char *columns,
1960 unsigned int columns_len,
1961 const char *values,
1962 unsigned int values_len,
1963 const char *ifexists,
1964 unsigned int ifexists_len,
1965 const char *each,
1966 unsigned int each_len)
1967 {
1968 if (!ctx || !ctx->implcxx . . $ _grn_ctx#impl.) {
1969 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, "db not initialized");
1970 return ctx->rccxx . . $ _grn_ctx#rc.;
1971 }
1972 GRN_API_ENTERcxx . . $ `lib/grn_ctx.h:41:9`!;
1973 {
1974 grn_load_inputcxx . . $ grn_load_input# input;
1975 input.typecxx . . $ grn_load_input_#type. = input_type;
1976 input.tablecxx . . $ grn_load_input_#table..valuecxx . . $ $anonymous_type_7f733dd816802915_0#value. = table;
1977 input.tablecxx . . $ grn_load_input_#table..lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length. = table_len;
1978 input.columnscxx . . $ grn_load_input_#columns..valuecxx . . $ $anonymous_type_7f733dd816802915_0#value. = columns;
1979 input.columnscxx . . $ grn_load_input_#columns..lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length. = columns_len;
1980 input.valuescxx . . $ grn_load_input_#values..valuecxx . . $ $anonymous_type_7f733dd816802915_0#value. = values;
1981 input.valuescxx . . $ grn_load_input_#values..lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length. = values_len;
1982 input.if_existscxx . . $ grn_load_input_#if_exists..valuecxx . . $ $anonymous_type_7f733dd816802915_0#value. = ifexists;
1983 input.if_existscxx . . $ grn_load_input_#if_exists..lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length. = ifexists_len;
1984 input.eachcxx . . $ grn_load_input_#each..valuecxx . . $ $anonymous_type_7f733dd816802915_0#value. = each;
1985 input.eachcxx . . $ grn_load_input_#each..lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length. = each_len;
1986 input.output_idscxx . . $ grn_load_input_#output_ids. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
1987 input.output_errorscxx . . $ grn_load_input_#output_errors. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
1988 input.lock_tablecxx . . $ grn_load_input_#lock_table. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
1989 input.emit_levelcxx . . $ grn_load_input_#emit_level. = 1;
1990 grn_load_internalcxx . . $ grn_load_internal(31cfdf7af6a9a4ca).(ctx, &input);
1991 }
1992 GRN_API_RETURNcxx . . $ `lib/grn_ctx.h:56:9`!(ctx->rc);
1993 }
1994
1995 void
1996 grn_p_loadercxx . . $ grn_p_loader(4e8e4ed50d4bb15).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_loadercxx . . $ grn_loader# *loader)
1997 {
1998 printfcxx . . $ printf(581fddd72a8db8fc).("#<loader %p\n", loader);
1999 grn_objcxx . . $ grn_obj# buffer;
2000 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&buffer, 0);
2001 grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, &buffer, &(loader->levelcxx . . $ $anonymous_type_504cda2014046ec0_2#level.));
2002 printfcxx . . $ printf(581fddd72a8db8fc).(" levels:%.*s\n",
2003 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&buffer),
2004 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&buffer));
2005 printfcxx . . $ printf(581fddd72a8db8fc).(" values:[\n");
2006 size_t n_values = GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(&(loader->values)) / sizeof(grn_objcxx . . $ grn_obj#);
2007 size_t i;
2008 for (i = 0; i < n_values; i++) {
2009 grn_objcxx . . $ grn_obj# *value = ((grn_objcxx . . $ grn_obj# *)GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(&(loader->values))) + i;
2010 GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&buffer);
2011 grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, &buffer, value);
2012 printfcxx . . $ printf(581fddd72a8db8fc).(" %" GRN_FMT_SIZEcxx . . $ `lib/grn.h:408:11`! ": %.*s,\n",
2013 i,
2014 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&buffer),
2015 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&buffer));
2016 }
2017 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &buffer);
2018 printfcxx . . $ printf(581fddd72a8db8fc).(" ]\n");
2019 printfcxx . . $ printf(581fddd72a8db8fc).(">\n");
2020 }