Create and delete a server file

The following example shows how to create a server file and then delete it.

The lld_copy function copies a large object to another large object. The lld_locator rows for the source and destination objects use the IFX_FILE protocol to specify a server file as the type of large object. The lld_copy function returns an lld_locator row that identifies the copy of the large object.

The INSERT statement inserts this row into the lobs table using 3 as the key.
Figure 1: Create and delete a server file
-- Create and delete a new server file 
insert into lobs
    values (3, lld_copy (
        "row('ifx_file',null,'/tmp/quote2.txt')"::lld_locator,
        "row('ifx_file',null,'/tmp/tmp3')"::lld_locator));

select lo from lobs where key = 3;


lo  ROW('IFX_FILE          ',NULL,'/tmp/tmp3') 


select lld_delete (lo) from lobs where key = 3;

(expression) 

           t


delete from lobs where key = 3;

The first SELECT statement returns the lld_locator row identifying the large object.

The lld_delete function deletes the large object itself. The DELETE statement deletes the lld_locator row that referenced the large object.