Report to Trace API that attachment has not been created
| 1562 | |
| 1563 | // Report to Trace API that attachment has not been created |
| 1564 | static void trace_failed_attach(const char* filename, const DatabaseOptions& options, |
| 1565 | unsigned flags, FbStatusVector* status, ICryptKeyCallback* callback) |
| 1566 | { |
| 1567 | // Avoid uncontrolled recursion |
| 1568 | if (options.dpb_map_attach) |
| 1569 | return; |
| 1570 | |
| 1571 | const char* origFilename = filename; |
| 1572 | if (options.dpb_org_filename.hasData()) |
| 1573 | origFilename = options.dpb_org_filename.c_str(); |
| 1574 | |
| 1575 | // Create trivial trace object for connection |
| 1576 | TraceFailedConnection conn(origFilename, &options); |
| 1577 | TraceStatusVectorImpl traceStatus(status, TraceStatusVectorImpl::TS_ERRORS); |
| 1578 | |
| 1579 | ISC_STATUS s = status->getErrors()[1]; |
| 1580 | const ntrace_result_t result = (s == isc_login || s == isc_no_priv) ? |
| 1581 | ITracePlugin::RESULT_UNAUTHORIZED : ITracePlugin::RESULT_FAILED; |
| 1582 | const char* func = flags & UNWIND_CREATE ? "JProvider::createDatabase" : "JProvider::attachDatabase"; |
| 1583 | |
| 1584 | // Perform actual trace |
| 1585 | TraceManager tempMgr(origFilename, callback, flags & UNWIND_NEW); |
| 1586 | |
| 1587 | if (tempMgr.needs(ITraceFactory::TRACE_EVENT_ATTACH)) |
| 1588 | tempMgr.event_attach(&conn, flags & UNWIND_CREATE, result); |
| 1589 | |
| 1590 | if (tempMgr.needs(ITraceFactory::TRACE_EVENT_ERROR)) |
| 1591 | tempMgr.event_error(&conn, &traceStatus, func); |
| 1592 | } |
| 1593 | |
| 1594 | |
| 1595 | namespace Jrd { |
no test coverage detected