org.mmbase.module.database
Class ConnectionWrapper
java.lang.Object
org.mmbase.module.database.ConnectionWrapper
- All Implemented Interfaces:
- Wrapper, MultiConnection
- Direct Known Subclasses:
- MultiConnectionImplementation
public abstract class ConnectionWrapper
- extends Object
- implements MultiConnection
Wraps a java.sql.Connection object. Extending this makes it possible to intercept calls.
- Since:
- MMBase-1.8
- Version:
- $Id: ConnectionWrapper.java 45322 2011-02-21 10:13:16Z michiel $
- Author:
- Michiel Meeuwissen
|
Method Summary |
void |
clearWarnings()
clear Warnings |
void |
close()
|
void |
commit()
|
Array |
createArrayOf(String typeName,
Object[] elements)
|
Statement |
createStatement()
|
Statement |
createStatement(int resultSetType,
int resultSetConcurrency)
|
Statement |
createStatement(int type,
int concurrency,
int holdability)
|
Struct |
createStruct(String typeName,
Object[] attributes)
|
boolean |
getAutoCommit()
|
String |
getCatalog()
|
Properties |
getClientInfo()
|
String |
getClientInfo(String name)
|
int |
getHoldability()
|
DatabaseMetaData |
getMetaData()
|
int |
getTransactionIsolation()
|
Map<String,Class<?>> |
getTypeMap()
|
SQLWarning |
getWarnings()
|
boolean |
isClosed()
|
boolean |
isReadOnly()
|
boolean |
isValid(int i)
|
boolean |
isWrapperFor(Class<?> iface)
|
String |
nativeSQL(String query)
|
CallableStatement |
prepareCall(String sql)
|
CallableStatement |
prepareCall(String sql,
int i,
int y)
|
CallableStatement |
prepareCall(String sql,
int type,
int concurrency,
int holdability)
|
PreparedStatement |
prepareStatement(String sql)
|
PreparedStatement |
prepareStatement(String sql,
int autoGeneratedKeys)
|
PreparedStatement |
prepareStatement(String sql,
int[] columnIndexes)
|
PreparedStatement |
prepareStatement(String sql,
int i,
int y)
|
PreparedStatement |
prepareStatement(String sql,
int type,
int concurrency,
int holdability)
|
PreparedStatement |
prepareStatement(String sql,
String[] columnNames)
|
void |
releaseSavepoint(Savepoint savepoint)
|
void |
rollback()
|
void |
rollback(Savepoint savepoint)
|
void |
setAutoCommit(boolean enableAutoCommit)
|
void |
setCatalog(String catalog)
|
void |
setHoldability(int holdability)
|
void |
setLastSQL(String sql)
Called just before every prepare statement. |
void |
setReadOnly(boolean readOnly)
|
Savepoint |
setSavepoint()
|
Savepoint |
setSavepoint(String name)
|
void |
setTransactionIsolation(int level)
|
void |
setTypeMap(Map<String,Class<?>> mp)
|
|
unwrap(Class<T> iface)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.mmbase.module.database.MultiConnection |
checkAfterException, claim, getLastSQL, getParent, getStackTrace, getStartTime, getStartTimeMillis, getStateString, getUsage, realclose, release, resetUsage, wrap |
con
protected Connection con
- The wrapped connection
ConnectionWrapper
public ConnectionWrapper(Connection c)
setLastSQL
public void setLastSQL(String sql)
- Called just before every prepare statement. Can be overridden, because this default implementation is empty.
- Specified by:
setLastSQL in interface MultiConnection
createStatement
public Statement createStatement()
throws SQLException
- Specified by:
createStatement in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.createStatement()
createStatement
public Statement createStatement(int resultSetType,
int resultSetConcurrency)
throws SQLException
- Specified by:
createStatement in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.createStatement(int, int)
createStatement
public Statement createStatement(int type,
int concurrency,
int holdability)
throws SQLException
- Specified by:
createStatement in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.createStatement(int, int, int)
prepareStatement
public PreparedStatement prepareStatement(String sql)
throws SQLException
- Specified by:
prepareStatement in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.prepareStatement(String)
prepareStatement
public PreparedStatement prepareStatement(String sql,
int autoGeneratedKeys)
throws SQLException
- Specified by:
prepareStatement in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.prepareStatement(String, int)
prepareStatement
public PreparedStatement prepareStatement(String sql,
int[] columnIndexes)
throws SQLException
- Specified by:
prepareStatement in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.prepareStatement(String, int[])
prepareStatement
public PreparedStatement prepareStatement(String sql,
String[] columnNames)
throws SQLException
- Specified by:
prepareStatement in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.prepareStatement(String, String[])
prepareStatement
public PreparedStatement prepareStatement(String sql,
int type,
int concurrency,
int holdability)
throws SQLException
- Specified by:
prepareStatement in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.prepareStatement(String, int, int, int)
prepareCall
public CallableStatement prepareCall(String sql)
throws SQLException
- Specified by:
prepareCall in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.prepareCall(String)
nativeSQL
public String nativeSQL(String query)
throws SQLException
- Specified by:
nativeSQL in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.nativeSQL(String)
setAutoCommit
public void setAutoCommit(boolean enableAutoCommit)
throws SQLException
- Specified by:
setAutoCommit in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.setAutoCommit(boolean)
getAutoCommit
public boolean getAutoCommit()
throws SQLException
- Specified by:
getAutoCommit in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.getAutoCommit()
commit
public void commit()
throws SQLException
- Specified by:
commit in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.commit()
rollback
public void rollback()
throws SQLException
- Specified by:
rollback in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.rollback()
close
public void close()
throws SQLException
- Specified by:
close in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.close()
isClosed
public boolean isClosed()
throws SQLException
- Specified by:
isClosed in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.isClosed()
getMetaData
public DatabaseMetaData getMetaData()
throws SQLException
- Specified by:
getMetaData in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.getMetaData()
setReadOnly
public void setReadOnly(boolean readOnly)
throws SQLException
- Specified by:
setReadOnly in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.setReadOnly(boolean)
isReadOnly
public boolean isReadOnly()
throws SQLException
- Specified by:
isReadOnly in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.isReadOnly()
setCatalog
public void setCatalog(String catalog)
throws SQLException
- Specified by:
setCatalog in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.setCatalog(String)
getCatalog
public String getCatalog()
throws SQLException
- Specified by:
getCatalog in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.getCatalog()
setTransactionIsolation
public void setTransactionIsolation(int level)
throws SQLException
- Specified by:
setTransactionIsolation in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.setTransactionIsolation(int)
getTransactionIsolation
public int getTransactionIsolation()
throws SQLException
- Specified by:
getTransactionIsolation in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.getTransactionIsolation()
getWarnings
public SQLWarning getWarnings()
throws SQLException
- Specified by:
getWarnings in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.getWarnings()
clearWarnings
public void clearWarnings()
throws SQLException
- clear Warnings
- Specified by:
clearWarnings in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.clearWarnings()
prepareCall
public CallableStatement prepareCall(String sql,
int i,
int y)
throws SQLException
- Specified by:
prepareCall in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.prepareCall(String, int, int)
setTypeMap
public void setTypeMap(Map<String,Class<?>> mp)
throws SQLException
- Specified by:
setTypeMap in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.setTypeMap(Map)
getTypeMap
public Map<String,Class<?>> getTypeMap()
throws SQLException
- Specified by:
getTypeMap in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.getTypeMap()
prepareStatement
public PreparedStatement prepareStatement(String sql,
int i,
int y)
throws SQLException
- Specified by:
prepareStatement in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.prepareStatement(String, int, int)
setHoldability
public void setHoldability(int holdability)
throws SQLException
- Specified by:
setHoldability in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.setHoldability(int)
getHoldability
public int getHoldability()
throws SQLException
- Specified by:
getHoldability in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.getHoldability()
setSavepoint
public Savepoint setSavepoint()
throws SQLException
- Specified by:
setSavepoint in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.setSavepoint()
setSavepoint
public Savepoint setSavepoint(String name)
throws SQLException
- Specified by:
setSavepoint in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.setSavepoint(String)
rollback
public void rollback(Savepoint savepoint)
throws SQLException
- Specified by:
rollback in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.rollback(Savepoint)
releaseSavepoint
public void releaseSavepoint(Savepoint savepoint)
throws SQLException
- Specified by:
releaseSavepoint in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.releaseSavepoint(Savepoint)
prepareCall
public CallableStatement prepareCall(String sql,
int type,
int concurrency,
int holdability)
throws SQLException
- Specified by:
prepareCall in interface MultiConnection
- Throws:
SQLException- See Also:
Connection.prepareCall(String, int, int, int)
isValid
public boolean isValid(int i)
getClientInfo
public String getClientInfo(String name)
getClientInfo
public Properties getClientInfo()
createArrayOf
public Array createArrayOf(String typeName,
Object[] elements)
createStruct
public Struct createStruct(String typeName,
Object[] attributes)
unwrap
public <T> T unwrap(Class<T> iface)
- Specified by:
unwrap in interface Wrapper
isWrapperFor
public boolean isWrapperFor(Class<?> iface)
- Specified by:
isWrapperFor in interface Wrapper
MMBase2 Core 2.0-SNAPSHOT - 2013-03-30T06:36