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

Method findRequest

src/jrd/Statement.cpp:401–451  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

399}
400
401Request* Statement::findRequest(thread_db* tdbb, bool unique)
402{
403 SET_TDBB(tdbb);
404 Attachment* const attachment = tdbb->getAttachment();
405
406 const Statement* const thisPointer = this; // avoid warning
407 if (!thisPointer)
408 BUGCHECK(167); /* msg 167 invalid SEND request */
409
410 // Search clones for one request in use by this attachment.
411 // If not found, return first inactive request.
412
413 Request* clone = NULL;
414 USHORT count = 0;
415 const USHORT clones = requests.getCount();
416 USHORT n;
417
418 for (n = 0; n < clones; ++n)
419 {
420 Request* next = getRequest(tdbb, n);
421
422 if (next->req_attachment == attachment)
423 {
424 if (!(next->req_flags & req_in_use))
425 {
426 clone = next;
427 break;
428 }
429
430 if (unique)
431 return NULL;
432
433 ++count;
434 }
435 else if (!(next->req_flags & req_in_use) && !clone)
436 clone = next;
437 }
438
439 if (count > MAX_CLONES)
440 ERR_post(Arg::Gds(isc_req_max_clones_exceeded));
441
442 if (!clone)
443 clone = getRequest(tdbb, n);
444
445 clone->setAttachment(attachment);
446 clone->req_stats.reset();
447 clone->req_base_stats.reset();
448 clone->req_flags |= req_in_use;
449
450 return clone;
451}
452
453Request* Statement::getRequest(thread_db* tdbb, USHORT level)
454{

Callers 7

DsqlDmlRequestMethod · 0.80
executeMethod · 0.80
executeProcedureMethod · 0.80
EXE_execute_triggersFunction · 0.80
IndexConditionMethod · 0.80
IndexExpressionMethod · 0.80
internalOpenMethod · 0.80

Calls 7

SET_TDBBFunction · 0.85
GdsClass · 0.85
ERR_postFunction · 0.70
getAttachmentMethod · 0.45
getCountMethod · 0.45
setAttachmentMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected