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

Method internalGetRecord

src/jrd/recsrc/ProcedureScan.cpp:176–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174}
175
176bool ProcedureScan::internalGetRecord(thread_db* tdbb) const
177{
178 JRD_reschedule(tdbb);
179
180 UserId* invoker = m_procedure->invoker ? m_procedure->invoker : tdbb->getAttachment()->att_ss_user;
181 AutoSetRestore<UserId*> userIdHolder(&tdbb->getAttachment()->att_ss_user, invoker);
182
183 Request* const request = tdbb->getRequest();
184 record_param* const rpb = &request->req_rpb[m_stream];
185 Impure* const impure = request->getImpure<Impure>(m_impure);
186
187 if (!(impure->irsb_flags & irsb_open))
188 {
189 rpb->rpb_number.setValid(false);
190 return false;
191 }
192
193 const Format* const msg_format = m_procedure->getOutputFormat();
194 const ULONG oml = msg_format->fmt_length;
195 UCHAR* om = impure->irsb_message;
196
197 if (!om)
198 om = impure->irsb_message = FB_NEW_POOL(*tdbb->getDefaultPool()) UCHAR[oml];
199
200 Record* const record = VIO_record(tdbb, rpb, m_format, tdbb->getDefaultPool());
201
202 Request* const proc_request = impure->irsb_req_handle;
203
204 TraceProcFetch trace(tdbb, proc_request);
205
206 AutoSetRestoreFlag<ULONG> autoSetReqProcSelect(&proc_request->req_flags, req_proc_select, true);
207 AutoSetRestore<USHORT> autoOriginalTimeZone(
208 &tdbb->getAttachment()->att_original_timezone,
209 tdbb->getAttachment()->att_current_timezone);
210
211 try
212 {
213 EXE_receive(tdbb, proc_request, 1, oml, om);
214
215 dsc desc = msg_format->fmt_desc[msg_format->fmt_count - 1];
216 desc.dsc_address = (UCHAR*) (om + (IPTR) desc.dsc_address);
217 SSHORT eos;
218 dsc eos_desc;
219 eos_desc.makeShort(0, &eos);
220 MOV_move(tdbb, &desc, &eos_desc);
221
222 if (!eos)
223 {
224 trace.fetch(true, ITracePlugin::RESULT_SUCCESS);
225 rpb->rpb_number.setValid(false);
226 return false;
227 }
228 }
229 catch (const Exception&)
230 {
231 trace.fetch(true, ITracePlugin::RESULT_FAILED);
232 close(tdbb);
233 throw;

Callers

nothing calls this directly

Calls 11

JRD_rescheduleFunction · 0.85
VIO_recordFunction · 0.85
EXE_receiveFunction · 0.85
MOV_moveFunction · 0.85
setValidMethod · 0.80
getOutputFormatMethod · 0.80
makeShortMethod · 0.80
getAttachmentMethod · 0.45
getRequestMethod · 0.45
getDefaultPoolMethod · 0.45
fetchMethod · 0.45

Tested by

no test coverage detected