org.afcs.warts.handlers
Class LobDataHandlerSupport

java.lang.Object
  extended byorg.afcs.warts.handlers.DataHandlerSupport
      extended byorg.afcs.warts.handlers.LobDataHandlerSupport
Direct Known Subclasses:
OracleBlobHandler, OracleClobHandler

public abstract class LobDataHandlerSupport
extends DataHandlerSupport

The LobDataHandlerSupport implements the postProcessBind(java.sql.Connection, java.util.List, java.lang.Object) method on behalf of subclasses, factoring out common code and requiring the subclasses to implement a new abstract method writeLobValue(java.sql.ResultSet, java.lang.Object).

LICENSE: This code is released to the public domain and may be used for any purpose whatsoever without permission or acknowledgment.

Version:
Last Modified 26 August 2003
Author:
Warren Hedley ( whedley at sdsc dot edu )

Constructor Summary
LobDataHandlerSupport(TableDescription tableDescription, ColumnDescription columnDescription)
          Constructs a new instance on behalf of subclasses that will handle data values for the specified column.
 
Method Summary
 void postProcessBind(java.sql.Connection connection, java.util.List primaryKeyValues, java.lang.Object value)
          This method does absolutely nothing, and needs to be overridden by subclasses that actually do require bind post-processing when writing data to the database.
 boolean requiresBindPostProcessing()
          This method always returns true, as LOB data handlers always need to do bind post-processing to write non-null data into the database.
 boolean requiresStreamedLoading()
          This method always returns true, as LOB data is always streamed.
protected abstract  void writeLobValue(java.sql.ResultSet results, java.lang.Object newLobValue)
          This method is responsible for writing the specified LOB value (which differs in type depending on whether it is a CLOB or a BLOB) to the first column in the specified result set, which should contain a newly initialized LOB locator.
 
Methods inherited from class org.afcs.warts.handlers.DataHandlerSupport
getColumnDescription, getNullType, getTableDescription, isCharacterData, isNullHandler, loadBytesFromStream, logWrongValueTypeWarning, toString, verifyObjectIsString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LobDataHandlerSupport

public LobDataHandlerSupport(TableDescription tableDescription,
                             ColumnDescription columnDescription)
Constructs a new instance on behalf of subclasses that will handle data values for the specified column.

Parameters:
tableDescription - The table that the handler will be handling data for.
columnDescription - The column that this class will be processing data for.
Method Detail

postProcessBind

public void postProcessBind(java.sql.Connection connection,
                            java.util.List primaryKeyValues,
                            java.lang.Object value)
                     throws java.sql.SQLException
This method does absolutely nothing, and needs to be overridden by subclasses that actually do require bind post-processing when writing data to the database.

Overrides:
postProcessBind in class DataHandlerSupport
Parameters:
connection - The database connection to use.
primaryKeyValues - The primary key values identifying the row that the specified value has to be written to.
value - The value to write to the database.
Throws:
java.sql.SQLException - If a SQL error occurs during binding.

requiresBindPostProcessing

public boolean requiresBindPostProcessing()
This method always returns true, as LOB data handlers always need to do bind post-processing to write non-null data into the database.

Overrides:
requiresBindPostProcessing in class DataHandlerSupport
Returns:
Always true.

requiresStreamedLoading

public boolean requiresStreamedLoading()
This method always returns true, as LOB data is always streamed.

Overrides:
requiresStreamedLoading in class DataHandlerSupport
Returns:
Always true.

writeLobValue

protected abstract void writeLobValue(java.sql.ResultSet results,
                                      java.lang.Object newLobValue)
                               throws java.sql.SQLException
This method is responsible for writing the specified LOB value (which differs in type depending on whether it is a CLOB or a BLOB) to the first column in the specified result set, which should contain a newly initialized LOB locator.

Parameters:
results - The result set containing the CLOB locator.
newLobValue - The new LOB value.
Throws:
java.sql.SQLException - If a SQL error occurs during update.