1 2 3 package com.opensourceconnections.msjdbcproxy; 4 5 import java.sql.CallableStatement; 6 import java.sql.Connection; 7 import java.sql.DatabaseMetaData; 8 import java.sql.PreparedStatement; 9 import java.sql.SQLException; 10 import java.sql.SQLWarning; 11 import java.sql.Savepoint; 12 import java.sql.Statement; 13 import java.util.Map; 14 15 public class ConnectionProxy implements Connection 16 { 17 protected final Connection _connection; 18 19 public ConnectionProxy(Connection connection) 20 { 21 _connection = connection; 22 } 23 24 public Statement createStatement() throws SQLException 25 { 26 return new StatementProxy(this, _connection.createStatement()); 27 } 28 29 public PreparedStatement prepareStatement(String sql) throws SQLException 30 { 31 return new PreparedStatementProxy(this, _connection.prepareStatement(sql)); 32 } 33 34 public CallableStatement prepareCall(String sql) throws SQLException 35 { 36 return new CallableStatementProxy(this, _connection.prepareCall(sql)); 37 } 38 39 public String nativeSQL(String sql) throws SQLException 40 { 41 return _connection.nativeSQL(sql); 42 } 43 44 public void setAutoCommit(boolean autoCommit) throws SQLException 45 { 46 _connection.setAutoCommit(autoCommit); 47 } 48 49 public boolean getAutoCommit() throws SQLException 50 { 51 return _connection.getAutoCommit(); 52 } 53 54 public void commit() throws SQLException 55 { 56 _connection.commit(); 57 } 58 59 public void rollback() throws SQLException 60 { 61 _connection.rollback(); 62 } 63 64 public void close() throws SQLException 65 { 66 _connection.close(); 67 } 68 69 public boolean isClosed() throws SQLException 70 { 71 return _connection.isClosed(); 72 } 73 74 public DatabaseMetaData getMetaData() throws SQLException 75 { 76 return _connection.getMetaData(); 77 } 78 79 public void setReadOnly(boolean readOnly) throws SQLException 80 { 81 _connection.setReadOnly(readOnly); 82 } 83 84 public boolean isReadOnly() throws SQLException 85 { 86 return _connection.isReadOnly(); 87 } 88 89 public void setCatalog(String catalog) throws SQLException 90 { 91 _connection.setCatalog(catalog); 92 } 93 94 public String getCatalog() throws SQLException 95 { 96 return _connection.getCatalog(); 97 } 98 99 public void setTransactionIsolation(int level) throws SQLException 100 { 101 _connection.setTransactionIsolation(level); 102 } 103 104 public int getTransactionIsolation() throws SQLException 105 { 106 return _connection.getTransactionIsolation(); 107 } 108 109 public SQLWarning getWarnings() throws SQLException 110 { 111 return _connection.getWarnings(); 112 } 113 114 public void clearWarnings() throws SQLException 115 { 116 _connection.clearWarnings(); 117 } 118 119 public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException 120 { 121 return new StatementProxy(this, _connection.createStatement(resultSetType, resultSetConcurrency)); 122 } 123 124 public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException 125 { 126 return new PreparedStatementProxy(this, _connection.prepareStatement(sql, resultSetType, resultSetConcurrency)); 127 } 128 129 public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException 130 { 131 return new CallableStatementProxy(this, _connection.prepareCall(sql, resultSetType, resultSetConcurrency)); 132 } 133 134 public Map getTypeMap() throws SQLException 135 { 136 return _connection.getTypeMap(); 137 } 138 139 public void setTypeMap(Map map) throws SQLException 140 { 141 _connection.setTypeMap(map); 142 } 143 144 public void setHoldability(int holdability) throws SQLException 145 { 146 _connection.setHoldability(holdability); 147 } 148 149 public int getHoldability() throws SQLException 150 { 151 return _connection.getHoldability(); 152 } 153 154 public Savepoint setSavepoint() throws SQLException 155 { 156 return _connection.setSavepoint(); 157 } 158 159 public Savepoint setSavepoint(String name) throws SQLException 160 { 161 return _connection.setSavepoint(name); 162 } 163 164 public void rollback(Savepoint savepoint) throws SQLException 165 { 166 _connection.rollback(savepoint); 167 } 168 169 public void releaseSavepoint(Savepoint savepoint) throws SQLException 170 { 171 _connection.releaseSavepoint(savepoint); 172 } 173 174 public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException 175 { 176 return new StatementProxy(this, _connection.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability)); 177 } 178 179 public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException 180 { 181 return new PreparedStatementProxy(this, _connection.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability)); 182 } 183 184 public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException 185 { 186 return new CallableStatementProxy(this, _connection.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability)); 187 } 188 189 public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException 190 { 191 return new PreparedStatementProxy(this, _connection.prepareStatement(sql, autoGeneratedKeys)); 192 } 193 194 public PreparedStatement prepareStatement(String sql, int columnIndexes[]) throws SQLException 195 { 196 return new PreparedStatementProxy(this, _connection.prepareStatement(sql, columnIndexes)); 197 } 198 199 public PreparedStatement prepareStatement(String sql, String columnNames[]) throws SQLException 200 { 201 return new PreparedStatementProxy(this, _connection.prepareStatement(sql, columnNames)); 202 } 203 }