1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45 package org.melati.poem.dbms.test.sql;
46
47 import java.sql.CallableStatement;
48 import java.sql.Connection;
49 import java.sql.DatabaseMetaData;
50 import java.sql.PreparedStatement;
51 import java.sql.SQLException;
52 import java.sql.SQLWarning;
53 import java.sql.Savepoint;
54 import java.sql.Statement;
55 import java.util.Map;
56
57
58
59
60
61
62
63
64 public abstract class ThrowingConnectionJdbc3
65 extends Thrower
66 implements Connection {
67
68 Connection it = null;
69
70
71
72
73
74
75 public void clearWarnings() throws SQLException {
76 if (shouldThrow(this.getClass().getInterfaces()[0], "clearWarnings"))
77 throw new SQLException("Connection bombed");
78 it.clearWarnings();
79 }
80
81
82
83
84
85 public void close() throws SQLException {
86 if (shouldThrow(this.getClass().getInterfaces()[0], "close"))
87 throw new SQLException("Connection bombed");
88 it.close();
89 }
90
91
92
93
94
95 public void commit() throws SQLException {
96 if (shouldThrow(this.getClass().getInterfaces()[0], "commit"))
97 throw new SQLException("Connection bombed");
98 it.commit();
99 }
100
101
102
103
104
105 public Statement createStatement() throws SQLException {
106 if (shouldThrow(this.getClass().getInterfaces()[0], "createStatement"))
107 throw new SQLException("Connection bombed");
108 return new ThrowingStatement(it.createStatement());
109 }
110
111
112
113
114
115 public Statement createStatement(int resultSetType, int resultSetConcurrency)
116 throws SQLException {
117 if (shouldThrow(this.getClass().getInterfaces()[0], "createStatement"))
118 throw new SQLException("Connection bombed");
119 return new ThrowingStatement(it.createStatement(resultSetType,resultSetConcurrency));
120 }
121
122
123
124
125
126 public Statement createStatement(int resultSetType, int resultSetConcurrency,
127 int resultSetHoldability) throws SQLException {
128 if (shouldThrow(this.getClass().getInterfaces()[0], "createStatement"))
129 throw new SQLException("Connection bombed");
130 return new ThrowingStatement(it.createStatement(resultSetType, resultSetConcurrency));
131 }
132
133
134
135
136
137 public boolean getAutoCommit() throws SQLException {
138 if (shouldThrow(this.getClass().getInterfaces()[0], "getAutoCommit"))
139 throw new SQLException("Connection bombed");
140 return it.getAutoCommit();
141 }
142
143
144
145
146
147 public String getCatalog() throws SQLException {
148 if (shouldThrow(this.getClass().getInterfaces()[0], "getCatalog"))
149 throw new SQLException("Connection bombed");
150 return it.getCatalog();
151 }
152
153
154
155
156
157 public int getHoldability() throws SQLException {
158 if (shouldThrow(this.getClass().getInterfaces()[0], "getHoldability"))
159 throw new SQLException("Connection bombed");
160 return it.getHoldability();
161 }
162
163
164
165
166
167 public DatabaseMetaData getMetaData() throws SQLException {
168 if (shouldThrow(this.getClass().getInterfaces()[0], "getMetaData"))
169 throw new SQLException("Connection bombed");
170 return new ThrowingDatabaseMetaData(it.getMetaData());
171 }
172
173
174
175
176
177 public int getTransactionIsolation() throws SQLException {
178 if (shouldThrow(this.getClass().getInterfaces()[0], "getTransactionIsolation"))
179 throw new SQLException("Connection bombed");
180 return it.getTransactionIsolation();
181 }
182
183
184
185
186
187 public Map<String,Class<?>> getTypeMap() throws SQLException {
188 if (shouldThrow(this.getClass().getInterfaces()[0], "getTypeMap()"))
189 throw new SQLException("Connection bombed");
190 return it.getTypeMap();
191 }
192
193
194
195
196
197 public SQLWarning getWarnings() throws SQLException {
198 if (shouldThrow(this.getClass().getInterfaces()[0], "getWarnings"))
199 throw new SQLException("Connection bombed");
200 return it.getWarnings();
201 }
202
203
204
205
206
207 public boolean isClosed() throws SQLException {
208 if (shouldThrow(this.getClass().getInterfaces()[0], "isClosed"))
209 throw new SQLException("Connection bombed");
210 return it.isClosed();
211 }
212
213
214
215
216
217 public boolean isReadOnly() throws SQLException {
218 if (shouldThrow(this.getClass().getInterfaces()[0], "isReadOnly"))
219 throw new SQLException("Connection bombed");
220 return it.isReadOnly();
221 }
222
223
224
225
226
227 public String nativeSQL(String sql) throws SQLException {
228 if (shouldThrow(this.getClass().getInterfaces()[0], "nativeSQL"))
229 throw new SQLException("Connection bombed");
230 return it.nativeSQL(sql);
231 }
232
233
234
235
236
237 public CallableStatement prepareCall(String sql) throws SQLException {
238 if (shouldThrow(this.getClass().getInterfaces()[0], "prepareCall"))
239 throw new SQLException("Connection bombed");
240 return new ThrowingCallableStatement(it.prepareCall(sql));
241 }
242
243
244
245
246
247 public CallableStatement prepareCall(String sql, int resultSetType,
248 int resultSetConcurrency) throws SQLException {
249 if (shouldThrow(this.getClass().getInterfaces()[0], "prepareCall"))
250 throw new SQLException("Connection bombed");
251 return new ThrowingCallableStatement(it.prepareCall(sql, resultSetType, resultSetConcurrency));
252 }
253
254
255
256
257
258 public CallableStatement prepareCall(String sql, int resultSetType,
259 int resultSetConcurrency, int resultSetHoldability) throws SQLException {
260 if (shouldThrow(this.getClass().getInterfaces()[0], "prepareCall"))
261 throw new SQLException("Connection bombed");
262 return new ThrowingCallableStatement(it.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability));
263 }
264
265
266
267
268
269 public PreparedStatement prepareStatement(String sql) throws SQLException {
270 if (shouldThrow(this.getClass().getInterfaces()[0], "prepareStatement"))
271 throw new SQLException("Connection bombed");
272 return new ThrowingPreparedStatement(it.prepareStatement(sql));
273 }
274
275
276
277
278
279 public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
280 throws SQLException {
281 if (shouldThrow(this.getClass().getInterfaces()[0], "prepareStatement"))
282 throw new SQLException("Connection bombed");
283 return new ThrowingPreparedStatement(it.prepareStatement(sql, autoGeneratedKeys));
284 }
285
286
287
288
289
290 public PreparedStatement prepareStatement(String sql, int[] columnIndexes)
291 throws SQLException {
292 if (shouldThrow(this.getClass().getInterfaces()[0], "prepareStatement"))
293 throw new SQLException("Connection bombed");
294 return new ThrowingPreparedStatement(it.prepareStatement(sql, columnIndexes));
295 }
296
297
298
299
300
301 public PreparedStatement prepareStatement(String sql, String[] columnNames)
302 throws SQLException {
303 if (shouldThrow(this.getClass().getInterfaces()[0], "prepareStatement"))
304 throw new SQLException("Connection bombed");
305 return new ThrowingPreparedStatement(it.prepareStatement(sql, columnNames));
306 }
307
308
309
310
311
312 public PreparedStatement prepareStatement(String sql, int resultSetType,
313 int resultSetConcurrency) throws SQLException {
314 if (shouldThrow(this.getClass().getInterfaces()[0], "prepareStatement"))
315 throw new SQLException("Connection bombed");
316 return new ThrowingPreparedStatement(it.prepareStatement(sql, resultSetType, resultSetConcurrency));
317 }
318
319
320
321
322
323 public PreparedStatement prepareStatement(String sql, int resultSetType,
324 int resultSetConcurrency, int resultSetHoldability) throws SQLException {
325 if (shouldThrow(this.getClass().getInterfaces()[0], "prepareStatement"))
326 throw new SQLException("Connection bombed");
327 return new ThrowingPreparedStatement(it.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability));
328 }
329
330
331
332
333
334 public void releaseSavepoint(Savepoint savepoint) throws SQLException {
335 if (shouldThrow(this.getClass().getInterfaces()[0], "releaseSavepoint"))
336 throw new SQLException("Connection bombed");
337 it.releaseSavepoint(savepoint);
338 }
339
340
341
342
343
344 public void rollback() throws SQLException {
345 if (shouldThrow(this.getClass().getInterfaces()[0], "rollback"))
346 throw new SQLException("Connection bombed");
347 it.rollback();
348 }
349
350
351
352
353
354 public void rollback(Savepoint savepoint) throws SQLException {
355 if (shouldThrow(this.getClass().getInterfaces()[0], "rollback"))
356 throw new SQLException("Connection bombed");
357 it.rollback(savepoint);
358 }
359
360
361
362
363
364 public void setAutoCommit(boolean autoCommit) throws SQLException {
365 if (shouldThrow(this.getClass().getInterfaces()[0], "setAutoCommit"))
366 throw new SQLException("Connection bombed");
367 it.setAutoCommit(autoCommit);
368 }
369
370
371
372
373
374 public void setCatalog(String catalog) throws SQLException {
375 if (shouldThrow(this.getClass().getInterfaces()[0], "setCatalog"))
376 throw new SQLException("Connection bombed");
377 it.setCatalog(catalog);
378 }
379
380
381
382
383
384 public void setHoldability(int holdability) throws SQLException {
385 if (shouldThrow(this.getClass().getInterfaces()[0], "setHoldability"))
386 throw new SQLException("Connection bombed");
387 it.setHoldability(holdability);
388 }
389
390
391
392
393
394 public void setReadOnly(boolean readOnly) throws SQLException {
395 if (shouldThrow(this.getClass().getInterfaces()[0], "setReadOnly"))
396 throw new SQLException("Connection bombed");
397 it.setReadOnly(readOnly);
398 }
399
400
401
402
403
404 public Savepoint setSavepoint() throws SQLException {
405 if (shouldThrow(this.getClass().getInterfaces()[0], "setSavepoint"))
406 throw new SQLException("Connection bombed");
407 return new ThrowingSavepoint(it.setSavepoint());
408 }
409
410
411
412
413
414 public Savepoint setSavepoint(String name) throws SQLException {
415 if (shouldThrow(this.getClass().getInterfaces()[0], "setSavepoint"))
416 throw new SQLException("Connection bombed");
417 return new ThrowingSavepoint(it.setSavepoint(name));
418 }
419
420
421
422
423
424 public void setTransactionIsolation(int level) throws SQLException {
425 if (shouldThrow(this.getClass().getInterfaces()[0], "setTransactionIsolation"))
426 throw new SQLException("Connection bombed");
427 it.setTransactionIsolation(level);
428 }
429
430
431
432
433
434 public void setTypeMap(Map<String,Class<?>> map) throws SQLException {
435 if (shouldThrow(this.getClass().getInterfaces()[0], "setTypeMap"))
436 throw new SQLException("Connection bombed");
437 it.setTypeMap(map);
438 }
439
440
441 }