| java.lang.Object de.danet.an.util.UniversalPrepStmt
UniversalPrepStmt | public class UniversalPrepStmt implements PreparedStatement(Code) | | This class provides a wrapper that can handle special database
requirements. Although suitable for all jdbc-driven database
connections, special features of the following databases
are supported: Oracle, SAPDB and Hypersonic. In addition, all
set/get methods for non-primitives handle null values
correctly.
Additional methods
UniversalPrepStmt.setBinary setBinary and
UniversalPrepStmt.setInt(int,Integer) setInt(int, Integer)
UniversalPrepStmt.setLargeString setLargeString are
provided for convenience.
author: version: $Revision: 1.7 $ |
Constructor Summary | |
public | UniversalPrepStmt(Connection connection, String statement) Creates an instance of UniversalPrepStmt with no
given primary key columns, thus assuming the 1st column of the
insert statement being primary key column. | public | UniversalPrepStmt(DataSource dataSource, Connection connection, String statement) Creates an instance of UniversalPrepStmt with no
given primary key columns, thus assuming the 1st column of the
insert statement being primary key column. | public | UniversalPrepStmt(Connection connection, String statement, String primaryKeyColumns) Creates an instance of UniversalPrepStmt . | public | UniversalPrepStmt(Connection connection, String statement, String[] primaryKeyColumns) Creates an instance of UniversalPrepStmt . | public | UniversalPrepStmt(DataSource dataSource, Connection connection, String statement, String primaryKeyColumns) Creates an instance of UniversalPrepStmt . | public | UniversalPrepStmt(DataSource dataSource, Connection connection, String statement, String[] primaryKeyColumns) Creates an instance of UniversalPrepStmt . |
Method Summary | |
public void | addBatch(String string) Calls the addBatch method on the delegee prepared
statement. | public void | addBatch() Calls the addBatch method on the delegee prepared
statement. | public void | cancel() Calls the cancel method on the delegee prepared statement. | public void | clearBatch() Calls the clearBatch method on the delegee prepared
statement. | public void | clearParameters() Calls the clearParameters method on the delegee prepared
statement. | public void | clearWarnings() Calls the clearWarnings method on the delegee prepared
statement. | public void | close() Calls the close method on the delegee prepared statement. | public boolean | execute(String string) Calls the execute method on the delegee prepared statement.
Throws a UnsupportedOperationException if no delegee is available.
Parameters: string - a String value. | public boolean | execute(String string, int autoGeneratedKeys) Calls the execute method on the delegee prepared statement. | public boolean | execute(String string, int[] columnIndexes) Calls the execute method on the delegee prepared statement. | public boolean | execute(String string, String[] columnNames) Calls the execute method on the delegee prepared statement. | public boolean | execute() Calls the execute method on the delegee prepared
statement. | public int[] | executeBatch() Calls the executeBatch method on the delegee prepared
statement. | public ResultSet | executeQuery(String string) Calls the executeQuery method on the delegee prepared
statement. | public ResultSet | executeQuery() Calls the executeQuery method on the delegee prepared
statement. | public int | executeUpdate(String string) Calls the executeUpdate method on the delegee prepared
statement.
Throws a UnsupportedOperationException if no delegee is available.
Parameters: string - a String value. | public int | executeUpdate(String string, int autoGeneratedKeys) Calls the executeUpdate method on the delegee prepared
statement. | public int | executeUpdate(String string, int[] columnIndexes) Calls the executeUpdate method on the delegee prepared
statement. | public int | executeUpdate(String string, String[] columnNames) Calls the executeUpdate method on the delegee prepared
statement. | public int | executeUpdate() Calls the executeUpdate method on the delegee prepared
statement and then execute the builded selectForUpdate statement to
lob datas. | public Connection | getConnection() Return the database connection. | public int | getFetchDirection() Calls the getFetchDirection method on the delegee prepared
statement. | public int | getFetchSize() Calls the getFetchSize method on the delegee prepared
statement. | public ResultSet | getGeneratedKeys() Calls the getGeneratedKeys method on the delegee prepared
statement. | public int | getMaxFieldSize() Calls the getMaxFieldSize method on the delegee prepared
statement. | public int | getMaxRows() Calls the getMaxRows method on the delegee prepared
statement. | public ResultSetMetaData | getMetaData() Calls the getMetaData method on the delegee prepared
statement. | public boolean | getMoreResults() Calls the getMoreResults method on the delegee prepared
statement. | public boolean | getMoreResults(int current) Calls the getMoreResults method on the delegee prepared
statement. | public ParameterMetaData | getParameterMetaData() Calls the getParameterMetaData method on the
delegee prepared statement. | public int | getQueryTimeout() Calls the getQueryTimeout method on the delegee
prepared statement. | public ResultSet | getResultSet() Calls the getResultSet method on the delegee prepared
statement. | public int | getResultSetConcurrency() Calls the getResultSetConcurrency method on the delegee
prepared statement. | public int | getResultSetHoldability() Calls the getResultSetHoldability method on the
delegee prepared statement. | public int | getResultSetType() Calls the getResultSetType method on the delegee prepared
statement. | public int | getUpdateCount() Calls the getUpdateCount method on the delegee prepared
statement. | public SQLWarning | getWarnings() Calls the getWarnings method on the delegee prepared
statement. | public void | setArray(int n, Array array) Calls the setArray method on the delegee prepared
statement. | public void | setAsciiStream(int n, InputStream inputStream, int n1) Calls the setAsciiStream method on the delegee prepared
statement. | public void | setBigDecimal(int n, BigDecimal bigDecimal) Calls the setBigDecimal method on the delegee prepared
statement. | public void | setBinary(int offset, Object data) Store the object. | public void | setBinaryStream(int n, InputStream inputStream, int n1) Calls
UniversalPrepStmt.setBinaryStream setBinaryStream or
UniversalPrepStmt.setBlob setBlob depends on the driver for the
delegee prepared statement. | public void | setBlob(int n, Blob blob) Calls the setBlob method on the delegee prepared
statement. | public void | setBoolean(int n, boolean flag) Calls the setBoolean method on the delegee prepared
statement. | public void | setByte(int n, byte b) Calls the setByte method on the delegee prepared
statement. | public void | setBytes(int n, byte[] byteArray) Store the object. | public void | setCharacterStream(int n, Reader reader, int n1) Calls the setCharacterStream method on the delegee prepared
statement. | public void | setClob(int n, Clob clob) Calls the setClob method on the delegee prepared
statement. | public void | setCursorName(String string) Calls the setCursorName method on the delegee prepared
statement. | public void | setDate(int n, Date date, Calendar calendar) Calls the setDate method on the delegee prepared
statement. | public void | setDate(int n, Date date) Calls the setDate method on the delegee prepared
statement. | public void | setDouble(int n, double d) Calls the setDouble method on the delegee prepared
statement. | public void | setEscapeProcessing(boolean flag) Calls the setEscapeProcessing method on the delegee
prepared statement. | public void | setFetchDirection(int n) Calls the setFetchDirection method on the delegee prepared
statement. | public void | setFetchSize(int n) Calls the setFetchSize method on the delegee prepared
statement. | public void | setFloat(int n, float f) Calls the setFloat method on the delegee prepared
statement. | public void | setInt(int n, int index) Calls the setInt method on the delegee prepared
statement. | public void | setInt(int offset, Integer value) Calls either setInt or setNull on
the prepared statement, depending on the value of the object
to be stored. | public void | setLargeString(int n, String string) Calls
UniversalPrepStmt.setString setString or
UniversalPrepStmt.setClob setClob depending on the driver for the
delegee prepared statement. | public void | setLong(int n, long l) Calls the setLong method on the delegee prepared
statement. | public void | setLong(int offset, Long value) Calls either setLong or setNull on
the prepared statement, depending on the value of the object
to be stored. | public void | setMaxFieldSize(int n) Calls the setMaxFieldSize method on the delegee prepared
statement. | public void | setMaxRows(int n) Calls the setMaxRows method on the delegee prepared
statement. | public void | setNull(int n, int index) Calls the setNull method on the delegee prepared
statement. | public void | setNull(int n, int n1, String string) Calls the setNull method on the delegee prepared
statement. | public void | setObject(int n, Object object, int n1, int n2) Calls the setObject method on the delegee prepared
statement. | public void | setObject(int n, Object object, int n1) Calls the setObject method on the delegee prepared
statement. | public void | setObject(int n, Object object) Delegates to setLargeString if object
is of type String and the driver requires special
handling of large strings. | public void | setQueryTimeout(int n) Calls the setQueryTimeout method on the delegee
prepared statement. | public void | setRef(int n, Ref ref) Calls the setRef method on the delegee prepared
statement. | public void | setShort(int n, short s) Calls the setShort method on the delegee prepared
statement. | public void | setString(int n, String string) Calls the setString method on the delegee prepared
statement. | public void | setTime(int n, Time time, Calendar calendar) Calls the setTime method on the delegee prepared
statement. | public void | setTime(int n, Time time) Calls the setTime method on the delegee prepared
statement. | public void | setTimestamp(int n, Timestamp timestamp) Calls the setTimestamp method on the delegee prepared
statement. | public void | setTimestamp(int n, Timestamp timestamp, Calendar calendar) Calls the setTimestamp method on the delegee prepared
statement. | public void | setURL(int parameterIndex, URL x) Calls the setURL method on the delegee prepared
statement. | public void | setUnicodeStream(int n, InputStream inputStream, int n1) Calls the setUnicodeStream method on the delegee prepared
statement. |
UniversalPrepStmt | public UniversalPrepStmt(Connection connection, String statement) throws IllegalArgumentException, SQLException(Code) | | Creates an instance of UniversalPrepStmt with no
given primary key columns, thus assuming the 1st column of the
insert statement being primary key column. NOTE: In this case,
only insert statements without column name listings (format:
INSERT INTO ) are supported. An internal
delegee prepared statement is generated using the given
connection for the supported databases.
Parameters: connection - the connection to be used to generate the delegeePrepareStatement. Parameters: statement - the statement to be executed. throws: IllegalArgumentException - if the statement cannot be parsed. throws: SQLException - if an error occurs.
UniversalPrepStmt | public UniversalPrepStmt(DataSource dataSource, Connection connection, String statement) throws IllegalArgumentException, SQLException(Code) | | Creates an instance of UniversalPrepStmt with no
given primary key columns, thus assuming the 1st column of the
insert statement being primary key column. NOTE: In this case,
only insert statements without column name listings (format:
INSERT INTO ) are supported. An internal
delegee prepared statement is generated using the given
connection for the supported databases.
Parameters: dataSource - used for caching properties of the database Parameters: connection - the connection to be used to generate the delegeePrepareStatement. Parameters: statement - the statement to be executed. throws: IllegalArgumentException - if the statement cannot be parsed. throws: SQLException - if an error occurs.
UniversalPrepStmt | public UniversalPrepStmt(Connection connection, String statement, String primaryKeyColumns) throws IllegalArgumentException, SQLException(Code) | | Creates an instance of UniversalPrepStmt . An internal
delegee prepared statement is generated using the given connection for
the supported databases.
Parameters: connection - the connection to be used. Parameters: statement - the statement to be executed. Parameters: primaryKeyColumns - the comma separated primary keylist. The column names must be in the same sequence as theyappear in the field list of the insert statement. throws: IllegalArgumentException - if the statement cannot be parsed. throws: SQLException - if an error occurs. |
UniversalPrepStmt | public UniversalPrepStmt(Connection connection, String statement, String[] primaryKeyColumns) throws IllegalArgumentException, SQLException(Code) | | Creates an instance of UniversalPrepStmt . An internal
delegee prepared statement is generated using the given connection for
the supported databases.
Parameters: connection - the connection to be used. Parameters: statement - the statement to be executed. Parameters: primaryKeyColumns - the primary key column name list. Thecolumn names must be in the same sequence as they appear in thefield list of the insert statement. throws: IllegalArgumentException - if the statement cannot be parsed. throws: SQLException - if an error occurs. |
UniversalPrepStmt | public UniversalPrepStmt(DataSource dataSource, Connection connection, String statement, String primaryKeyColumns) throws IllegalArgumentException, SQLException(Code) | | Creates an instance of UniversalPrepStmt . An internal
delegee prepared statement is generated using the given connection for
the supported databases.
Parameters: dataSource - used for caching properties of the database Parameters: connection - the connection to be used. Parameters: statement - the statement to be executed. Parameters: primaryKeyColumns - the comma separated primary keylist. The column names must be in the same sequence as theyappear in the field list of the insert statement. throws: IllegalArgumentException - if the statement cannot be parsed. throws: SQLException - if an error occurs. |
UniversalPrepStmt | public UniversalPrepStmt(DataSource dataSource, Connection connection, String statement, String[] primaryKeyColumns) throws IllegalArgumentException, SQLException(Code) | | Creates an instance of UniversalPrepStmt . An internal
delegee prepared statement is generated using the given connection for
the supported databases.
Parameters: dataSource - used for caching properties of the database Parameters: connection - the connection to be used. Parameters: statement - the statement to be executed. Parameters: primaryKeyColumns - the primary key column name list. Thecolumn names must be in the same sequence as they appear in thefield list of the insert statement. throws: IllegalArgumentException - if the statement cannot be parsed. throws: SQLException - if an error occurs. |
executeUpdate | public int executeUpdate() throws SQLException(Code) | | Calls the executeUpdate method on the delegee prepared
statement and then execute the builded selectForUpdate statement to
lob datas. Throws a UnsupportedOperationException if no delegee is
available.
an int value throws: SQLException - if an error occurs |
setArray | public void setArray(int n, Array array) throws SQLException(Code) | | Calls the setArray method on the delegee prepared
statement. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: n - an int value. Parameters: array - an Array value. throws: SQLException - if an error occurs. See Also: java.sql.PreparedStatement.setArray |
setAsciiStream | public void setAsciiStream(int n, InputStream inputStream, int n1) throws SQLException(Code) | | Calls the setAsciiStream method on the delegee prepared
statement. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: n - an int value Parameters: inputStream - an InputStream value. Parameters: n1 - an int value. throws: SQLException - if an error occurs. See Also: java.sql.PreparedStatement.setAsciiStream |
setBlob | public void setBlob(int n, Blob blob) throws SQLException(Code) | | Calls the setBlob method on the delegee prepared
statement. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: n - an int value. Parameters: blob - a Blob value. throws: SQLException - if an error occurs. See Also: java.sql.PreparedStatement.setBlob |
setBoolean | public void setBoolean(int n, boolean flag) throws SQLException(Code) | | Calls the setBoolean method on the delegee prepared
statement. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: n - an int value. Parameters: flag - a boolean value. throws: SQLException - if an error occurs. See Also: java.sql.PreparedStatement.setBoolean |
setByte | public void setByte(int n, byte b) throws SQLException(Code) | | Calls the setByte method on the delegee prepared
statement. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: n - an int value. Parameters: b - a byte value. throws: SQLException - if an error occurs. See Also: java.sql.PreparedStatement.setByte |
setCharacterStream | public void setCharacterStream(int n, Reader reader, int n1) throws SQLException(Code) | | Calls the setCharacterStream method on the delegee prepared
statement. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: n - an int value. Parameters: reader - a Reader value. Parameters: n1 - an int value. throws: SQLException - if an error occurs. See Also: java.sql.PreparedStatement.setCharacterStream |
setClob | public void setClob(int n, Clob clob) throws SQLException(Code) | | Calls the setClob method on the delegee prepared
statement. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: n - an int value. Parameters: clob - a Clob value. throws: SQLException - if an error occurs. See Also: java.sql.PreparedStatement.setClob |
setDate | public void setDate(int n, Date date, Calendar calendar) throws SQLException(Code) | | Calls the setDate method on the delegee prepared
statement. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: n - an int value. Parameters: date - a Date value. Parameters: calendar - a Calendar value. throws: SQLException - if an error occurs. See Also: java.sql.PreparedStatement.setDate |
setDate | public void setDate(int n, Date date) throws SQLException(Code) | | Calls the setDate method on the delegee prepared
statement. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: n - an int value. Parameters: date - a Date value. throws: SQLException - if an error occurs. See Also: java.sql.PreparedStatement.setDate |
setDouble | public void setDouble(int n, double d) throws SQLException(Code) | | Calls the setDouble method on the delegee prepared
statement. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: n - an int value. Parameters: d - a double value. throws: SQLException - if an error occurs. See Also: java.sql.PreparedStatement.setDouble |
setFloat | public void setFloat(int n, float f) throws SQLException(Code) | | Calls the setFloat method on the delegee prepared
statement. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: n - an int value. Parameters: f - a float value. throws: SQLException - if an error occurs. See Also: java.sql.PreparedStatement.setFloat |
setInt | public void setInt(int n, int index) throws SQLException(Code) | | Calls the setInt method on the delegee prepared
statement. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: n - an int value. Parameters: index - an int value. throws: SQLException - if an error occurs. See Also: java.sql.PreparedStatement.setInt |
setInt | public void setInt(int offset, Integer value) throws SQLException(Code) | | Calls either setInt or setNull on
the prepared statement, depending on the value of the object
to be stored. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: offset - position of paramter in prepared statement. Parameters: value - the value to be stored. throws: SQLException - if a database error occurs. See Also: java.sql.PreparedStatement.setInt |
setLong | public void setLong(int n, long l) throws SQLException(Code) | | Calls the setLong method on the delegee prepared
statement. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: n - an int value. Parameters: l - a long value. throws: SQLException - if an error occurs. See Also: java.sql.PreparedStatement.setLong |
setLong | public void setLong(int offset, Long value) throws SQLException(Code) | | Calls either setLong or setNull on
the prepared statement, depending on the value of the object
to be stored. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: offset - position of paramter in prepared statement. Parameters: value - the value to be stored. throws: SQLException - if a database error occurs. See Also: java.sql.PreparedStatement.setInt |
setNull | public void setNull(int n, int index) throws SQLException(Code) | | Calls the setNull method on the delegee prepared
statement. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: n - an int value. Parameters: index - an int value. throws: SQLException - if an error occurs. See Also: java.sql.PreparedStatement.setNull |
setNull | public void setNull(int n, int n1, String string) throws SQLException(Code) | | Calls the setNull method on the delegee prepared
statement. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: n - an int value. Parameters: n1 - an int value. Parameters: string - a String value. throws: SQLException - if an error occurs. See Also: java.sql.PreparedStatement.setNull |
setObject | public void setObject(int n, Object object, int n1, int n2) throws SQLException(Code) | | Calls the setObject method on the delegee prepared
statement. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: n - an int value. Parameters: object - an Object value. Parameters: n1 - an int value. Parameters: n2 - an int value. throws: SQLException - if an error occurs. See Also: java.sql.PreparedStatement.setObject |
setObject | public void setObject(int n, Object object, int n1) throws SQLException(Code) | | Calls the setObject method on the delegee prepared
statement. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: n - an int value. Parameters: object - an Object value. Parameters: n1 - an int value. throws: SQLException - if an error occurs. See Also: java.sql.PreparedStatement.setObject |
setObject | public void setObject(int n, Object object) throws SQLException(Code) | | Delegates to setLargeString if object
is of type String and the driver requires special
handling of large strings. Else calls the
setObject method on the delegee prepared
statement. Throws a UnsupportedOperationException if no delegee
is available.
Parameters: n - an int value. Parameters: object - an Object value. throws: SQLException - if an error occurs. See Also: java.sql.PreparedStatement.setObject |
setRef | public void setRef(int n, Ref ref) throws SQLException(Code) | | Calls the setRef method on the delegee prepared
statement. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: n - an int value. Parameters: ref - a Ref value. throws: SQLException - if an error occurs. See Also: java.sql.PreparedStatement.setRef |
setShort | public void setShort(int n, short s) throws SQLException(Code) | | Calls the setShort method on the delegee prepared
statement. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: n - an int value. Parameters: s - a short value. throws: SQLException - if an error occurs. See Also: java.sql.PreparedStatement.setShort |
setString | public void setString(int n, String string) throws SQLException(Code) | | Calls the setString method on the delegee prepared
statement. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: n - an int value. Parameters: string - a String value. throws: SQLException - if an error occurs. See Also: java.sql.PreparedStatement.setString |
setTime | public void setTime(int n, Time time, Calendar calendar) throws SQLException(Code) | | Calls the setTime method on the delegee prepared
statement. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: n - an int value. Parameters: time - a Time value. Parameters: calendar - a Calendar value. throws: SQLException - if an error occurs. See Also: java.sql.PreparedStatement.setTime |
setTime | public void setTime(int n, Time time) throws SQLException(Code) | | Calls the setTime method on the delegee prepared
statement. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: n - an int value. Parameters: time - a Time value. throws: SQLException - if an error occurs. See Also: java.sql.PreparedStatement.setTime |
setTimestamp | public void setTimestamp(int n, Timestamp timestamp, Calendar calendar) throws SQLException(Code) | | Calls the setTimestamp method on the delegee prepared
statement. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: n - an int value. Parameters: timestamp - a Timestamp value. Parameters: calendar - a Calendar value. throws: SQLException - if an error occurs. See Also: java.sql.PreparedStatement.setTimestamp |
setURL | public void setURL(int parameterIndex, URL x) throws SQLException(Code) | | Calls the setURL method on the delegee prepared
statement. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: parameterIndex - an int value Parameters: x - an URL value exception: SQLException - if an error occurs. See Also: java.sql.PreparedStatement.setURL |
setUnicodeStream | public void setUnicodeStream(int n, InputStream inputStream, int n1) throws SQLException(Code) | | Calls the setUnicodeStream method on the delegee prepared
statement. Throws a UnsupportedOperationException if no delegee is
available.
Parameters: n - an int value. Parameters: inputStream - an InputStream value. Parameters: n1 - an int value. throws: SQLException - if an error occurs. See Also: java.sql.PreparedStatement.setUnicodeStream |
|
|
|
|