© 2005 BEA Systems, Inc.

com.bea.p13n.util.jdbc
Interface JdbcHelperDelegate


public interface JdbcHelperDelegate

Interface for the JdbcHelperDelegate, which is used to delegate CLOB read/write operations for specific database drivers.


Method Summary
 void commitConnection(Connection con)
          Deprecated. Commits the java.sql.Connection that you have been using for CLOB operations.
 Clob getClobLocator(Connection con, String tableName, String clobColumnName, String whereClause)
          Deprecated. Retrieve the LOB locator for a CLOB.
 String getEmptyClobInitializer()
          Deprecated. Return the database specific keyword that must be used when inserting a row with an empty CLOB.
 String readClobData(ResultSet rs, int index)
          Deprecated. Retrieve CLOB value as a String of Unicode characters.
 boolean writeClobData(PreparedStatement stmt, int index, Clob clob, String str)
          Deprecated. Write to a CLOB.
 

Method Detail

commitConnection

public void commitConnection(Connection con)
                      throws SQLException
Deprecated. 
Commits the java.sql.Connection that you have been using for CLOB operations. A CLOB becomes inactive as soon as a transaction is committed. You must have auto-commit=false on your connection if you need to have a CLOB available across multiple SQL statements.

The delegate may implement this as a no-op method if it is illegal to do a Connection.commit() for the driver (e.g., jDriver for Oracle XA)

Parameters:
con - the Connection
Throws:
SQLException - on an error

getClobLocator

public Clob getClobLocator(Connection con,
                           String tableName,
                           String clobColumnName,
                           String whereClause)
                    throws SQLException
Deprecated. 
Retrieve the LOB locator for a CLOB. The method creates a PreparedStatement from the specified parameters and gets the LOB locator from the ResultSet.

This method only returns a single CLOB locator. If the WHERE clause results in mutiple rows, only the CLOB from the first row is returned.

Parameters:
con - the database connection
tableName - the name of the database table
clobColumnName - the name of the column holding the CLOB
whereClause - the where clause (without WHERE keyword)
Returns:
a CLOB locator, return null if the ResultSet is empty
Throws:
SQLException - on an error

getEmptyClobInitializer

public String getEmptyClobInitializer()
                               throws SQLException
Deprecated. 
Return the database specific keyword that must be used when inserting a row with an empty CLOB. For example, the method returns EMPTY_CLOB() when the database is Oracle.

Returns:
keyword required to insert an empty CLOB, return empty String if not supported
Throws:
SQLException - on an error

readClobData

public String readClobData(ResultSet rs,
                           int index)
                    throws SQLException
Deprecated. 
Retrieve CLOB value as a String of Unicode characters.

Parameters:
rs - the resultset containing the clob
index - the position of the clob in the resultset
Returns:
the value of the CLOB as a String.
Throws:
SQLException - on an error

writeClobData

public boolean writeClobData(PreparedStatement stmt,
                             int index,
                             Clob clob,
                             String str)
                      throws SQLException
Deprecated. 
Write to a CLOB. Write the input stream containing the ASCII data associated with the passed String to the CLOB's output stream. Streams support for updating CLOB columns is not addressed by JDBC 2.0 so this method uses an extension implemented in the delegate.

Parameters:
stmt - the PreparedStatement
index - the paramater index
clob - the CLOB locator
str - the string value
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.
Throws:
SQLException - on an error

© 2005 BEA Systems, Inc.

Copyright © 2005 BEA Systems, Inc. All Rights Reserved