Home | Previous Page | Next Page   Using the Optical Subsystem >

Using TEXT and BYTE Data Descriptors

Data rows that include TEXT or BYTE data do not include the TEXT or BYTE data in the row itself. Instead, the data row contains a 56-byte TEXT or BYTE data descriptor that includes a pointer to the location where the first segment of data is stored. The descriptor can point to a dbspace blobpage, a blobspace blobpage, or an optical-storage location.

You can use the DESCR() function expression to retrieve the TEXT or BYTE data descriptor for TEXT or BYTE data that is stored on WORM optical media. The DESCR() function returns the descriptor in an encoded format that is 112 bytes long. Using the DESCR() function as a column value in INSERT and UPDATE statements enables you to create additional pointers to existing TEXT and BYTE data objects on the optical media. Creating additional pointers to TEXT and BYTE data objects saves space on the optical platters by allowing multiple tables to refer to the same physical TEXT and BYTE data.

Before the TEXT or BYTE data descriptor is inserted in a data row, it is decoded and validated to verify consistency and legitimacy. The optical-storage subsystem performs all encoding, decoding, and validations through the Optical Subsystem calls to API functions. If the validation process fails, the insert operation fails.

The following example uses DESCR() in an INSERT statement to insert TEXT or BYTE data descriptors, or pointers to existing TEXT and BYTE data objects, in the following hypothetical pictures table. Assume that the picture column is a BYTE column assigned to an optical platter.

INSERT INTO pictures (stock_num, manu_code, picture)
   SELECT stock_num, manu_code, DESCR(cat_picture) 
      FROM catalog
      WHERE manu_code = 'ANZ'

Figure 6 illustrates the result of the preceding INSERT statement for a row in the pictures table.

Figure 6. Two Descriptors That Point to the Same TEXT or BYTE Data Object on a WORM Platter
begin figure description - The figure contains a platter where pictures are stored; two tables: the catalog table and the pictures table; and two arrows. Both arrows extend from the same picture on the platter. One arrow points to the cat_picture column in the catalog table, and the other arrow points to the picture column in the pictures table. - end figure description

The following example uses DESCR() to update the pictures table with all pictures from the cat_picture column of the catalog table:

UPDATE pictures
   SET (picture) = 
      (SELECT DESCR(cat_picture) 
         FROM catalog
         WHERE pictures.stock_num = catalog.stock_num
         AND pictures.manu_code = catalog.manu_code
         AND cat_picture IS NOT NULL)

You can use the DESCR() function expression for TEXT or BYTE data columns that are stored on an optical platter. An error is returned if you use DESCR() on a nonoptical TEXT or BYTE data column.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]