Source code: com/mysql/jdbc/jdbc2/optional/PreparedStatementWrapper.java
1 /*
2 Copyright (C) 2002-2004 MySQL AB
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of version 2 of the GNU General Public License as
6 published by the Free Software Foundation.
7
8
9 There are special exceptions to the terms and conditions of the GPL
10 as it is applied to this software. View the full text of the
11 exception exception in file EXCEPTIONS-CONNECTOR-J in the directory of this
12 software distribution.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
23 */
24 package com.mysql.jdbc.jdbc2.optional;
25
26 import java.io.InputStream;
27 import java.io.Reader;
28 import java.math.BigDecimal;
29 import java.net.URL;
30 import java.sql.Array;
31 import java.sql.Blob;
32 import java.sql.Clob;
33 import java.sql.Date;
34 import java.sql.ParameterMetaData;
35 import java.sql.PreparedStatement;
36 import java.sql.Ref;
37 import java.sql.ResultSet;
38 import java.sql.ResultSetMetaData;
39 import java.sql.SQLException;
40 import java.sql.Time;
41 import java.sql.Timestamp;
42 import java.util.Calendar;
43
44 import com.mysql.jdbc.SQLError;
45
46
47 /**
48 * Wraps prepared statements so that errors can be reported correctly to
49 * ConnectionEventListeners.
50 *
51 * @author Mark Matthews
52 *
53 * @version $Id: PreparedStatementWrapper.java,v 1.1.2.4 2004/08/09 22:15:12 mmatthew Exp $
54 */
55 class PreparedStatementWrapper extends StatementWrapper
56 implements PreparedStatement {
57 PreparedStatementWrapper(MysqlPooledConnection conn,
58 PreparedStatement toWrap) {
59 super(conn, toWrap);
60 }
61
62 /* (non-Javadoc)
63 * @see java.sql.PreparedStatement#setArray(int, java.sql.Array)
64 */
65 public void setArray(int parameterIndex, Array x) throws SQLException {
66 try {
67 if (this.wrappedStmt != null) {
68 ((PreparedStatement) this.wrappedStmt).setArray(parameterIndex,
69 x);
70 } else {
71 throw new SQLException("No operations allowed after statement closed",
72 SQLError.SQL_STATE_GENERAL_ERROR);
73 }
74 } catch (SQLException sqlEx) {
75 checkAndFireConnectionError(sqlEx);
76 }
77 }
78
79 /* (non-Javadoc)
80 * @see java.sql.PreparedStatement#setAsciiStream(int, java.io.InputStream, int)
81 */
82 public void setAsciiStream(int parameterIndex, InputStream x, int length)
83 throws SQLException {
84 try {
85 if (this.wrappedStmt != null) {
86 ((PreparedStatement) this.wrappedStmt).setAsciiStream(parameterIndex,
87 x, length);
88 } else {
89 throw new SQLException("No operations allowed after statement closed",
90 SQLError.SQL_STATE_GENERAL_ERROR);
91 }
92 } catch (SQLException sqlEx) {
93 checkAndFireConnectionError(sqlEx);
94 }
95 }
96
97 /* (non-Javadoc)
98 * @see java.sql.PreparedStatement#setBigDecimal(int, java.math.BigDecimal)
99 */
100 public void setBigDecimal(int parameterIndex, BigDecimal x)
101 throws SQLException {
102 try {
103 if (this.wrappedStmt != null) {
104 ((PreparedStatement) this.wrappedStmt).setBigDecimal(parameterIndex,
105 x);
106 } else {
107 throw new SQLException("No operations allowed after statement closed",
108 SQLError.SQL_STATE_GENERAL_ERROR);
109 }
110 } catch (SQLException sqlEx) {
111 checkAndFireConnectionError(sqlEx);
112 }
113 }
114
115 /* (non-Javadoc)
116 * @see java.sql.PreparedStatement#setBinaryStream(int, java.io.InputStream, int)
117 */
118 public void setBinaryStream(int parameterIndex, InputStream x, int length)
119 throws SQLException {
120 try {
121 if (this.wrappedStmt != null) {
122 ((PreparedStatement) this.wrappedStmt).setBinaryStream(parameterIndex,
123 x, length);
124 } else {
125 throw new SQLException("No operations allowed after statement closed",
126 SQLError.SQL_STATE_GENERAL_ERROR);
127 }
128 } catch (SQLException sqlEx) {
129 checkAndFireConnectionError(sqlEx);
130 }
131 }
132
133 /* (non-Javadoc)
134 * @see java.sql.PreparedStatement#setBlob(int, java.sql.Blob)
135 */
136 public void setBlob(int parameterIndex, Blob x) throws SQLException {
137 try {
138 if (this.wrappedStmt != null) {
139 ((PreparedStatement) this.wrappedStmt).setBlob(parameterIndex, x);
140 } else {
141 throw new SQLException("No operations allowed after statement closed",
142 SQLError.SQL_STATE_GENERAL_ERROR);
143 }
144 } catch (SQLException sqlEx) {
145 checkAndFireConnectionError(sqlEx);
146 }
147 }
148
149 /* (non-Javadoc)
150 * @see java.sql.PreparedStatement#setBoolean(int, boolean)
151 */
152 public void setBoolean(int parameterIndex, boolean x)
153 throws SQLException {
154 try {
155 if (this.wrappedStmt != null) {
156 ((PreparedStatement) this.wrappedStmt).setBoolean(parameterIndex,
157 x);
158 } else {
159 throw new SQLException("No operations allowed after statement closed",
160 SQLError.SQL_STATE_GENERAL_ERROR);
161 }
162 } catch (SQLException sqlEx) {
163 checkAndFireConnectionError(sqlEx);
164 }
165 }
166
167 /* (non-Javadoc)
168 * @see java.sql.PreparedStatement#setByte(int, byte)
169 */
170 public void setByte(int parameterIndex, byte x) throws SQLException {
171 try {
172 if (this.wrappedStmt != null) {
173 ((PreparedStatement) this.wrappedStmt).setByte(parameterIndex, x);
174 } else {
175 throw new SQLException("No operations allowed after statement closed",
176 SQLError.SQL_STATE_GENERAL_ERROR);
177 }
178 } catch (SQLException sqlEx) {
179 checkAndFireConnectionError(sqlEx);
180 }
181 }
182
183 /* (non-Javadoc)
184 * @see java.sql.PreparedStatement#setBytes(int, byte[])
185 */
186 public void setBytes(int parameterIndex, byte[] x)
187 throws SQLException {
188 try {
189 if (this.wrappedStmt != null) {
190 ((PreparedStatement) this.wrappedStmt).setBytes(parameterIndex,
191 x);
192 } else {
193 throw new SQLException("No operations allowed after statement closed",
194 SQLError.SQL_STATE_GENERAL_ERROR);
195 }
196 } catch (SQLException sqlEx) {
197 checkAndFireConnectionError(sqlEx);
198 }
199 }
200
201 /* (non-Javadoc)
202 * @see java.sql.PreparedStatement#setCharacterStream(int, java.io.Reader, int)
203 */
204 public void setCharacterStream(int parameterIndex, Reader reader, int length)
205 throws SQLException {
206 try {
207 if (this.wrappedStmt != null) {
208 ((PreparedStatement) this.wrappedStmt).setCharacterStream(parameterIndex,
209 reader, length);
210 } else {
211 throw new SQLException("No operations allowed after statement closed",
212 SQLError.SQL_STATE_GENERAL_ERROR);
213 }
214 } catch (SQLException sqlEx) {
215 checkAndFireConnectionError(sqlEx);
216 }
217 }
218
219 /* (non-Javadoc)
220 * @see java.sql.PreparedStatement#setClob(int, java.sql.Clob)
221 */
222 public void setClob(int parameterIndex, Clob x) throws SQLException {
223 try {
224 if (this.wrappedStmt != null) {
225 ((PreparedStatement) this.wrappedStmt).setClob(parameterIndex, x);
226 } else {
227 throw new SQLException("No operations allowed after statement closed",
228 SQLError.SQL_STATE_GENERAL_ERROR);
229 }
230 } catch (SQLException sqlEx) {
231 checkAndFireConnectionError(sqlEx);
232 }
233 }
234
235 /* (non-Javadoc)
236 * @see java.sql.PreparedStatement#setDate(int, java.sql.Date)
237 */
238 public void setDate(int parameterIndex, Date x) throws SQLException {
239 try {
240 if (this.wrappedStmt != null) {
241 ((PreparedStatement) this.wrappedStmt).setDate(parameterIndex, x);
242 } else {
243 throw new SQLException("No operations allowed after statement closed",
244 SQLError.SQL_STATE_GENERAL_ERROR);
245 }
246 } catch (SQLException sqlEx) {
247 checkAndFireConnectionError(sqlEx);
248 }
249 }
250
251 /* (non-Javadoc)
252 * @see java.sql.PreparedStatement#setDate(int, java.sql.Date, java.util.Calendar)
253 */
254 public void setDate(int parameterIndex, Date x, Calendar cal)
255 throws SQLException {
256 try {
257 if (this.wrappedStmt != null) {
258 ((PreparedStatement) this.wrappedStmt).setDate(parameterIndex,
259 x, cal);
260 } else {
261 throw new SQLException("No operations allowed after statement closed",
262 SQLError.SQL_STATE_GENERAL_ERROR);
263 }
264 } catch (SQLException sqlEx) {
265 checkAndFireConnectionError(sqlEx);
266 }
267 }
268
269 /* (non-Javadoc)
270 * @see java.sql.PreparedStatement#setDouble(int, double)
271 */
272 public void setDouble(int parameterIndex, double x)
273 throws SQLException {
274 try {
275 if (this.wrappedStmt != null) {
276 ((PreparedStatement) this.wrappedStmt).setDouble(parameterIndex,
277 x);
278 } else {
279 throw new SQLException("No operations allowed after statement closed",
280 SQLError.SQL_STATE_GENERAL_ERROR);
281 }
282 } catch (SQLException sqlEx) {
283 checkAndFireConnectionError(sqlEx);
284 }
285 }
286
287 /* (non-Javadoc)
288 * @see java.sql.PreparedStatement#setFloat(int, float)
289 */
290 public void setFloat(int parameterIndex, float x) throws SQLException {
291 try {
292 if (this.wrappedStmt != null) {
293 ((PreparedStatement) this.wrappedStmt).setFloat(parameterIndex,
294 x);
295 } else {
296 throw new SQLException("No operations allowed after statement closed",
297 SQLError.SQL_STATE_GENERAL_ERROR);
298 }
299 } catch (SQLException sqlEx) {
300 checkAndFireConnectionError(sqlEx);
301 }
302 }
303
304 /* (non-Javadoc)
305 * @see java.sql.PreparedStatement#setInt(int, int)
306 */
307 public void setInt(int parameterIndex, int x) throws SQLException {
308 try {
309 if (this.wrappedStmt != null) {
310 ((PreparedStatement) this.wrappedStmt).setInt(parameterIndex, x);
311 } else {
312 throw new SQLException("No operations allowed after statement closed",
313 SQLError.SQL_STATE_GENERAL_ERROR);
314 }
315 } catch (SQLException sqlEx) {
316 checkAndFireConnectionError(sqlEx);
317 }
318 }
319
320 /* (non-Javadoc)
321 * @see java.sql.PreparedStatement#setLong(int, long)
322 */
323 public void setLong(int parameterIndex, long x) throws SQLException {
324 try {
325 if (this.wrappedStmt != null) {
326 ((PreparedStatement) this.wrappedStmt).setLong(parameterIndex, x);
327 } else {
328 throw new SQLException("No operations allowed after statement closed",
329 SQLError.SQL_STATE_GENERAL_ERROR);
330 }
331 } catch (SQLException sqlEx) {
332 checkAndFireConnectionError(sqlEx);
333 }
334 }
335
336 /* (non-Javadoc)
337 * @see java.sql.PreparedStatement#getMetaData()
338 */
339 public ResultSetMetaData getMetaData() throws SQLException {
340 try {
341 if (this.wrappedStmt != null) {
342 return ((PreparedStatement) this.wrappedStmt).getMetaData();
343 } else {
344 throw new SQLException("No operations allowed after statement closed",
345 SQLError.SQL_STATE_GENERAL_ERROR);
346 }
347 } catch (SQLException sqlEx) {
348 checkAndFireConnectionError(sqlEx);
349 }
350
351 return null;
352 }
353
354 /* (non-Javadoc)
355 * @see java.sql.PreparedStatement#setNull(int, int)
356 */
357 public void setNull(int parameterIndex, int sqlType)
358 throws SQLException {
359 try {
360 if (this.wrappedStmt != null) {
361 ((PreparedStatement) this.wrappedStmt).setNull(parameterIndex,
362 sqlType);
363 } else {
364 throw new SQLException("No operations allowed after statement closed",
365 SQLError.SQL_STATE_GENERAL_ERROR);
366 }
367 } catch (SQLException sqlEx) {
368 checkAndFireConnectionError(sqlEx);
369 }
370 }
371
372 /* (non-Javadoc)
373 * @see java.sql.PreparedStatement#setNull(int, int, java.lang.String)
374 */
375 public void setNull(int parameterIndex, int sqlType, String typeName)
376 throws SQLException {
377 try {
378 if (this.wrappedStmt != null) {
379 ((PreparedStatement) this.wrappedStmt).setNull(parameterIndex,
380 sqlType, typeName);
381 } else {
382 throw new SQLException("No operations allowed after statement closed",
383 SQLError.SQL_STATE_GENERAL_ERROR);
384 }
385 } catch (SQLException sqlEx) {
386 checkAndFireConnectionError(sqlEx);
387 }
388 }
389
390 /* (non-Javadoc)
391 * @see java.sql.PreparedStatement#setObject(int, java.lang.Object)
392 */
393 public void setObject(int parameterIndex, Object x)
394 throws SQLException {
395 try {
396 if (this.wrappedStmt != null) {
397 ((PreparedStatement) this.wrappedStmt).setObject(parameterIndex,
398 x);
399 } else {
400 throw new SQLException("No operations allowed after statement closed",
401 SQLError.SQL_STATE_GENERAL_ERROR);
402 }
403 } catch (SQLException sqlEx) {
404 checkAndFireConnectionError(sqlEx);
405 }
406 }
407
408 /* (non-Javadoc)
409 * @see java.sql.PreparedStatement#setObject(int, java.lang.Object, int)
410 */
411 public void setObject(int parameterIndex, Object x, int targetSqlType)
412 throws SQLException {
413 try {
414 if (this.wrappedStmt != null) {
415 ((PreparedStatement) this.wrappedStmt).setObject(parameterIndex,
416 x, targetSqlType);
417 } else {
418 throw new SQLException("No operations allowed after statement closed",
419 SQLError.SQL_STATE_GENERAL_ERROR);
420 }
421 } catch (SQLException sqlEx) {
422 checkAndFireConnectionError(sqlEx);
423 }
424 }
425
426 /* (non-Javadoc)
427 * @see java.sql.PreparedStatement#setObject(int, java.lang.Object, int, int)
428 */
429 public void setObject(int parameterIndex, Object x, int targetSqlType,
430 int scale) throws SQLException {
431 try {
432 if (this.wrappedStmt != null) {
433 ((PreparedStatement) this.wrappedStmt).setObject(parameterIndex,
434 x, scale);
435 } else {
436 throw new SQLException("No operations allowed after statement closed",
437 SQLError.SQL_STATE_GENERAL_ERROR);
438 }
439 } catch (SQLException sqlEx) {
440 checkAndFireConnectionError(sqlEx);
441 }
442 }
443
444 /* (non-Javadoc)
445 * @see java.sql.PreparedStatement#getParameterMetaData()
446 */
447 public ParameterMetaData getParameterMetaData() throws SQLException {
448 try {
449 if (this.wrappedStmt != null) {
450 return ((PreparedStatement) this.wrappedStmt)
451 .getParameterMetaData();
452 } else {
453 throw new SQLException("No operations allowed after statement closed",
454 SQLError.SQL_STATE_GENERAL_ERROR);
455 }
456 } catch (SQLException sqlEx) {
457 checkAndFireConnectionError(sqlEx);
458 }
459
460 return null;
461 }
462
463 /* (non-Javadoc)
464 * @see java.sql.PreparedStatement#setRef(int, java.sql.Ref)
465 */
466 public void setRef(int parameterIndex, Ref x) throws SQLException {
467 try {
468 if (this.wrappedStmt != null) {
469 ((PreparedStatement) this.wrappedStmt).setRef(parameterIndex, x);
470 } else {
471 throw new SQLException("No operations allowed after statement closed",
472 SQLError.SQL_STATE_GENERAL_ERROR);
473 }
474 } catch (SQLException sqlEx) {
475 checkAndFireConnectionError(sqlEx);
476 }
477 }
478
479 /* (non-Javadoc)
480 * @see java.sql.PreparedStatement#setShort(int, short)
481 */
482 public void setShort(int parameterIndex, short x) throws SQLException {
483 try {
484 if (this.wrappedStmt != null) {
485 ((PreparedStatement) this.wrappedStmt).setShort(parameterIndex,
486 x);
487 } else {
488 throw new SQLException("No operations allowed after statement closed",
489 SQLError.SQL_STATE_GENERAL_ERROR);
490 }
491 } catch (SQLException sqlEx) {
492 checkAndFireConnectionError(sqlEx);
493 }
494 }
495
496 /* (non-Javadoc)
497 * @see java.sql.PreparedStatement#setString(int, java.lang.String)
498 */
499 public void setString(int parameterIndex, String x)
500 throws SQLException {
501 try {
502 if (this.wrappedStmt != null) {
503 ((PreparedStatement) this.wrappedStmt).setString(parameterIndex,
504 x);
505 } else {
506 throw new SQLException("No operations allowed after statement closed",
507 SQLError.SQL_STATE_GENERAL_ERROR);
508 }
509 } catch (SQLException sqlEx) {
510 checkAndFireConnectionError(sqlEx);
511 }
512 }
513
514 /* (non-Javadoc)
515 * @see java.sql.PreparedStatement#setTime(int, java.sql.Time)
516 */
517 public void setTime(int parameterIndex, Time x) throws SQLException {
518 try {
519 if (this.wrappedStmt != null) {
520 ((PreparedStatement) this.wrappedStmt).setTime(parameterIndex, x);
521 } else {
522 throw new SQLException("No operations allowed after statement closed",
523 SQLError.SQL_STATE_GENERAL_ERROR);
524 }
525 } catch (SQLException sqlEx) {
526 checkAndFireConnectionError(sqlEx);
527 }
528 }
529
530 /* (non-Javadoc)
531 * @see java.sql.PreparedStatement#setTime(int, java.sql.Time, java.util.Calendar)
532 */
533 public void setTime(int parameterIndex, Time x, Calendar cal)
534 throws SQLException {
535 try {
536 if (this.wrappedStmt != null) {
537 ((PreparedStatement) this.wrappedStmt).setTime(parameterIndex,
538 x, cal);
539 } else {
540 throw new SQLException("No operations allowed after statement closed",
541 SQLError.SQL_STATE_GENERAL_ERROR);
542 }
543 } catch (SQLException sqlEx) {
544 checkAndFireConnectionError(sqlEx);
545 }
546 }
547
548 /* (non-Javadoc)
549 * @see java.sql.PreparedStatement#setTimestamp(int, java.sql.Timestamp)
550 */
551 public void setTimestamp(int parameterIndex, Timestamp x)
552 throws SQLException {
553 try {
554 if (this.wrappedStmt != null) {
555 ((PreparedStatement) this.wrappedStmt).setTimestamp(parameterIndex,
556 x);
557 } else {
558 throw new SQLException("No operations allowed after statement closed",
559 SQLError.SQL_STATE_GENERAL_ERROR);
560 }
561 } catch (SQLException sqlEx) {
562 checkAndFireConnectionError(sqlEx);
563 }
564 }
565
566 /* (non-Javadoc)
567 * @see java.sql.PreparedStatement#setTimestamp(int, java.sql.Timestamp, java.util.Calendar)
568 */
569 public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal)
570 throws SQLException {
571 try {
572 if (this.wrappedStmt != null) {
573 ((PreparedStatement) this.wrappedStmt).setTimestamp(parameterIndex,
574 x, cal);
575 } else {
576 throw new SQLException("No operations allowed after statement closed",
577 SQLError.SQL_STATE_GENERAL_ERROR);
578 }
579 } catch (SQLException sqlEx) {
580 checkAndFireConnectionError(sqlEx);
581 }
582 }
583
584 /* (non-Javadoc)
585 * @see java.sql.PreparedStatement#setURL(int, java.net.URL)
586 */
587 public void setURL(int parameterIndex, URL x) throws SQLException {
588 try {
589 if (this.wrappedStmt != null) {
590 ((PreparedStatement) this.wrappedStmt).setURL(parameterIndex, x);
591 } else {
592 throw new SQLException("No operations allowed after statement closed",
593 SQLError.SQL_STATE_GENERAL_ERROR);
594 }
595 } catch (SQLException sqlEx) {
596 checkAndFireConnectionError(sqlEx);
597 }
598 }
599
600 /**
601 * DOCUMENT ME!
602 *
603 * @param parameterIndex DOCUMENT ME!
604 * @param x DOCUMENT ME!
605 * @param length DOCUMENT ME!
606 *
607 * @throws SQLException DOCUMENT ME!
608 *
609 * @see java.sql.PreparedStatement#setUnicodeStream(int,
610 * java.io.InputStream, int)
611 * @deprecated
612 */
613 public void setUnicodeStream(int parameterIndex, InputStream x, int length)
614 throws SQLException {
615 try {
616 if (this.wrappedStmt != null) {
617 ((PreparedStatement) this.wrappedStmt).setUnicodeStream(parameterIndex,
618 x, length);
619 } else {
620 throw new SQLException("No operations allowed after statement closed",
621 SQLError.SQL_STATE_GENERAL_ERROR);
622 }
623 } catch (SQLException sqlEx) {
624 checkAndFireConnectionError(sqlEx);
625 }
626 }
627
628 /* (non-Javadoc)
629 * @see java.sql.PreparedStatement#addBatch()
630 */
631 public void addBatch() throws SQLException {
632 try {
633 if (this.wrappedStmt != null) {
634 ((PreparedStatement) this.wrappedStmt).addBatch();
635 } else {
636 throw new SQLException("No operations allowed after statement closed",
637 SQLError.SQL_STATE_GENERAL_ERROR);
638 }
639 } catch (SQLException sqlEx) {
640 checkAndFireConnectionError(sqlEx);
641 }
642 }
643
644 /* (non-Javadoc)
645 * @see java.sql.PreparedStatement#clearParameters()
646 */
647 public void clearParameters() throws SQLException {
648 try {
649 if (this.wrappedStmt != null) {
650 ((PreparedStatement) this.wrappedStmt).clearParameters();
651 } else {
652 throw new SQLException("No operations allowed after statement closed",
653 SQLError.SQL_STATE_GENERAL_ERROR);
654 }
655 } catch (SQLException sqlEx) {
656 checkAndFireConnectionError(sqlEx);
657 }
658 }
659
660 /* (non-Javadoc)
661 * @see java.sql.PreparedStatement#execute()
662 */
663 public boolean execute() throws SQLException {
664 try {
665 if (this.wrappedStmt != null) {
666 return ((PreparedStatement) this.wrappedStmt).execute();
667 } else {
668 throw new SQLException("No operations allowed after statement closed",
669 SQLError.SQL_STATE_GENERAL_ERROR);
670 }
671 } catch (SQLException sqlEx) {
672 checkAndFireConnectionError(sqlEx);
673 }
674
675 return false; // we actually never get here, but the compiler can't figure
676
677 // that out
678 }
679
680 /* (non-Javadoc)
681 * @see java.sql.PreparedStatement#executeQuery()
682 */
683 public ResultSet executeQuery() throws SQLException {
684 try {
685 if (this.wrappedStmt != null) {
686 return ((PreparedStatement) this.wrappedStmt).executeQuery();
687 } else {
688 throw new SQLException("No operations allowed after statement closed",
689 SQLError.SQL_STATE_GENERAL_ERROR);
690 }
691 } catch (SQLException sqlEx) {
692 checkAndFireConnectionError(sqlEx);
693 }
694
695 return null; // we actually never get here, but the compiler can't figure
696
697 // that out
698 }
699
700 /* (non-Javadoc)
701 * @see java.sql.PreparedStatement#executeUpdate()
702 */
703 public int executeUpdate() throws SQLException {
704 try {
705 if (this.wrappedStmt != null) {
706 return ((PreparedStatement) this.wrappedStmt).executeUpdate();
707 } else {
708 throw new SQLException("No operations allowed after statement closed",
709 SQLError.SQL_STATE_GENERAL_ERROR);
710 }
711 } catch (SQLException sqlEx) {
712 checkAndFireConnectionError(sqlEx);
713 }
714
715 return -1; // we actually never get here, but the compiler can't figure
716
717 // that out
718 }
719 }