| 151 | } |
| 152 | |
| 153 | bool BufferedStream::internalGetRecord(thread_db* tdbb) const |
| 154 | { |
| 155 | JRD_reschedule(tdbb); |
| 156 | |
| 157 | Request* const request = tdbb->getRequest(); |
| 158 | Impure* const impure = request->getImpure<Impure>(m_impure); |
| 159 | |
| 160 | if (!(impure->irsb_flags & irsb_open)) |
| 161 | return false; |
| 162 | |
| 163 | dsc from, to; |
| 164 | |
| 165 | Record* const buffer_record = impure->irsb_buffer->getTempRecord(); |
| 166 | |
| 167 | if (impure->irsb_flags & irsb_mustread) |
| 168 | { |
| 169 | if (!m_next->getRecord(tdbb)) |
| 170 | { |
| 171 | // ASF: There is nothing more to read, so remove irsb_mustread flag. |
| 172 | // That's important if m_next is reused in another stream and our caller |
| 173 | // relies on this BufferedStream being non-lazy, like WindowedStream does. |
| 174 | impure->irsb_flags &= ~irsb_mustread; |
| 175 | return false; |
| 176 | } |
| 177 | |
| 178 | buffer_record->nullify(); |
| 179 | |
| 180 | // Assign the fields to the record to be stored |
| 181 | for (FB_SIZE_T i = 0; i < m_map.getCount(); i++) |
| 182 | { |
| 183 | const FieldMap& map = m_map[i]; |
| 184 | |
| 185 | record_param* const rpb = &request->req_rpb[map.map_stream]; |
| 186 | Record* const record = rpb->rpb_record; |
| 187 | |
| 188 | if (map.map_type == FieldMap::REGULAR_FIELD) |
| 189 | { |
| 190 | if (!EVL_field(rpb->rpb_relation, record, map.map_id, &from)) |
| 191 | continue; |
| 192 | } |
| 193 | |
| 194 | buffer_record->clearNull(i); |
| 195 | |
| 196 | if (!EVL_field(rpb->rpb_relation, buffer_record, (USHORT) i, &to)) |
| 197 | fb_assert(false); |
| 198 | |
| 199 | switch (map.map_type) |
| 200 | { |
| 201 | case FieldMap::REGULAR_FIELD: |
| 202 | MOV_move(tdbb, &from, &to); |
| 203 | break; |
| 204 | |
| 205 | case FieldMap::TRANSACTION_ID: |
| 206 | *reinterpret_cast<SINT64*>(to.dsc_address) = rpb->rpb_transaction_nr; |
| 207 | break; |
| 208 | |
| 209 | case FieldMap::DBKEY_NUMBER: |
| 210 | *reinterpret_cast<SINT64*>(to.dsc_address) = rpb->rpb_number.getValue(); |
nothing calls this directly
no test coverage detected