1 package org.jahia.services.database; 2 3 import java.sql.CallableStatement ; 4 import java.sql.Connection ; 5 import java.sql.DatabaseMetaData ; 6 import java.sql.PreparedStatement ; 7 import java.sql.SQLException ; 8 import java.sql.SQLWarning ; 9 import java.sql.Savepoint ; 10 import java.sql.Statement ; 11 import java.util.HashMap ; 12 import java.util.Iterator ; 13 import java.util.Map ; 14 15 public class ConnectionWrapper implements Connection { 16 17 Connection connection; 18 19 private HashMap cachedStatements; 20 21 public ConnectionWrapper(Connection c) { 22 cachedStatements = new HashMap (); 23 connection = c; 24 } 25 public void clearWarnings() throws SQLException {connection.clearWarnings();} 26 public void close() throws SQLException { 27 } 28 public void realClose() throws SQLException { 29 connection.close(); 36 } 38 public void commit() throws SQLException {connection.commit();} 39 public Statement createStatement() throws SQLException { 40 return connection.createStatement(); 41 } 42 public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { 43 return connection.createStatement(resultSetType, resultSetConcurrency); 44 } 45 public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { 46 return connection.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability); 47 } 48 public boolean getAutoCommit() throws SQLException { 49 return connection.getAutoCommit(); 50 } 51 public String getCatalog() throws SQLException { 52 return connection.getCatalog(); 53 } 54 public DatabaseMetaData getMetaData() throws SQLException { 55 return connection.getMetaData(); 56 } 57 public int getTransactionIsolation() throws SQLException { 58 return connection.getTransactionIsolation(); 59 } 60 public Map getTypeMap() throws SQLException { 61 return connection.getTypeMap(); 62 } 63 public SQLWarning getWarnings() throws SQLException { 64 return connection.getWarnings(); 65 } 66 public boolean isClosed() throws SQLException { 67 return connection.isClosed(); 68 } 69 public boolean isReadOnly() throws SQLException { 70 return connection.isReadOnly(); 71 } 72 public String nativeSQL(String sql) throws SQLException { 73 return connection.nativeSQL(sql); 74 } 75 public CallableStatement prepareCall(String sql) throws SQLException { 76 return connection.prepareCall(sql); 77 } 78 public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { 79 return connection.prepareCall(sql, resultSetType, resultSetConcurrency); 80 } 81 public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { 82 return connection.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability); 83 } 84 87 public PreparedStatement prepareStatement(String sql) throws SQLException { 88 return connection.prepareStatement(sql); 94 } 95 public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { 96 return connection.prepareStatement(sql, autoGeneratedKeys); 97 } 98 public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { 99 return connection.prepareStatement(sql, columnIndexes); 100 } 101 public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { 102 return connection.prepareStatement(sql, resultSetType, resultSetConcurrency); 103 } 104 public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { 105 return connection.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability); 106 } 107 public PreparedStatement prepareStatement(String sql, String [] columnNames) throws SQLException { 108 return connection.prepareStatement(sql, columnNames); 109 } 110 public void rollback() throws SQLException {connection.rollback();} 111 public void rollback(Savepoint savepoint) throws SQLException {connection.rollback(savepoint);} 112 public void releaseSavepoint(Savepoint savepoint) throws SQLException {connection.releaseSavepoint(savepoint);} 113 public void setAutoCommit(boolean autoCommit) throws SQLException {connection.setAutoCommit(autoCommit);} 114 public void setCatalog(String catalog) throws SQLException {connection.setCatalog(catalog);} 115 public void setReadOnly(boolean readOnly) throws SQLException {connection.setReadOnly(readOnly);} 116 public void setTransactionIsolation(int level) throws SQLException {connection.setTransactionIsolation(level);} 117 public void setTypeMap(Map map) throws SQLException {connection.setTypeMap(map);} 118 public int getHoldability() throws SQLException { 119 return connection.getHoldability(); 120 } 121 public void setHoldability(int holdability) throws SQLException {connection.setHoldability(holdability);} 122 public Savepoint setSavepoint() throws SQLException { 123 return connection.setSavepoint(); 124 } 125 public Savepoint setSavepoint(String name) throws SQLException { 126 return connection.setSavepoint(name); 127 } 128 } | Popular Tags |