Package org.apache.openjpa.lib.jdbc
Class LoggingConnectionDecorator.LoggingConnection
- java.lang.Object
-
- org.apache.openjpa.lib.jdbc.DelegatingConnection
-
- org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.LoggingConnection
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,java.sql.Connection
,java.sql.Wrapper
,Closeable
- Enclosing class:
- LoggingConnectionDecorator
protected class LoggingConnectionDecorator.LoggingConnection extends DelegatingConnection
Logging connection.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
LoggingConnectionDecorator.LoggingConnection.LoggingCallableStatement
CallableStatement decorated with logging.protected class
LoggingConnectionDecorator.LoggingConnection.LoggingDatabaseMetaData
Metadata wrapper that logs actions.protected class
LoggingConnectionDecorator.LoggingConnection.LoggingPreparedStatement
protected class
LoggingConnectionDecorator.LoggingConnection.LoggingResultSet
Warning-handling result set.protected class
LoggingConnectionDecorator.LoggingConnection.LoggingStatement
Statement wrapper that logs SQL to the parent data source and remembers the last piece of SQL to be executed on it.
-
Constructor Summary
Constructors Constructor Description LoggingConnection(java.sql.Connection conn)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
commit()
protected java.sql.Statement
createStatement(boolean wrap)
Create a statement, with the option of not wrapping it in aDelegatingStatement
, which is the default.protected java.sql.Statement
createStatement(int type, int concurrency, boolean wrap)
Create a statement, with the option of not wrapping it in aDelegatingStatement
, which is the default.protected java.sql.Statement
createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean wrap)
protected java.sql.DatabaseMetaData
getMetaData(boolean wrap)
Return the metadata, with the option of not wrapping it in aDelegatingDatabaseMetaData
, which is the default.protected java.sql.CallableStatement
prepareCall(java.lang.String sql, boolean wrap)
Prepare a call, with the option of not wrapping it in aDelegatingCallableStatement
, which is the default.protected java.sql.PreparedStatement
prepareStatement(java.lang.String sql, boolean wrap)
Prepare a statement, with the option of not wrapping it in aDelegatingPreparedStatement
, which is the default.protected java.sql.PreparedStatement
prepareStatement(java.lang.String sql, int[] columnIndexes, boolean wrap)
protected java.sql.PreparedStatement
prepareStatement(java.lang.String sql, int autoGeneratedKeys, boolean wrap)
protected java.sql.PreparedStatement
prepareStatement(java.lang.String sql, int rsType, int rsConcur, boolean wrap)
Prepare a statement, with the option of not wrapping it in aDelegatingPreparedStatement
, which is the default.protected java.sql.PreparedStatement
prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean wrap)
protected java.sql.PreparedStatement
prepareStatement(java.lang.String sql, java.lang.String[] columnNames, boolean wrap)
void
releaseSavepoint(java.sql.Savepoint savepoint)
void
rollback()
void
rollback(java.sql.Savepoint savepoint)
java.sql.Savepoint
setSavepoint()
java.sql.Savepoint
setSavepoint(java.lang.String name)
-
Methods inherited from class org.apache.openjpa.lib.jdbc.DelegatingConnection
abort, appendInfo, clearWarnings, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStatement, createStatement, createStatement, createStruct, equals, getAutoCommit, getCatalog, getClientInfo, getClientInfo, getDelegate, getHoldability, getInnermostDelegate, getMetaData, getNetworkTimeout, getSchema, getTransactionIsolation, getTypeMap, getWarnings, hashCode, isClosed, isReadOnly, isValid, isWrapperFor, nativeSQL, prepareCall, prepareCall, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, setAutoCommit, setCatalog, setClientInfo, setClientInfo, setHoldability, setNetworkTimeout, setReadOnly, setSchema, setTransactionIsolation, setTypeMap, toString, unwrap
-
-
-
-
Method Detail
-
prepareStatement
protected java.sql.PreparedStatement prepareStatement(java.lang.String sql, boolean wrap) throws java.sql.SQLException
Description copied from class:DelegatingConnection
Prepare a statement, with the option of not wrapping it in aDelegatingPreparedStatement
, which is the default.- Overrides:
prepareStatement
in classDelegatingConnection
- Throws:
java.sql.SQLException
-
prepareStatement
protected java.sql.PreparedStatement prepareStatement(java.lang.String sql, int rsType, int rsConcur, boolean wrap) throws java.sql.SQLException
Description copied from class:DelegatingConnection
Prepare a statement, with the option of not wrapping it in aDelegatingPreparedStatement
, which is the default.- Overrides:
prepareStatement
in classDelegatingConnection
- Throws:
java.sql.SQLException
-
createStatement
protected java.sql.Statement createStatement(boolean wrap) throws java.sql.SQLException
Description copied from class:DelegatingConnection
Create a statement, with the option of not wrapping it in aDelegatingStatement
, which is the default.- Overrides:
createStatement
in classDelegatingConnection
- Throws:
java.sql.SQLException
-
createStatement
protected java.sql.Statement createStatement(int type, int concurrency, boolean wrap) throws java.sql.SQLException
Description copied from class:DelegatingConnection
Create a statement, with the option of not wrapping it in aDelegatingStatement
, which is the default.- Overrides:
createStatement
in classDelegatingConnection
- Throws:
java.sql.SQLException
-
prepareCall
protected java.sql.CallableStatement prepareCall(java.lang.String sql, boolean wrap) throws java.sql.SQLException
Description copied from class:DelegatingConnection
Prepare a call, with the option of not wrapping it in aDelegatingCallableStatement
, which is the default.- Overrides:
prepareCall
in classDelegatingConnection
- Throws:
java.sql.SQLException
-
commit
public void commit() throws java.sql.SQLException
- Specified by:
commit
in interfacejava.sql.Connection
- Overrides:
commit
in classDelegatingConnection
- Throws:
java.sql.SQLException
-
rollback
public void rollback() throws java.sql.SQLException
- Specified by:
rollback
in interfacejava.sql.Connection
- Overrides:
rollback
in classDelegatingConnection
- Throws:
java.sql.SQLException
-
close
public void close() throws java.sql.SQLException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfacejava.sql.Connection
- Overrides:
close
in classDelegatingConnection
- Throws:
java.sql.SQLException
-
setSavepoint
public java.sql.Savepoint setSavepoint() throws java.sql.SQLException
- Specified by:
setSavepoint
in interfacejava.sql.Connection
- Overrides:
setSavepoint
in classDelegatingConnection
- Throws:
java.sql.SQLException
-
setSavepoint
public java.sql.Savepoint setSavepoint(java.lang.String name) throws java.sql.SQLException
- Specified by:
setSavepoint
in interfacejava.sql.Connection
- Overrides:
setSavepoint
in classDelegatingConnection
- Throws:
java.sql.SQLException
-
rollback
public void rollback(java.sql.Savepoint savepoint) throws java.sql.SQLException
- Specified by:
rollback
in interfacejava.sql.Connection
- Overrides:
rollback
in classDelegatingConnection
- Throws:
java.sql.SQLException
-
releaseSavepoint
public void releaseSavepoint(java.sql.Savepoint savepoint) throws java.sql.SQLException
- Specified by:
releaseSavepoint
in interfacejava.sql.Connection
- Overrides:
releaseSavepoint
in classDelegatingConnection
- Throws:
java.sql.SQLException
-
createStatement
protected java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean wrap) throws java.sql.SQLException
- Overrides:
createStatement
in classDelegatingConnection
- Throws:
java.sql.SQLException
-
prepareStatement
protected java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean wrap) throws java.sql.SQLException
- Overrides:
prepareStatement
in classDelegatingConnection
- Throws:
java.sql.SQLException
-
prepareStatement
protected java.sql.PreparedStatement prepareStatement(java.lang.String sql, int autoGeneratedKeys, boolean wrap) throws java.sql.SQLException
- Overrides:
prepareStatement
in classDelegatingConnection
- Throws:
java.sql.SQLException
-
prepareStatement
protected java.sql.PreparedStatement prepareStatement(java.lang.String sql, int[] columnIndexes, boolean wrap) throws java.sql.SQLException
- Overrides:
prepareStatement
in classDelegatingConnection
- Throws:
java.sql.SQLException
-
prepareStatement
protected java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.String[] columnNames, boolean wrap) throws java.sql.SQLException
- Overrides:
prepareStatement
in classDelegatingConnection
- Throws:
java.sql.SQLException
-
getMetaData
protected java.sql.DatabaseMetaData getMetaData(boolean wrap) throws java.sql.SQLException
Description copied from class:DelegatingConnection
Return the metadata, with the option of not wrapping it in aDelegatingDatabaseMetaData
, which is the default.- Overrides:
getMetaData
in classDelegatingConnection
- Throws:
java.sql.SQLException
-
-