1 | /* |
---|
2 | Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. |
---|
3 | |
---|
4 | |
---|
5 | The MySQL Connector/J is licensed under the terms of the GPLv2 |
---|
6 | <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most MySQL Connectors. |
---|
7 | There are special exceptions to the terms and conditions of the GPLv2 as it is applied to |
---|
8 | this software, see the FLOSS License Exception |
---|
9 | <http://www.mysql.com/about/legal/licensing/foss-exception.html>. |
---|
10 | |
---|
11 | This program is free software; you can redistribute it and/or modify it under the terms |
---|
12 | of the GNU General Public License as published by the Free Software Foundation; version 2 |
---|
13 | of the License. |
---|
14 | |
---|
15 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
---|
16 | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
---|
17 | See the GNU General Public License for more details. |
---|
18 | |
---|
19 | You should have received a copy of the GNU General Public License along with this |
---|
20 | program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth |
---|
21 | Floor, Boston, MA 02110-1301 USA |
---|
22 | |
---|
23 | |
---|
24 | |
---|
25 | */ |
---|
26 | package com.mysql.jdbc.jdbc2.optional; |
---|
27 | |
---|
28 | import java.io.InputStream; |
---|
29 | import java.io.Reader; |
---|
30 | import java.lang.reflect.InvocationHandler; |
---|
31 | import java.lang.reflect.InvocationTargetException; |
---|
32 | import java.lang.reflect.Method; |
---|
33 | import java.lang.reflect.Proxy; |
---|
34 | import java.sql.Array; |
---|
35 | import java.sql.Blob; |
---|
36 | import java.sql.CallableStatement; |
---|
37 | import java.sql.Clob; |
---|
38 | import java.sql.Connection; |
---|
39 | import java.sql.NClob; |
---|
40 | import java.sql.PreparedStatement; |
---|
41 | import java.sql.RowId; |
---|
42 | import java.sql.SQLClientInfoException; |
---|
43 | import java.sql.SQLException; |
---|
44 | import java.sql.SQLXML; |
---|
45 | import java.sql.Statement; |
---|
46 | import java.util.HashMap; |
---|
47 | import java.util.List; |
---|
48 | import java.util.Map; |
---|
49 | import java.util.Properties; |
---|
50 | |
---|
51 | import com.mysql.jdbc.ConnectionImpl; |
---|
52 | import com.mysql.jdbc.SQLError; |
---|
53 | |
---|
54 | import com.mysql.jdbc.jdbc2.optional.ConnectionWrapper; |
---|
55 | import com.mysql.jdbc.jdbc2.optional.MysqlPooledConnection; |
---|
56 | |
---|
57 | /** |
---|
58 | */ |
---|
59 | public class JDBC4CallableStatementWrapper extends CallableStatementWrapper { |
---|
60 | |
---|
61 | public JDBC4CallableStatementWrapper(ConnectionWrapper c, MysqlPooledConnection conn, |
---|
62 | CallableStatement toWrap) { |
---|
63 | super(c, conn, toWrap); |
---|
64 | } |
---|
65 | |
---|
66 | public void close() throws SQLException { |
---|
67 | try { |
---|
68 | super.close(); |
---|
69 | } finally { |
---|
70 | this.unwrappedInterfaces = null; |
---|
71 | } |
---|
72 | } |
---|
73 | |
---|
74 | public boolean isClosed() throws SQLException { |
---|
75 | try { |
---|
76 | if (this.wrappedStmt != null) { |
---|
77 | return this.wrappedStmt.isClosed(); |
---|
78 | } else { |
---|
79 | throw SQLError.createSQLException("Statement already closed", |
---|
80 | SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor); |
---|
81 | } |
---|
82 | } catch (SQLException sqlEx) { |
---|
83 | checkAndFireConnectionError(sqlEx); |
---|
84 | } |
---|
85 | |
---|
86 | return false; // never get here - compiler can't tell |
---|
87 | } |
---|
88 | |
---|
89 | public void setPoolable(boolean poolable) throws SQLException { |
---|
90 | try { |
---|
91 | if (this.wrappedStmt != null) { |
---|
92 | this.wrappedStmt.setPoolable(poolable); |
---|
93 | } else { |
---|
94 | throw SQLError.createSQLException("Statement already closed", |
---|
95 | SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor); |
---|
96 | } |
---|
97 | } catch (SQLException sqlEx) { |
---|
98 | checkAndFireConnectionError(sqlEx); |
---|
99 | } |
---|
100 | } |
---|
101 | |
---|
102 | public boolean isPoolable() throws SQLException { |
---|
103 | try { |
---|
104 | if (this.wrappedStmt != null) { |
---|
105 | return this.wrappedStmt.isPoolable(); |
---|
106 | } else { |
---|
107 | throw SQLError.createSQLException("Statement already closed", |
---|
108 | SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor); |
---|
109 | } |
---|
110 | } catch (SQLException sqlEx) { |
---|
111 | checkAndFireConnectionError(sqlEx); |
---|
112 | } |
---|
113 | |
---|
114 | return false; // never get here - compiler can't tell |
---|
115 | } |
---|
116 | |
---|
117 | public void setRowId(int parameterIndex, RowId x) throws SQLException { |
---|
118 | try { |
---|
119 | if (this.wrappedStmt != null) { |
---|
120 | ((PreparedStatement) this.wrappedStmt).setRowId(parameterIndex, |
---|
121 | x); |
---|
122 | } else { |
---|
123 | throw SQLError.createSQLException( |
---|
124 | "No operations allowed after statement closed", |
---|
125 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
126 | } |
---|
127 | } catch (SQLException sqlEx) { |
---|
128 | checkAndFireConnectionError(sqlEx); |
---|
129 | } |
---|
130 | } |
---|
131 | |
---|
132 | public void setNClob(int parameterIndex, NClob value) throws SQLException { |
---|
133 | try { |
---|
134 | if (this.wrappedStmt != null) { |
---|
135 | ((PreparedStatement) this.wrappedStmt).setNClob(parameterIndex, |
---|
136 | value); |
---|
137 | } else { |
---|
138 | throw SQLError.createSQLException( |
---|
139 | "No operations allowed after statement closed", |
---|
140 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
141 | } |
---|
142 | } catch (SQLException sqlEx) { |
---|
143 | checkAndFireConnectionError(sqlEx); |
---|
144 | } |
---|
145 | } |
---|
146 | |
---|
147 | public void setSQLXML(int parameterIndex, SQLXML xmlObject) |
---|
148 | throws SQLException { |
---|
149 | try { |
---|
150 | if (this.wrappedStmt != null) { |
---|
151 | ((PreparedStatement) this.wrappedStmt).setSQLXML(parameterIndex, |
---|
152 | xmlObject); |
---|
153 | } else { |
---|
154 | throw SQLError.createSQLException( |
---|
155 | "No operations allowed after statement closed", |
---|
156 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
157 | } |
---|
158 | } catch (SQLException sqlEx) { |
---|
159 | checkAndFireConnectionError(sqlEx); |
---|
160 | } |
---|
161 | } |
---|
162 | |
---|
163 | |
---|
164 | public void setNString(int parameterIndex, |
---|
165 | String value) |
---|
166 | throws SQLException { |
---|
167 | try { |
---|
168 | if (this.wrappedStmt != null) { |
---|
169 | ((PreparedStatement) this.wrappedStmt).setNString(parameterIndex, |
---|
170 | value); |
---|
171 | } else { |
---|
172 | throw SQLError.createSQLException( |
---|
173 | "No operations allowed after statement closed", |
---|
174 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
175 | } |
---|
176 | } catch (SQLException sqlEx) { |
---|
177 | checkAndFireConnectionError(sqlEx); |
---|
178 | } |
---|
179 | } |
---|
180 | |
---|
181 | public void setNCharacterStream(int parameterIndex, |
---|
182 | Reader value, |
---|
183 | long length) |
---|
184 | throws SQLException { |
---|
185 | try { |
---|
186 | if (this.wrappedStmt != null) { |
---|
187 | ((PreparedStatement) this.wrappedStmt).setNCharacterStream(parameterIndex, |
---|
188 | value, length); |
---|
189 | } else { |
---|
190 | throw SQLError.createSQLException( |
---|
191 | "No operations allowed after statement closed", |
---|
192 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
193 | } |
---|
194 | } catch (SQLException sqlEx) { |
---|
195 | checkAndFireConnectionError(sqlEx); |
---|
196 | } |
---|
197 | } |
---|
198 | |
---|
199 | public void setClob(int parameterIndex, |
---|
200 | Reader reader, |
---|
201 | long length) |
---|
202 | throws SQLException { |
---|
203 | try { |
---|
204 | if (this.wrappedStmt != null) { |
---|
205 | ((PreparedStatement) this.wrappedStmt).setClob(parameterIndex, |
---|
206 | reader, length); |
---|
207 | } else { |
---|
208 | throw SQLError.createSQLException( |
---|
209 | "No operations allowed after statement closed", |
---|
210 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
211 | } |
---|
212 | } catch (SQLException sqlEx) { |
---|
213 | checkAndFireConnectionError(sqlEx); |
---|
214 | } |
---|
215 | } |
---|
216 | |
---|
217 | public void setBlob(int parameterIndex, |
---|
218 | InputStream inputStream, |
---|
219 | long length) |
---|
220 | throws SQLException { |
---|
221 | try { |
---|
222 | if (this.wrappedStmt != null) { |
---|
223 | ((PreparedStatement) this.wrappedStmt).setBlob(parameterIndex, |
---|
224 | inputStream, length); |
---|
225 | } else { |
---|
226 | throw SQLError.createSQLException( |
---|
227 | "No operations allowed after statement closed", |
---|
228 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
229 | } |
---|
230 | } catch (SQLException sqlEx) { |
---|
231 | checkAndFireConnectionError(sqlEx); |
---|
232 | } |
---|
233 | } |
---|
234 | |
---|
235 | public void setNClob(int parameterIndex, |
---|
236 | Reader reader, |
---|
237 | long length) |
---|
238 | throws SQLException { |
---|
239 | try { |
---|
240 | if (this.wrappedStmt != null) { |
---|
241 | ((PreparedStatement) this.wrappedStmt).setNClob(parameterIndex, |
---|
242 | reader, length); |
---|
243 | } else { |
---|
244 | throw SQLError.createSQLException( |
---|
245 | "No operations allowed after statement closed", |
---|
246 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
247 | } |
---|
248 | } catch (SQLException sqlEx) { |
---|
249 | checkAndFireConnectionError(sqlEx); |
---|
250 | } |
---|
251 | } |
---|
252 | |
---|
253 | public void setAsciiStream(int parameterIndex, |
---|
254 | InputStream x, |
---|
255 | long length) |
---|
256 | throws SQLException { |
---|
257 | try { |
---|
258 | if (this.wrappedStmt != null) { |
---|
259 | ((PreparedStatement) this.wrappedStmt).setAsciiStream(parameterIndex, |
---|
260 | x, length); |
---|
261 | } else { |
---|
262 | throw SQLError.createSQLException( |
---|
263 | "No operations allowed after statement closed", |
---|
264 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
265 | } |
---|
266 | } catch (SQLException sqlEx) { |
---|
267 | checkAndFireConnectionError(sqlEx); |
---|
268 | } |
---|
269 | } |
---|
270 | |
---|
271 | public void setBinaryStream(int parameterIndex, |
---|
272 | InputStream x, |
---|
273 | long length) |
---|
274 | throws SQLException { |
---|
275 | try { |
---|
276 | if (this.wrappedStmt != null) { |
---|
277 | ((PreparedStatement) this.wrappedStmt).setBinaryStream(parameterIndex, |
---|
278 | x, length); |
---|
279 | } else { |
---|
280 | throw SQLError.createSQLException( |
---|
281 | "No operations allowed after statement closed", |
---|
282 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
283 | } |
---|
284 | } catch (SQLException sqlEx) { |
---|
285 | checkAndFireConnectionError(sqlEx); |
---|
286 | } |
---|
287 | } |
---|
288 | |
---|
289 | public void setCharacterStream(int parameterIndex, |
---|
290 | Reader reader, |
---|
291 | long length) |
---|
292 | throws SQLException { |
---|
293 | try { |
---|
294 | if (this.wrappedStmt != null) { |
---|
295 | ((PreparedStatement) this.wrappedStmt).setCharacterStream(parameterIndex, |
---|
296 | reader, length); |
---|
297 | } else { |
---|
298 | throw SQLError.createSQLException( |
---|
299 | "No operations allowed after statement closed", |
---|
300 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
301 | } |
---|
302 | } catch (SQLException sqlEx) { |
---|
303 | checkAndFireConnectionError(sqlEx); |
---|
304 | } |
---|
305 | } |
---|
306 | |
---|
307 | public void setAsciiStream(int parameterIndex, |
---|
308 | InputStream x) |
---|
309 | throws SQLException { |
---|
310 | try { |
---|
311 | if (this.wrappedStmt != null) { |
---|
312 | ((PreparedStatement) this.wrappedStmt).setAsciiStream(parameterIndex, |
---|
313 | x); |
---|
314 | } else { |
---|
315 | throw SQLError.createSQLException( |
---|
316 | "No operations allowed after statement closed", |
---|
317 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
318 | } |
---|
319 | } catch (SQLException sqlEx) { |
---|
320 | checkAndFireConnectionError(sqlEx); |
---|
321 | } |
---|
322 | } |
---|
323 | |
---|
324 | public void setBinaryStream(int parameterIndex, |
---|
325 | InputStream x) |
---|
326 | throws SQLException { |
---|
327 | try { |
---|
328 | if (this.wrappedStmt != null) { |
---|
329 | ((PreparedStatement) this.wrappedStmt).setBinaryStream(parameterIndex, |
---|
330 | x); |
---|
331 | } else { |
---|
332 | throw SQLError.createSQLException( |
---|
333 | "No operations allowed after statement closed", |
---|
334 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
335 | } |
---|
336 | } catch (SQLException sqlEx) { |
---|
337 | checkAndFireConnectionError(sqlEx); |
---|
338 | } |
---|
339 | } |
---|
340 | |
---|
341 | public void setCharacterStream(int parameterIndex, |
---|
342 | Reader reader) |
---|
343 | throws SQLException { |
---|
344 | try { |
---|
345 | if (this.wrappedStmt != null) { |
---|
346 | ((PreparedStatement) this.wrappedStmt).setCharacterStream(parameterIndex, |
---|
347 | reader); |
---|
348 | } else { |
---|
349 | throw SQLError.createSQLException( |
---|
350 | "No operations allowed after statement closed", |
---|
351 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
352 | } |
---|
353 | } catch (SQLException sqlEx) { |
---|
354 | checkAndFireConnectionError(sqlEx); |
---|
355 | } |
---|
356 | |
---|
357 | } |
---|
358 | |
---|
359 | public void setNCharacterStream(int parameterIndex, |
---|
360 | Reader value) |
---|
361 | throws SQLException { |
---|
362 | try { |
---|
363 | if (this.wrappedStmt != null) { |
---|
364 | ((PreparedStatement) this.wrappedStmt).setNCharacterStream(parameterIndex, |
---|
365 | value); |
---|
366 | } else { |
---|
367 | throw SQLError.createSQLException( |
---|
368 | "No operations allowed after statement closed", |
---|
369 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
370 | } |
---|
371 | } catch (SQLException sqlEx) { |
---|
372 | checkAndFireConnectionError(sqlEx); |
---|
373 | } |
---|
374 | |
---|
375 | } |
---|
376 | |
---|
377 | public void setClob(int parameterIndex, |
---|
378 | Reader reader) |
---|
379 | throws SQLException { |
---|
380 | try { |
---|
381 | if (this.wrappedStmt != null) { |
---|
382 | ((PreparedStatement) this.wrappedStmt).setClob(parameterIndex, |
---|
383 | reader); |
---|
384 | } else { |
---|
385 | throw SQLError.createSQLException( |
---|
386 | "No operations allowed after statement closed", |
---|
387 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
388 | } |
---|
389 | } catch (SQLException sqlEx) { |
---|
390 | checkAndFireConnectionError(sqlEx); |
---|
391 | } |
---|
392 | |
---|
393 | } |
---|
394 | |
---|
395 | public void setBlob(int parameterIndex, |
---|
396 | InputStream inputStream) |
---|
397 | throws SQLException { |
---|
398 | try { |
---|
399 | if (this.wrappedStmt != null) { |
---|
400 | ((PreparedStatement) this.wrappedStmt).setBlob(parameterIndex, |
---|
401 | inputStream); |
---|
402 | } else { |
---|
403 | throw SQLError.createSQLException( |
---|
404 | "No operations allowed after statement closed", |
---|
405 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
406 | } |
---|
407 | } catch (SQLException sqlEx) { |
---|
408 | checkAndFireConnectionError(sqlEx); |
---|
409 | } |
---|
410 | } |
---|
411 | |
---|
412 | public void setNClob(int parameterIndex, |
---|
413 | Reader reader) |
---|
414 | throws SQLException { |
---|
415 | try { |
---|
416 | if (this.wrappedStmt != null) { |
---|
417 | ((PreparedStatement) this.wrappedStmt).setNClob(parameterIndex, |
---|
418 | reader); |
---|
419 | } else { |
---|
420 | throw SQLError.createSQLException( |
---|
421 | "No operations allowed after statement closed", |
---|
422 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
423 | } |
---|
424 | } catch (SQLException sqlEx) { |
---|
425 | checkAndFireConnectionError(sqlEx); |
---|
426 | } |
---|
427 | } |
---|
428 | |
---|
429 | /** |
---|
430 | * Returns true if this either implements the interface argument or is |
---|
431 | * directly or indirectly a wrapper for an object that does. Returns false |
---|
432 | * otherwise. If this implements the interface then return true, else if |
---|
433 | * this is a wrapper then return the result of recursively calling |
---|
434 | * <code>isWrapperFor</code> on the wrapped object. If this does not |
---|
435 | * implement the interface and is not a wrapper, return false. This method |
---|
436 | * should be implemented as a low-cost operation compared to |
---|
437 | * <code>unwrap</code> so that callers can use this method to avoid |
---|
438 | * expensive <code>unwrap</code> calls that may fail. If this method |
---|
439 | * returns true then calling <code>unwrap</code> with the same argument |
---|
440 | * should succeed. |
---|
441 | * |
---|
442 | * @param interfaces |
---|
443 | * a Class defining an interface. |
---|
444 | * @return true if this implements the interface or directly or indirectly |
---|
445 | * wraps an object that does. |
---|
446 | * @throws java.sql.SQLException |
---|
447 | * if an error occurs while determining whether this is a |
---|
448 | * wrapper for an object with the given interface. |
---|
449 | * @since 1.6 |
---|
450 | */ |
---|
451 | public boolean isWrapperFor(Class<?> iface) throws SQLException { |
---|
452 | |
---|
453 | boolean isInstance = iface.isInstance(this); |
---|
454 | |
---|
455 | if (isInstance) { |
---|
456 | return true; |
---|
457 | } |
---|
458 | |
---|
459 | String interfaceClassName = iface.getName(); |
---|
460 | |
---|
461 | return (interfaceClassName.equals("com.mysql.jdbc.Statement") |
---|
462 | || interfaceClassName.equals("java.sql.Statement") |
---|
463 | || interfaceClassName.equals("java.sql.PreparedStatement") |
---|
464 | || interfaceClassName.equals("java.sql.Wrapper")); |
---|
465 | } |
---|
466 | |
---|
467 | /** |
---|
468 | * Returns an object that implements the given interface to allow access to |
---|
469 | * non-standard methods, or standard methods not exposed by the proxy. The |
---|
470 | * result may be either the object found to implement the interface or a |
---|
471 | * proxy for that object. If the receiver implements the interface then that |
---|
472 | * is the object. If the receiver is a wrapper and the wrapped object |
---|
473 | * implements the interface then that is the object. Otherwise the object is |
---|
474 | * the result of calling <code>unwrap</code> recursively on the wrapped |
---|
475 | * object. If the receiver is not a wrapper and does not implement the |
---|
476 | * interface, then an <code>SQLException</code> is thrown. |
---|
477 | * |
---|
478 | * @param iface |
---|
479 | * A Class defining an interface that the result must implement. |
---|
480 | * @return an object that implements the interface. May be a proxy for the |
---|
481 | * actual implementing object. |
---|
482 | * @throws java.sql.SQLException |
---|
483 | * If no object found that implements the interface |
---|
484 | * @since 1.6 |
---|
485 | */ |
---|
486 | public synchronized <T> T unwrap(java.lang.Class<T> iface) |
---|
487 | throws java.sql.SQLException { |
---|
488 | try { |
---|
489 | if ("java.sql.Statement".equals(iface.getName()) |
---|
490 | || "java.sql.PreparedStatement".equals(iface.getName()) |
---|
491 | || "java.sql.Wrapper.class".equals(iface.getName())) { |
---|
492 | return iface.cast(this); |
---|
493 | } |
---|
494 | |
---|
495 | if (unwrappedInterfaces == null) { |
---|
496 | unwrappedInterfaces = new HashMap(); |
---|
497 | } |
---|
498 | |
---|
499 | Object cachedUnwrapped = unwrappedInterfaces.get(iface); |
---|
500 | |
---|
501 | if (cachedUnwrapped == null) { |
---|
502 | if (cachedUnwrapped == null) { |
---|
503 | cachedUnwrapped = Proxy.newProxyInstance( |
---|
504 | this.wrappedStmt.getClass().getClassLoader(), |
---|
505 | new Class[] { iface }, |
---|
506 | new ConnectionErrorFiringInvocationHandler(this.wrappedStmt)); |
---|
507 | unwrappedInterfaces.put(iface, cachedUnwrapped); |
---|
508 | } |
---|
509 | unwrappedInterfaces.put(iface, cachedUnwrapped); |
---|
510 | } |
---|
511 | |
---|
512 | return iface.cast(cachedUnwrapped); |
---|
513 | } catch (ClassCastException cce) { |
---|
514 | throw SQLError.createSQLException("Unable to unwrap to " |
---|
515 | + iface.toString(), SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor); |
---|
516 | } |
---|
517 | } |
---|
518 | |
---|
519 | public void setRowId(String parameterName, RowId x) throws SQLException { |
---|
520 | try { |
---|
521 | if (this.wrappedStmt != null) { |
---|
522 | ((CallableStatement) this.wrappedStmt).setRowId(parameterName, x); |
---|
523 | } else { |
---|
524 | throw SQLError.createSQLException( |
---|
525 | "No operations allowed after statement closed", |
---|
526 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
527 | } |
---|
528 | } catch (SQLException sqlEx) { |
---|
529 | checkAndFireConnectionError(sqlEx); |
---|
530 | } |
---|
531 | } |
---|
532 | |
---|
533 | public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException { |
---|
534 | try { |
---|
535 | if (this.wrappedStmt != null) { |
---|
536 | ((CallableStatement) this.wrappedStmt).setSQLXML(parameterName, xmlObject); |
---|
537 | } else { |
---|
538 | throw SQLError.createSQLException( |
---|
539 | "No operations allowed after statement closed", |
---|
540 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
541 | } |
---|
542 | } catch (SQLException sqlEx) { |
---|
543 | checkAndFireConnectionError(sqlEx); |
---|
544 | } |
---|
545 | } |
---|
546 | |
---|
547 | public SQLXML getSQLXML(int parameterIndex) throws SQLException { |
---|
548 | try { |
---|
549 | if (this.wrappedStmt != null) { |
---|
550 | return ((CallableStatement) this.wrappedStmt).getSQLXML(parameterIndex); |
---|
551 | } else { |
---|
552 | throw SQLError.createSQLException( |
---|
553 | "No operations allowed after statement closed", |
---|
554 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
555 | } |
---|
556 | } catch (SQLException sqlEx) { |
---|
557 | checkAndFireConnectionError(sqlEx); |
---|
558 | } |
---|
559 | |
---|
560 | return null; |
---|
561 | |
---|
562 | } |
---|
563 | |
---|
564 | public SQLXML getSQLXML(String parameterName) throws SQLException { |
---|
565 | try { |
---|
566 | if (this.wrappedStmt != null) { |
---|
567 | return ((CallableStatement) this.wrappedStmt).getSQLXML(parameterName); |
---|
568 | } else { |
---|
569 | throw SQLError.createSQLException( |
---|
570 | "No operations allowed after statement closed", |
---|
571 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
572 | } |
---|
573 | } catch (SQLException sqlEx) { |
---|
574 | checkAndFireConnectionError(sqlEx); |
---|
575 | } |
---|
576 | |
---|
577 | return null; |
---|
578 | } |
---|
579 | |
---|
580 | public RowId getRowId(String parameterName) throws SQLException { |
---|
581 | try { |
---|
582 | if (this.wrappedStmt != null) { |
---|
583 | return ((CallableStatement) this.wrappedStmt).getRowId(parameterName); |
---|
584 | } else { |
---|
585 | throw SQLError.createSQLException( |
---|
586 | "No operations allowed after statement closed", |
---|
587 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
588 | } |
---|
589 | } catch (SQLException sqlEx) { |
---|
590 | checkAndFireConnectionError(sqlEx); |
---|
591 | } |
---|
592 | |
---|
593 | return null; |
---|
594 | } |
---|
595 | |
---|
596 | public void setNClob(String parameterName, NClob value) throws SQLException { |
---|
597 | try { |
---|
598 | if (this.wrappedStmt != null) { |
---|
599 | ((CallableStatement) this.wrappedStmt).setNClob(parameterName, value); |
---|
600 | } else { |
---|
601 | throw SQLError.createSQLException( |
---|
602 | "No operations allowed after statement closed", |
---|
603 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
604 | } |
---|
605 | } catch (SQLException sqlEx) { |
---|
606 | checkAndFireConnectionError(sqlEx); |
---|
607 | } |
---|
608 | } |
---|
609 | |
---|
610 | public void setNClob(String parameterName, Reader reader) throws SQLException { |
---|
611 | try { |
---|
612 | if (this.wrappedStmt != null) { |
---|
613 | ((CallableStatement) this.wrappedStmt).setNClob(parameterName, reader); |
---|
614 | } else { |
---|
615 | throw SQLError.createSQLException( |
---|
616 | "No operations allowed after statement closed", |
---|
617 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
618 | } |
---|
619 | } catch (SQLException sqlEx) { |
---|
620 | checkAndFireConnectionError(sqlEx); |
---|
621 | } |
---|
622 | } |
---|
623 | |
---|
624 | public void setNClob(String parameterName, Reader reader, long length) throws SQLException { |
---|
625 | try { |
---|
626 | if (this.wrappedStmt != null) { |
---|
627 | ((CallableStatement) this.wrappedStmt).setNClob(parameterName, reader, length); |
---|
628 | } else { |
---|
629 | throw SQLError.createSQLException( |
---|
630 | "No operations allowed after statement closed", |
---|
631 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
632 | } |
---|
633 | } catch (SQLException sqlEx) { |
---|
634 | checkAndFireConnectionError(sqlEx); |
---|
635 | } |
---|
636 | } |
---|
637 | |
---|
638 | public void setNString(String parameterName, String value) throws SQLException { |
---|
639 | try { |
---|
640 | if (this.wrappedStmt != null) { |
---|
641 | ((CallableStatement) this.wrappedStmt).setNString(parameterName, value); |
---|
642 | } else { |
---|
643 | throw SQLError.createSQLException( |
---|
644 | "No operations allowed after statement closed", |
---|
645 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
646 | } |
---|
647 | } catch (SQLException sqlEx) { |
---|
648 | checkAndFireConnectionError(sqlEx); |
---|
649 | } |
---|
650 | } |
---|
651 | |
---|
652 | /** |
---|
653 | * @see java.sql.CallableStatement#getCharacterStream(int) |
---|
654 | */ |
---|
655 | public Reader getCharacterStream(int parameterIndex) throws SQLException { |
---|
656 | try { |
---|
657 | if (this.wrappedStmt != null) { |
---|
658 | return ((CallableStatement) this.wrappedStmt).getCharacterStream(parameterIndex); |
---|
659 | } else { |
---|
660 | throw SQLError.createSQLException( |
---|
661 | "No operations allowed after statement closed", |
---|
662 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
663 | } |
---|
664 | } catch (SQLException sqlEx) { |
---|
665 | checkAndFireConnectionError(sqlEx); |
---|
666 | } |
---|
667 | |
---|
668 | return null; |
---|
669 | } |
---|
670 | |
---|
671 | /** |
---|
672 | * @see java.sql.CallableStatement#getCharacterStream(java.lang.String) |
---|
673 | */ |
---|
674 | public Reader getCharacterStream(String parameterName) throws SQLException { |
---|
675 | try { |
---|
676 | if (this.wrappedStmt != null) { |
---|
677 | return ((CallableStatement) this.wrappedStmt).getCharacterStream(parameterName); |
---|
678 | } else { |
---|
679 | throw SQLError.createSQLException( |
---|
680 | "No operations allowed after statement closed", |
---|
681 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
682 | } |
---|
683 | } catch (SQLException sqlEx) { |
---|
684 | checkAndFireConnectionError(sqlEx); |
---|
685 | } |
---|
686 | |
---|
687 | return null; |
---|
688 | } |
---|
689 | |
---|
690 | /** |
---|
691 | * @see java.sql.CallableStatement#getNCharacterStream(int) |
---|
692 | */ |
---|
693 | public Reader getNCharacterStream(int parameterIndex) throws SQLException { |
---|
694 | try { |
---|
695 | if (this.wrappedStmt != null) { |
---|
696 | return ((CallableStatement) this.wrappedStmt).getNCharacterStream(parameterIndex); |
---|
697 | } else { |
---|
698 | throw SQLError.createSQLException( |
---|
699 | "No operations allowed after statement closed", |
---|
700 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
701 | } |
---|
702 | } catch (SQLException sqlEx) { |
---|
703 | checkAndFireConnectionError(sqlEx); |
---|
704 | } |
---|
705 | |
---|
706 | return null; |
---|
707 | } |
---|
708 | |
---|
709 | /** |
---|
710 | * @see java.sql.CallableStatement#getNCharacterStream(java.lang.String) |
---|
711 | */ |
---|
712 | public Reader getNCharacterStream(String parameterName) throws SQLException { |
---|
713 | try { |
---|
714 | if (this.wrappedStmt != null) { |
---|
715 | return ((CallableStatement) this.wrappedStmt).getNCharacterStream(parameterName); |
---|
716 | } else { |
---|
717 | throw SQLError.createSQLException( |
---|
718 | "No operations allowed after statement closed", |
---|
719 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
720 | } |
---|
721 | } catch (SQLException sqlEx) { |
---|
722 | checkAndFireConnectionError(sqlEx); |
---|
723 | } |
---|
724 | |
---|
725 | return null; |
---|
726 | } |
---|
727 | |
---|
728 | /** |
---|
729 | * @see java.sql.CallableStatement#getNClob(java.lang.String) |
---|
730 | */ |
---|
731 | public NClob getNClob(String parameterName) throws SQLException { |
---|
732 | try { |
---|
733 | if (this.wrappedStmt != null) { |
---|
734 | return ((CallableStatement) this.wrappedStmt).getNClob(parameterName); |
---|
735 | } else { |
---|
736 | throw SQLError.createSQLException( |
---|
737 | "No operations allowed after statement closed", |
---|
738 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
739 | } |
---|
740 | } catch (SQLException sqlEx) { |
---|
741 | checkAndFireConnectionError(sqlEx); |
---|
742 | } |
---|
743 | |
---|
744 | return null; |
---|
745 | } |
---|
746 | |
---|
747 | /** |
---|
748 | * @see java.sql.CallableStatement#getNString(java.lang.String) |
---|
749 | */ |
---|
750 | public String getNString(String parameterName) throws SQLException { |
---|
751 | try { |
---|
752 | if (this.wrappedStmt != null) { |
---|
753 | return ((CallableStatement) this.wrappedStmt).getNString(parameterName); |
---|
754 | } else { |
---|
755 | throw SQLError.createSQLException( |
---|
756 | "No operations allowed after statement closed", |
---|
757 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
758 | } |
---|
759 | } catch (SQLException sqlEx) { |
---|
760 | checkAndFireConnectionError(sqlEx); |
---|
761 | } |
---|
762 | |
---|
763 | return null; |
---|
764 | } |
---|
765 | |
---|
766 | public void setAsciiStream(String parameterName, InputStream x) throws SQLException { |
---|
767 | try { |
---|
768 | if (this.wrappedStmt != null) { |
---|
769 | ((CallableStatement) this.wrappedStmt).setAsciiStream(parameterName, x); |
---|
770 | } else { |
---|
771 | throw SQLError.createSQLException( |
---|
772 | "No operations allowed after statement closed", |
---|
773 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
774 | } |
---|
775 | } catch (SQLException sqlEx) { |
---|
776 | checkAndFireConnectionError(sqlEx); |
---|
777 | } |
---|
778 | } |
---|
779 | |
---|
780 | public void setAsciiStream(String parameterName, InputStream x, long length) throws SQLException { |
---|
781 | try { |
---|
782 | if (this.wrappedStmt != null) { |
---|
783 | ((CallableStatement) this.wrappedStmt).setAsciiStream(parameterName, x, length); |
---|
784 | } else { |
---|
785 | throw SQLError.createSQLException( |
---|
786 | "No operations allowed after statement closed", |
---|
787 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
788 | } |
---|
789 | } catch (SQLException sqlEx) { |
---|
790 | checkAndFireConnectionError(sqlEx); |
---|
791 | } |
---|
792 | } |
---|
793 | |
---|
794 | public void setBinaryStream(String parameterName, InputStream x) throws SQLException { |
---|
795 | try { |
---|
796 | if (this.wrappedStmt != null) { |
---|
797 | ((CallableStatement) this.wrappedStmt).setBinaryStream(parameterName, x); |
---|
798 | } else { |
---|
799 | throw SQLError.createSQLException( |
---|
800 | "No operations allowed after statement closed", |
---|
801 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
802 | } |
---|
803 | } catch (SQLException sqlEx) { |
---|
804 | checkAndFireConnectionError(sqlEx); |
---|
805 | } |
---|
806 | } |
---|
807 | |
---|
808 | public void setBinaryStream(String parameterName, InputStream x, long length) throws SQLException { |
---|
809 | try { |
---|
810 | if (this.wrappedStmt != null) { |
---|
811 | ((CallableStatement) this.wrappedStmt).setBinaryStream(parameterName, x, length); |
---|
812 | } else { |
---|
813 | throw SQLError.createSQLException( |
---|
814 | "No operations allowed after statement closed", |
---|
815 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
816 | } |
---|
817 | } catch (SQLException sqlEx) { |
---|
818 | checkAndFireConnectionError(sqlEx); |
---|
819 | } |
---|
820 | } |
---|
821 | |
---|
822 | public void setBlob(String parameterName, InputStream x) throws SQLException { |
---|
823 | try { |
---|
824 | if (this.wrappedStmt != null) { |
---|
825 | ((CallableStatement) this.wrappedStmt).setBlob(parameterName, x); |
---|
826 | } else { |
---|
827 | throw SQLError.createSQLException( |
---|
828 | "No operations allowed after statement closed", |
---|
829 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
830 | } |
---|
831 | } catch (SQLException sqlEx) { |
---|
832 | checkAndFireConnectionError(sqlEx); |
---|
833 | } |
---|
834 | } |
---|
835 | |
---|
836 | public void setBlob(String parameterName, InputStream x, long length) throws SQLException { |
---|
837 | try { |
---|
838 | if (this.wrappedStmt != null) { |
---|
839 | ((CallableStatement) this.wrappedStmt).setBlob(parameterName, x, length); |
---|
840 | } else { |
---|
841 | throw SQLError.createSQLException( |
---|
842 | "No operations allowed after statement closed", |
---|
843 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
844 | } |
---|
845 | } catch (SQLException sqlEx) { |
---|
846 | checkAndFireConnectionError(sqlEx); |
---|
847 | } |
---|
848 | } |
---|
849 | |
---|
850 | public void setBlob(String parameterName, Blob x) throws SQLException { |
---|
851 | try { |
---|
852 | if (this.wrappedStmt != null) { |
---|
853 | ((CallableStatement) this.wrappedStmt).setBlob(parameterName, x); |
---|
854 | } else { |
---|
855 | throw SQLError.createSQLException( |
---|
856 | "No operations allowed after statement closed", |
---|
857 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
858 | } |
---|
859 | } catch (SQLException sqlEx) { |
---|
860 | checkAndFireConnectionError(sqlEx); |
---|
861 | } |
---|
862 | } |
---|
863 | |
---|
864 | public void setCharacterStream(String parameterName, Reader reader) throws SQLException { |
---|
865 | try { |
---|
866 | if (this.wrappedStmt != null) { |
---|
867 | ((CallableStatement) this.wrappedStmt).setCharacterStream(parameterName, reader); |
---|
868 | } else { |
---|
869 | throw SQLError.createSQLException( |
---|
870 | "No operations allowed after statement closed", |
---|
871 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
872 | } |
---|
873 | } catch (SQLException sqlEx) { |
---|
874 | checkAndFireConnectionError(sqlEx); |
---|
875 | } |
---|
876 | } |
---|
877 | |
---|
878 | public void setCharacterStream(String parameterName, Reader reader, long length) throws SQLException { |
---|
879 | try { |
---|
880 | if (this.wrappedStmt != null) { |
---|
881 | ((CallableStatement) this.wrappedStmt).setCharacterStream(parameterName, reader, length); |
---|
882 | } else { |
---|
883 | throw SQLError.createSQLException( |
---|
884 | "No operations allowed after statement closed", |
---|
885 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
886 | } |
---|
887 | } catch (SQLException sqlEx) { |
---|
888 | checkAndFireConnectionError(sqlEx); |
---|
889 | } |
---|
890 | } |
---|
891 | |
---|
892 | public void setClob(String parameterName, Clob x) throws SQLException { |
---|
893 | try { |
---|
894 | if (this.wrappedStmt != null) { |
---|
895 | ((CallableStatement) this.wrappedStmt).setClob(parameterName, x); |
---|
896 | } else { |
---|
897 | throw SQLError.createSQLException( |
---|
898 | "No operations allowed after statement closed", |
---|
899 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
900 | } |
---|
901 | } catch (SQLException sqlEx) { |
---|
902 | checkAndFireConnectionError(sqlEx); |
---|
903 | } |
---|
904 | } |
---|
905 | |
---|
906 | public void setClob(String parameterName, Reader reader) throws SQLException { |
---|
907 | try { |
---|
908 | if (this.wrappedStmt != null) { |
---|
909 | ((CallableStatement) this.wrappedStmt).setClob(parameterName, reader); |
---|
910 | } else { |
---|
911 | throw SQLError.createSQLException( |
---|
912 | "No operations allowed after statement closed", |
---|
913 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
914 | } |
---|
915 | } catch (SQLException sqlEx) { |
---|
916 | checkAndFireConnectionError(sqlEx); |
---|
917 | } |
---|
918 | } |
---|
919 | |
---|
920 | public void setClob(String parameterName, Reader reader, long length) throws SQLException { |
---|
921 | try { |
---|
922 | if (this.wrappedStmt != null) { |
---|
923 | ((CallableStatement) this.wrappedStmt).setClob(parameterName, reader, length); |
---|
924 | } else { |
---|
925 | throw SQLError.createSQLException( |
---|
926 | "No operations allowed after statement closed", |
---|
927 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
928 | } |
---|
929 | } catch (SQLException sqlEx) { |
---|
930 | checkAndFireConnectionError(sqlEx); |
---|
931 | } |
---|
932 | } |
---|
933 | |
---|
934 | public void setNCharacterStream(String parameterName, Reader reader) throws SQLException { |
---|
935 | try { |
---|
936 | if (this.wrappedStmt != null) { |
---|
937 | ((CallableStatement) this.wrappedStmt).setNCharacterStream(parameterName, reader); |
---|
938 | } else { |
---|
939 | throw SQLError.createSQLException( |
---|
940 | "No operations allowed after statement closed", |
---|
941 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
942 | } |
---|
943 | } catch (SQLException sqlEx) { |
---|
944 | checkAndFireConnectionError(sqlEx); |
---|
945 | } |
---|
946 | } |
---|
947 | |
---|
948 | public void setNCharacterStream(String parameterName, Reader reader, long length) throws SQLException { |
---|
949 | try { |
---|
950 | if (this.wrappedStmt != null) { |
---|
951 | ((CallableStatement) this.wrappedStmt).setNCharacterStream(parameterName, reader, length); |
---|
952 | } else { |
---|
953 | throw SQLError.createSQLException( |
---|
954 | "No operations allowed after statement closed", |
---|
955 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
956 | } |
---|
957 | } catch (SQLException sqlEx) { |
---|
958 | checkAndFireConnectionError(sqlEx); |
---|
959 | } |
---|
960 | } |
---|
961 | |
---|
962 | public NClob getNClob(int parameterIndex) throws SQLException { |
---|
963 | try { |
---|
964 | if (this.wrappedStmt != null) { |
---|
965 | return ((CallableStatement) this.wrappedStmt).getNClob(parameterIndex); |
---|
966 | } else { |
---|
967 | throw SQLError.createSQLException( |
---|
968 | "No operations allowed after statement closed", |
---|
969 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
970 | } |
---|
971 | } catch (SQLException sqlEx) { |
---|
972 | checkAndFireConnectionError(sqlEx); |
---|
973 | } |
---|
974 | |
---|
975 | return null; |
---|
976 | } |
---|
977 | |
---|
978 | public String getNString(int parameterIndex) throws SQLException { |
---|
979 | try { |
---|
980 | if (this.wrappedStmt != null) { |
---|
981 | return ((CallableStatement) this.wrappedStmt).getNString(parameterIndex); |
---|
982 | } else { |
---|
983 | throw SQLError.createSQLException( |
---|
984 | "No operations allowed after statement closed", |
---|
985 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
986 | } |
---|
987 | } catch (SQLException sqlEx) { |
---|
988 | checkAndFireConnectionError(sqlEx); |
---|
989 | } |
---|
990 | |
---|
991 | return null; |
---|
992 | } |
---|
993 | |
---|
994 | public RowId getRowId(int parameterIndex) throws SQLException { |
---|
995 | try { |
---|
996 | if (this.wrappedStmt != null) { |
---|
997 | return ((CallableStatement) this.wrappedStmt).getRowId(parameterIndex); |
---|
998 | } else { |
---|
999 | throw SQLError.createSQLException( |
---|
1000 | "No operations allowed after statement closed", |
---|
1001 | SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); |
---|
1002 | } |
---|
1003 | } catch (SQLException sqlEx) { |
---|
1004 | checkAndFireConnectionError(sqlEx); |
---|
1005 | } |
---|
1006 | |
---|
1007 | return null; |
---|
1008 | } |
---|
1009 | } |
---|