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

Method internalGetRecord

src/jrd/recsrc/IndexTableScan.cpp:156–355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154}
155
156bool IndexTableScan::internalGetRecord(thread_db* tdbb) const
157{
158 JRD_reschedule(tdbb);
159
160 Request* const request = tdbb->getRequest();
161 record_param* const rpb = &request->req_rpb[m_stream];
162 Impure* const impure = request->getImpure<Impure>(m_impure);
163
164 if (!(impure->irsb_flags & irsb_open))
165 {
166 rpb->rpb_number.setValid(false);
167 return false;
168 }
169
170 if (impure->irsb_flags & irsb_first)
171 {
172 impure->irsb_flags &= ~irsb_first;
173 setPage(tdbb, impure, NULL);
174
175 impure->irsb_iterator = m_index->retrieval->irb_list ?
176 FB_NEW_POOL(*tdbb->getDefaultPool()) IndexScanListIterator(tdbb, m_index->retrieval) :
177 nullptr;
178
179 USHORT dummy = 0; // exclude upper/lower bits are not used here,
180 // i.e. additional forced include not needed
181 if (!BTR_make_bounds(tdbb, m_index->retrieval, impure->irsb_iterator,
182 impure->irsb_nav_lower, impure->irsb_nav_upper, dummy))
183 {
184 rpb->rpb_number.setValid(false);
185 return false;
186 }
187 }
188
189 // If this is the first time, start at the beginning
190 if (!impure->irsb_nav_page)
191 {
192 // initialize for a retrieval
193 if (!setupBitmaps(tdbb, impure))
194 {
195 rpb->rpb_number.setValid(false);
196 return false;
197 }
198 }
199
200 index_desc* const idx = (index_desc*) ((SCHAR*) impure + m_offset);
201
202 // find the last fetched position from the index
203 const USHORT pageSpaceID = m_relation->getPages(tdbb)->rel_pg_space_id;
204 win window(pageSpaceID, impure->irsb_nav_page);
205
206 const IndexRetrieval* const retrieval = m_index->retrieval;
207 const USHORT flags = retrieval->irb_generic & (irb_descending | irb_partial | irb_starting);
208
209 do
210 {
211 UCHAR* nextPointer = getPosition(tdbb, impure, &window);
212 if (!nextPointer)
213 {

Callers

nothing calls this directly

Calls 15

JRD_rescheduleFunction · 0.85
BTR_make_boundsFunction · 0.85
CCH_HANDOFFFunction · 0.85
CCH_RELEASEFunction · 0.85
BTR_find_pageFunction · 0.85
BTR_find_leafFunction · 0.85
setPositionFunction · 0.85
VIO_getFunction · 0.85
setValidMethod · 0.80
readNodeMethod · 0.80
testFunction · 0.50

Tested by

no test coverage detected