1 10 package org.mmbase.module.database; 11 12 import java.sql.*; 13 import java.util.Map ; 14 15 22 public abstract class ConnectionWrapper implements Connection { 23 26 protected Connection con; 27 28 public ConnectionWrapper(Connection c) { 29 con = c; 30 } 31 32 35 protected void setLastSQL(String sql) { 36 } 37 40 public Statement createStatement() throws SQLException { 41 return con.createStatement(); 42 } 43 46 public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { 47 return con.createStatement(resultSetType, resultSetConcurrency); 48 } 49 52 public Statement createStatement(int type, int concurrency, int holdability) throws SQLException { 53 return con.createStatement(type, concurrency, holdability); 54 } 55 58 public PreparedStatement prepareStatement(String sql) throws SQLException { 59 setLastSQL(sql); 60 return con.prepareStatement(sql); 61 } 62 65 public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { 66 setLastSQL(sql); 67 return con.prepareStatement(sql, autoGeneratedKeys); 68 } 69 70 73 public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { 74 setLastSQL(sql); 75 return con.prepareStatement(sql, columnIndexes); 76 } 77 78 81 public PreparedStatement prepareStatement(String sql, String [] columnNames) throws SQLException { 82 setLastSQL(sql); 83 return con.prepareStatement(sql, columnNames); 84 } 85 88 public PreparedStatement prepareStatement(String sql, int type, int concurrency, int holdability) throws SQLException { 89 setLastSQL(sql); 90 return con.prepareStatement(sql, type, concurrency, holdability); 91 } 92 93 96 public CallableStatement prepareCall(String sql) throws SQLException { 97 setLastSQL(sql); 98 return con.prepareCall(sql); 99 } 100 103 public String nativeSQL(String query) throws SQLException { 104 setLastSQL(query); 105 return con.nativeSQL(query); 106 } 107 110 public void setAutoCommit(boolean enableAutoCommit) throws SQLException { 111 con.setAutoCommit(enableAutoCommit); 112 } 113 116 public boolean getAutoCommit() throws SQLException { 117 return con.getAutoCommit(); 118 } 119 122 public void commit() throws SQLException { 123 con.commit(); 124 } 125 126 129 public void rollback() throws SQLException { 130 con.rollback(); 131 } 132 135 public void close() throws SQLException { 136 con.close(); 137 } 138 139 142 public boolean isClosed() throws SQLException { 143 return con.isClosed(); 144 } 145 146 147 150 public DatabaseMetaData getMetaData() throws SQLException { 151 return con.getMetaData(); 152 } 153 154 155 158 public void setReadOnly(boolean readOnly) throws SQLException { 159 con.setReadOnly(readOnly); 160 } 161 162 165 public boolean isReadOnly() throws SQLException { 166 return con.isReadOnly(); 167 } 168 171 public void setCatalog(String catalog) throws SQLException { 172 con.setCatalog(catalog); 173 } 174 175 178 public String getCatalog() throws SQLException { 179 return con.getCatalog(); 180 } 181 182 185 public void setTransactionIsolation(int level) throws SQLException { 186 con.setTransactionIsolation(level); 187 } 188 189 192 public int getTransactionIsolation() throws SQLException { 193 return con.getTransactionIsolation(); 194 } 195 196 199 public SQLWarning getWarnings() throws SQLException { 200 return con.getWarnings(); 201 } 202 203 206 209 public void clearWarnings() throws SQLException { 210 con.clearWarnings(); 211 } 212 213 216 public CallableStatement prepareCall(String sql, int i, int y) throws SQLException { 217 setLastSQL(sql); 218 return con.prepareCall(sql,i,y); 219 } 220 221 224 public void setTypeMap(Map mp) throws SQLException { 225 con.setTypeMap(mp); 226 } 227 228 231 public Map getTypeMap() throws SQLException { 232 return con.getTypeMap(); 233 } 234 235 236 239 public PreparedStatement prepareStatement(String sql,int i, int y) throws SQLException { 240 setLastSQL(sql); 241 return con.prepareStatement(sql,i,y); 242 } 243 244 247 public void setHoldability(int holdability) throws SQLException { 248 con.setHoldability(holdability); 249 } 250 253 public int getHoldability() throws SQLException { 254 return con.getHoldability(); 255 } 256 257 260 public Savepoint setSavepoint() throws SQLException { 261 return con.setSavepoint(); 262 } 263 264 267 public Savepoint setSavepoint(String name) throws SQLException { 268 return con.setSavepoint(name); 269 } 270 271 274 public void rollback(Savepoint savepoint) throws SQLException { 275 con.rollback(savepoint); 276 } 277 280 public void releaseSavepoint(Savepoint savepoint) throws SQLException { 281 con.releaseSavepoint(savepoint); 282 } 283 284 285 288 public CallableStatement prepareCall(String sql, int type, int concurrency, int holdability) throws SQLException { 289 setLastSQL(sql); 290 return con.prepareCall(sql, type, concurrency, holdability); 291 } 292 293 294 } 295 296 297 | Popular Tags |