Package org.apache.openjpa.jdbc.kernel
Class PreparedStatementManagerImpl
java.lang.Object
org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl
- All Implemented Interfaces:
PreparedStatementManager
- Direct Known Subclasses:
BatchingPreparedStatementManagerImpl
Basic prepared statement manager implementation.
- Author:
- Abe White
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Connection
protected final DBDictionary
protected final Collection<Exception>
protected Log
protected final JDBCStore
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected int
executeUpdate
(PreparedStatement stmnt, String sql, RowImpl row) This method is to provide override for non-JDBC or JDBC-like implementation of executing update.void
flush()
This method must be called after the last row has been flushed, to flush any remaining statements.void
Flush the given row.protected void
flushAndUpdate
(RowImpl row) Flush the given row immediately.protected void
flushInternal
(RowImpl row) Flush the given row.protected String[]
getAutoAssignColNames
(Column[] autoAssign, RowImpl row) protected Column[]
Return the exceptions encountered during all flushes.getGeneratedKeys
(PreparedStatement stmnt, String[] autoAssignColNames) This method will only be called when the database supports getGeneratedKeys.getGeneratedKeys
(PreparedStatement stmnt, DBIdentifier[] autoAssignColNames) protected void
Provided the JDBC log category is logging warnings, this method will log any SQL warnings that result from the execution of a SQL statement.protected void
logSQLWarnings
(Statement stmt) populateAutoAssignCols
(PreparedStatement stmnt, Column[] autoAssign, String[] autoAssignColNames, RowImpl row) populateAutoAssignCols
(PreparedStatement stmnt, Column[] autoAssign, DBIdentifier[] autoAssignColNames, RowImpl row) This method will only be called when there is auto assign columns.protected PreparedStatement
prepareStatement
(String sql) This method is to provide override for non-JDBC or JDBC-like implementation of preparing statement.protected PreparedStatement
prepareStatement
(String sql, String[] autoAssignColNames) This method is to provide override for non-JDBC or JDBC-like implementation of preparing statement.protected void
setObjectId
(List vals, Column[] autoAssign, String[] autoAssignColNames, RowImpl row) protected void
setObjectId
(List vals, Column[] autoAssign, DBIdentifier[] autoAssignColNames, RowImpl row)
-
Field Details
-
_store
-
_conn
-
_dict
-
_log
-
_exceptions
-
-
Constructor Details
-
PreparedStatementManagerImpl
Constructor. Supply connection.
-
-
Method Details
-
getExceptions
Description copied from interface:PreparedStatementManager
Return the exceptions encountered during all flushes.- Specified by:
getExceptions
in interfacePreparedStatementManager
-
flush
Description copied from interface:PreparedStatementManager
Flush the given row.- Specified by:
flush
in interfacePreparedStatementManager
-
flushInternal
Flush the given row.- Throws:
SQLException
-
flushAndUpdate
Flush the given row immediately.- Throws:
SQLException
-
populateAutoAssignCols
protected List<Object> populateAutoAssignCols(PreparedStatement stmnt, Column[] autoAssign, DBIdentifier[] autoAssignColNames, RowImpl row) throws SQLException This method will only be called when there is auto assign columns. If database supports getGeneratedKeys, the keys will be obtained from the result set associated with the stmnt. If not, a separate sql to select the key will be issued from DBDictionary.- Throws:
SQLException
-
populateAutoAssignCols
protected List<Object> populateAutoAssignCols(PreparedStatement stmnt, Column[] autoAssign, String[] autoAssignColNames, RowImpl row) throws SQLException - Throws:
SQLException
-
setObjectId
protected void setObjectId(List vals, Column[] autoAssign, String[] autoAssignColNames, RowImpl row) throws SQLException - Throws:
SQLException
-
setObjectId
protected void setObjectId(List vals, Column[] autoAssign, DBIdentifier[] autoAssignColNames, RowImpl row) throws SQLException - Throws:
SQLException
-
getGeneratedKeys
protected List<Object> getGeneratedKeys(PreparedStatement stmnt, String[] autoAssignColNames) throws SQLException This method will only be called when the database supports getGeneratedKeys.- Throws:
SQLException
-
getGeneratedKeys
protected List<Object> getGeneratedKeys(PreparedStatement stmnt, DBIdentifier[] autoAssignColNames) throws SQLException - Throws:
SQLException
-
getAutoAssignColumns
-
getAutoAssignColNames
-
flush
public void flush()Description copied from interface:PreparedStatementManager
This method must be called after the last row has been flushed, to flush any remaining statements.- Specified by:
flush
in interfacePreparedStatementManager
-
executeUpdate
This method is to provide override for non-JDBC or JDBC-like implementation of executing update.- Throws:
SQLException
-
prepareStatement
This method is to provide override for non-JDBC or JDBC-like implementation of preparing statement.- Throws:
SQLException
-
prepareStatement
protected PreparedStatement prepareStatement(String sql, String[] autoAssignColNames) throws SQLException This method is to provide override for non-JDBC or JDBC-like implementation of preparing statement.- Throws:
SQLException
-
logSQLWarnings
Provided the JDBC log category is logging warnings, this method will log any SQL warnings that result from the execution of a SQL statement. -
logSQLWarnings
-