/** * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. * * Copyright 2012-2016 the original author or authors. */ package org.assertj.db.common; import java.sql.*; import java.util.Map; import java.util.Properties; import java.util.concurrent.Executor; /** * Default Connection. * * @author RĂ©gis Pouiller * */ public class DefaultConnection implements Connection { protected Connection thisConnection; public DefaultConnection(Connection connection) { this.thisConnection = connection; } @Override public <T> T unwrap(Class<T> iface) throws SQLException { return thisConnection.unwrap(iface); } @Override public boolean isWrapperFor(Class<?> iface) throws SQLException { return thisConnection.isWrapperFor(iface); } @Override public void setTypeMap(Map<String, Class<?>> map) throws SQLException { thisConnection.setTypeMap(map); } @Override public void setTransactionIsolation(int level) throws SQLException { thisConnection.setTransactionIsolation(level); } @Override public Savepoint setSavepoint(String name) throws SQLException { return thisConnection.setSavepoint(name); } @Override public Savepoint setSavepoint() throws SQLException { return thisConnection.setSavepoint(); } @Override public void setReadOnly(boolean readOnly) throws SQLException { thisConnection.setReadOnly(readOnly); } @Override public void setHoldability(int holdability) throws SQLException { thisConnection.setHoldability(holdability); } @Override public void setClientInfo(String name, String value) throws SQLClientInfoException { thisConnection.setClientInfo(name, value); } @Override public void setClientInfo(Properties properties) throws SQLClientInfoException { thisConnection.setClientInfo(properties); } @Override public void setCatalog(String catalog) throws SQLException { thisConnection.setCatalog(catalog); } @Override public void setAutoCommit(boolean autoCommit) throws SQLException { thisConnection.setAutoCommit(autoCommit); } @Override public void rollback(Savepoint savepoint) throws SQLException { thisConnection.rollback(savepoint); } @Override public void rollback() throws SQLException { thisConnection.rollback(); } @Override public void releaseSavepoint(Savepoint savepoint) throws SQLException { thisConnection.releaseSavepoint(savepoint); } @Override public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { return thisConnection.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability); } @Override public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { return thisConnection.prepareStatement(sql, resultSetType, resultSetConcurrency); } @Override public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException { return thisConnection.prepareStatement(sql, columnNames); } @Override public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { return thisConnection.prepareStatement(sql, columnIndexes); } @Override public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { return thisConnection.prepareStatement(sql, autoGeneratedKeys); } @Override public PreparedStatement prepareStatement(String sql) throws SQLException { return new DefaultPreparedStatement(thisConnection.prepareStatement(sql)); } @Override public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { return thisConnection.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability); } @Override public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { return thisConnection.prepareCall(sql, resultSetType, resultSetConcurrency); } @Override public CallableStatement prepareCall(String sql) throws SQLException { return thisConnection.prepareCall(sql); } @Override public String nativeSQL(String sql) throws SQLException { return thisConnection.nativeSQL(sql); } @Override public boolean isValid(int timeout) throws SQLException { return thisConnection.isValid(timeout); } @Override public boolean isReadOnly() throws SQLException { return thisConnection.isReadOnly(); } @Override public boolean isClosed() throws SQLException { return thisConnection.isClosed(); } @Override public SQLWarning getWarnings() throws SQLException { return thisConnection.getWarnings(); } @Override public Map<String, Class<?>> getTypeMap() throws SQLException { return thisConnection.getTypeMap(); } @Override public int getTransactionIsolation() throws SQLException { return thisConnection.getTransactionIsolation(); } @Override public DatabaseMetaData getMetaData() throws SQLException { return thisConnection.getMetaData(); } @Override public int getHoldability() throws SQLException { return thisConnection.getHoldability(); } @Override public String getClientInfo(String name) throws SQLException { return thisConnection.getClientInfo(name); } @Override public Properties getClientInfo() throws SQLException { return thisConnection.getClientInfo(); } @Override public String getCatalog() throws SQLException { return thisConnection.getCatalog(); } @Override public boolean getAutoCommit() throws SQLException { return thisConnection.getAutoCommit(); } @Override public Struct createStruct(String typeName, Object[] attributes) throws SQLException { return thisConnection.createStruct(typeName, attributes); } @Override public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { return thisConnection.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability); } @Override public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { return thisConnection.createStatement(resultSetType, resultSetConcurrency); } @Override public Statement createStatement() throws SQLException { return new DefaultStatement(thisConnection.createStatement()); } @Override public SQLXML createSQLXML() throws SQLException { return thisConnection.createSQLXML(); } @Override public NClob createNClob() throws SQLException { return thisConnection.createNClob(); } @Override public Clob createClob() throws SQLException { return thisConnection.createClob(); } @Override public Blob createBlob() throws SQLException { return thisConnection.createBlob(); } @Override public Array createArrayOf(String typeName, Object[] elements) throws SQLException { return thisConnection.createArrayOf(typeName, elements); } @Override public void commit() throws SQLException { thisConnection.commit(); } @Override public void close() throws SQLException { throw new SQLException(); } @Override public void clearWarnings() throws SQLException { thisConnection.clearWarnings(); } @Override public void setSchema(String schema) throws SQLException { thisConnection.setSchema(schema); } @Override public String getSchema() throws SQLException { return thisConnection.getSchema(); } @Override public void abort(Executor executor) throws SQLException { thisConnection.abort(executor); } @Override public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException { thisConnection.setNetworkTimeout(executor, milliseconds); } @Override public int getNetworkTimeout() throws SQLException { return thisConnection.getNetworkTimeout(); } }