isc_cancel_blob()

From InterBase

Go Up to API Function Reference


Discards a Blob, frees internal storage used by the Blob, and sets the Blob handle to NULL.

Syntax

 ISC_STATUS isc_cancel_blob(
 ISC_STATUS *status_vector,
 isc_blob_handle *blob_handle);
Parameter Type Description

status_vector

ISC_STATUS *

Pointer to the error status vector

blob_handle

isc_blob_handle *

Pointer to the handle for the Blob you want to cancel; sets the handle to zero and returns a successful result even if the handle is NULL.

Description

InterBase temporarily stores Blob data in the database during create operations. If, for some reason, you do not, or cannot, close a Blob, the storage space remains allocated in the database and InterBase does not set the handle to NULL. Call isc_cancel_blob() to release the temporary storage in the database, and to set blob_handle to NULL. If you close the Blob in the normal course of your application processing logic, this step is unnecessary as InterBase releases system resources on a call to isc_close_blob().

Note: A call to this function does not produce an error when the handle is NULL. Therefore, it is good practice to call isc_cancel_blob() before creating or opening a Blob to clean up existing Blob operations.

Example

The following fragment cancels any open Blob before creating a new one:

isc_cancel_blob(status_vector, &blob_handle);
if (status_vector[0] == 1 && status_vector[1]){
/* process error */
isc_print_status(status_vector);
return(1);
}
isc_create_blob(status_vector, &DB, &trans, &blob_handle, &blob_id)

Return value

isc_cancel_blob() returns the second element of the status vector. Zero indicates success. A nonzero value indicates an error. For InterBase errors, the first element of the status vector is set to 1, and the second element is set to an InterBase error code.

To check for an InterBase error, examine the first two elements of the status vector directly. For more information about examining the status vector, see Handling Error Conditions.

See Also

Advance To: