KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > jdbclogger > core > ConnectionWrapper


1 package net.sourceforge.jdbclogger.core;
2 /*
3  * Licensed to the Apache Software Foundation (ASF) under one or more
4  * contributor license agreements. See the NOTICE file distributed with
5  * this work for additional information regarding copyright ownership.
6  * The ASF licenses this file to You under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with
8  * the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 import java.sql.*;
19 import java.util.List JavaDoc;
20 import java.util.Map JavaDoc;
21 /**
22  * @author Martin Marinschek (latest modification by $Author: catalean $)
23  * @version $Revision: 83 $ $Date: 2007-07-08 00:00:58 +0300 (Sun, 08 Jul 2007) $
24  */

25 public class ConnectionWrapper implements Connection
26 {
27     private Connection _connection;
28     protected List JavaDoc _formatters;
29
30     public ConnectionWrapper(Connection connection, List JavaDoc formatters)
31     {
32         _connection = connection;
33         _formatters = formatters;
34     }
35
36     public int getHoldability() throws SQLException
37     {
38         return _connection.getHoldability();
39     }
40
41     public int getTransactionIsolation() throws SQLException
42     {
43         return _connection.getTransactionIsolation();
44     }
45
46     public void clearWarnings() throws SQLException
47     {
48         _connection.clearWarnings();
49     }
50
51     public void close() throws SQLException
52     {
53         _connection.close();
54     }
55
56     public void commit() throws SQLException
57     {
58         _connection.commit();
59     }
60
61     public void rollback() throws SQLException
62     {
63         _connection.rollback();
64     }
65
66     public boolean getAutoCommit() throws SQLException
67     {
68         return _connection.getAutoCommit();
69     }
70
71     public boolean isClosed() throws SQLException
72     {
73         return _connection.isClosed();
74     }
75
76     public boolean isReadOnly() throws SQLException
77     {
78         return _connection.isReadOnly();
79     }
80
81     public void setHoldability(int holdability) throws SQLException
82     {
83         _connection.setHoldability(holdability);
84     }
85
86     public void setTransactionIsolation(int level) throws SQLException
87     {
88         _connection.setTransactionIsolation(level);
89     }
90
91     public void setAutoCommit(boolean autoCommit) throws SQLException
92     {
93         _connection.setAutoCommit(autoCommit);
94     }
95
96     public void setReadOnly(boolean readOnly) throws SQLException
97     {
98         _connection.setReadOnly(readOnly);
99     }
100
101     public String JavaDoc getCatalog() throws SQLException
102     {
103         return _connection.getCatalog();
104     }
105
106     public void setCatalog(String JavaDoc catalog) throws SQLException
107     {
108         _connection.setCatalog(catalog);
109     }
110
111     public DatabaseMetaData getMetaData() throws SQLException
112     {
113         return _connection.getMetaData();
114     }
115
116     public SQLWarning getWarnings() throws SQLException
117     {
118         return _connection.getWarnings();
119     }
120
121     public Savepoint setSavepoint() throws SQLException
122     {
123         return _connection.setSavepoint();
124     }
125
126     public void releaseSavepoint(Savepoint savepoint) throws SQLException
127     {
128         _connection.releaseSavepoint(savepoint);
129     }
130
131     public void rollback(Savepoint savepoint) throws SQLException
132     {
133         _connection.rollback(savepoint);
134     }
135
136     public Map JavaDoc getTypeMap() throws SQLException
137     {
138         return _connection.getTypeMap();
139     }
140
141     public void setTypeMap(Map JavaDoc map) throws SQLException
142     {
143         _connection.setTypeMap(map);
144     }
145
146     public String JavaDoc nativeSQL(String JavaDoc sql) throws SQLException
147     {
148         return _connection.nativeSQL(sql);
149     }
150
151     public Savepoint setSavepoint(String JavaDoc name) throws SQLException
152     {
153         return _connection.setSavepoint(name);
154     }
155
156     public CallableStatement prepareCall(String JavaDoc sql) throws SQLException
157     {
158         return _connection.prepareCall(sql);
159     }
160
161     public CallableStatement prepareCall(String JavaDoc sql, int resultSetType, int resultSetConcurrency) throws SQLException
162     {
163         return _connection.prepareCall(sql, resultSetType, resultSetConcurrency);
164     }
165
166     public CallableStatement prepareCall(String JavaDoc sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
167     {
168         return _connection.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
169     }
170
171     public PreparedStatement prepareStatement(String JavaDoc sql) throws SQLException
172     {
173         return new PreparedStatementWrapper(_connection.prepareStatement(sql), sql, _formatters);
174     }
175
176     public PreparedStatement prepareStatement(String JavaDoc sql, int autoGeneratedKeys) throws SQLException
177     {
178         return new PreparedStatementWrapper(
179                 _connection.prepareStatement(sql, autoGeneratedKeys),sql,_formatters);
180     }
181
182     public PreparedStatement prepareStatement(String JavaDoc sql, int resultSetType, int resultSetConcurrency) throws SQLException
183     {
184         return new PreparedStatementWrapper(
185                 _connection.prepareStatement(sql, resultSetType, resultSetConcurrency),sql,_formatters);
186     }
187
188     public PreparedStatement prepareStatement(String JavaDoc sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
189     {
190         return new PreparedStatementWrapper(
191                 _connection.prepareStatement(sql, resultSetType, resultSetConcurrency),sql,_formatters);
192     }
193
194     public PreparedStatement prepareStatement(String JavaDoc sql, int columnIndexes[]) throws SQLException
195     {
196         return new PreparedStatementWrapper(
197                 _connection.prepareStatement(sql, columnIndexes),sql,_formatters);
198     }
199
200     public PreparedStatement prepareStatement(String JavaDoc sql, String JavaDoc columnNames[]) throws SQLException
201     {
202         return new PreparedStatementWrapper(
203                 _connection.prepareStatement(sql, columnNames),sql,_formatters);
204     }
205
206     public Statement createStatement() throws SQLException
207     {
208         return new StatementWrapper(_connection.createStatement());
209     }
210
211     public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException
212     {
213         return new StatementWrapper(_connection.createStatement(resultSetType, resultSetConcurrency));
214     }
215
216     public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
217     {
218         return new StatementWrapper(_connection.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability));
219     }
220
221
222 }
223
Popular Tags