SetStringDatabase Class

com.bea.p13n.util.jdbc
SetStringDatabase Class

public class SetStringDatabase

    extends GenericDatabase

Hierarchy
Object
  GenericDatabase
    SetStringDatabase
All Implemented Interfaces

Database

Constructor Summary

SetStringDatabase(Connection connection)

 

Method Summary

public boolean
commitConnection(Connection connection)
public String
getClob(ResultSet rs, int index)
Get the value of a CLOB column as a string.
public String
getName()
The name of this GenericDatabase instance.
public void
setClob(PreparedStatement stmt, int index, String str)
Set the value of a CLOB column with a string.
public boolean
setClob(PreparedStatement stmt, int index, Clob clob, String str)
If there is a delegate, this method uses JdbcHelperDelegate.writeClobData() If this is done, then the PreparedStatement does not need to be used and the return value, executeRequired, is false.
 
Methods from  com.bea.p13n.util.jdbc.GenericDatabase
accept, close, close, close, close, close, close, close, close, close, createPreparedStatement, endBlob, endClob, getApplicationName, getBlob, getBlobLocator, getClobLocator, getClobTableName, getConnection, getEmptyBlobInitializer, getEmptyClobInitializer, getProperty, printSqlWarning, readFromClob, readFromClob, startBlob, startClob, writeToClob, writeToClob
 
Methods from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
   
Methods from interface com.bea.p13n.util.jdbc.Database
accept, close, close, close, close, close, close, close, close, close, commitConnection, endBlob, endClob, getApplicationName, getBlob, getBlobLocator, getClob, getClobLocator, getConnection, getEmptyBlobInitializer, getEmptyClobInitializer, getName, readFromClob, setClob, setClob, startBlob, startClob, writeToClob
 

Constructor Detail

SetStringDatabase

public SetStringDatabase(Connection connection)
 

Method Detail

commitConnection(Connection) Method

public boolean commitConnection(Connection connection)
throws SQLException
Overrides
GenericDatabase.commitConnection(Connection)

Exceptions

SQLException

getClob(ResultSet, int) Method

public String getClob(ResultSet rs, 
                      int index)
throws SQLException
Description copied from Database.getClob(ResultSet, int)
Get the value of a CLOB column as a string.

This method will only return the value of the CLOB in the current row of the ResultSet. This method does not increment the ResultSet cursor. You must use ResultSet.next() to increment the cursor before calling this method. This allows the method to be used to process multi-row ResultSets.

If no JdbcHelperDelegate is specified in the console (configured via JdbcHelperMBean) then this method will return a string obtained using the default method that was used before a delegate model was implemented for this class. That method uses Clob.getCharacterStream() to construct a BufferedReader that is read in with the readLine() method.

Overrides
GenericDatabase.getClob(ResultSet, int)

Parameters

rs
the result set.
index
the column index in the result set.

Returns

the column as a string.

Exceptions

SQLException

getName() Method

public String getName()
Description copied from GenericDatabase.getName()
The name of this GenericDatabase instance.

Overrides
GenericDatabase.getName()

Returns

the name of the database

setClob(PreparedStatement, int, String) Method

public void setClob(PreparedStatement stmt, 
                    int index, 
                    String str)
throws SQLException
Description copied from Database.setClob(PreparedStatement, int, String)
Set the value of a CLOB column with a string.

Overrides
GenericDatabase.setClob(PreparedStatement, int, String)

Parameters

stmt
the prepared statement.
index
the column index.
str
the CLOB string.

Exceptions

SQLException

setClob(PreparedStatement, int, Clob, String) Method

public boolean setClob(PreparedStatement stmt, 
                       int index, 
                       Clob clob, 
                       String str)
throws SQLException
Description copied from Database.setClob(PreparedStatement, int, Clob, String)
If there is a delegate, this method uses JdbcHelperDelegate.writeClobData() If this is done, then the PreparedStatement does not need to be used and the return value, executeRequired, is false. The CLOB should be first located with getClobLocator() If there is no delegate, then this method ignores the Clob argument and sets the value of the String into the CLOB placeholder in the PreparedStatement with setClob(PreparedStatement stmt, int index, String str) and returns executeRequired = true.

WARNING: if using a delegate to stream data to a CLOB, then you should have used Connection.setAutoCommit(false) before calling the CLOB locator method that provided the Clob you are using in this method call. This will make the CLOB available across multiple SQL statements.

Overrides
GenericDatabase.setClob(PreparedStatement, int, Clob, String)

Parameters

stmt
the prepared statement.
index
the column index.
clob
the CLOB locator (ignored if no delegate).
str
the String to be set in the CLOB (if delegate) or in the PreparedStatement (if no delegate)

Returns

boolean executeRequired. If false then a delegate was used to directly set the CLOB in the database without using the PreparedStatement. If true then no delegate was used, or the delegate set the Clob value on the statement and the PreparedStatement must be executed to update the database.

Exceptions

SQLException