MCPcopy Create free account
hub / github.com/SOCI/soci / execute

Method execute

src/core/statement.cpp:284–391  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

282}
283
284bool statement_impl::execute(bool withDataExchange)
285{
286 try
287 {
288 initialFetchSize_ = intos_size();
289
290 if (intos_.empty() == false && initialFetchSize_ == 0)
291 {
292 // this can happen only with into-vectors elements
293 // and is not allowed when calling execute
294 throw soci_error("Vectors of size 0 are not allowed.");
295 }
296
297 fetchSize_ = initialFetchSize_;
298
299 // pre-use should be executed before inspecting the sizes of use
300 // elements, as they can be resized in type conversion routines
301
302 pre_use();
303
304 std::size_t const bindSize = uses_size();
305
306 if (bindSize > 1 && fetchSize_ > 1)
307 {
308 throw soci_error(
309 "Bulk insert/update and bulk select not allowed in same query");
310 }
311
312 // looks like a hack and it is - row description should happen
313 // *after* the use elements were completely prepared
314 // and *before* the into elements are touched, so that the row
315 // description process can inject more into elements for
316 // implicit data exchange
317 if (row_ != nullptr && alreadyDescribed_ == false)
318 {
319 describe();
320 }
321
322 int num = 0;
323 if (withDataExchange)
324 {
325 num = 1;
326
327 pre_fetch();
328
329 if (static_cast<int>(fetchSize_) > num)
330 {
331 num = static_cast<int>(fetchSize_);
332 }
333 if (static_cast<int>(bindSize) > num)
334 {
335 num = static_cast<int>(bindSize);
336 }
337 }
338
339 pre_exec(num);
340
341 statement_backend::exec_fetch_result res = backEnd_->execute(num);

Callers 5

soci_executeFunction · 0.45
final_actionMethod · 0.45
rowset_implMethod · 0.45
executeFunction · 0.45
executeFunction · 0.45

Calls 6

pre_useFunction · 0.85
describeFunction · 0.85
set_got_dataMethod · 0.80
pre_execFunction · 0.50
post_useFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected