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

Method sendInlineBlob

src/remote/server/server.cpp:6057–6164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6055
6056
6057bool rem_port::sendInlineBlob(PACKET* sendL, Rtr* rtr, SQUAD blobId, ULONG maxSize)
6058{
6059 P_INLINE_BLOB* p_blob = &sendL->p_inline_blob;
6060
6061 p_blob->p_tran_id = rtr->rtr_id;
6062 p_blob->p_blob_id = blobId;
6063
6064 LocalStatus ls;
6065 CheckStatusWrapper status(&ls);
6066
6067 ServAttachment att = port_context->rdb_iface;
6068
6069 // openBlob() returns an IBlob with a reference count set to 1, no need to increment it.
6070 ServBlob blob(REF_NO_INCR, att->openBlob(&status, rtr->rtr_iface, &blobId, 0, nullptr));
6071 if (status.getState() & IStatus::STATE_ERRORS)
6072 return false;
6073
6074 // ask blob info
6075 const UCHAR items[] = {
6076 isc_info_blob_num_segments,
6077 isc_info_blob_max_segment,
6078 isc_info_blob_total_length,
6079 isc_info_blob_type,
6080 isc_info_end
6081 };
6082
6083 UCHAR info[64];
6084
6085 blob->getInfo(&status, sizeof(items), items, sizeof(info), info);
6086 if (status.getState() & IStatus::STATE_ERRORS)
6087 return false;
6088
6089 bool segmented;
6090 ULONG num_segments;
6091 ULONG max_segment;
6092 ULONG total_length;
6093
6094 ClumpletReader p(ClumpletReader::InfoResponse, info, sizeof(info));
6095 for (; !p.isEof(); p.moveNext())
6096 {
6097 switch (p.getClumpTag())
6098 {
6099 case isc_info_blob_num_segments:
6100 num_segments = p.getInt();
6101 break;
6102 case isc_info_blob_max_segment:
6103 max_segment = p.getInt();
6104 break;
6105 case isc_info_blob_total_length:
6106 total_length = p.getInt();
6107 break;
6108 case isc_info_blob_type:
6109 segmented = (p.getInt() == 0);
6110 break;
6111 case isc_info_end:
6112 p_blob->p_blob_info.cstr_length = p.getCurOffset() + 1;
6113 break;
6114 default:

Callers

nothing calls this directly

Calls 13

send_partialMethod · 0.95
getClumpTagMethod · 0.80
getCurOffsetMethod · 0.80
openBlobMethod · 0.45
getStateMethod · 0.45
getInfoMethod · 0.45
isEofMethod · 0.45
moveNextMethod · 0.45
getIntMethod · 0.45
getBufferMethod · 0.45
getSegmentMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected