IBM Books

Image, Audio, and Video Extenders Administration and Programming

Content UDF formats for updating

The Content UDF is overloaded, meaning, that it has different formats depending on how the UDF is used. The formats are as follows:

Format 1: Update an object from a client buffer or client file:

Content(
     handle,                     /* object handle */
     content,                    /* object content */
     source_format,              /* source format */
     target_file                 /* target file name for storage in file */
                                 /* server or NULL for storage in table as BLOB */
  );

Format 2: Update an object from a server file:

Content(
     handle,                     /* object handle */
     source_file,                /* server file name */
     source_format,              /* source format */
     stortype                    /* MMDB_STORAGE_TYPE_EXTERNAL=store */
                                 /* in file server */
                                 /* MMDB_STORAGE_TYPE_INTERNAL=store as a BLOB*/
  );

Format 3: Update an object with user-supplied attributes from a client buffer or client file:

Content(
     handle,                   /* object handle */
     content,                  /* object content */
     target_file,              /* target file name for storage in file server */
                               /* or NULL for storage in table as BLOB */
     attrs,                    /* user-supplied attributes */
     thumbnail                 /* thumbnail (image and video only) */
  );

Format 4: Update an object with user-supplied attributes from a server file:

Content(
     handle,                   /* object handle */
     source_file,              /* source file name */
     stortype,                 /* MMDB_STORAGE_TYPE_EXTERNAL=store */
                               /* in file server*/
                               /* MMDB_STORAGE_TYPE_INTERNAL=store */
                               /* as a BLOB*/
     attrs,                    /* user-supplied attributes */
     thumbnail                 /* thumbnail (image and video only) */
  );

For image objects only, the Content UDF has the following additional formats:

Format 5: Update an image from a client buffer or client file with format conversion:

Content(
     handle,                     /* object handle */
     content,                    /* object content */
     source format,              /* source format */
     target format,              /* target format */
     target_file                 /* target file name for storage in file server */
                                 /* or NULL for storage in table as BLOB */
  );

Format 6: Update an object from a server file with format conversion:

Content(
     handle,                     /* object handle */
     source_file,                /* server file name */
     source format,              /* source format */
     target format,              /* target format */
     target_file                 /* target file name for storage in file server */
                                 /* or NULL for storage in table as BLOB */
  );

Format 7: Update an image from a client buffer or client file with format conversion and additional changes:

Content(
     handle,                     /* object handle */
     content,                    /* object content */
     source format,              /* source format */
     target format,              /* target format */
     conversion_options,         /* conversion options */ 
     target_file                 /* target file name for storage in file server */
                                 /* or NULL for storage in table as BLOB */
  );

Format 8: Update an object from a server file with format conversion and additional changes:

Content(
     handle,                     /* object handle */
     source_file,                /* server file name */
     source format,              /* source format */
     target format,              /* target format */
     conversion_options,         /* conversion options */
     target_file                 /* target file name for storage in file server */
                                 /* or NULL for storage in table as BLOB */
  );

For example, the following statements in a C application program update an image in the employee table. The source content for the update is in a server file that is named ajones.bmp. The updated image is stored in the employee table as a BLOB. (This corresponds to format 2 above.)

EXEC SQL UPDATE EMPLOYEE
   SET PICTURE=CONTENT(
                 PICTURE,                         /*image handle*/
                 '/employee/newimg/ajones.bmp',   /*source file */
                 'ASIS',                          /*keep the image format*/
                 '');                             /*store image in DB as BLOB*/
   WHERE NAME='Anita Jones';

The following statements in a C application program update the same image as in the previous example. However, here the image is converted from BMP to GIF format on update. (This corresponds to format 6 above.)

EXEC SQL UPDATE EMPLOYEE
   SET PICTURE=CONTENT(
                 PICTURE,                         /*image handle*/
                 '/employee/newimg/ajones.bmp',   /*source file */
                 'BMP',                           /*source format*/
                 'GIF',                           /*target format*/
                 '');                             /*store image in DB as BLOB*/
   WHERE NAME='Anita Jones';


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