Develop and Download Open Source Software

Browse Subversion Repository

Contents of /jdbcdebugger/trunk/src/jp/co/powerbeans/jdbcdebug/sql/Connection.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 34 - (show annotations) (download) (as text)
Fri Feb 4 08:45:40 2011 UTC (13 years, 3 months ago) by amsoft
File MIME type: text/x-java
File size: 12400 byte(s)
add ijyou 
1 package jp.co.powerbeans.jdbcdebug.sql;
2
3 import java.sql.Array;
4 import java.sql.Blob;
5 import java.sql.CallableStatement;
6 import java.sql.Clob;
7 import java.sql.DatabaseMetaData;
8 import java.sql.NClob;
9 import java.sql.PreparedStatement;
10 import java.sql.SQLClientInfoException;
11 import java.sql.SQLException;
12 import java.sql.SQLWarning;
13 import java.sql.SQLXML;
14 import java.sql.Savepoint;
15 import java.sql.Statement;
16 import java.sql.Struct;
17 import java.util.Map;
18 import java.util.Properties;
19
20 import jp.co.powerbeans.jdbcdebug.notify.NotifyUtil;
21 import jp.co.powerbeans.jdbcdebug.util.ConCheckMgr;
22
23
24 /**
25 * <p>タイトル: Connection</p>
26 * <p>説明: Connection 実装</p>
27 * <p>Created on 2003/10/01</p>
28 * @author 門田明彦
29 * @version $Revision: 1.1 $
30 */
31 public class Connection implements java.sql.Connection {
32
33 /* (non-Javadoc)
34 * @see java.lang.Object#toString()
35 */
36 public String toString() {
37 if (rcon != null) {
38 return rcon.toString();
39 } else {
40 return super.toString();
41 }
42 }
43
44 /** 実DB Connection */
45 private java.sql.Connection rcon;
46
47 /**
48 * コンストラクタ
49 */
50 Connection(java.sql.Connection con) {
51 super();
52
53 rcon = con;
54
55 ConCheckMgr.addChecker(con);
56 NotifyUtil.onConnection(Driver.getDriverInstance(), this);
57 }
58
59 /* (non-Javadoc)
60 * @see java.sql.Connection#createStatement()
61 */
62 public Statement createStatement() throws SQLException {
63
64 return new jp.co.powerbeans.jdbcdebug.sql.Statement(rcon.createStatement());
65 }
66
67 /* (non-Javadoc)
68 * @see java.sql.Connection#prepareStatement(java.lang.String)
69 */
70 public PreparedStatement prepareStatement(String sql) throws SQLException {
71
72 return new jp.co.powerbeans.jdbcdebug.sql.PreparedStatement(
73 rcon.prepareStatement(sql),
74 sql);
75 }
76
77 /* (non-Javadoc)
78 * @see java.sql.Connection#prepareCall(java.lang.String)
79 */
80 public CallableStatement prepareCall(String sql) throws SQLException {
81
82 return new jp.co.powerbeans.jdbcdebug.sql.CallableStatement(
83 rcon.prepareCall(sql));
84 }
85
86 /* (non-Javadoc)
87 * @see java.sql.Connection#nativeSQL(java.lang.String)
88 */
89 public String nativeSQL(String sql) throws SQLException {
90
91 return rcon.nativeSQL(sql);
92 }
93
94 /* (non-Javadoc)
95 * @see java.sql.Connection#setAutoCommit(boolean)
96 */
97 public void setAutoCommit(boolean autoCommit) throws SQLException {
98
99 rcon.setAutoCommit(autoCommit);
100 }
101
102 /* (non-Javadoc)
103 * @see java.sql.Connection#getAutoCommit()
104 */
105 public boolean getAutoCommit() throws SQLException {
106
107 return rcon.getAutoCommit();
108 }
109
110 /* (non-Javadoc)
111 * @see java.sql.Connection#commit()
112 */
113 public void commit() throws SQLException {
114
115 rcon.commit();
116 }
117
118 /* (non-Javadoc)
119 * @see java.sql.Connection#rollback()
120 */
121 public void rollback() throws SQLException {
122
123 rcon.rollback();
124 }
125
126 /* (non-Javadoc)
127 * @see java.sql.Connection#close()
128 */
129 public void close() throws SQLException {
130
131 rcon.close();
132 ConCheckMgr.closed(rcon);
133 NotifyUtil.onConnectionClose(Driver.getDriverInstance(), this);
134 }
135
136 /* (non-Javadoc)
137 * @see java.sql.Connection#isClosed()
138 */
139 public boolean isClosed() throws SQLException {
140
141 if (rcon != null) {
142 return rcon.isClosed();
143 } else {
144 return true;
145 }
146 }
147
148 /* (non-Javadoc)
149 * @see java.sql.Connection#getMetaData()
150 */
151 public DatabaseMetaData getMetaData() throws SQLException {
152
153 return new jp.co.powerbeans.jdbcdebug.sql.DatabaseMetaData(
154 rcon.getMetaData());
155 }
156
157 /* (non-Javadoc)
158 * @see java.sql.Connection#setReadOnly(boolean)
159 */
160 public void setReadOnly(boolean readOnly) throws SQLException {
161
162 rcon.setReadOnly(readOnly);
163 }
164
165 /* (non-Javadoc)
166 * @see java.sql.Connection#isReadOnly()
167 */
168 public boolean isReadOnly() throws SQLException {
169
170 return rcon.isReadOnly();
171 }
172
173 /* (non-Javadoc)
174 * @see java.sql.Connection#setCatalog(java.lang.String)
175 */
176 public void setCatalog(String catalog) throws SQLException {
177
178 rcon.setCatalog(catalog);
179 }
180
181 /* (non-Javadoc)
182 * @see java.sql.Connection#getCatalog()
183 */
184 public String getCatalog() throws SQLException {
185
186 return rcon.getCatalog();
187 }
188
189 /* (non-Javadoc)
190 * @see java.sql.Connection#setTransactionIsolation(int)
191 */
192 public void setTransactionIsolation(int level) throws SQLException {
193
194 rcon.setTransactionIsolation(level);
195 }
196
197 /* (non-Javadoc)
198 * @see java.sql.Connection#getTransactionIsolation()
199 */
200 public int getTransactionIsolation() throws SQLException {
201
202 return rcon.getTransactionIsolation();
203 }
204
205 /* (non-Javadoc)
206 * @see java.sql.Connection#getWarnings()
207 */
208 public SQLWarning getWarnings() throws SQLException {
209
210 return rcon.getWarnings();
211 }
212
213 /* (non-Javadoc)
214 * @see java.sql.Connection#clearWarnings()
215 */
216 public void clearWarnings() throws SQLException {
217
218 rcon.clearWarnings();
219 }
220
221 /* (non-Javadoc)
222 * @see java.sql.Connection#createStatement(int, int)
223 */
224 public Statement createStatement(
225 int resultSetType,
226 int resultSetConcurrency)
227 throws SQLException {
228
229 return new jp.co.powerbeans.jdbcdebug.sql.Statement(
230 rcon.createStatement(resultSetType, resultSetConcurrency));
231 }
232
233 /* (non-Javadoc)
234 * @see java.sql.Connection#prepareStatement(java.lang.String, int, int)
235 */
236 public PreparedStatement prepareStatement(
237 String sql,
238 int resultSetType,
239 int resultSetConcurrency)
240 throws SQLException {
241
242 return new jp.co.powerbeans.jdbcdebug.sql.PreparedStatement(
243 rcon.prepareStatement(sql, resultSetType, resultSetConcurrency),
244 sql);
245 }
246
247 /* (non-Javadoc)
248 * @see java.sql.Connection#prepareCall(java.lang.String, int, int)
249 */
250 public CallableStatement prepareCall(
251 String sql,
252 int resultSetType,
253 int resultSetConcurrency)
254 throws SQLException {
255
256 return new jp.co.powerbeans.jdbcdebug.sql.CallableStatement(
257 rcon.prepareCall(sql, resultSetType, resultSetConcurrency));
258 }
259
260 /* (non-Javadoc)
261 * @see java.sql.Connection#getTypeMap()
262 */
263 public Map getTypeMap() throws SQLException {
264
265 return rcon.getTypeMap();
266 }
267
268 /* (non-Javadoc)
269 * @see java.sql.Connection#setTypeMap(java.util.Map)
270 */
271 public void setTypeMap(Map map) throws SQLException {
272
273 rcon.setTypeMap(map);
274 }
275
276 /* (non-Javadoc)
277 * @see java.sql.Connection#setHoldability(int)
278 */
279 public void setHoldability(int holdability) throws SQLException {
280
281 rcon.setHoldability(holdability);
282 }
283
284 /* (non-Javadoc)
285 * @see java.sql.Connection#getHoldability()
286 */
287 public int getHoldability() throws SQLException {
288
289 return rcon.getHoldability();
290 }
291
292 /* (non-Javadoc)
293 * @see java.sql.Connection#setSavepoint()
294 */
295 public Savepoint setSavepoint() throws SQLException {
296
297 return new jp.co.powerbeans.jdbcdebug.sql.Savepoint(rcon.setSavepoint());
298 }
299
300 /* (non-Javadoc)
301 * @see java.sql.Connection#setSavepoint(java.lang.String)
302 */
303 public Savepoint setSavepoint(String name) throws SQLException {
304
305 return new jp.co.powerbeans.jdbcdebug.sql.Savepoint(rcon.setSavepoint(name));
306 }
307
308 /* (non-Javadoc)
309 * @see java.sql.Connection#rollback(java.sql.Savepoint)
310 */
311 public void rollback(Savepoint savepoint) throws SQLException {
312
313 rcon.rollback(savepoint);
314 }
315
316 /* (non-Javadoc)
317 * @see java.sql.Connection#releaseSavepoint(java.sql.Savepoint)
318 */
319 public void releaseSavepoint(Savepoint savepoint) throws SQLException {
320
321 rcon.releaseSavepoint(savepoint);
322 }
323
324 /* (non-Javadoc)
325 * @see java.sql.Connection#createStatement(int, int, int)
326 */
327 public Statement createStatement(
328 int resultSetType,
329 int resultSetConcurrency,
330 int resultSetHoldability)
331 throws SQLException {
332
333 return new jp.co.powerbeans.jdbcdebug.sql.Statement(
334 rcon.createStatement(
335 resultSetType,
336 resultSetConcurrency,
337 resultSetHoldability));
338 }
339
340 /* (non-Javadoc)
341 * @see java.sql.Connection#prepareStatement(java.lang.String, int, int, int)
342 */
343 public PreparedStatement prepareStatement(
344 String sql,
345 int resultSetType,
346 int resultSetConcurrency,
347 int resultSetHoldability)
348 throws SQLException {
349
350 return new jp.co.powerbeans.jdbcdebug.sql.PreparedStatement(
351 rcon.prepareStatement(
352 sql,
353 resultSetType,
354 resultSetConcurrency,
355 resultSetHoldability),
356 sql);
357 }
358
359 /* (non-Javadoc)
360 * @see java.sql.Connection#prepareCall(java.lang.String, int, int, int)
361 */
362 public CallableStatement prepareCall(
363 String sql,
364 int resultSetType,
365 int resultSetConcurrency,
366 int resultSetHoldability)
367 throws SQLException {
368
369 return new jp.co.powerbeans.jdbcdebug.sql.CallableStatement(
370 rcon.prepareCall(
371 sql,
372 resultSetType,
373 resultSetConcurrency,
374 resultSetHoldability));
375 }
376
377 /* (non-Javadoc)
378 * @see java.sql.Connection#prepareStatement(java.lang.String, int)
379 */
380 public PreparedStatement prepareStatement(
381 String sql,
382 int autoGeneratedKeys)
383 throws SQLException {
384
385 return new jp.co.powerbeans.jdbcdebug.sql.PreparedStatement(
386 rcon.prepareStatement(sql, autoGeneratedKeys),
387 sql);
388 }
389
390 /* (non-Javadoc)
391 * @see java.sql.Connection#prepareStatement(java.lang.String, int[])
392 */
393 public PreparedStatement prepareStatement(String sql, int[] columnIndexes)
394 throws SQLException {
395
396 return new jp.co.powerbeans.jdbcdebug.sql.PreparedStatement(
397 prepareStatement(sql, columnIndexes),
398 sql);
399 }
400
401 /* (non-Javadoc)
402 * @see java.sql.Connection#prepareStatement(java.lang.String, java.lang.String[])
403 */
404 public PreparedStatement prepareStatement(String sql, String[] columnNames)
405 throws SQLException {
406
407 return new jp.co.powerbeans.jdbcdebug.sql.PreparedStatement(
408 prepareStatement(sql, columnNames),
409 sql);
410 }
411
412 /**
413 * @param typeName
414 * @param elements
415 * @return
416 * @throws SQLException
417 * @see java.sql.Connection#createArrayOf(java.lang.String, java.lang.Object[])
418 */
419 public Array createArrayOf(String typeName, Object[] elements)
420 throws SQLException {
421 return rcon.createArrayOf(typeName, elements);
422 }
423
424 /**
425 * @return
426 * @throws SQLException
427 * @see java.sql.Connection#createBlob()
428 */
429 public Blob createBlob() throws SQLException {
430 return rcon.createBlob();
431 }
432
433 /**
434 * @return
435 * @throws SQLException
436 * @see java.sql.Connection#createClob()
437 */
438 public Clob createClob() throws SQLException {
439 return rcon.createClob();
440 }
441
442 /**
443 * @return
444 * @throws SQLException
445 * @see java.sql.Connection#createNClob()
446 */
447 public NClob createNClob() throws SQLException {
448 return rcon.createNClob();
449 }
450
451 /**
452 * @return
453 * @throws SQLException
454 * @see java.sql.Connection#createSQLXML()
455 */
456 public SQLXML createSQLXML() throws SQLException {
457 return rcon.createSQLXML();
458 }
459
460 /**
461 * @param typeName
462 * @param attributes
463 * @return
464 * @throws SQLException
465 * @see java.sql.Connection#createStruct(java.lang.String, java.lang.Object[])
466 */
467 public Struct createStruct(String typeName, Object[] attributes)
468 throws SQLException {
469 return rcon.createStruct(typeName, attributes);
470 }
471
472 /**
473 * @return
474 * @throws SQLException
475 * @see java.sql.Connection#getClientInfo()
476 */
477 public Properties getClientInfo() throws SQLException {
478 return rcon.getClientInfo();
479 }
480
481 /**
482 * @param name
483 * @return
484 * @throws SQLException
485 * @see java.sql.Connection#getClientInfo(java.lang.String)
486 */
487 public String getClientInfo(String name) throws SQLException {
488 return rcon.getClientInfo(name);
489 }
490
491 /**
492 * @param timeout
493 * @return
494 * @throws SQLException
495 * @see java.sql.Connection#isValid(int)
496 */
497 public boolean isValid(int timeout) throws SQLException {
498 return rcon.isValid(timeout);
499 }
500
501 /**
502 * @param iface
503 * @return
504 * @throws SQLException
505 * @see java.sql.Wrapper#isWrapperFor(java.lang.Class)
506 */
507 public boolean isWrapperFor(Class<?> iface) throws SQLException {
508 return rcon.isWrapperFor(iface);
509 }
510
511 /**
512 * @param properties
513 * @throws SQLClientInfoException
514 * @see java.sql.Connection#setClientInfo(java.util.Properties)
515 */
516 public void setClientInfo(Properties properties)
517 throws SQLClientInfoException {
518 rcon.setClientInfo(properties);
519 }
520
521 /**
522 * @param name
523 * @param value
524 * @throws SQLClientInfoException
525 * @see java.sql.Connection#setClientInfo(java.lang.String, java.lang.String)
526 */
527 public void setClientInfo(String name, String value)
528 throws SQLClientInfoException {
529 rcon.setClientInfo(name, value);
530 }
531
532 /**
533 * @param <T>
534 * @param iface
535 * @return
536 * @throws SQLException
537 * @see java.sql.Wrapper#unwrap(java.lang.Class)
538 */
539 public <T> T unwrap(Class<T> iface) throws SQLException {
540 return rcon.unwrap(iface);
541 }
542
543 }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26