INFORMIX
DataBlade API Programmer's Manual
Chapter 3: Handling Smart Large Objects
Home Contents Index Master Index New Book

Deleting a Smart Large Object

You can delete an LO handle from a CLOB, BLOB, or opaque-type column, as follows:

Alternatively, you can mark an LO handle as invalid with the mi_lo_invalidate() function to indicate that it no longer identifies a valid smart large object.

Tip: You can use the DELETE statement to remove a row that contains a CLOB, BLOB, or opaque-type column.

When the LO handle is deleted from the CLOB or BLOB column, the reference count of the smart large object must be decremented by one. However, the database server does not delete the smart large object until both the following conditions exist:

Managing the Reference Count

The reference count of a smart large object is the number of LO handles that reference the smart large object. Each LO handle contains the location of the smart large object in an sbspace. The reference count is stored with the smart-large-object data in an sbspace. (For more information on sbspaces, see INFORMIX-Universal Server Administrator's Guide.) You can obtain the reference count with the mi_lo_stat_refcnt() function.

For smart-large-object columns (CLOB and BLOB), the database server automatically manages the reference count, as follows:

For columns of an opaque data type that contain a smart large object, you must manage the reference count in the support functions of the opaque data type, as follows:

A smart large object remains allocated as long as its reference count is greater than zero. When the reference count is greater than zero (0), a column references the smart large object and the database server does not delete the smart-large-object data from the sbspace. In this sense, the smart large object is permanent.

A temporary smart large object is one that is open but does not have any LO handles stored in the database. Therefore, the reference count of a temporary smart large object is zero. When all LO file descriptors are closed, the database server deletes the temporary smart large object at the end of the session. You can explicitly release the resources of a temporary smart large object with the mi_lo_release() function.

Closing LO File Descriptors

An LO file descriptor exists until one of the following conditions occurs:

The resources that an open smart large object uses are released automatically at session boundaries. However, LO handles are released based on their memory duration. For more information on the memory duration of LO handles, see "Deallocating an LO Handle".

When you close all its LO file descriptors, a permanent smart large object (one that is referenced by at least one column) remains allocated. The database server does not delete the data until the reference count is zero. However, when you close the last LO file descriptor for a temporary smart large object, the database server deletes the smart large object from the sbspace because both of the following deallocation conditions are true:

    Once you close the last open LO file descriptor (explicitly or implicitly), no more references to this smart large object exist, and the data is not kept.




DataBlade API Programmer's Manual, version 9.1
Copyright © 1998, Informix Software, Inc. All rights reserved.