MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / print_cs

Function print_cs

examples/interfaces/11.batch.cpp:166–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164// BatchCompletionState printer - prints all what we know about completed batch
165
166static void print_cs(ThrowStatusWrapper& status, IBatchCompletionState* cs, IUtil* utl)
167{
168 unsigned p = 0;
169 IStatus* s2 = NULL;
170 bool pr1 = false, pr2 = false;
171
172 // 1. Print per-message state info
173
174 unsigned upcount = cs->getSize(&status);
175 unsigned unk = 0, succ = 0;
176 for (p = 0; p < upcount; ++p)
177 {
178 int s = cs->getState(&status, p);
179 switch (s)
180 {
181 case IBatchCompletionState::EXECUTE_FAILED:
182 if (!pr1)
183 {
184 printf("Message Status\n");
185 pr1 = true;
186 }
187 printf("%5u Execute failed\n", p);
188 break;
189
190 case IBatchCompletionState::SUCCESS_NO_INFO:
191 ++unk;
192 break;
193
194 default:
195 if (!pr1)
196 {
197 printf("Message Status\n");
198 pr1 = true;
199 }
200 printf("%5u Updated %d record(s)\n", p, s);
201 ++succ;
202 break;
203 }
204 }
205 printf("Summary: total=%u success=%u success(but no update info)=%u\n", upcount, succ, unk);
206
207 // 2. Print detailed errors (if exist) for messages
208
209 s2 = master->getStatus();
210 for(p = 0; (p = cs->findError(&status, p)) != IBatchCompletionState::NO_MORE_ERRORS; ++p)
211 {
212 try
213 {
214 cs->getStatus(&status, s2, p);
215
216 char text[1024];
217 utl->formatStatus(text, sizeof(text) - 1, s2);
218 text[sizeof(text) - 1] = 0;
219 if (!pr2)
220 {
221 printf("\nDetailed errors status:\n");
222 pr2 = true;
223 }

Callers 1

mainFunction · 0.70

Calls 7

errPrintFunction · 0.70
getSizeMethod · 0.45
getStateMethod · 0.45
getStatusMethod · 0.45
findErrorMethod · 0.45
formatStatusMethod · 0.45
disposeMethod · 0.45

Tested by

no test coverage detected