| 1 | /* |
| 2 | Copyright (C) 2024 Sutou Kouhei <[email protected]> |
| 3 | |
| 4 | This library is free software; you can redistribute it and/or |
| 5 | modify it under the terms of the GNU Lesser General Public |
| 6 | License as published by the Free Software Foundation; either |
| 7 | version 2.1 of the License, or (at your option) any later version. |
| 8 | |
| 9 | This library is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | Lesser General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Lesser General Public |
| 15 | License along with this library; if not, write to the Free Software |
| 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 17 | */ |
| 18 | |
| 19 | #include "grn.h"cxx . . $ `<file>/lib/grn.h`/ |
| 20 | #include "grn_expr_executor.h"cxx . . $ `<file>/lib/grn_expr_executor.h`/ |
| 21 | #include "grn_generated_column.h"cxx . . $ `<file>/lib/grn_generated_column.h`/ |
| 22 | #include "grn_store.h"cxx . . $ `<file>/lib/grn_store.h`/ |
| 23 | |
| 24 | void |
| 25 | grn_generated_column_updatecxx . . $ grn_generated_column_update(b2c0befd04d98e66).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 26 | grn_objcxx . . $ grn_obj# *column, |
| 27 | grn_idcxx . . $ grn_id# id, |
| 28 | int section, |
| 29 | grn_objcxx . . $ grn_obj# *old_value, |
| 30 | grn_objcxx . . $ grn_obj# *new_value) |
| 31 | { |
| 32 | grn_jacxx . . $ grn_ja# *ja = (grn_jacxx . . $ grn_ja# *)column; |
| 33 | grn_expr_executorcxx . . $ grn_expr_executor# executor; |
| 34 | grn_expr_executor_initcxx . . $ grn_expr_executor_init(16b7e5d9c819f729).(ctx, &executor, ja->parsed_generatorcxx . . $ _grn_ja#parsed_generator.); |
| 35 | grn_idcxx . . $ grn_id# *source_ids = DB_OBJcxx . . $ `lib/grn_db.h:62:9`!(column)->sourcecxx . . $ $anonymous_type_4a7c1014017e4c5d_0#source.; |
| 36 | grn_expr_executor_add_replace_valuecxx . . $ grn_expr_executor_add_replace_value(44de691ea14fbcd).(ctx, &executor, source_ids[0], new_value); |
| 37 | grn_objcxx . . $ grn_obj# *value = grn_expr_executor_execcxx . . $ grn_expr_executor_exec(16f9569af33219a9).(ctx, &executor, id); |
| 38 | if (ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 39 | grn_obj_set_valuecxx . . $ grn_obj_set_value(16170250441fe8eb).(ctx, column, id, value, GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!); |
| 40 | } |
| 41 | grn_expr_executor_fincxx . . $ grn_expr_executor_fin(55b9315442a275ec).(ctx, &executor); |
| 42 | } |
| 43 | |
| 44 | void |
| 45 | grn_generated_column_buildcxx . . $ grn_generated_column_build(cda3a5f3c2e53c6b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *column) |
| 46 | { |
| 47 | grn_objcxx . . $ grn_obj# *table = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, column->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.); |
| 48 | grn_idcxx . . $ grn_id# *source_ids = DB_OBJcxx . . $ `lib/grn_db.h:62:9`!(column)->sourcecxx . . $ $anonymous_type_4a7c1014017e4c5d_0#source.; |
| 49 | grn_objcxx . . $ grn_obj# *source = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, source_ids[0]); |
| 50 | grn_obj_set_visibilitycxx . . $ grn_obj_set_visibility(7f588588f63dc99e).(ctx, column, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!); |
| 51 | if (ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 52 | grn_objcxx . . $ grn_obj# *generator = ((grn_jacxx . . $ grn_ja# *)(column))->parsed_generatorcxx . . $ _grn_ja#parsed_generator.; |
| 53 | grn_table_apply_exprcxx . . $ grn_table_apply_expr(ffa46423c2ea40ab).(ctx, table, column, generator); |
| 54 | } |
| 55 | if (ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 56 | grn_obj_set_visibilitycxx . . $ grn_obj_set_visibility(7f588588f63dc99e).(ctx, column, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!); |
| 57 | } |
| 58 | grn_obj_unrefcxx . . $ grn_obj_unref(cda3a5f3c2e53c6b).(ctx, source); |
| 59 | grn_obj_unrefcxx . . $ grn_obj_unref(cda3a5f3c2e53c6b).(ctx, table); |
| 60 | } |