Expresso 5-6

com.jcorporate.expresso.core.dbobj
Class LOBSupport

java.lang.Object
  extended bycom.jcorporate.expresso.core.dbobj.LOBSupport

Deprecated. since Expresso 5.3 the ways it worked on LOBs wasn't remotely efficient and has been replaced by the implementation in com.jcorporate.expresso. core.dataobjects.jdbc.LOBField

public class LOBSupport
extends Object

Many databases support arbitrarily large objects. The problem with large objects is that their symantics are significantly different compared to other standard database fields. Specifically some highlighted differences are:

To support this, LOB Support is designed to provide several facilities to assist with this:

Delayed Loading: The LOBSupport class is activated by DBObjects only when a LOB data field's data is requested.

Separate command execution The LOBSupport executes a second statement to the database in the form of a PreparedStatement to retrieve all the Large Objects

Transaction usage IF supported If the JDBC driver indicates it supports transactions, LOBSupport will automatically attempt to setAutoCommit(false) and call explitic commit()s. If you are already within a transaction, LOBSupport will not attempt to get another transaction

Usage

Most often you would not use this class directly, but instead call the similar DBObject method calls. However, sometimes access to the lower level capabilities of these functions are useful for performance sake and therefore...

Since:
$DatabaseSchema $Date: 2004/11/17 20:48:11 $
Author:
Michael Rimov
See Also:
com.jcorporate.expresso.core.dataobjcets.jdbc.LOBField,

Modify by Yves Henri AMAIZO


Field Summary
protected static LOBSupport theInstance
          Deprecated.  
 
Constructor Summary
protected LOBSupport()
          Deprecated. Default Constructor
 
Method Summary
protected  void finalizeUpdate(DBConnection theConnection)
          Deprecated.  
 byte[] getBLOB(DBObject baseObject, String fieldName, DBConnection theConnection)
          Deprecated. Returns a single stream for a LOB object.
 String getCLOB(DBObject baseObject, String fieldName)
          Deprecated.  
 String getCLOB(DBObject baseObject, String fieldName, DBConnection theConnection)
          Deprecated. Retrieves the CLOB data for the specified DBObject and the specified fieldName
static LOBSupport getInstance()
          Deprecated. Singleton implementation.
protected  void prepSelectResultSet(DBObject baseObject, String fieldName, DBConnection theConnection)
          Deprecated. Internal helper function that does the guts of the work
protected  PreparedStatement prepUpdate(DBObject baseObject, String fieldName, DBConnection theConnection)
          Deprecated. Internal helper function to prepare a LOB update
 void setBLOB(DBObject baseObject, String fieldName, byte[] theData, DBConnection theConnection)
          Deprecated. Updates the underlying table with a BLOB object.
 void setBLOB(DBObject baseObject, String fieldName, InputStream theData, int dataLength, DBConnection theConnection)
          Deprecated. Updates the underlying table with a BLOB object.
 void setCLOB(DBObject baseObject, String fieldName, String theData, DBConnection theConnection)
          Deprecated. Writes a LONG Character string to the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theInstance

protected static LOBSupport theInstance
Deprecated. 
Constructor Detail

LOBSupport

protected LOBSupport()
Deprecated. 
Default Constructor

Method Detail

getInstance

public static LOBSupport getInstance()
Deprecated. 
Singleton implementation. Use this to get to the LOB helper functions

Returns:
an instantiated LOBSupport class

getCLOB

public String getCLOB(DBObject baseObject,
                      String fieldName)
               throws DBException
Deprecated. 
Throws:
DBException

getCLOB

public String getCLOB(DBObject baseObject,
                      String fieldName,
                      DBConnection theConnection)
               throws DBException
Deprecated. 
Retrieves the CLOB data for the specified DBObject and the specified fieldName

Parameters:
baseObject - The dbobject containing all the table information, and key fields set.
fieldName - The name of the field to retrieve as a LOB.
theConnection - a DBConnection object that has already been retrieved from the DBConnectionPool May be null although it's not recommended for performance.
Returns:
an array of bytes that will contain the BLOB
Throws:
DBException - if there's an error executing the statement

setCLOB

public void setCLOB(DBObject baseObject,
                    String fieldName,
                    String theData,
                    DBConnection theConnection)
             throws DBException
Deprecated. 
Writes a LONG Character string to the database.

Parameters:
baseObject - The object that contains the metadata for this BLOB
fieldName - the name of the field that is the BLOB field
theData - the data in a String
theConnection - an already allocated DBConnection object Currently may not be null
Throws:
DBException - upon error

getBLOB

public byte[] getBLOB(DBObject baseObject,
                      String fieldName,
                      DBConnection theConnection)
               throws DBException
Deprecated. 
Returns a single stream for a LOB object. This single LOB object is not wrapped by any javax.activation code and therefore is strictly up to the code creator on how to use the Input Stream.

Parameters:
baseObject - The dbobject containing all the table information, and key fields set.
fieldName - The name of the field to retrieve as a LOB.
theConnection - a DBConnection object that has already been retrieved from the DBConnectionPool
Returns:
an array of bytes that will contain the BLOB
Throws:
DBException - if there's an error executing the statement

setBLOB

public void setBLOB(DBObject baseObject,
                    String fieldName,
                    byte[] theData,
                    DBConnection theConnection)
             throws DBException
Deprecated. 
Updates the underlying table with a BLOB object.

Parameters:
baseObject - The object that contains the metadata for this BLOB
fieldName - the name of the field that is the BLOB field
theData - the data in a byte array
theConnection - an already allocated DBConnection object
Throws:
DBException - upon error

setBLOB

public void setBLOB(DBObject baseObject,
                    String fieldName,
                    InputStream theData,
                    int dataLength,
                    DBConnection theConnection)
             throws DBException
Deprecated. 
Updates the underlying table with a BLOB object. Same as the byte[] method but uses InputStreams intead

Parameters:
baseObject - The object that contains the metadata for this BLOB
fieldName - the name of the field that is the BLOB field
theData - the data as an InputStream
dataLength - the total length to be read from the InputStream
theConnection - an already allocated DBConnection object
Throws:
DBException - upon error

prepSelectResultSet

protected void prepSelectResultSet(DBObject baseObject,
                                   String fieldName,
                                   DBConnection theConnection)
                            throws DBException
Deprecated. 
Internal helper function that does the guts of the work

Parameters:
baseObject - The object that contains the metadata for this BLOB
fieldName - the name of the field that is the BLOB field
theConnection - an already allocated DBConnection object. This function modifies the state of theConnection by allocating a prepared statement
Throws:
DBException - upon error

Modify by Yves Henri AMAIZO

Since:
$DatabaseSchema $Date: 2004/11/17 20:48:11 $

prepUpdate

protected PreparedStatement prepUpdate(DBObject baseObject,
                                       String fieldName,
                                       DBConnection theConnection)
                                throws DBException
Deprecated. 
Internal helper function to prepare a LOB update

Parameters:
baseObject - The object that contains the metadata for this BLOB
fieldName - the name of the field that is the BLOB field
theConnection - an already allocated DBConnection object
Returns:
a created PreparedStatement object
Throws:
DBException - Modify by Yves Henri AMAIZO
Since:
$DatabaseSchema $Date: 2004/11/17 20:48:11 $

finalizeUpdate

protected void finalizeUpdate(DBConnection theConnection)
                       throws DBException
Deprecated. 
Throws:
DBException

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.