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

Method mapData

src/jrd/recsrc/SortedStream.cpp:338–616  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

336}
337
338void SortedStream::mapData(thread_db* tdbb, Request* request, UCHAR* data) const
339{
340 StreamType stream = INVALID_STREAM;
341 dsc from, to;
342 StreamList refetchStreams;
343
344 for (const auto& item : m_map->items)
345 {
346 const auto flag = (*(data + item.flagOffset) == TRUE);
347 from = item.desc;
348 from.dsc_address = data + (IPTR) from.dsc_address;
349
350 if (item.node && !nodeIs<FieldNode>(item.node))
351 continue;
352
353 // Some fields may have volatile keys, so that their value
354 // can be possibly changed before or during the sorting.
355 // We should ignore such an item, because there is a later field
356 // in the item list that contains the original value to send back
357 // (or the record will be refetched as a whole).
358
359 if (hasVolatileKey(&item.desc) && isKey(&item.desc))
360 continue;
361
362 const auto rpb = &request->req_rpb[item.stream];
363 const auto relation = rpb->rpb_relation;
364 const auto id = item.fieldId;
365
366 if (id < 0)
367 {
368 switch (id)
369 {
370 case ID_TRANS:
371 rpb->rpb_transaction_nr = *reinterpret_cast<SINT64*>(from.dsc_address);
372 break;
373 case ID_DBKEY:
374 rpb->rpb_number.setValue(*reinterpret_cast<SINT64*>(from.dsc_address));
375 break;
376 case ID_DBKEY_VALID:
377 rpb->rpb_number.setValid(*from.dsc_address != 0);
378 break;
379 default:
380 fb_assert(false);
381 }
382
383 rpb->rpb_runtime_flags &= ~RPB_CLEAR_FLAGS;
384
385 // If transaction ID is present, then fields from this stream are accessed.
386 // So we need to refetch the stream, either immediately or on demand.
387 const auto refetch = (id == ID_TRANS);
388
389 if (refetch && relation &&
390 !relation->rel_file &&
391 !relation->rel_view_rse &&
392 !relation->isVirtual())
393 {
394 if (m_map->flags & FLAG_REFETCH)
395 {

Callers 2

internalGetRecordMethod · 0.80
fetchRecordMethod · 0.80

Calls 15

VIO_recordFunction · 0.85
EVL_fieldFunction · 0.85
MOV_moveFunction · 0.85
GdsClass · 0.85
VIO_chase_record_versionFunction · 0.85
VIO_dataFunction · 0.85
VIO_copy_recordFunction · 0.85
INTL_string_to_keyFunction · 0.85
MOV_compareFunction · 0.85
setValidMethod · 0.80
isVirtualMethod · 0.80
nullifyMethod · 0.80

Tested by

no test coverage detected