INFORMIX
Informix-ESQL/C Programmer's Manual
Chapter 8: Working with Simple Large Objects
Home Contents Index Master Index New Book

Reading and Writing Simple Large Objects to an Optical Disc

Only Universal Server and INFORMIX-OnLine Dynamic Server, on the UNIX operating system, can use optical discs.

Within a table, rows that include simple-large-object data do not include the simple-large-object data in the row itself. Instead, the simple-large-object column contains a 56-byte simple-large-object descriptor that includes a forward pointer (rowid) to the location where the first segment of simple-large-object data is stored. The descriptor can point to a dbspace blobpage, a blobspace blobpage, or a platter in an optical storage subsystem. For details, see the Administrator's Guide for your database server and the INFORMIX-OnLine/Optical User Manual.

When a simple large object is stored on a write-once-read-many (WORM) optical-storage subsystem, you can have a single physical simple large object reside in more than one table to conserve storage space on the WORM optical disc. The LOC_DESCRIPTOR flag enables you to migrate a simple-large-object descriptor, rather than the simple large object itself, from one table to another.

When you read or write a simple-large-object column that is stored on a WORM optical disc, you can manipulate only the simple-large-object descriptor if you set the loc_oflags field of the locator structure to LOC_DESCRIPTOR.

Important: Only use LOC_DESCRIPTOR with simple large objects that are stored on WORM optical media.
Figure 8-20 shows a code fragment that selects the stock_num, manu_code, cat_descr, and cat_picture columns from the catalog table of the named database. The program uses the DESCR() SQL function expression to retrieve the simple-large-object descriptor, rather than to retrieve the simple large object itself, for the cat_picture column. The program then sets the loc_oflags field of the cat_picture locator structure to LOC_DESCRIPTOR to signal that the simple-large-object descriptor, rather than the simple large object, is to be inserted into the cat_picture column of the pictures table. The result is that the cat_picture columns in both the catalog and pictures tables refer to a single set of physical simple large objects.

Figure 8-20
Code Fragment to Retrieve the Simple-Large-Object Descriptor

You can also use the SQL DESCR() function to achieve the same result without a loc_oflags value of LOC_DESCRIPTOR. The SQL statement shown in Figure 8-21 accomplishes the same task as the locator structure in the preceding example.

Figure 8-21
Using DESCR() to Access a Simple- Large-Object Descriptor




Informix-ESQL/C Programmer's Manual, version 9.1
Copyright © 1998, Informix Software, Inc. All rights reserved.