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

Method attachServiceManager

src/yvalve/why.cpp:6638–6693  ·  view source on GitHub ↗

Attach a service through the first subsystem that recognizes it.

Source from the content-addressed store, hash-verified

6636
6637// Attach a service through the first subsystem that recognizes it.
6638YService* Dispatcher::attachServiceManager(CheckStatusWrapper* status, const char* serviceName,
6639 unsigned int spbLength, const unsigned char* spb)
6640{
6641 IService* service = NULL;
6642 status->init();
6643
6644 try
6645 {
6646 DispatcherEntry entry(status);
6647
6648 if (!serviceName)
6649 status_exception::raise(Arg::Gds(isc_service_att_err) << Arg::Gds(isc_svc_name_missing));
6650
6651 if (spbLength > 0 && !spb)
6652 status_exception::raise(Arg::Gds(isc_bad_spb_form) <<
6653 Arg::Gds(isc_null_spb));
6654
6655 PathName svcName(serviceName);
6656 svcName.trim();
6657
6658 ClumpletWriter spbWriter(ClumpletReader::spbList, MAX_DPB_SIZE, spb, spbLength);
6659 bool utfData = spbWriter.find(isc_spb_utf8_filename);
6660
6661 // Take care about SPB
6662 setLogin(spbWriter, true);
6663 if (!utfData)
6664 {
6665 IntlSpb().toUtf8(spbWriter);
6666 }
6667
6668 IProvider* p;
6669 service = internalServiceAttach(status, svcName, spbWriter,
6670 [](CheckStatusWrapper*, IService*){ }, &p);
6671
6672 if (!(status->getState() & IStatus::STATE_ERRORS))
6673 {
6674 YService* r = FB_NEW YService(p, service, utfData, this);
6675 r->addRef();
6676 r->attachSpb.reset(spbWriter);
6677 return r;
6678 }
6679 }
6680 catch (const Exception& e)
6681 {
6682 if (service)
6683 {
6684 StatusVector temp(NULL);
6685 CheckStatusWrapper tempCheckStatusWrapper(&temp);
6686 service->detach(&tempCheckStatusWrapper);
6687 }
6688
6689 e.stuffException(status);
6690 }
6691
6692 return NULL;
6693}
6694
6695

Callers 2

internalServiceAttachMethod · 0.45

Calls 14

raiseFunction · 0.85
GdsClass · 0.85
setLoginFunction · 0.85
IntlSpbClass · 0.85
YServiceClass · 0.85
initMethod · 0.45
trimMethod · 0.45
findMethod · 0.45
toUtf8Method · 0.45
getStateMethod · 0.45
addRefMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected