diff options
Diffstat (limited to 'plugins/org.eclipse.net4j.db.jdbc/src/org/eclipse/net4j/db/jdbc/DelegatingConnection.java')
-rw-r--r-- | plugins/org.eclipse.net4j.db.jdbc/src/org/eclipse/net4j/db/jdbc/DelegatingConnection.java | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/plugins/org.eclipse.net4j.db.jdbc/src/org/eclipse/net4j/db/jdbc/DelegatingConnection.java b/plugins/org.eclipse.net4j.db.jdbc/src/org/eclipse/net4j/db/jdbc/DelegatingConnection.java index f8ed479182..bf56075c25 100644 --- a/plugins/org.eclipse.net4j.db.jdbc/src/org/eclipse/net4j/db/jdbc/DelegatingConnection.java +++ b/plugins/org.eclipse.net4j.db.jdbc/src/org/eclipse/net4j/db/jdbc/DelegatingConnection.java @@ -31,11 +31,15 @@ import java.util.concurrent.Executor; */ public abstract class DelegatingConnection implements Connection { + // protected static int COUNT; + private final Connection delegate; public DelegatingConnection(Connection delegate) { this.delegate = delegate; + // System.out.println("++ Open connections: " + ++COUNT); + // ReflectUtil.printStackTrace(); } public final Connection getDelegate() @@ -101,6 +105,7 @@ public abstract class DelegatingConnection implements Connection public void close() throws SQLException { delegate.close(); + // System.out.println("-- Open connections: " + --COUNT); } public boolean isClosed() throws SQLException @@ -358,4 +363,53 @@ public abstract class DelegatingConnection implements Connection { return delegate.getNetworkTimeout(); } + + /** + * @author Eike Stepper + */ + public static class Default extends DelegatingConnection + { + public Default(Connection delegate) + { + super(delegate); + } + + @Override + public PreparedStatement prepareStatement(String sql) throws SQLException + { + return getDelegate().prepareStatement(sql); + } + + @Override + public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) + throws SQLException + { + return getDelegate().prepareStatement(sql, resultSetType, resultSetConcurrency); + } + + @Override + public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, + int resultSetHoldability) throws SQLException + { + return getDelegate().prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability); + } + + @Override + public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException + { + return getDelegate().prepareStatement(sql, autoGeneratedKeys); + } + + @Override + public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException + { + return getDelegate().prepareStatement(sql, columnIndexes); + } + + @Override + public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException + { + return getDelegate().prepareStatement(sql, columnNames); + } + } } |