Debian Codegraph @

lib/proc/proc_query_log_flags.c

raw symbols SCIP
1 /*
2 Copyright (C) 2017 Brazil
3 Copyright (C) 2022 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_proc.h"cxx . . $ `<file>/lib/grn_proc.h`/
21
22 #include <groonga/plugin.h>cxx . . $ `<file>/include/groonga/plugin.h`/
23
24 static grn_objcxx . . $ grn_obj# *
25 command_query_log_flags_getcxx . . $ command_query_log_flags_get(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx,
26 int nargs,
27 grn_objcxx . . $ grn_obj# **args,
28 grn_user_datacxx . . $ grn_user_data# *user_data)
29 {
30 unsigned int current_flags;
31 grn_objcxx . . $ grn_obj# inspected_flags;
32
33 current_flags = grn_query_logger_get_flagscxx . . $ grn_query_logger_get_flags(42892115b099e3b9).(ctx);
34 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected_flags, 0);
35
36 grn_inspect_query_log_flagscxx . . $ grn_inspect_query_log_flags(fe791abc79590565).(ctx, &inspected_flags, current_flags);
37 grn_ctx_output_strcxx . . $ grn_ctx_output_str(bd29ebb5071afc4b).(ctx,
38 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected_flags),
39 GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected_flags));
40
41 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected_flags);
42
43 return NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!;
44 }
45
46 void
47 grn_proc_init_query_log_flags_getcxx . . $ grn_proc_init_query_log_flags_get(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx)
48 {
49 grn_plugin_command_createcxx . . $ grn_plugin_command_create(2dfd920bb40f3149).(ctx,
50 "query_log_flags_get",
51 -1,
52 command_query_log_flags_getcxx . . $ command_query_log_flags_get(fd082858389c8bb0).,
53 0,
54 NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!);
55 }
56
57 typedef enumcxx . . $ $anonymous_type_8864c0c64a846b02_0# {
58 UPDATE_SETcxx . . $ UPDATE_SET.,
59 UPDATE_ADDcxx . . $ UPDATE_ADD.,
60 UPDATE_REMOVEcxx . . $ UPDATE_REMOVE.
61 } grn_query_log_flags_update_modecxx . . $ grn_query_log_flags_update_mode#;
62
63 static void
64 grn_query_log_flags_updatecxx . . $ grn_query_log_flags_update(d51b023fa026f300).(grn_ctxcxx . . $ grn_ctx# *ctx,
65 grn_objcxx . . $ grn_obj# *flags_text,
66 grn_query_log_flags_update_modecxx . . $ grn_query_log_flags_update_mode# mode,
67 const char *error_message_tag)
68 {
69 unsigned int previous_flags;
70 unsigned int flags = 0;
71
72 previous_flags = grn_query_logger_get_flagscxx . . $ grn_query_logger_get_flags(42892115b099e3b9).(ctx);
73 if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(flags_text) == 0) {
74 GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx,
75 GRN_INVALID_ARGUMENT,
76 "%s no query log flags",
77 error_message_tag);
78 grn_ctx_output_nullcxx . . $ grn_ctx_output_null(b578cd6e53d5fe91).(ctx);
79 return;
80 }
81
82 if (!grn_query_log_flags_parsecxx . . $ grn_query_log_flags_parse(78ed585585023718).(GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(flags_text),
83 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(flags_text),
84 &flags)) {
85 GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx,
86 GRN_INVALID_ARGUMENT,
87 "%s invalid query log flags: <%.*s>",
88 error_message_tag,
89 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(flags_text),
90 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(flags_text));
91 grn_ctx_output_nullcxx . . $ grn_ctx_output_null(b578cd6e53d5fe91).(ctx);
92 return;
93 }
94
95 switch (mode) {
96 case UPDATE_SETcxx . . $ UPDATE_SET.:
97 grn_query_logger_set_flagscxx . . $ grn_query_logger_set_flags(969b9cdb234920c4).(ctx, flags);
98 break;
99 case UPDATE_ADDcxx . . $ UPDATE_ADD.:
100 grn_query_logger_add_flagscxx . . $ grn_query_logger_add_flags(969b9cdb234920c4).(ctx, flags);
101 break;
102 case UPDATE_REMOVEcxx . . $ UPDATE_REMOVE.:
103 grn_query_logger_remove_flagscxx . . $ grn_query_logger_remove_flags(969b9cdb234920c4).(ctx, flags);
104 break;
105 }
106
107 {
108 unsigned int current_flags;
109 grn_objcxx . . $ grn_obj# inspected_flags;
110
111 current_flags = grn_query_logger_get_flagscxx . . $ grn_query_logger_get_flags(42892115b099e3b9).(ctx);
112 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected_flags, 0);
113
114 grn_ctx_output_map_opencxx . . $ grn_ctx_output_map_open(f0f392d632556531).(ctx, "query_log_flags", 2);
115
116 grn_inspect_query_log_flagscxx . . $ grn_inspect_query_log_flags(fe791abc79590565).(ctx, &inspected_flags, previous_flags);
117 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "previous");
118 grn_ctx_output_strcxx . . $ grn_ctx_output_str(bd29ebb5071afc4b).(ctx,
119 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected_flags),
120 GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected_flags));
121
122 GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&inspected_flags);
123 grn_inspect_query_log_flagscxx . . $ grn_inspect_query_log_flags(fe791abc79590565).(ctx, &inspected_flags, current_flags);
124 grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "current");
125 grn_ctx_output_strcxx . . $ grn_ctx_output_str(bd29ebb5071afc4b).(ctx,
126 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected_flags),
127 GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected_flags));
128
129 grn_ctx_output_map_closecxx . . $ grn_ctx_output_map_close(b578cd6e53d5fe91).(ctx);
130
131 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected_flags);
132 }
133
134 return;
135 }
136
137 static grn_objcxx . . $ grn_obj# *
138 command_query_log_flags_setcxx . . $ command_query_log_flags_set(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx,
139 int nargs,
140 grn_objcxx . . $ grn_obj# **args,
141 grn_user_datacxx . . $ grn_user_data# *user_data)
142 {
143 grn_objcxx . . $ grn_obj# *flags_text;
144
145 flags_text = grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(ctx, user_data, "flags", -1);
146 grn_query_log_flags_updatecxx . . $ grn_query_log_flags_update(d51b023fa026f300).(ctx,
147 flags_text,
148 UPDATE_SETcxx . . $ UPDATE_SET.,
149 "[query-log][flags][set]");
150 return NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!;
151 }
152
153 void
154 grn_proc_init_query_log_flags_setcxx . . $ grn_proc_init_query_log_flags_set(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx)
155 {
156 grn_expr_varcxx . . $ grn_expr_var# vars[1];
157
158 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[0]), "flags", -1);
159 grn_plugin_command_createcxx . . $ grn_plugin_command_create(2dfd920bb40f3149).(ctx,
160 "query_log_flags_set",
161 -1,
162 command_query_log_flags_setcxx . . $ command_query_log_flags_set(fd082858389c8bb0).,
163 1,
164 vars);
165 }
166
167 static grn_objcxx . . $ grn_obj# *
168 command_query_log_flags_addcxx . . $ command_query_log_flags_add(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx,
169 int nargs,
170 grn_objcxx . . $ grn_obj# **args,
171 grn_user_datacxx . . $ grn_user_data# *user_data)
172 {
173 grn_objcxx . . $ grn_obj# *flags_text;
174
175 flags_text = grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(ctx, user_data, "flags", -1);
176 grn_query_log_flags_updatecxx . . $ grn_query_log_flags_update(d51b023fa026f300).(ctx,
177 flags_text,
178 UPDATE_ADDcxx . . $ UPDATE_ADD.,
179 "[query-log][flags][add]");
180 return NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!;
181 }
182
183 void
184 grn_proc_init_query_log_flags_addcxx . . $ grn_proc_init_query_log_flags_add(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx)
185 {
186 grn_expr_varcxx . . $ grn_expr_var# vars[1];
187
188 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[0]), "flags", -1);
189 grn_plugin_command_createcxx . . $ grn_plugin_command_create(2dfd920bb40f3149).(ctx,
190 "query_log_flags_add",
191 -1,
192 command_query_log_flags_addcxx . . $ command_query_log_flags_add(fd082858389c8bb0).,
193 1,
194 vars);
195 }
196
197 static grn_objcxx . . $ grn_obj# *
198 command_query_log_flags_removecxx . . $ command_query_log_flags_remove(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx,
199 int nargs,
200 grn_objcxx . . $ grn_obj# **args,
201 grn_user_datacxx . . $ grn_user_data# *user_data)
202 {
203 grn_objcxx . . $ grn_obj# *flags_text;
204
205 flags_text = grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(ctx, user_data, "flags", -1);
206 grn_query_log_flags_updatecxx . . $ grn_query_log_flags_update(d51b023fa026f300).(ctx,
207 flags_text,
208 UPDATE_REMOVEcxx . . $ UPDATE_REMOVE.,
209 "[query-log][flags][remove]");
210 return NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!;
211 }
212
213 void
214 grn_proc_init_query_log_flags_removecxx . . $ grn_proc_init_query_log_flags_remove(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx)
215 {
216 grn_expr_varcxx . . $ grn_expr_var# vars[1];
217
218 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[0]), "flags", -1);
219 grn_plugin_command_createcxx . . $ grn_plugin_command_create(2dfd920bb40f3149).(ctx,
220 "query_log_flags_remove",
221 -1,
222 command_query_log_flags_removecxx . . $ command_query_log_flags_remove(fd082858389c8bb0).,
223 1,
224 vars);
225 }