| 983 | } |
| 984 | |
| 985 | SINT64 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); |
nothing calls this directly
no test coverage detected