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

Method delete_blob

src/jrd/blb.cpp:2180–2265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2178
2179
2180void blb::delete_blob(thread_db* tdbb, ULONG prior_page)
2181{
2182/**************************************
2183 *
2184 * d e l e t e _ b l o b
2185 *
2186 **************************************
2187 *
2188 * Functional description
2189 * Delete all disk storage associated with blob. This can be used
2190 * to either abort a temporary blob or get rid of an unwanted and
2191 * unloved permanent blob. The routine deletes only blob page --
2192 * somebody else will have to worry about the blob root.
2193 *
2194 **************************************/
2195 SET_TDBB(tdbb);
2196 Database* const dbb = tdbb->getDatabase();
2197 CHECK_DBB(dbb);
2198
2199 const USHORT pageSpaceID = blb_pg_space_id;
2200
2201 if (dbb->readOnly())
2202 {
2203 const USHORT tempSpaceID = dbb->dbb_page_manager.getTempPageSpaceID(tdbb);
2204
2205 if (pageSpaceID != tempSpaceID)
2206 {
2207 ERR_post(Arg::Gds(isc_read_only_database));
2208 }
2209 }
2210
2211 // Level 0 blobs don't need cleanup
2212
2213 if (blb_level == 0)
2214 return;
2215
2216 const PageNumber prior(pageSpaceID, prior_page);
2217
2218 // Level 1 blobs just need the root page level released
2219
2220 vcl::iterator ptr = blb_pages->begin();
2221 const vcl::iterator end = blb_pages->end();
2222
2223 if (blb_level == 1)
2224 {
2225 for (; ptr < end; ++ptr)
2226 {
2227 if (*ptr) {
2228 PAG_release_page(tdbb, PageNumber(pageSpaceID, *ptr), prior);
2229 }
2230 }
2231 return;
2232 }
2233
2234 // Level 2 blobs need a little more work to keep the page precedence
2235 // in order. The basic problem is that the pointer page has to be
2236 // released before the data pages that it points to. Sigh.
2237

Callers 1

delete_blob_idMethod · 0.80

Calls 13

SET_TDBBFunction · 0.85
CHECK_DBBFunction · 0.85
GdsClass · 0.85
PAG_release_pageFunction · 0.85
CCH_FETCHFunction · 0.85
CCH_RELEASE_TAILFunction · 0.85
getDatabaseMethod · 0.80
readOnlyMethod · 0.80
getTempPageSpaceIDMethod · 0.80
ERR_postFunction · 0.70
PageNumberClass · 0.70
beginMethod · 0.45

Tested by

no test coverage detected