Oracle8i interMedia Audio, Image, and Video Java Client User's Guide and Reference
Release 8.1.5

A67296-01

Library

Product

Contents

Index

Prev Next

3
ORDMultiMedia and BindToTableParams Reference Information

Oracle8i interMedia Audio, Image, and Video Java Client contains information about the ORDMultiMedia:

Oracle8i interMedia Audio, Image, and Video Java Client contains information about the BindToTableParams:

Methods invoked at the ORDMultiMedia level that are handed off for processing to the server-side source plug-in have byte[ ] ctx as a context parameter. The space for the parameter is created by the client (in the reference examples, 4000 bytes of space), but the content of the context parameter is generated by the server. The context parameter is passed from the client to the server for the processing of context information.


Note:

In the current release, not all source plug-ins will use or generate the context parameter, but if you include the parameter as previously described, your application should work with any current or future source plug-in.  


See Oracle8i interMedia Audio, Image, and Video User's Guide and Reference for more information.

3.1 Object Types

Oracle8i interMedia Audio, Image, and Video Java Client describes the ORDMultiMedia object type, which is the abstract superclass for all the other objects, namely ORDAudio, ORDImage, and ORDVideo.

It also describes the BindToTableParams object type, which contains information about binding a client-side object to a database object.


ORDMultiMedia Object Type

The ORDMultiMedia object type contains the common attributes and methods of the ORDAudio, ORDImage, and ORDVideo object types. It is an abstract superclass of ORDAudio, ORDImage, and ORDVideo.


Note:

In the following code, some methods will begin with public. This indicates that the method can be called by all classes in all packages. Other methods are designated protected, which means that the method can be called by all classes in the package, plus all subclasses anywhere. The methods that are not designated as public have the default protection, which means that they can be called only by other methods in the package.  


The object type is defined as follows:

package oracle.ord.media;
import java.sql.*;
import java.io.*;
import oracle.jdbc.driver.*;
import oracle.sql.*;

public abstract class OrdMultiMedia {
     BindToTableParams bindParams; 
     String mediaType; // OrdAudio, OrdVideo, OrdImage
     Connection connection;
     
     OrdSource source;
     String mimeType = "";
     String format = "" ;
     
     protected OrdMultiMedia( )
     { }
     
     abstract String getMediaType( );
     { }
     
     abstract String getFormatStr( )
     { }
     
     abstract String getUpdStr( )
     { }
     
     abstract String getSourceStr( )
     { }
     
     abstract String getContentLengthAPI( )
     { }
     
     public abstract int getContentLength( )
     throws SQLException
     { }
     
     protected void setConnection(Connection the_connection)
     { }
     
     protected Connection getConnection( )
     { }
     
     public void setBindParams(String tableName, String columnName,
          String condition)
     { }
     
     String getSQLConstructor(boolean updateOption, String objName)
     { }
     
     String defineSQLResults(String var)
     { }
     
     int declareSQLResults(int start, OracleCallableStatement stmt)
     throws SQLException
     { }
     
     int getSQLResults(int start, OracleCallableStatement stmt)
     throws SQLException
     { }
     
     String setSQLParams(String var)
     { }
     
     int bindInSQLParams(int start, OracleCallableStatement stmt)
     throws SQLException
     { }
     
     public abstract void refresh(boolean forUpdate)
     throws SQLException
     { }
     
     void setLock(boolean lockOption)
     { }
     
     boolean isLocked( )
     { }
     
     String getUpdateStr(String objName)
     { }
     
     public abstract void flush( )
     throws SQLException
     { }
     
     String getPlSqlStmtBlockTemplate(boolean updateOption, String statement, 
          String objName)
     { }
     
     public String getMimeType( )
     { }
     
     public void setMimeType(String the_mimeType)
     { }
     
     public Timestamp getUpdateTime( )
     { }
     
     public void setUpdateTime( )
     throws SQLException
     { }
     
     public void setFormat(String the_format)
     { }
     
     public String getFormat( )
     { }
     
     OrdSource getSourceObject( )
     { }
     
     public String getSource( )
     { }
     
     public void setSource(String type, String loc, String name)
     { }
     
     public String getSourceType( )
     { }
     
     public String getSourceLocation( )
     { }
     
     public String getSourceName( )
     { }
     
     public void importData(byte[ ] ctx)
     throws SQLException
     { }
     
     public void importFrom(byte[ ] ctx, String type, String loc,
          String name)
     throws SQLException
     { }
     
     public void export(byte[ ] ctx, String type, String loc, String name)
     throws SQLException
     { }
     
     public BLOB getContent( )
     throws SQLException
     { }
     
     public int getContentLength(byte[ ] ctx)
     throws SQLException
     { }
     
     public void deleteContent( )
     throws SQLException
     { }
     
     public byte[ ] getData(String tableName, String columnName,
          String condition)
     throws SQLException, OutOfMemoryError
     { }
     
     public byte[ ] getData( )
     throws SQLException, OutOfMemoryError
     { }
     
     public void getDataInFile(String fileName)
     throws SQLException, IOException
     { }
     
     public InputStream getDataInStream( )
     throws SQLException
     { }
     
     public boolean loadData(String fileName, String tableName,
          String columnName, String condition)
     throws SQLException, FileNotFoundException, IOException
     { }
     
     public boolean loadData(String filename)
     throws SQLException, IOException, SecurityException
     { }
     
     boolean loadDataInChunks(String filename, int fileLength)
     throws SQLException, IOException
     { }
     
     public void setLocal( )
     { }
     
     public void clearLocal( )
     { }
     
     public boolean isLocal( )
     { }
     
     public int getContentLength( )
     throws SQLException
     { }
     
     public BFILE getBFILE( )
     throws SQLException
     { }
     
     public void setSourceInformation(String sourceType,
          String sourceLocation, String sourceName)
     { }
}

where the class attributes are defined as:


BindToTableParams Object Type

The BindToTableParams object type contains information about binding a client-side object to a database object.


Note:

In the following code, the methods begin with public. This indicates that the method can be called by all classes in all packages.  


The object type is defined as follows:

package oracle.ord.media;

public class BindToTableParams {
     String tableName;
     String columnName;
     String dataCondition;
     
     public BindToTableParams( )
     { }
     
     public String getTableName( )
     { }
     
     public String getColumnName( )
     { }
     
     public String getDataCondition( )
     { }
     
     public void setTableName(String the_tableName)
     { }
     
     public void setColumnName(String the_columnName)
     { }
     
     public void setDataCondition(String the_dataCondition)
     { }
}

where the class attributes are defined as:

3.2 ORDMultiMedia Methods

This section presents reference information on the methods contained in the ORDMultiMedia superclass. These methods are described in the following groupings:

ORDMultiMedia Methods Associated with the bindParams Attribute

ORDMultiMedia Methods Associated with the connection Attribute

ORDMultiMedia Methods Associated with the source Attribute

ORDMultiMedia Methods Associated with the mimeType Attribute

ORDMultiMedia Methods Associated with the format Attribute

ORDMultiMedia Methods Associated with the updateTime attribute

ORDMultiMedia Methods Associated with the Media Type

ORDMultiMedia Methods Associated with the Content Length

ORDMultiMedia Methods Associated with Communication Between the Client and Server

ORDMultiMedia Methods Associated with Locking

ORDMultiMedia Methods Associated with the SQL Type

ORDMultiMedia Methods Associated with Generating SQL Queries

ORDMultiMedia Methods Associated with the Media Data

3.2.1 ORDMultiMedia Methods Associated with the bindParams Attribute

This section presents reference information on the ORDMultiMedia methods associated with the bindParams attribute.

The methods described in this reference chapter show examples based on the instantiation of an ORDMultiMedia object. For the examples in Section 3.2.1 through Section 3.2.13, please consult the following code:

import oracle.ord.media.mediaClass;

public class clientProgram {
     public static void main(String[ ] args){
          The code in the examples appears here
     }
}

mediaClass can add features to audio, image, or video.


setBindParams( ) Method

Format

public void setBindParams(String tableName, String columnName,
                          String condition)

Scope

public

Description

Sets the data location parameters, also known as binding parameters, which will be used to bind the client-side proxy object to the server-side object.

The client-side proxy object is bound to a server-side object that resides in an object of a relational table. This method sets the binding parameters for the proxy object with the server-side object.

The parameters must point to a unique interMedia object in the database.

Parameters

tableName

The name of the table to which the object will be bound.

columnName

The name of the column in the table to which the object will be bound. The column must contain interMedia objects.

condition

The select condition on the table, used to identify the row to which the object will be bound.

Returns

None.

Exceptions

None.

Usage

mediaClass mediaObject = new mediaObject(connection);
.
.
.
mediaObject.setBindParams("audioTable", "song", "songID = 3");

where:

3.2.2 ORDMultiMedia Methods Associated with the connection Attribute

This section presents reference information on the ORDMultiMedia methods associated with the connection attribute.

See Section 3.2.1 for additional code required to run the example code.


setConnection( ) Method

Format

protected void setConnection(Connection the_connection)

Scope

protected

Description

Sets the connection with the database.

Parameter

the_connection

The connection instance.

Returns

None.

Exceptions

None.

Usage

Do not use this method unless you are extending the package.


getConnection( ) Method

Format

protected Connection getConnection( )

Scope

protected

Description

Gets the connection with the database.

Parameter

None.

Returns

This method returns the connection attribute.

Exceptions

None.

Usage

Do not use this method unless you are extending the package.

3.2.3 ORDMultiMedia Methods Associated with the source Attribute

This section presents reference information on the ORDMultiMedia methods associated with the source attribute.

See Section 3.2.1 for additional code required to run the example code.


getSourceObject( ) Method

Format

OrdSource getSourceObject( )

Scope

package

Description

Gets the client-side ORDSource object.

Parameter

None.

Returns

This method returns the ORDSource attribute.

Exceptions

None.

Usage

Do not use this method unless you are extending the package.


setSource( ) Method

Format

public void setSource(String type, String loc, String name)

Scope

public

Description

Sets the client-side ORDMultiMedia object source information, which is of the form srcType://srcLocation/srcName.

Parameters

type

The source type (for example, FILE or HTTP).

loc

The source location.

name

The source name.

Returns

None.

Exceptions

None.

Usage

mediaClass mediaObject = new mediaObject(connection);
.
.
.
mediaObject.setSource("file", "ORDIMGDIR", "jdoe.gif");

where:


getSource( ) Method

Format

public String getSource( )

Scope

public

Description

Gets the client-side ORDMultiMedia object source information, which is of the form srcType://srcLocation/srcName.

Parameter

None.

Returns

This method returns the source information.

Exceptions

None.

Usage

mediaClass mediaObject = new mediaObject(connection);
.
.
.
String srcStr = mediaObject.getSource( );

setSourceInformation( ) Method

Format

public void setSourceInformation(String sourceType, String sourceLocation, 
                               String sourceName)

Scope

public

Description

Sets the source-related attribute values of the client-side ORDMultiMedia object.

Parameters

sourceType

The type of the source.

sourceLocation

The location of the source.

sourceName

The name of the source.

Returns

None.

Exceptions

None.

Usage

mediaClass mediaObject = new mediaObject(connection);
.
.
.
mediaObject.setSourceInformation("file", "ORDIMGDIR", "jdoe.gif");

where:


getSourceType( ) Method

Format

public String getSourceType( )

Scope

public

Description

Gets the source type information of the client-side ORDMultiMedia object.

Parameter

None.

Returns

This method returns the source type information.

Exceptions

None.

Usage

mediaClass mediaObject = new mediaObject(connection);
.
.
.
String srcType = mediaObject.getSourceType( );

getSourceLocation( ) Method

Format

public String getSourceLocation( )

Scope

public

Description

Gets the source location information of the client-side ORDMultiMedia object.

Parameter

None.

Returns

This method returns the source location information.

Exceptions

None.

Usage

mediaClass mediaObject = new mediaObject(connection);
.
.
.
String str = mediaObject.getSourceLocation( );

getSourceName( ) Method

Format

public String getSourceName( )

Scope

public

Description

Gets the source name information of the client-side ORDMultiMedia object.

Parameter

None.

Returns

This method returns the source name information.

Exceptions

None.

Usage

mediaClass mediaObject = new mediaObject(connection);
.
.
.
String str = mediaObject.getSourceName( );

importData( ) Method

Format

public void importData(byte[ ] ctx)
throws SQLException

Scope

public

Description

Imports data from the source information into the server-side ORDMultiMedia object. The source information is provided in the attributes of the server-side ORDMultiMedia object.

Parameter

ctx

The source plug-in context information.

Returns

None.

Exceptions

java.sql.SQLException

Usage

try{
     byte[ ] ctx = new byte[4000];
     mediaClass mediaObject = new mediaObject(connection);
     .
     .
     .
     mediaObject.importData(ctx);
}
catch(SQLException e){
     .
     .
     .
}

where:


importFrom( ) Method

Format

public void importFrom(byte[ ] ctx, String type, String loc, String name)
throws SQLException

Scope

public

Description

Imports data from the source information into the server-side ORDMultiMedia object. The source information in provided in the parameters.

Parameters

ctx

The source plug-in context information.

type

The source type.

loc

The source location.

name

The source name.

Returns

None.

Exceptions

java.sql.SQLException

Usage

try{
     mediaClass mediaObject = new mediaObject(connection);
     byte[ ] ctx = new byte[4000];
     .
     .
     .
     mediaObject.importFrom(ctx, "HTTP", "directory1", "file");
}
catch(SQLException e){
     .
     .
     .
}

where:


export( ) Method

Format

public void export(byte[ ] ctx, String type, String loc, String name)
throws SQLException

Scope

public

Description

Exports the data in the server-side ORDMultiMedia object localData attribute to the target specified in the parameters.

Currently this method is not supported at the server side, so the client raises an exception.

Parameters

ctx

The source plug-in context information.

type

The source type.

loc

The source location.

name

The source name.

Returns

None.

Exceptions

java.sql.SQLException

Usage

try{
     mediaClass mediaObject = new mediaObject(connection);
     byte[ ] ctx = new byte[4000];
     .
     .
     .
     mediaObject.export(ctx, "HTTP", "directory1", "file");
}
catch(SQLException e){
     .
     .
     .
}

where:


getContent( ) Method

Format

public BLOB getContent( )
throws SQLException

Scope

public

Description

Copy the BLOB from the server side to the client side and return the LOB locator from the client cache.

Parameter

None.

Returns

This method returns the LOB locator where the content of the multimedia object is stored.

Exceptions

java.sql.SQLException

Usage

try{
     mediaClass mediaObject = new mediaObject(connection);
     .
     .
     .
     BLOB blob = mediaObject.getContent( );
}
catch(SQLException e){
     .
     .
     .
}

getContentLength(byte[ ]) Method

Format

public int getContentLength(byte[ ] ctx)
throws SQLException

Scope

public

Description

Returns the content length of the media data.

Parameter

ctx

The source plug-in context information.

Returns

This method returns the length of the data content of the media object.

Exceptions

java.sql.SQLException

Usage

try{
     mediaClass mediaObject = new mediaObject(connection);
     byte[ ] ctx = new byte[4000];
     .
     .
     .
     int length = mediaObject.getContentLength(ctx);
}
catch(SQLException e){
     .
     .
     .
}

where:


getContentLength( ) Method

Format

public int getContentLength( )
throws SQLException

Scope

public

Description

Gets the content length of the source localData attribute.

Parameter

None.

Returns

This method returns the content length of the source data.

Exceptions

java.sql.SQLException

Usage

try{
     mediaClass mediaObject = new mediaObject(connection);
     .
     .
     .
     int i = mediaObject.getContentLength( );
}
catch(SQLException e){
     .
     .
     .
}

deleteContent( ) Method

Format

public void deleteContent( )
throws SQLException

Scope

public

Description

Deletes the media data in the server-side ORDMultiMedia object.

Parameter

None.

Returns

None.

Exceptions

java.sql.SQLException

Usage

try{
     mediaClass mediaObject = new mediaObject(connection);
     .
     .
     .
     mediaObject.deleteContent( );
}
catch(SQLException e){
     .
     .
     .
}

setLocal( ) Method

Format

public void setLocal( )

Scope

public

Description

Sets the client-side ORDMultiMedia object source local attribute to true, which indicates that the localData attribute is valid.

Parameter

None.

Returns

None.

Exceptions

None.

Usage

mediaClass mediaObject = new mediaObject(connection);
.
.
.
mediaObject.setLocal( );

clearLocal( ) Method

Format

public void clearLocal( )

Scope

public

Description

Sets the client-side ORDMultiMedia object source local attribute to false.

Parameter

None.

Returns

None.

Exceptions

None.

Usage

mediaClass mediaObject = new mediaObject(connection);
.
.
.
mediaObject.clearLocal( );

isLocal( ) Method

Format

public boolean isLocal( )

Scope

public

Description

Gets the client-side ORDMultiMedia object source local attribute.

Parameter

None.

Returns

This method returns the value of the source local variable.

Exceptions

None.

Usage

mediaClass mediaObject = new mediaObject(connection);
.
.
.
if(mediaObject.isLocal( )){
          system.out.println("Source is local");
};

getBFILE( ) Method

Format

public BFILE getBFILE( )
throws SQLException

Scope

public

Description

Gets the server-side ORDMultiMedia object source BFILE attribute, assuming that srcType="file".

Parameter

None.

Returns

This method returns the BFILE.

Exceptions

java.sql.SQLException

Usage

try{
     mediaClass mediaObject = new mediaObject(connection);
     .
     .
     .
     BFILE bfile = mediaObject.getBFILE( );
}
catch(SQLException e){
     .
     .
     .
}

3.2.4 ORDMultiMedia Methods Associated with the mimeType Attribute

This section presents reference information on the ORDMultiMedia methods associated with the mimeType attribute.

See Section 3.2.1 for additional code required to run the example code.


setMimeType( ) Method

Format

public void setMimeType(String the_mimeType)

Scope

public

Description

Sets the MIME type of the client-side ORDMultiMedia object.

Parameter

the_mimeType

The value of the MIME type in the client-side object cache.

Returns

None.

Exceptions

None.

Usage

mediaClass mediaObject = new mediaObject(connection);
.
.
.
mediaObject.setMimeType("audio/basic");

where:


getMimeType( ) Method

Format

public String getMimeType( )

Scope

public

Description

Gets the MIME type of the client-side ORDMultiMedia object.

Parameter

None.

Returns

This method returns the MIME type value.

Exceptions

None.

Usage

mediaClass mediaObject = new mediaObject(connection);
.
.
.
String mimeType = mediaObject.getMimeType( );

3.2.5 ORDMultiMedia Methods Associated with the format Attribute

This section presents reference information on the ORDMultiMedia methods associated with the format attribute.

See Section 3.2.1 for additional code required to run the example code.


setFormat( ) Method

Format

public void setFormat(String the_format)

Scope

public

Description

Sets the format of the client-side ORDMultiMedia object.

Parameter

the_format

The value of the format.

Returns

None.

Exceptions

None.

Usage

mediaClass mediaObject = new mediaObject(connection);
.
.
.
mediaObject.setFormat("AUFF");

where:


getFormat( ) Method

Format

public String getFormat( )

Scope

public

Description

Gets the format of the client-side ORDMultiMedia object.

Parameter

None.

Returns

This method returns the value of the format stored in the client-side object cache.

Exceptions

None.

Usage

mediaClass mediaObject = new mediaObject(connection);
.
.
.
String sqlStr = mediaObject.getFormat( );

3.2.6 ORDMultiMedia Methods Associated with the updateTime Attribute

This section presents reference information on the ORDMultiMedia methods associated with the updateTime attribute.

See Section 3.2.1 for additional code required to run the example code.


setUpdateTime( ) Method

Format

public void setUpdateTime( )
throws SQLException

Scope

public

Description

Sets the ORDMultiMedia source updateTime attribute to the current time in both the server-side and client-side ORDMultiMedia objects.

Parameter

None.

Returns

None.

Exceptions

java.sql.SQLException

Usage

try{
     mediaClass mediaObject = new mediaObject(connection);
     .
     .
     .
     mediaObject.setUpdateTime( );
}
catch(SQLException e){
     .
     .
     .
}

getUpdateTime( ) Method

Format

public Timestamp getUpdateTime( )

Scope

public

Description

Returns the value of the client-side ORDMultiMedia object source updateTime attribute.

Parameter

None.

Returns

This method returns the source updateTime attribute.

Exceptions

None.

Usage

mediaClass mediaObject = new mediaObject(connection);
.
.
.
String lastUpdateTime = mediaObject.getUpdateTime( );

3.2.7 ORDMultiMedia Methods Associated with the Media Type

This section presents reference information on the ORDMultiMedia methods associated with the media type.

See Section 3.2.1 for additional code required to run the example code.


getMediaType( ) Method

Format

abstract String getMediaType( )

Scope

packaged

Description

Returns the media type information.

This is a virtual method that is defined in the ORDAudio, ORDImage, and ORDVideo subclasses.

Parameter

None.

Returns

This method returns the media type.

Exceptions

None.

Usage

Do not use this method unless you are extending the package.

3.2.8 ORDVideo Methods Associated with the Content Length

This section presents reference information on the ORDVideo methods associated with the content length.

See Section 3.2.1 for additional code required to run the example code.


getContentLength( ) Method

Format

public abstract int getContentLength( )
throws SQLException

Scope

public

Description

Returns the content length.

This is a virtual method that is defined in the ORDAudio and ORDVideo subclasses.

Parameter

None.

Returns

This method returns the content length, in bytes.

Exceptions

java.sql.SQLException

Usage

See "getContentLength( ) Method" in Chapter 4; "getContentLength(byte[ ]) Method" or "getContentLength( ) Method" in Chapter 5; "getContentLength( ) Method" in Chapter 6; or "getContentLength(byte[ ]) Method" or "getContentLength( ) Method" in Chapter 7 for the usage of this method.

3.2.9 ORDMultiMedia Methods Associated with Communication Between the Client and Server

This section presents reference information on the ORDMultiMedia methods associated with communication between the client and server.

See Section 3.2.1 for additional code required to run the example code.


refresh( ) Method

Format

public abstract void refresh(boolean forUpdate)
throws SQLException

Scope

public

Description

Sends information from the server-side media object to the client-side media object with or without locking the database row. See Section 3.2.10 for information on locking.

This is a virtual method that is defined in the ORDAudio, ORDImage, and ORDVideo subclasses.

Parameter

forUpdate

The indicator for whether or not the option will be refreshed for update. If the object is refreshed for update, the value is true. Otherwise, the value is false.

Returns

None.

Exceptions

java.sql.SQLException

Usage

See "refresh( ) Method" in Chapter 5; "refresh( ) Method" in Chapter 6; or
"refresh( ) Method" in Chapter 7 for the usage of this method.


flush( ) Method

Format

public abstract void flush( )
throws SQLException

Scope

public

Description

Sends information from the client-side media object to the server-side media object.

This is a virtual method that is defined in the ORDAudio, ORDImage, and ORDVideo subclasses.

Parameter

None.

Returns

None.

Exceptions

java.sql.SQLException

Usage

See "flush( ) Method" in Chapter 5; "flush( ) Method" in Chapter 6; or
"flush( ) Method" in Chapter 7 for the usage of this method.


getUpdateStr( ) Method

Format

String getUpdateStr(String objName)

Scope

package

Description

Returns the SQL statement to update the ORDMultiMedia object.

Parameter

objName

The object variable name.

Returns

This method returns the SQL string that will update a database instance with the value of the object instance defined in objName.

Exceptions

None.

Usage

Do not use this method unless you are extending the package.

3.2.10 ORDMultiMedia Methods Associated with Locking

This section presents reference information on the ORDMultiMedia methods associated with locking.

See Section 3.2.1 for additional code required to run the example code.


setLock( ) Method

Format

void setLock(boolean lockOption)

Scope

package

Description

Sets the lock.

Parameter

lockOption

The lock value.

Returns

None.

Exceptions

None.

Usage

Do not use this method unless you are extending the package.


isLocked( ) Method

Format

boolean isLocked( )

Scope

package

Description

Gets the value of the lock.

Parameter

None.

Returns

This method returns the value of the lock.

Exceptions

None.

Usage

Do not use this method unless you are extending the package.

3.2.11 ORDMultiMedia Methods Associated with the SQL Type

This section presents reference information on the ORDMultiMedia methods associated with the SQL type.

See Section 3.2.1 for additional code required to run the example code.


getSQLConstructor( ) Method

Format

String getSQLConstructor(boolean updateOption, String objName)

Scope

package

Description

Gets the SQL type constructor for the ORDMultiMedia object, which can be either an ORDAudio, ORDImage, or ORDVideo object.

Parameters

updateOption

The indicator for whether or not the option is to be updated.

objName

The multimedia object variable name.

Returns

This method returns the SQL string that will bind an object instance variable to a database object instance.

Exceptions

None.

Usage

Do not use this method unless you are extending the package.


defineSQLResults( ) Method

Format

String defineSQLResults(String var)

Scope

package

Description

Defines the SQL results that will be used to assign values to the ORDMultiMedia object attributes.

This method is used by the refresh( ) method to assign the server-side object attribute values to the corresponding client-side object attributes.

Parameter

var

The name of the multimedia object variable.

Returns

This method returns the String that will define the SQL results.

Exceptions

None.

Usage

Do not use this method unless you are extending the package.


declareSQLResults( ) Method

Format

int declareSQLResults(int start, OracleCallableStatement stmt)
throws SQLException

Scope

package

Description

Declares types for the SQL results corresponding to the different ORDMultiMedia object attributes.

This method is used by the refresh( ) method to declare the types of the client-side object attributes needed for assigning values to those attributes corresponding to the server-side object attributes.

Parameters

start

The position in the statement where the binding begins.

stmt

The Oracle callable statement that will be executed on the server side.

Returns

This method returns an integer defined as position + 1, where position is the last index in the statement for which the type was declared.

Exceptions

java.sql.SQLException

Usage

Do not use this method unless you are extending the package.


getSQLResults( ) Method

Format

int getSQLResults(int start, OracleCallableStatement stmt)
throws SQLException

Scope

package

Description

Gets the SQL results to assign to the attributes of the ORDMultiMedia object (for example, mimeType or format).

This method is used by the refresh( ) method to assign the server-side object attribute values to the corresponding client-side object attributes.

Parameters

start

The initial position in the statement to get the results.

stmt

The Oracle callable statement that has been executed on the server side.

Returns

This method returns the position in the statement from which the next result can be fetched.

Exceptions

java.sql.SQLException

Usage

Do not use this method unless you are extending the package.


setSQLParams( ) Method

Format

String setSQLParams(String var)

Scope

package

Description

Sets the values of the SQL type of the ORDMultiMedia object as parameters.

This method is used by the flush( ) method to set the values of the different attributes of the server-side object with the client-side attributes.

Parameter

var

The name of the multimedia object variable.

Returns

This method returns the SQL string that will set the different attributes of the ORDMultiMedia object.

Exceptions

None.

Usage

Do not use this method unless you are extending the package.


bindInSQLParams( ) Method

Format

int bindInSQLParams(int start, OracleCallableStatement stmt)
throws SQLException

Scope

package

Description

Binds the values of the SQL type of the ORDMultiMedia object.

This method is used by the flush( ) method to set the values of the different attributes of the server-side object with the client-side attributes.

Parameters

start

The position in the statement where the binding begins.

stmt

The Oracle callable statement which is to be executed on the server side.

Returns

This method returns an integer defined as position + 1, where position is the last index in the statement to which a value was bound.

Exceptions

java.sql.SQLException

Usage

Do not use this method unless you are extending the package.


getPlSqlStmtBlockTemplate( ) Method

Format

String getPlSqlStmtBlockTemplate(boolean updateOption,
                                           String statement,
                                           String objName)

Scope

package

Description

Returns a code template for executing a PL/SQL statement.

Parameters

updateOption

The indicator for whether or not the statement requires a lock.

statement

The PL/SQL statement to be embedded in the code template.

objName

The PL/SQL variable name for the multimedia object.

Returns

This method returns the SQL string that will contain the PL/SQL DECLARE... BEGIN... END statement block.

Exceptions

None.

Usage

Do not use this method unless you are extending the package.

3.2.12 ORDVideo Methods Associated with Generating SQL Queries

This section presents reference information on the ORDVideo methods associated with generating SQL queries.

See Section 3.2.1 for additional code required to run the example code.


getFormatStr( ) Method

Format

abstract String getFormatStr( )

Scope

package

Description

Returns the format String, which is used by other methods to generate SQL queries.

This is a virtual method that is defined in the ORDAudio, ORDImage, and ORDVideo subclasses.

Parameter

None.

Returns

This method returns the format String.

Exceptions

None.

Usage

Do not use this method unless you are extending the package.


getUpdStr( ) Method

Format

abstract String getUpdStr( )

Scope

package

Description

Returns the SQL string that is used to update an instance, which is used by other methods to generate SQL queries.

This is a virtual method that is defined in the ORDAudio, ORDImage, and ORDVideo subclasses.

Parameter

None.

Returns

This method returns the SQL string that is used to update an instance.

Exceptions

None.

Usage

Do not use this method unless you are extending the package.


getSourceStr( ) Method

Format

abstract String getSourceStr( )

Scope

package

Description

Returns the source String, which is used by other methods to generate SQL queries.

This is a virtual method that is defined in the ORDAudio, ORDImage, and ORDVideo subclasses.

Parameter

None.

Returns

This method returns the source String.

Exceptions

None.

Usage

Do not use this method unless you are extending the package.


getContentLengthAPI( ) Method

Format

abstract String getContentLengthAPI( )

Scope

package

Description

Returns the server-side contentLength API for this class, which is used by other methods to generate SQL queries.

This is a virtual method that is defined in the ORDAudio, ORDImage, and ORDVideo subclasses.

Parameter

None.

Returns

This method returns the server-side contentLength API for this class.

Exceptions

None.

Usage

Do not use this method unless you are extending the package.

3.2.13 ORDMultiMedia Methods Associated with the Media Data

This section presents reference information on the ORDMultiMedia methods associated with the media data.

See Section 3.2.1 for additional code required to run the example code.


getData(String, String, String) Method

Format

public byte[ ] getData(String tableName, String columnName,
                      String condition)
throws SQLException, OutOfMemoryError

Scope

public

Description

Returns the BLOB data of the server-side ORDMultiMedia object as a byte array, given the table name, the column name, and the data condition.

If the data cannot fit into the main memory at any one point in time, then this method raises an OutOfMemory error. In this case, the application program can catch the exception and call the getDataInFile( ) method, which will download the data in the BLOB into a file.

Parameters

tableName

The name of the table from which to get the data.

columnName

The name of the column from which to get the data.

condition

The selection condition to identify the row from which to get the data.

Returns

This method returns the byte array containing the BLOB data.

Exceptions

java.sql.SQLException

java.lang.OutOfMemoryError

Usage

try{
     mediaClass mediaObject = new mediaObject(connection);
     .
     .
     .
     byte[ ] data = mediaObject.getData("audioTable", "song", "songID = 3");
}
catch(SQLException e){
     .
     .
     .
}
catch(OutOfMemoryError oum){
     .
     .
     .
}

where:


getData( ) Method

Format

public byte[ ] getData( )
throws SQLException, OutOfMemoryError

Scope

public

Description

Returns the BLOB data of the server-side ORDMultiMedia object as a byte array.

The bindParams attribute is used to locate the data in the database. It reads the length of the data content in the BLOB, reads the data in chunks of 32,300 bytes, and writes the data into a byte array. The method returns this byte array.

See "setBindParams( ) Method" for information on setting the binding parameters.

If the data cannot fit into the main memory at any one point in time, then this method raises an OutOfMemory error. In this case, the application program can call the getDataInFile( ) method, which will download the data in the BLOB into a file.

Parameter

None.

Returns

This method returns the byte array containing the BLOB data.

Exceptions

java.sql.SQLException

java.lang.OutOfMemoryError

Usage

try{
     mediaClass mediaObject = new mediaObject(connection);
     .
     .
     .
     byte[ ] data = mediaObject.getData( );
}
catch(SQLException e){
     .
     .
     .
}
catch(OutOfMemoryError oum){
     .
     .
     .
}

getDataInFile( ) Method

Format

public void getDataInFile(String fileName)
throws SQLException, IOException

Scope

public

Description

Puts the server-side ORDMultiMedia object BLOB data into a file whose name is provided in the parameter.

Parameter

fileName

The name of the file where the media data will be stored.

Returns

None.

Exceptions

java.sql.SQLException

java.io.IOException

Usage

try{
     mediaClass mediaObject = new mediaObject(connection);
     .
     .
     .
     mediaObject.getDataInFile(file);
}
catch(SQLException e){
     .
     .
     .
}
catch(IOException io){
     .
     .
     .
}

where:


getDataInStream( ) Method

Format

public InputStream getDataInStream( )
throws SQLException

Scope

public

Description

Returns the server-side ORDMultiMedia object media data as an InputStream object.

Parameters

None.

Returns

This method returns the media data, as an InputStream object.

Exceptions

java.sql.SQLException

Usage

try{
     mediaClass mediaObject = new mediaObject(connection);
     .
     .
     .
     InputStream mediaStream = mediaObject.getDataInFile( );
}
catch(SQLException e){
     .
     .
     .
}


loadData(String, String, String, String) Method

Format

public boolean loadData(String fileName, String tableName,
                        String columnName, String condition)
throws SQLException, FileNotFoundException, IOException

Scope

public

Description

Loads the server-side ORDMultiMedia object media data into a BLOB that is identified by the parameters tableName, columnName, and condition.

Parameters

fileName

The file from which the data will be loaded.

tableName

The name of the table into which the data will be loaded.

columnName

The name of the column into which the data will be loaded.

condition

The selection condition to identify the row into which the data will be loaded.

Returns

This method returns true if successful; false otherwise.

Exceptions

java.sql.SQLException

java.io.FileNotFoundException

java.io.IOException

Usage

try{
     mediaClass mediaObject = new mediaObject(connection);
     .
     .
     .
     if(mediaObject.loadData("file", "audioTable", "song", "songID = 3")){
          system.out.println("Loading is successful");
     }
}
catch(SQLException e){
     .
     .
     .
}
catch(FileNotFoundException fnf){
     .
     .
     .
}
catch(IOException io){
     .
     .
     .
}

where:


loadData(String) Method

Format

public boolean loadData(String fileName)
throws SQLException, IOException, SecurityException

Scope

public

Description

Loads the server-side ORDMultiMedia object media data from a given file into a media object designated by the binding parameters.

Parameters

fileName

The file from which the data will be loaded.

Returns

This method returns true if the loading is successful; false otherwise.

Exceptions

java.sql.SQLException

java.io.IOException

java.lang.SecurityException

Usage

try{
     mediaClass mediaObject = new mediaObject(connection);
     .
     .
     .
     if(mediaObject.loadData("jdoe.gif")){
          system.out.println("Loading is successful.");
     }
}
catch(SQLException e){
     .
     .
     .
}
catch(OutOfMemoryError oum){
     .
     .
     .
}
catch(IOException io){
     .
     .
     .
}
catch(SecurityException s){
     .
     .
     .
}

where:


loadDataInChunks( ) Method

Format

boolean loadDataInChunks(String fileName, int fileLength)
throws SQLException, IOException

Scope

package

Description

Loads the server-side ORDMultiMedia object media data in chunks of 32K bytes at a time from a given file into a media object that is designated by the binding parameters.

This method is called by loadData( ) if the data file to be loaded is too large to fit into the memory.

Parameters

fileName

The file from which the data will be loaded.

fileLength

The total length of the file, in bytes.

Returns

This method returns true if loading is successful; false otherwise.

Exceptions

java.sql.SQLException

java.io.IOException

Usage

Do not use this method unless you are extending the package.

3.3 BindToTableParams Methods

This section presents reference information on the methods contained in the BindToTableParams class. These methods are described in the following groupings:

BindToTableParams Methods Associated with the tableName Attribute

BindToTableParams Methods Associated with the columnName Attribute

BindToTableParams Methods Associated with the dataCondition Attribute

3.3.1 BindToTableParams Methods Associated with the tableName Attribute

This section presents reference information on the BindToTableParams methods associated with the tableName attribute.


setTableName( ) Method

Format

public void setTableName(String the_tableName)

Scope

public

Description

Sets the table name.

Parameter

the_tableName

The table name.

Returns

None.

Exceptions

None.

Usage

None.


getTableName( ) Method

Format

public String getTableName( )

Scope

public

Description

Gets the table name to which the client object is bound.

Parameter

None.

Returns

This method returns the table name.

Exceptions

None.

Usage

None.

3.3.2 BindToTableParams Methods Associated with the columnName Attribute

This section presents reference information on the BindToTableParams methods associated with the columnName attribute.


setColumnName( ) Method

Format

public void setColumnName(String the_columnName)

Scope

public

Description

Sets the column name.

Parameter

the_columnName

The column name.

Returns

None.

Exceptions

None.

Usage

None.


getColumnName( ) Method

Format

public String getColumnName( )

Scope

public

Description

Gets the column name to which the client object is bound.

Parameter

None.

Returns

This method returns the column name.

Exceptions

None.

Usage

None.

3.3.3 BindToTableParams Methods Associated with the dataCondition Attribute

This section presents reference information on the BindToTableParams methods associated with the dataCondition attribute.


setDataCondition( ) Method

Format

public void setDataCondition(String the_dataCondition)

Scope

public

Description

Sets the data condition.

Parameter

the_dataCondition

The data condition.

Returns

None.

Exceptions

None.

Usage

None.


getDataCondition( ) Method

Format

public String getDataCondition( )

Scope

public

Description

Gets the select condition of the row on the server-side object to which the client-side object is bound.

Parameter

None.

Returns

This method returns the data condition.

Exceptions

None.

Usage

None.




Prev

Next
Oracle
Copyright © 1999 Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index