Skip Headers

Oracle® interMedia Reference
10g Release 1 (10.1)

Part Number B10829-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

Static Methods Unique to the ORDDoc Object Type Relational Interface

This section presents reference information on the interMedia static methods unique to the ORDDoc relational interface.

The relational interface adds interMedia support to audio, image, video, and other heterogeneous media data stored in BLOBs and BFILEs rather than in the ORDDoc object type. The following interface is defined in the orddspec.sql file:

.
.
.
  -- Static Methods for the relational interface
  STATIC PROCEDURE export(ctx             IN OUT RAW,
                          local_data      IN BLOB,
                          source_type     IN VARCHAR2,
                          source_location IN VARCHAR2,
                          source_name     IN VARCHAR2),
  --
  STATIC PROCEDURE importFrom(ctx             IN OUT RAW,
                              local_data      IN OUT NOCOPY BLOB,
                              source_type     IN VARCHAR2,
                              source_location IN VARCHAR2,
                              source_name     IN VARCHAR2),
  --
  STATIC PROCEDURE importFrom(ctx             IN OUT RAW,
                              local_data      IN OUT NOCOPY BLOB,
                              source_type     IN VARCHAR2,
                              source_location IN VARCHAR2,
                              source_name     IN VARCHAR2,
                              format          OUT VARCHAR2,
                              mime_type       OUT VARCHAR2),
  --
  STATIC PROCEDURE getProperties(ctx            IN OUT RAW,
                                 docBlob        IN BLOB,
                                 attributes     IN OUT NOCOPY CLOB,
                                 format         IN VARCHAR2),
  --
  STATIC PROCEDURE getProperties(ctx              IN OUT RAW,
                                 docBlob          IN BLOB,
                                 attributes       IN OUT NOCOPY CLOB,
                                 mimeType         OUT VARCHAR2,
                                 format           IN OUT VARCHAR2,
                                 contentLength    OUT INTEGER),
 --
  STATIC PROCEDURE getProperties(ctx            IN OUT RAW,
                                 docBfile       IN OUT NOCOPY BFILE,
                                 attributes     IN OUT NOCOPY CLOB,
                                 format         IN VARCHAR2),
  --
  STATIC PROCEDURE getProperties(ctx                IN OUT RAW,
                                 docBfile           IN OUT NOCOPY BFILE,
                                 attributes         IN OUT NOCOPY CLOB,
                                 mimeType           OUT VARCHAR2,
                                 format             IN OUT VARCHAR2,
                                 contentLength      OUT INTEGER),
.
.
.

Example Media Table Definition

The methods described in this section show examples based on a test document table TDOC. Refer to the TDOC table definition that follows when reading through the examples:


TDOC Table Definition
CREATE TABLE tdoc(n             NUMBER, 
                  document      BLOB, 
                  attributes    CLOB,
                  mimetype      VARCHAR2(80),
                  format        VARCHAR2(80),
                  contentlength INTEGER)
STORAGE (INITIAL 100K NEXT 100K PCTINCREASE 0);

INSERT INTO tdoc VALUES(1, EMPTY_BLOB(), EMPTY_CLOB(), NULL, NULL, NULL);
INSERT INTO tdoc VALUES(2, EMPTY_BLOB(), EMPTY_CLOB(), NULL, NULL, NULL);
INSERT INTO tdoc VALUES(3, EMPTY_BLOB(), EMPTY_CLOB(), NULL, NULL, NULL);
INSERT INTO tdoc VALUES(4, EMPTY_BLOB(), EMPTY_CLOB(), NULL, NULL, NULL);
COMMIT;

getProperties( ) for BLOBs

Format

getProperties(ctx IN OUT RAW,

docBlob IN BLOB,

attributes IN OUT NOCOPY CLOB,

format IN VARCHAR2);

Description

Reads the document BLOB data to get the values of the media attributes, and then stores them in the input CLOB. This method populates the CLOB with an extensive set of format and application properties in XML form.

Parameters

ctx

The format plug-in context information.

docBlob

The document data represented as a BLOB.

attributes

The CLOB to hold the XML attribute information generated by the getProperties( ) method. This CLOB is populated with an extensive set of format and application properties of the document BLOB data in XML form.

format

The format of the document data. If a non-NULL value is specified, then the format plug-in for this format type is invoked.

Usage Notes

None.

Pragmas

None.

Exceptions

ORDDocExceptions.DOC_PLUGIN_EXCEPTION

This exception is raised if you call the getProperties( ) method and the document plug-in raises an exception.

ORDSourceExceptions.EMPTY_SOURCE

This exception is raised when the value of the source.local attribute is 1 or 0 (TRUE), but the value of the source.localData attribute is NULL.

Examples

Get the property information for known document attributes:

DECLARE
  doc_attrib CLOB;
  ctx RAW(64) :=NULL;
  doc_data BLOB;
  doc_format VARCHAR2(160) := NULL;

BEGIN
    SELECT document,attributes INTO doc_data,doc_attrib FROM tdoc WHERE N = 1 FOR UPDATE;
   ORDSYS.ORDDoc.getProperties(ctx, doc_data, doc_attrib, doc_format);

   DBMS_OUTPUT.put_line('Size of XML Annotations ' ||
                   TO_CHAR(DBMS_LOB.GETLENGTH(doc_attrib)));
   UPDATE tdoc SET document=doc_data, attributes=doc_attrib WHERE N=1;
   COMMIT;
   EXCEPTION
      WHEN OTHERS THEN
      RAISE;
END;
/


getProperties( ) (all attributes) for BLOBs

Format

getProperties(ctx IN OUT RAW,

docBlob IN BLOB,

attributes IN OUT NOCOPY CLOB,

mimeType OUT VARCHAR2,

format IN OUT VARCHAR2,

contentLength OUT INTEGER);

Description

Reads the document BLOB data to get the values of the media attributes, and then stores them in the input CLOB and returns them as explicit parameters. This method gets the properties for the following attributes of the document data: MIME type, content length, and format. It populates the CLOB with an extensive set of format and application properties in XML form.

Parameters

ctx

The format plug-in context information.

docBlob

The document data represented as a BLOB.

attributes

The CLOB to hold the XML attribute information generated by the getProperties( ) method. This CLOB is populated with an extensive set of format and application properties of the document BLOB data in XML form.

mimeType

The MIME type of the document data.

format

The format of the document data. If a non-NULL value is specified, then the format plug-in for this format type is invoked.

contentLength

The length in bytes of the content.

Usage Notes

If a property cannot be extracted from the media source, then the respective parameter is set to NULL.

Pragmas

None.

Exceptions

ORDDocExceptions.DOC_PLUGIN_EXCEPTION

This exception is raised if you call the getProperties( ) method and the document plug-in raises an exception.

ORDSourceExceptions.EMPTY_SOURCE

This exception is raised when the value of the source.local attribute is 1 or 0 (TRUE), but the value of the source.localData attribute is NULL.

Examples

Get the property information for known document attributes:

DECLARE
  doc_attrib        CLOB;
  ctx               RAW(64) :=NULL;
  doc_data          BLOB;
  doc_mimeType      VARCHAR2(80);
  doc_format        VARCHAR2(32):=NULL;
  doc_contentLength NUMBER;
BEGIN
   SELECT document, attributes, mimetype, format, contentlength INTO doc_data, 
     doc_attrib, doc_mimeType, doc_format, doc_contentLength FROM tdoc 
     WHERE N = 1 FOR UPDATE;

   ORDSYS.ORDDoc.getProperties(ctx, doc_data, doc_attrib, 
                  doc_mimeType, doc_format, doc_contentLength);

   DBMS_OUTPUT.put_line('Size of XML Annotations ' ||
                   TO_CHAR(DBMS_LOB.GETLENGTH(doc_attrib)));
   DBMS_OUTPUT.put_line('mimeType: ' || doc_mimeType );
   DBMS_OUTPUT.put_line('format: ' || doc_format );
   DBMS_OUTPUT.put_line('contentLength: ' || doc_contentLength );
   UPDATE tdoc SET 
     document=doc_data, 
     attributes=doc_attrib, 
     mimetype=doc_mimeType, 
     format=doc_format, 
     contentlength=doc_contentLength 
    WHERE N=1;
   COMMIT;
EXCEPTION
   WHEN OTHERS THEN
   RAISE;
END;
/

getProperties( ) for BFILEs

Format

getProperties(ctx IN OUT RAW,

docBfile IN OUT NOCOPY BFILE,

attributes IN OUT NOCOPY CLOB,

format IN VARCHAR2);

Description

Reads the document BFILE data to get the values of the media attributes, and then stores them in the input CLOB. It populates the CLOB with an extensive set of format and application properties in XML form.

Parameters

ctx

The format plug-in context information.

docBfile

The document data represented as a BFILE.

attributes

The CLOB to hold the XML attribute information generated by the getProperties( ) method. This CLOB is populated with an extensive set of format and application properties of the document BFILE data in XML form.

format

The format of the document data. If a non-NULL value is specified, then the format plug-in for this format type is invoked.

Usage Notes

None.

Pragmas

None.

Exceptions

ORDDocExceptions.DOC_PLUGIN_EXCEPTION

This exception is raised if you call the getProperties( ) method and the document plug-in raises an exception.

ORDSourceExceptions.EMPTY_SOURCE

This exception is raised when the value of the source.local attribute is 1 or 0 (TRUE), but the value of the source.localData attribute is NULL.

Examples

Get the property information for known document attributes:

DECLARE
  doc_attrib CLOB;
  ctx RAW(64) :=NULL;
  doc_data BFILE := BFILENAME('DOCDIR','testvid.dat');
  doc_format VARCHAR2(160) := NULL;
BEGIN
   DBMS_LOB.CREATETEMPORARY(doc_attrib, FALSE, DBMS_LOB.CALL);
   ORDSYS.ORDDoc.getProperties(ctx, doc_data, doc_attrib, doc_format);

   DBMS_OUTPUT.put_line('Size of XML Annotations ' ||
                   TO_CHAR(DBMS_LOB.GETLENGTH(doc_attrib)));
EXCEPTION
   WHEN OTHERS THEN
   RAISE;
END;
/


getProperties( ) (all attributes) for BFILEs

Format

getProperties(ctx IN OUT RAW,

docBfile IN OUT NOCOPY BFILE,

attributes IN OUT NOCOPY CLOB,

mimeType OUT VARCHAR2,

format IN OUT VARCHAR2,

contentLength OUT INTEGER);

Description

Reads the document BFILE data to get the values of the media attributes for supported formats, and then stores them in the input CLOB and returns them as explicit parameters. This method gets the properties for the following attributes of the document data: MIME type, content length, and format. It populates the CLOB with an extensive set of format and application properties in XML form.

Parameters

ctx

The format plug-in context information.

docBfile

The document data represented as a BFILE.

attributes

The CLOB to hold the XML attribute information generated by the getProperties( ) method. This CLOB is populated with an extensive set of format and application properties of the document BFILE data in XML form.

mimeType

The MIME type of the document data.

format

The format of the document data. If a non-NULL value is specified, then the format plug-in for this format type is invoked. If not specified, the derived format is returned.

contentLength

The length in bytes of the content.

Usage Notes

If a property cannot be extracted from the media source, then the respective parameter is set to NULL.

Pragmas

None.

Exceptions

ORDDocExceptions.DOC_PLUGIN_EXCEPTION

This exception is raised if you call the getProperties( ) method and the document plug-in raises an exception.

ORDSourceExceptions.EMPTY_SOURCE

This exception is raised when the value of the source.local attribute is 1 or 0 (TRUE), but the value of the source.localData attribute is NULL.

Examples

Get the property information for known document attributes:

DECLARE
  doc_attrib        CLOB;
  ctx               RAW(64) :=NULL;
  doc_data          BFILE := BFILENAME('DOCDIR','testimg.dat');
  doc_mimeType      VARCHAR2(80);
  doc_format        VARCHAR2(32) := NULL;
  doc_contentLength NUMBER;
BEGIN
   DBMS_LOB.CREATETEMPORARY(doc_attrib, FALSE, DBMS_LOB.CALL);
   ORDSYS.ORDDoc.getProperties(ctx, doc_data, doc_attrib, 
                  doc_mimeType, doc_format, doc_contentLength);
   DBMS_OUTPUT.put_line('Size of XML Annotations ' || TO_CHAR(DBMS_LOB.GETLENGTH(doc_attrib)));
   DBMS_OUTPUT.put_line('mimeType: ' || doc_mimeType );
   DBMS_OUTPUT.put_line('format: ' || doc_format );
   DBMS_OUTPUT.put_line('contentLength: ' || doc_contentLength );
EXCEPTION
   WHEN OTHERS THEN
   RAISE;
END;
/