Release a blob and associated blocks. Among other things, disconnect it from the transaction. However, if purge_flag is false, then only release the associated blocks.
| 2735 | // Release a blob and associated blocks. Among other things, disconnect it from the transaction. |
| 2736 | // However, if purge_flag is false, then only release the associated blocks. |
| 2737 | void blb::destroy(const bool purge_flag) |
| 2738 | { |
| 2739 | // Disconnect blob from transaction block. |
| 2740 | |
| 2741 | if (purge_flag) |
| 2742 | { |
| 2743 | if (blb_transaction->tra_blobs->locate(blb_temp_id)) |
| 2744 | { |
| 2745 | Request* blob_request = blb_transaction->tra_blobs->current().bli_request; |
| 2746 | |
| 2747 | if (blob_request) |
| 2748 | { |
| 2749 | if (blob_request->req_blobs.locate(blb_temp_id)) |
| 2750 | blob_request->req_blobs.fastRemove(); |
| 2751 | else |
| 2752 | { |
| 2753 | // We should never get here because when bli_request is assigned |
| 2754 | // item should be added to req_blobs array |
| 2755 | fb_assert(false); |
| 2756 | } |
| 2757 | } |
| 2758 | |
| 2759 | blb_transaction->tra_blobs->fastRemove(); |
| 2760 | } |
| 2761 | else |
| 2762 | { |
| 2763 | // We should never get here because allocate_blob stores each blob object |
| 2764 | // in tra_blobs |
| 2765 | fb_assert(false); |
| 2766 | } |
| 2767 | |
| 2768 | if (blb_interface) |
| 2769 | blb_interface->clearHandle(); |
| 2770 | } |
| 2771 | |
| 2772 | delete blb_pages; |
| 2773 | blb_pages = NULL; |
| 2774 | |
| 2775 | if ((blb_flags & BLB_temporary) && blb_temp_size > 0) |
| 2776 | { |
| 2777 | blb_transaction->getBlobSpace()->releaseSpace(blb_temp_offset, blb_temp_size); |
| 2778 | } |
| 2779 | |
| 2780 | delete this; |
| 2781 | } |
| 2782 | |
| 2783 | |
| 2784 | static void slice_callback(array_slice* arg, ULONG /*count*/, DSC* descriptors) |
no test coverage detected