001: package net.sourceforge.jdbclogger.core;
002:
003: /*
004: * Licensed to the Apache Software Foundation (ASF) under one or more
005: * contributor license agreements. See the NOTICE file distributed with
006: * this work for additional information regarding copyright ownership.
007: * The ASF licenses this file to You under the Apache License, Version 2.0
008: * (the "License"); you may not use this file except in compliance with
009: * the License. You may obtain a copy of the License at
010: *
011: * http://www.apache.org/licenses/LICENSE-2.0
012: *
013: * Unless required by applicable law or agreed to in writing, software
014: * distributed under the License is distributed on an "AS IS" BASIS,
015: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016: * See the License for the specific language governing permissions and
017: * limitations under the License.
018: */
019: import java.sql.*;
020: import java.util.List;
021: import java.util.Map;
022:
023: /**
024: * @author Martin Marinschek (latest modification by $Author: catalean $)
025: * @version $Revision: 83 $ $Date: 2007-07-07 14:00:58 -0700 (Sat, 07 Jul 2007) $
026: */
027: public class ConnectionWrapper implements Connection {
028: private Connection _connection;
029: protected List _formatters;
030:
031: public ConnectionWrapper(Connection connection, List formatters) {
032: _connection = connection;
033: _formatters = formatters;
034: }
035:
036: public int getHoldability() throws SQLException {
037: return _connection.getHoldability();
038: }
039:
040: public int getTransactionIsolation() throws SQLException {
041: return _connection.getTransactionIsolation();
042: }
043:
044: public void clearWarnings() throws SQLException {
045: _connection.clearWarnings();
046: }
047:
048: public void close() throws SQLException {
049: _connection.close();
050: }
051:
052: public void commit() throws SQLException {
053: _connection.commit();
054: }
055:
056: public void rollback() throws SQLException {
057: _connection.rollback();
058: }
059:
060: public boolean getAutoCommit() throws SQLException {
061: return _connection.getAutoCommit();
062: }
063:
064: public boolean isClosed() throws SQLException {
065: return _connection.isClosed();
066: }
067:
068: public boolean isReadOnly() throws SQLException {
069: return _connection.isReadOnly();
070: }
071:
072: public void setHoldability(int holdability) throws SQLException {
073: _connection.setHoldability(holdability);
074: }
075:
076: public void setTransactionIsolation(int level) throws SQLException {
077: _connection.setTransactionIsolation(level);
078: }
079:
080: public void setAutoCommit(boolean autoCommit) throws SQLException {
081: _connection.setAutoCommit(autoCommit);
082: }
083:
084: public void setReadOnly(boolean readOnly) throws SQLException {
085: _connection.setReadOnly(readOnly);
086: }
087:
088: public String getCatalog() throws SQLException {
089: return _connection.getCatalog();
090: }
091:
092: public void setCatalog(String catalog) throws SQLException {
093: _connection.setCatalog(catalog);
094: }
095:
096: public DatabaseMetaData getMetaData() throws SQLException {
097: return _connection.getMetaData();
098: }
099:
100: public SQLWarning getWarnings() throws SQLException {
101: return _connection.getWarnings();
102: }
103:
104: public Savepoint setSavepoint() throws SQLException {
105: return _connection.setSavepoint();
106: }
107:
108: public void releaseSavepoint(Savepoint savepoint)
109: throws SQLException {
110: _connection.releaseSavepoint(savepoint);
111: }
112:
113: public void rollback(Savepoint savepoint) throws SQLException {
114: _connection.rollback(savepoint);
115: }
116:
117: public Map getTypeMap() throws SQLException {
118: return _connection.getTypeMap();
119: }
120:
121: public void setTypeMap(Map map) throws SQLException {
122: _connection.setTypeMap(map);
123: }
124:
125: public String nativeSQL(String sql) throws SQLException {
126: return _connection.nativeSQL(sql);
127: }
128:
129: public Savepoint setSavepoint(String name) throws SQLException {
130: return _connection.setSavepoint(name);
131: }
132:
133: public CallableStatement prepareCall(String sql)
134: throws SQLException {
135: return _connection.prepareCall(sql);
136: }
137:
138: public CallableStatement prepareCall(String sql, int resultSetType,
139: int resultSetConcurrency) throws SQLException {
140: return _connection.prepareCall(sql, resultSetType,
141: resultSetConcurrency);
142: }
143:
144: public CallableStatement prepareCall(String sql, int resultSetType,
145: int resultSetConcurrency, int resultSetHoldability)
146: throws SQLException {
147: return _connection.prepareCall(sql, resultSetType,
148: resultSetConcurrency, resultSetHoldability);
149: }
150:
151: public PreparedStatement prepareStatement(String sql)
152: throws SQLException {
153: return new PreparedStatementWrapper(_connection
154: .prepareStatement(sql), sql, _formatters);
155: }
156:
157: public PreparedStatement prepareStatement(String sql,
158: int autoGeneratedKeys) throws SQLException {
159: return new PreparedStatementWrapper(_connection
160: .prepareStatement(sql, autoGeneratedKeys), sql,
161: _formatters);
162: }
163:
164: public PreparedStatement prepareStatement(String sql,
165: int resultSetType, int resultSetConcurrency)
166: throws SQLException {
167: return new PreparedStatementWrapper(_connection
168: .prepareStatement(sql, resultSetType,
169: resultSetConcurrency), sql, _formatters);
170: }
171:
172: public PreparedStatement prepareStatement(String sql,
173: int resultSetType, int resultSetConcurrency,
174: int resultSetHoldability) throws SQLException {
175: return new PreparedStatementWrapper(_connection
176: .prepareStatement(sql, resultSetType,
177: resultSetConcurrency), sql, _formatters);
178: }
179:
180: public PreparedStatement prepareStatement(String sql,
181: int columnIndexes[]) throws SQLException {
182: return new PreparedStatementWrapper(_connection
183: .prepareStatement(sql, columnIndexes), sql, _formatters);
184: }
185:
186: public PreparedStatement prepareStatement(String sql,
187: String columnNames[]) throws SQLException {
188: return new PreparedStatementWrapper(_connection
189: .prepareStatement(sql, columnNames), sql, _formatters);
190: }
191:
192: public Statement createStatement() throws SQLException {
193: return new StatementWrapper(_connection.createStatement());
194: }
195:
196: public Statement createStatement(int resultSetType,
197: int resultSetConcurrency) throws SQLException {
198: return new StatementWrapper(_connection.createStatement(
199: resultSetType, resultSetConcurrency));
200: }
201:
202: public Statement createStatement(int resultSetType,
203: int resultSetConcurrency, int resultSetHoldability)
204: throws SQLException {
205: return new StatementWrapper(_connection.createStatement(
206: resultSetType, resultSetConcurrency,
207: resultSetHoldability));
208: }
209:
210: }
|