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

Method openBlob

src/remote/client/interface.cpp:5877–6079  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5875
5876
5877IBlob* Attachment::openBlob(CheckStatusWrapper* status, ITransaction* apiTra, ISC_QUAD* id,
5878 unsigned int bpb_length, const unsigned char* bpb)
5879{
5880/**************************************
5881 *
5882 * g d s _ o p e n _ b l o b 2
5883 *
5884 **************************************
5885 *
5886 * Functional description
5887 * Open an existing blob.
5888 *
5889 **************************************/
5890 try
5891 {
5892 reset(status);
5893
5894 CHECK_HANDLE(rdb, isc_bad_db_handle);
5895 rem_port* port = rdb->rdb_port;
5896 RefMutexGuard portGuard(*port->port_sync, FB_FUNCTION);
5897
5898 Rtr* transaction = remoteTransaction(apiTra);
5899 CHECK_HANDLE(transaction, isc_bad_trans_handle);
5900
5901 for (Rbl* blob = transaction->rtr_blobs.locate(*id); blob;
5902 blob = transaction->rtr_blobs.getNext())
5903 {
5904 if (blob->rbl_blob_id != *id)
5905 break;
5906
5907 if (!(blob->rbl_flags & Rbl::CACHED))
5908 continue;
5909
5910 if (bpb_length)
5911 {
5912 if (!(blob->rbl_flags & Rbl::USED))
5913 release_blob(blob);
5914 break;
5915 }
5916
5917 if (blob->rbl_flags & Rbl::USED)
5918 break;
5919
5920 blob->rbl_flags |= Rbl::USED;
5921
5922 Blob* iBlob = FB_NEW Blob(blob);
5923 iBlob->addRef();
5924 return iBlob;
5925 }
5926
5927 // Validate data length
5928
5929 CHECK_LENGTH(port, bpb_length);
5930
5931 PACKET* packet = &rdb->rdb_packet;
5932 packet->p_operation = op_open_blob2;
5933 P_BLOB* p_blob = &packet->p_blob;
5934 p_blob->p_blob_transaction = transaction->rtr_id;

Callers 2

open_blobMethod · 0.45
sendInlineBlobMethod · 0.45

Calls 15

CHECK_HANDLEFunction · 0.85
CHECK_LENGTHFunction · 0.85
send_partial_packetFunction · 0.85
send_packetFunction · 0.85
receive_responseFunction · 0.85
containsErrorCodeFunction · 0.85
send_and_receiveFunction · 0.85
RblClass · 0.85
parseInfoMethod · 0.80
resetFunction · 0.70
release_blobFunction · 0.70
BlobClass · 0.70

Tested by

no test coverage detected