| 282 | } |
| 283 | |
| 284 | bool 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); |
no test coverage detected