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

Method BLB_close

src/jrd/blb.cpp:180–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178
179
180bool blb::BLB_close(thread_db* tdbb)
181{
182/**************************************
183 *
184 * b l b : : c l o s e
185 *
186 **************************************
187 *
188 * Functional description
189 * Close a blob. If the blob is open for retrieval, release the
190 * blob block. If it's a temporary blob, flush out the last page
191 * (if necessary) in preparation for materialization.
192 * Return true if the blob was physically destroyed.
193 *
194 **************************************/
195
196 SET_TDBB(tdbb);
197
198 const bool alreadyClosed = (blb_flags & BLB_closed);
199
200 // Release filter control resources
201
202 if (blb_filter)
203 BLF_close_blob(tdbb, &blb_filter);
204
205 blb_flags &= ~BLB_close_on_read;
206 blb_flags |= BLB_closed;
207
208 if (!(blb_flags & BLB_temporary))
209 {
210 destroy(true);
211 return true;
212 }
213
214 if (!alreadyClosed)
215 blb_transaction->tra_temp_blobs_count--;
216
217 if (blb_level == 0)
218 {
219 //Database* dbb = tdbb->getDatabase();
220
221 blb_temp_size = blb_clump_size - blb_space_remaining;
222
223 if (blb_temp_size > 0)
224 {
225 blb_temp_size += BLP_SIZE;
226 TempSpace* const tempSpace = blb_transaction->getBlobSpace();
227
228 blb_temp_offset = tempSpace->allocateSpace(blb_temp_size);
229 tempSpace->write(blb_temp_offset, getBuffer(), blb_temp_size);
230 }
231 }
232 else if (blb_level >= 1 && blb_space_remaining < blb_clump_size)
233 {
234 insert_page(tdbb);
235 }
236
237 freeBuffer();

Callers 15

executeMethod · 0.80
performMethod · 0.80
executeMethod · 0.80
aggExecuteMethod · 0.80
executeMethod · 0.80
sleuthMethod · 0.80
closeHandleProcedureMethod · 0.80
internalCloseMethod · 0.80
EXE_receiveFunction · 0.80
closeBlobsMethod · 0.80
evlEncodeDecode64Function · 0.80
evlEncodeDecodeHexFunction · 0.80

Calls 7

SET_TDBBFunction · 0.85
BLF_close_blobFunction · 0.85
getBufferFunction · 0.85
getBlobSpaceMethod · 0.80
allocateSpaceMethod · 0.80
destroyFunction · 0.50
writeMethod · 0.45

Tested by

no test coverage detected