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

Method BLB_get_segment

src/jrd/blb.cpp:663–867  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

661
662
663USHORT blb::BLB_get_segment(thread_db* tdbb, void* segment, USHORT buffer_length)
664{
665/**************************************
666 *
667 * b l b : : g e t _ s e g m e n t
668 *
669 **************************************
670 *
671 * Functional description
672 * Get next segment or fragment from a blob. Return the number
673 * of bytes returned.
674 *
675 **************************************/
676 SET_TDBB(tdbb);
677 Database* dbb = tdbb->getDatabase();
678
679 if (blb_flags & BLB_temporary)
680 ERR_post(Arg::Gds(isc_cannot_read_new_blob));
681
682 JRD_reschedule(tdbb);
683
684 // If we reached end of file, we're still there
685
686 if (blb_flags & BLB_eof)
687 return 0;
688
689 if (blb_filter)
690 {
691 blb_fragment_size = 0;
692 USHORT tmp_len = 0;
693 const ISC_STATUS status =
694 BLF_get_segment(tdbb, &blb_filter, &tmp_len, buffer_length, segment);
695
696 switch (status)
697 {
698 case isc_segstr_eof:
699 blb_flags |= BLB_eof;
700 break;
701 case isc_segment:
702 blb_fragment_size = 1;
703 break;
704 default:
705 fb_assert(status == 0);
706 }
707
708 return tmp_len;
709 }
710
711 // If there is a seek pending, handle it here
712
713 USHORT seek = 0;
714
715 if (blb_flags & BLB_seek)
716 {
717 if (blb_seek >= blb_length)
718 {
719 blb_flags |= BLB_eof;
720 return 0;

Callers 8

sleuthMethod · 0.80
readDataFunctionMethod · 0.80
getSegmentMethod · 0.80
get_arrayMethod · 0.80
scalarMethod · 0.80
blob_filterFunction · 0.80
copy_blobMethod · 0.80
putExtBlobMethod · 0.80

Calls 9

SET_TDBBFunction · 0.85
GdsClass · 0.85
JRD_rescheduleFunction · 0.85
BLF_get_segmentFunction · 0.85
getBufferFunction · 0.85
CCH_RELEASE_TAILFunction · 0.85
CCH_RELEASEFunction · 0.85
getDatabaseMethod · 0.80
ERR_postFunction · 0.70

Tested by

no test coverage detected