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

Function store_array

src/jrd/blb.cpp:2894–2941  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2892
2893
2894static blb* store_array(thread_db* tdbb, jrd_tra* transaction, bid* blob_id)
2895{
2896/**************************************
2897 *
2898 * s t o r e _ a r r a y
2899 *
2900 **************************************
2901 *
2902 * Functional description
2903 * Actually store an array. Oh boy!
2904 *
2905 **************************************/
2906 SET_TDBB(tdbb);
2907
2908 // Validate array
2909
2910 const ArrayField* array = find_array(transaction, blob_id);
2911 if (!array)
2912 return NULL;
2913
2914 // Create blob for array
2915
2916 blb* blob = blb::create2(tdbb, transaction, blob_id, 0, NULL);
2917 blob->blb_flags |= BLB_stream;
2918
2919 // Write out array descriptor
2920
2921 blob->BLB_put_segment(tdbb, reinterpret_cast<const UCHAR*>(&array->arr_desc),
2922 array->arr_desc.iad_length);
2923
2924 // Write out actual array
2925 const USHORT seg_limit = 32768;
2926 const BLOB_PTR* p = array->arr_data;
2927 SLONG length = array->arr_effective_length;
2928 while (length > seg_limit)
2929 {
2930 blob->BLB_put_segment(tdbb, p, seg_limit);
2931 length -= seg_limit;
2932 p += seg_limit;
2933 }
2934
2935 if (length)
2936 blob->BLB_put_segment(tdbb, p, (USHORT) length);
2937
2938 blob->BLB_close(tdbb);
2939
2940 return blob;
2941}
2942
2943void blb::fromPageHeader(const Ods::blh* header)
2944{

Callers 1

moveMethod · 0.85

Calls 4

SET_TDBBFunction · 0.85
find_arrayFunction · 0.85
BLB_put_segmentMethod · 0.80
BLB_closeMethod · 0.80

Tested by

no test coverage detected