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

Method fetchFromCache

src/dsql/DsqlCursor.cpp:290–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288}
289
290int DsqlCursor::fetchFromCache(thread_db* tdbb, UCHAR* buffer, FB_UINT64 position)
291{
292 if (position >= m_cachedCount)
293 {
294 if (m_eof || !cacheInput(tdbb, position))
295 {
296 m_state = EOS;
297 return 1;
298 }
299 }
300
301 fb_assert(position < m_cachedCount);
302
303 UCHAR* const msgBuffer = m_dsqlRequest->req_msg_buffers[m_message->msg_buffer_number];
304
305 const FB_UINT64 offset = position * m_message->msg_length;
306 const FB_UINT64 readBytes = m_space.read(offset, msgBuffer, m_message->msg_length);
307 fb_assert(readBytes == m_message->msg_length);
308
309 m_dsqlRequest->mapInOut(tdbb, true, m_message, NULL, buffer);
310
311 m_position = position;
312 m_state = POSITIONED;
313 return 0;
314}
315
316bool DsqlCursor::cacheInput(thread_db* tdbb, FB_UINT64 position)
317{

Callers

nothing calls this directly

Calls 2

mapInOutMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected