| 174 | } |
| 175 | |
| 176 | bool 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; |
nothing calls this directly
no test coverage detected