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 classLoggingConnectionDecorator.LoggingConnection.LoggingCallableStatementCallableStatement decorated with logging.protected classLoggingConnectionDecorator.LoggingConnection.LoggingDatabaseMetaDataMetadata wrapper that logs actions.protected classLoggingConnectionDecorator.LoggingConnection.LoggingPreparedStatementprotected classLoggingConnectionDecorator.LoggingConnection.LoggingResultSetWarning-handling result set.protected classLoggingConnectionDecorator.LoggingConnection.LoggingStatementStatement 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 voidclose()voidcommit()protected java.sql.StatementcreateStatement(boolean wrap)Create a statement, with the option of not wrapping it in aDelegatingStatement, which is the default.protected java.sql.StatementcreateStatement(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.StatementcreateStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean wrap)protected java.sql.DatabaseMetaDatagetMetaData(boolean wrap)Return the metadata, with the option of not wrapping it in aDelegatingDatabaseMetaData, which is the default.protected java.sql.CallableStatementprepareCall(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.PreparedStatementprepareStatement(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.PreparedStatementprepareStatement(java.lang.String sql, int[] columnIndexes, boolean wrap)protected java.sql.PreparedStatementprepareStatement(java.lang.String sql, int autoGeneratedKeys, boolean wrap)protected java.sql.PreparedStatementprepareStatement(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.PreparedStatementprepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean wrap)protected java.sql.PreparedStatementprepareStatement(java.lang.String sql, java.lang.String[] columnNames, boolean wrap)voidreleaseSavepoint(java.sql.Savepoint savepoint)voidrollback()voidrollback(java.sql.Savepoint savepoint)java.sql.SavepointsetSavepoint()java.sql.SavepointsetSavepoint(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.SQLExceptionDescription copied from class:DelegatingConnectionPrepare a statement, with the option of not wrapping it in aDelegatingPreparedStatement, which is the default.- Overrides:
prepareStatementin classDelegatingConnection- Throws:
java.sql.SQLException
-
prepareStatement
protected java.sql.PreparedStatement prepareStatement(java.lang.String sql, int rsType, int rsConcur, boolean wrap) throws java.sql.SQLExceptionDescription copied from class:DelegatingConnectionPrepare a statement, with the option of not wrapping it in aDelegatingPreparedStatement, which is the default.- Overrides:
prepareStatementin classDelegatingConnection- Throws:
java.sql.SQLException
-
createStatement
protected java.sql.Statement createStatement(boolean wrap) throws java.sql.SQLExceptionDescription copied from class:DelegatingConnectionCreate a statement, with the option of not wrapping it in aDelegatingStatement, which is the default.- Overrides:
createStatementin classDelegatingConnection- Throws:
java.sql.SQLException
-
createStatement
protected java.sql.Statement createStatement(int type, int concurrency, boolean wrap) throws java.sql.SQLExceptionDescription copied from class:DelegatingConnectionCreate a statement, with the option of not wrapping it in aDelegatingStatement, which is the default.- Overrides:
createStatementin classDelegatingConnection- Throws:
java.sql.SQLException
-
prepareCall
protected java.sql.CallableStatement prepareCall(java.lang.String sql, boolean wrap) throws java.sql.SQLExceptionDescription copied from class:DelegatingConnectionPrepare a call, with the option of not wrapping it in aDelegatingCallableStatement, which is the default.- Overrides:
prepareCallin classDelegatingConnection- Throws:
java.sql.SQLException
-
commit
public void commit() throws java.sql.SQLException- Specified by:
commitin interfacejava.sql.Connection- Overrides:
commitin classDelegatingConnection- Throws:
java.sql.SQLException
-
rollback
public void rollback() throws java.sql.SQLException- Specified by:
rollbackin interfacejava.sql.Connection- Overrides:
rollbackin classDelegatingConnection- Throws:
java.sql.SQLException
-
close
public void close() throws java.sql.SQLException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfacejava.sql.Connection- Overrides:
closein classDelegatingConnection- Throws:
java.sql.SQLException
-
setSavepoint
public java.sql.Savepoint setSavepoint() throws java.sql.SQLException- Specified by:
setSavepointin interfacejava.sql.Connection- Overrides:
setSavepointin classDelegatingConnection- Throws:
java.sql.SQLException
-
setSavepoint
public java.sql.Savepoint setSavepoint(java.lang.String name) throws java.sql.SQLException- Specified by:
setSavepointin interfacejava.sql.Connection- Overrides:
setSavepointin classDelegatingConnection- Throws:
java.sql.SQLException
-
rollback
public void rollback(java.sql.Savepoint savepoint) throws java.sql.SQLException- Specified by:
rollbackin interfacejava.sql.Connection- Overrides:
rollbackin classDelegatingConnection- Throws:
java.sql.SQLException
-
releaseSavepoint
public void releaseSavepoint(java.sql.Savepoint savepoint) throws java.sql.SQLException- Specified by:
releaseSavepointin interfacejava.sql.Connection- Overrides:
releaseSavepointin classDelegatingConnection- Throws:
java.sql.SQLException
-
createStatement
protected java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean wrap) throws java.sql.SQLException- Overrides:
createStatementin 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:
prepareStatementin classDelegatingConnection- Throws:
java.sql.SQLException
-
prepareStatement
protected java.sql.PreparedStatement prepareStatement(java.lang.String sql, int autoGeneratedKeys, boolean wrap) throws java.sql.SQLException- Overrides:
prepareStatementin classDelegatingConnection- Throws:
java.sql.SQLException
-
prepareStatement
protected java.sql.PreparedStatement prepareStatement(java.lang.String sql, int[] columnIndexes, boolean wrap) throws java.sql.SQLException- Overrides:
prepareStatementin 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:
prepareStatementin classDelegatingConnection- Throws:
java.sql.SQLException
-
getMetaData
protected java.sql.DatabaseMetaData getMetaData(boolean wrap) throws java.sql.SQLExceptionDescription copied from class:DelegatingConnectionReturn the metadata, with the option of not wrapping it in aDelegatingDatabaseMetaData, which is the default.- Overrides:
getMetaDatain classDelegatingConnection- Throws:
java.sql.SQLException
-
-