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

Method get_slice

src/jrd/blb.cpp:870–960  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

868
869
870SLONG blb::get_slice(thread_db* tdbb,
871 jrd_tra* transaction,
872 const bid* blob_id,
873 const UCHAR* sdl,
874 USHORT param_length,
875 const UCHAR* param, SLONG slice_length, UCHAR* slice_addr)
876{
877/**************************************
878 *
879 * b l b : : g e t _ s l i c e
880 *
881 **************************************
882 *
883 * Functional description
884 * Fetch a slice of an array.
885 *
886 **************************************/
887 transaction = transaction->getOuter();
888
889 SET_TDBB(tdbb);
890 //Database* database = GET_DBB();
891 Jrd::ContextPoolHolder context(tdbb, transaction->tra_pool);
892
893 // Checkout slice description language
894 SLONG variables[64];
895 sdl_info info;
896 memcpy(variables, param, MIN(sizeof(variables), param_length));
897
898 if (SDL_info(tdbb->tdbb_status_vector, sdl, &info, variables)) {
899 ERR_punt();
900 }
901
902 SLONG stuff[IAD_LEN(16) / 4];
903 Ods::InternalArrayDesc* desc = (Ods::InternalArrayDesc*) stuff;
904 blb* blob = get_array(tdbb, transaction, blob_id, desc);
905 SLONG length = desc->iad_total_length;
906
907 // Get someplace to put data
908
909 UCharBuffer data_buffer;
910 UCHAR* const data = data_buffer.getBuffer(desc->iad_total_length);
911
912 // zero out memory, so that it does not have to be done for each element
913
914 memset(data, 0, desc->iad_total_length);
915
916 SLONG offset = 0;
917
918 array_slice arg;
919
920 // If we know something about the subscript bounds, prepare
921 // to fetch only stuff we really care about
922
923 if (info.sdl_info_dimensions)
924 {
925 const SLONG from = SDL_compute_subscript(tdbb->tdbb_status_vector, desc,
926 info.sdl_info_dimensions, info.sdl_info_lower);
927 const SLONG to = SDL_compute_subscript(tdbb->tdbb_status_vector, desc,

Callers

nothing calls this directly

Calls 9

SET_TDBBFunction · 0.85
SDL_infoFunction · 0.85
ERR_puntFunction · 0.85
SDL_compute_subscriptFunction · 0.85
SDL_walkFunction · 0.85
getOuterMethod · 0.80
BLB_lseekMethod · 0.80
BLB_get_dataMethod · 0.80
getBufferMethod · 0.45

Tested by

no test coverage detected