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

Method locateFrameRange

src/jrd/recsrc/WindowedStream.cpp:985–1096  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

983}
984
985SINT64 WindowedStream::WindowStream::locateFrameRange(thread_db* tdbb, Request* request, Impure* impure,
986 const Frame* frame, const dsc* offsetDesc, SINT64 position) const
987{
988 if (m_order->expressions.getCount() != 1)
989 {
990 fb_assert(false);
991 return false;
992 }
993
994 SINT64 rangePos = position;
995
996 if (offsetDesc)
997 {
998 cacheValues(tdbb, request, &m_order->expressions, impure->orderValues,
999 AdjustFunctor(m_arithNodes[frame == m_frameExtent->frame1 ? 0 : 1], offsetDesc));
1000 }
1001 else
1002 {
1003 cacheValues(tdbb, request, &m_order->expressions, impure->orderValues,
1004 DummyAdjustFunctor());
1005 }
1006
1007 // We found a NULL...
1008 if (!impure->orderValues[0].vlu_desc.dsc_address)
1009 {
1010 if (frame == m_frameExtent->frame2)
1011 {
1012 while (++rangePos <= impure->partitionBlock.endPosition)
1013 {
1014 if (!m_next->getRecord(tdbb))
1015 fb_assert(false);
1016
1017 if (lookForChange(tdbb, request, &m_order->expressions, m_order,
1018 impure->orderValues))
1019 {
1020 break;
1021 }
1022 }
1023
1024 --rangePos;
1025 }
1026 }
1027 else if (frame->bound == Frame::Bound::FOLLOWING)
1028 {
1029 const int bound = frame == m_frameExtent->frame1 ? 0 : 1;
1030
1031 do
1032 {
1033 if (lookForChange(tdbb, request, &m_order->expressions, m_order, impure->orderValues) >=
1034 bound ||
1035 ++rangePos > impure->partitionBlock.endPosition)
1036 {
1037 break;
1038 }
1039
1040 if (!m_next->getRecord(tdbb))
1041 fb_assert(false);
1042 } while (true);

Callers

nothing calls this directly

Calls 5

AdjustFunctorClass · 0.85
DummyAdjustFunctorClass · 0.85
getCountMethod · 0.45
getRecordMethod · 0.45
locateMethod · 0.45

Tested by

no test coverage detected