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

Method startSession

src/jrd/trace/TraceService.cpp:104–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104void TraceSvcJrd::startSession(TraceSession& session, bool interactive)
105{
106 if (!TraceManager::pluginsCount())
107 {
108 m_svc.printf(false, "Can not start trace session. There are no trace plugins loaded\n");
109 return;
110 }
111
112 ConfigStorage* storage = TraceManager::getStorage();
113
114 { // scope
115 StorageGuard guard(storage);
116
117 session.ses_auth = m_authBlock;
118 session.ses_user = m_user.hasData() ? m_user : m_svc.getUserName();
119 MetaString role = m_role.hasData() ? m_role : m_svc.getRoleName();
120 UserId::makeRoleName(role, SQL_DIALECT_V6);
121 session.ses_role = role.c_str();
122
123 session.ses_flags = trs_active;
124 if (m_admin) {
125 session.ses_flags |= trs_admin;
126 }
127
128 if (interactive)
129 {
130 Guid guid;
131 GenerateGuid(&guid);
132
133 char* buff = session.ses_logfile.getBuffer(GUID_BUFF_SIZE);
134 GuidToString(buff, &guid);
135
136 session.ses_logfile.insert(0, FB_TRACE_FILE);
137 }
138
139 storage->addSession(session);
140 m_chg_number = storage->getChangeNumber();
141 }
142
143 m_svc.started();
144 m_svc.printf(false, "Trace session ID %ld started\n", session.ses_id);
145
146 if (interactive)
147 {
148 readSession(session);
149 {
150 StorageGuard guard(storage);
151 storage->removeSession(session.ses_id);
152 }
153 }
154}
155
156void TraceSvcJrd::stopSession(ULONG id)
157{

Callers 1

fbtraceFunction · 0.45

Calls 13

GuidToStringFunction · 0.85
addSessionMethod · 0.80
getChangeNumberMethod · 0.80
removeSessionMethod · 0.80
GenerateGuidFunction · 0.50
printfMethod · 0.45
hasDataMethod · 0.45
getUserNameMethod · 0.45
getRoleNameMethod · 0.45
c_strMethod · 0.45
getBufferMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected