KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mysql > jdbc > jdbc2 > optional > PreparedStatementWrapper


1 /*
2    Copyright (C) 2004 MySQL AB
3
4       This program is free software; you can redistribute it and/or modify
5       it under the terms of the GNU General Public License as published by
6       the Free Software Foundation; either version 2 of the License, or
7       (at your option) any later version.
8
9       This program is distributed in the hope that it will be useful,
10       but WITHOUT ANY WARRANTY; without even the implied warranty of
11       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12       GNU General Public License for more details.
13
14       You should have received a copy of the GNU General Public License
15       along with this program; if not, write to the Free Software
16       Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18  */

19 package com.mysql.jdbc.jdbc2.optional;
20
21 import com.mysql.jdbc.SQLError;
22
23 import java.io.InputStream JavaDoc;
24 import java.io.Reader JavaDoc;
25
26 import java.math.BigDecimal JavaDoc;
27
28 import java.net.URL JavaDoc;
29
30 import java.sql.Array JavaDoc;
31 import java.sql.Blob JavaDoc;
32 import java.sql.Clob JavaDoc;
33 import java.sql.Date JavaDoc;
34 import java.sql.ParameterMetaData JavaDoc;
35 import java.sql.PreparedStatement JavaDoc;
36 import java.sql.Ref JavaDoc;
37 import java.sql.ResultSet JavaDoc;
38 import java.sql.ResultSetMetaData JavaDoc;
39 import java.sql.SQLException JavaDoc;
40 import java.sql.Time JavaDoc;
41 import java.sql.Timestamp JavaDoc;
42
43 import java.util.Calendar JavaDoc;
44
45
46 /**
47  * Wraps prepared statements so that errors can be reported correctly to
48  * ConnectionEventListeners.
49  *
50  * @author Mark Matthews
51  *
52  * @version $Id: PreparedStatementWrapper.java,v 1.1.2.1 2004/02/13 17:55:30 mmatthew Exp $
53  */

54 class PreparedStatementWrapper extends StatementWrapper
55     implements PreparedStatement JavaDoc {
56     PreparedStatementWrapper(MysqlPooledConnection conn,
57         PreparedStatement JavaDoc toWrap) {
58         super(conn, toWrap);
59     }
60
61     /* (non-Javadoc)
62      * @see java.sql.PreparedStatement#setArray(int, java.sql.Array)
63      */

64     public void setArray(int parameterIndex, Array JavaDoc x) throws SQLException JavaDoc {
65         try {
66             if (this.wrappedStmt != null) {
67                 ((PreparedStatement JavaDoc) this.wrappedStmt).setArray(parameterIndex,
68                     x);
69             } else {
70                 throw new SQLException JavaDoc("No operations allowed after statement closed",
71                     SQLError.SQL_STATE_GENERAL_ERROR);
72             }
73         } catch (SQLException JavaDoc sqlEx) {
74             checkAndFireConnectionError(sqlEx);
75         }
76     }
77
78     /* (non-Javadoc)
79      * @see java.sql.PreparedStatement#setAsciiStream(int, java.io.InputStream, int)
80      */

81     public void setAsciiStream(int parameterIndex, InputStream JavaDoc x, int length)
82         throws SQLException JavaDoc {
83         try {
84             if (this.wrappedStmt != null) {
85                 ((PreparedStatement JavaDoc) this.wrappedStmt).setAsciiStream(parameterIndex,
86                     x, length);
87             } else {
88                 throw new SQLException JavaDoc("No operations allowed after statement closed",
89                     SQLError.SQL_STATE_GENERAL_ERROR);
90             }
91         } catch (SQLException JavaDoc sqlEx) {
92             checkAndFireConnectionError(sqlEx);
93         }
94     }
95
96     /* (non-Javadoc)
97      * @see java.sql.PreparedStatement#setBigDecimal(int, java.math.BigDecimal)
98      */

99     public void setBigDecimal(int parameterIndex, BigDecimal JavaDoc x)
100         throws SQLException JavaDoc {
101         try {
102             if (this.wrappedStmt != null) {
103                 ((PreparedStatement JavaDoc) this.wrappedStmt).setBigDecimal(parameterIndex,
104                     x);
105             } else {
106                 throw new SQLException JavaDoc("No operations allowed after statement closed",
107                     SQLError.SQL_STATE_GENERAL_ERROR);
108             }
109         } catch (SQLException JavaDoc sqlEx) {
110             checkAndFireConnectionError(sqlEx);
111         }
112     }
113
114     /* (non-Javadoc)
115      * @see java.sql.PreparedStatement#setBinaryStream(int, java.io.InputStream, int)
116      */

117     public void setBinaryStream(int parameterIndex, InputStream JavaDoc x, int length)
118         throws SQLException JavaDoc {
119         try {
120             if (this.wrappedStmt != null) {
121                 ((PreparedStatement JavaDoc) this.wrappedStmt).setBinaryStream(parameterIndex,
122                     x, length);
123             } else {
124                 throw new SQLException JavaDoc("No operations allowed after statement closed",
125                     SQLError.SQL_STATE_GENERAL_ERROR);
126             }
127         } catch (SQLException JavaDoc sqlEx) {
128             checkAndFireConnectionError(sqlEx);
129         }
130     }
131
132     /* (non-Javadoc)
133      * @see java.sql.PreparedStatement#setBlob(int, java.sql.Blob)
134      */

135     public void setBlob(int parameterIndex, Blob JavaDoc x) throws SQLException JavaDoc {
136         try {
137             if (this.wrappedStmt != null) {
138                 ((PreparedStatement JavaDoc) this.wrappedStmt).setBlob(parameterIndex, x);
139             } else {
140                 throw new SQLException JavaDoc("No operations allowed after statement closed",
141                     SQLError.SQL_STATE_GENERAL_ERROR);
142             }
143         } catch (SQLException JavaDoc sqlEx) {
144             checkAndFireConnectionError(sqlEx);
145         }
146     }
147
148     /* (non-Javadoc)
149      * @see java.sql.PreparedStatement#setBoolean(int, boolean)
150      */

151     public void setBoolean(int parameterIndex, boolean x)
152         throws SQLException JavaDoc {
153         try {
154             if (this.wrappedStmt != null) {
155                 ((PreparedStatement JavaDoc) this.wrappedStmt).setBoolean(parameterIndex,
156                     x);
157             } else {
158                 throw new SQLException JavaDoc("No operations allowed after statement closed",
159                     SQLError.SQL_STATE_GENERAL_ERROR);
160             }
161         } catch (SQLException JavaDoc sqlEx) {
162             checkAndFireConnectionError(sqlEx);
163         }
164     }
165
166     /* (non-Javadoc)
167      * @see java.sql.PreparedStatement#setByte(int, byte)
168      */

169     public void setByte(int parameterIndex, byte x) throws SQLException JavaDoc {
170         try {
171             if (this.wrappedStmt != null) {
172                 ((PreparedStatement JavaDoc) this.wrappedStmt).setByte(parameterIndex, x);
173             } else {
174                 throw new SQLException JavaDoc("No operations allowed after statement closed",
175                     SQLError.SQL_STATE_GENERAL_ERROR);
176             }
177         } catch (SQLException JavaDoc sqlEx) {
178             checkAndFireConnectionError(sqlEx);
179         }
180     }
181
182     /* (non-Javadoc)
183      * @see java.sql.PreparedStatement#setBytes(int, byte[])
184      */

185     public void setBytes(int parameterIndex, byte[] x)
186         throws SQLException JavaDoc {
187         try {
188             if (this.wrappedStmt != null) {
189                 ((PreparedStatement JavaDoc) this.wrappedStmt).setBytes(parameterIndex,
190                     x);
191             } else {
192                 throw new SQLException JavaDoc("No operations allowed after statement closed",
193                     SQLError.SQL_STATE_GENERAL_ERROR);
194             }
195         } catch (SQLException JavaDoc sqlEx) {
196             checkAndFireConnectionError(sqlEx);
197         }
198     }
199
200     /* (non-Javadoc)
201      * @see java.sql.PreparedStatement#setCharacterStream(int, java.io.Reader, int)
202      */

203     public void setCharacterStream(int parameterIndex, Reader JavaDoc reader, int length)
204         throws SQLException JavaDoc {
205         try {
206             if (this.wrappedStmt != null) {
207                 ((PreparedStatement JavaDoc) this.wrappedStmt).setCharacterStream(parameterIndex,
208                     reader, length);
209             } else {
210                 throw new SQLException JavaDoc("No operations allowed after statement closed",
211                     SQLError.SQL_STATE_GENERAL_ERROR);
212             }
213         } catch (SQLException JavaDoc sqlEx) {
214             checkAndFireConnectionError(sqlEx);
215         }
216     }
217
218     /* (non-Javadoc)
219      * @see java.sql.PreparedStatement#setClob(int, java.sql.Clob)
220      */

221     public void setClob(int parameterIndex, Clob JavaDoc x) throws SQLException JavaDoc {
222         try {
223             if (this.wrappedStmt != null) {
224                 ((PreparedStatement JavaDoc) this.wrappedStmt).setClob(parameterIndex, x);
225             } else {
226                 throw new SQLException JavaDoc("No operations allowed after statement closed",
227                     SQLError.SQL_STATE_GENERAL_ERROR);
228             }
229         } catch (SQLException JavaDoc sqlEx) {
230             checkAndFireConnectionError(sqlEx);
231         }
232     }
233
234     /* (non-Javadoc)
235      * @see java.sql.PreparedStatement#setDate(int, java.sql.Date)
236      */

237     public void setDate(int parameterIndex, Date JavaDoc x) throws SQLException JavaDoc {
238         try {
239             if (this.wrappedStmt != null) {
240                 ((PreparedStatement JavaDoc) this.wrappedStmt).setDate(parameterIndex, x);
241             } else {
242                 throw new SQLException JavaDoc("No operations allowed after statement closed",
243                     SQLError.SQL_STATE_GENERAL_ERROR);
244             }
245         } catch (SQLException JavaDoc sqlEx) {
246             checkAndFireConnectionError(sqlEx);
247         }
248     }
249
250     /* (non-Javadoc)
251      * @see java.sql.PreparedStatement#setDate(int, java.sql.Date, java.util.Calendar)
252      */

253     public void setDate(int parameterIndex, Date JavaDoc x, Calendar JavaDoc cal)
254         throws SQLException JavaDoc {
255         try {
256             if (this.wrappedStmt != null) {
257                 ((PreparedStatement JavaDoc) this.wrappedStmt).setDate(parameterIndex,
258                     x, cal);
259             } else {
260                 throw new SQLException JavaDoc("No operations allowed after statement closed",
261                     SQLError.SQL_STATE_GENERAL_ERROR);
262             }
263         } catch (SQLException JavaDoc sqlEx) {
264             checkAndFireConnectionError(sqlEx);
265         }
266     }
267
268     /* (non-Javadoc)
269      * @see java.sql.PreparedStatement#setDouble(int, double)
270      */

271     public void setDouble(int parameterIndex, double x)
272         throws SQLException JavaDoc {
273         try {
274             if (this.wrappedStmt != null) {
275                 ((PreparedStatement JavaDoc) this.wrappedStmt).setDouble(parameterIndex,
276                     x);
277             } else {
278                 throw new SQLException JavaDoc("No operations allowed after statement closed",
279                     SQLError.SQL_STATE_GENERAL_ERROR);
280             }
281         } catch (SQLException JavaDoc sqlEx) {
282             checkAndFireConnectionError(sqlEx);
283         }
284     }
285
286     /* (non-Javadoc)
287      * @see java.sql.PreparedStatement#setFloat(int, float)
288      */

289     public void setFloat(int parameterIndex, float x) throws SQLException JavaDoc {
290         try {
291             if (this.wrappedStmt != null) {
292                 ((PreparedStatement JavaDoc) this.wrappedStmt).setFloat(parameterIndex,
293                     x);
294             } else {
295                 throw new SQLException JavaDoc("No operations allowed after statement closed",
296                     SQLError.SQL_STATE_GENERAL_ERROR);
297             }
298         } catch (SQLException JavaDoc sqlEx) {
299             checkAndFireConnectionError(sqlEx);
300         }
301     }
302
303     /* (non-Javadoc)
304      * @see java.sql.PreparedStatement#setInt(int, int)
305      */

306     public void setInt(int parameterIndex, int x) throws SQLException JavaDoc {
307         try {
308             if (this.wrappedStmt != null) {
309                 ((PreparedStatement JavaDoc) this.wrappedStmt).setInt(parameterIndex, x);
310             } else {
311                 throw new SQLException JavaDoc("No operations allowed after statement closed",
312                     SQLError.SQL_STATE_GENERAL_ERROR);
313             }
314         } catch (SQLException JavaDoc sqlEx) {
315             checkAndFireConnectionError(sqlEx);
316         }
317     }
318
319     /* (non-Javadoc)
320      * @see java.sql.PreparedStatement#setLong(int, long)
321      */

322     public void setLong(int parameterIndex, long x) throws SQLException JavaDoc {
323         try {
324             if (this.wrappedStmt != null) {
325                 ((PreparedStatement JavaDoc) this.wrappedStmt).setLong(parameterIndex, x);
326             } else {
327                 throw new SQLException JavaDoc("No operations allowed after statement closed",
328                     SQLError.SQL_STATE_GENERAL_ERROR);
329             }
330         } catch (SQLException JavaDoc sqlEx) {
331             checkAndFireConnectionError(sqlEx);
332         }
333     }
334
335     /* (non-Javadoc)
336      * @see java.sql.PreparedStatement#getMetaData()
337      */

338     public ResultSetMetaData JavaDoc getMetaData() throws SQLException JavaDoc {
339         try {
340             if (this.wrappedStmt != null) {
341                 return ((PreparedStatement JavaDoc) this.wrappedStmt).getMetaData();
342             } else {
343                 throw new SQLException JavaDoc("No operations allowed after statement closed",
344                     SQLError.SQL_STATE_GENERAL_ERROR);
345             }
346         } catch (SQLException JavaDoc sqlEx) {
347             checkAndFireConnectionError(sqlEx);
348         }
349
350         return null;
351     }
352
353     /* (non-Javadoc)
354      * @see java.sql.PreparedStatement#setNull(int, int)
355      */

356     public void setNull(int parameterIndex, int sqlType)
357         throws SQLException JavaDoc {
358         try {
359             if (this.wrappedStmt != null) {
360                 ((PreparedStatement JavaDoc) this.wrappedStmt).setNull(parameterIndex,
361                     sqlType);
362             } else {
363                 throw new SQLException JavaDoc("No operations allowed after statement closed",
364                     SQLError.SQL_STATE_GENERAL_ERROR);
365             }
366         } catch (SQLException JavaDoc sqlEx) {
367             checkAndFireConnectionError(sqlEx);
368         }
369     }
370
371     /* (non-Javadoc)
372      * @see java.sql.PreparedStatement#setNull(int, int, java.lang.String)
373      */

374     public void setNull(int parameterIndex, int sqlType, String JavaDoc typeName)
375         throws SQLException JavaDoc {
376         try {
377             if (this.wrappedStmt != null) {
378                 ((PreparedStatement JavaDoc) this.wrappedStmt).setNull(parameterIndex,
379                     sqlType, typeName);
380             } else {
381                 throw new SQLException JavaDoc("No operations allowed after statement closed",
382                     SQLError.SQL_STATE_GENERAL_ERROR);
383             }
384         } catch (SQLException JavaDoc sqlEx) {
385             checkAndFireConnectionError(sqlEx);
386         }
387     }
388
389     /* (non-Javadoc)
390      * @see java.sql.PreparedStatement#setObject(int, java.lang.Object)
391      */

392     public void setObject(int parameterIndex, Object JavaDoc x)
393         throws SQLException JavaDoc {
394         try {
395             if (this.wrappedStmt != null) {
396                 ((PreparedStatement JavaDoc) this.wrappedStmt).setObject(parameterIndex,
397                     x);
398             } else {
399                 throw new SQLException JavaDoc("No operations allowed after statement closed",
400                     SQLError.SQL_STATE_GENERAL_ERROR);
401             }
402         } catch (SQLException JavaDoc sqlEx) {
403             checkAndFireConnectionError(sqlEx);
404         }
405     }
406
407     /* (non-Javadoc)
408      * @see java.sql.PreparedStatement#setObject(int, java.lang.Object, int)
409      */

410     public void setObject(int parameterIndex, Object JavaDoc x, int targetSqlType)
411         throws SQLException JavaDoc {
412         try {
413             if (this.wrappedStmt != null) {
414                 ((PreparedStatement JavaDoc) this.wrappedStmt).setObject(parameterIndex,
415                     x, targetSqlType);
416             } else {
417                 throw new SQLException JavaDoc("No operations allowed after statement closed",
418                     SQLError.SQL_STATE_GENERAL_ERROR);
419             }
420         } catch (SQLException JavaDoc sqlEx) {
421             checkAndFireConnectionError(sqlEx);
422         }
423     }
424
425     /* (non-Javadoc)
426      * @see java.sql.PreparedStatement#setObject(int, java.lang.Object, int, int)
427      */

428     public void setObject(int parameterIndex, Object JavaDoc x, int targetSqlType,
429         int scale) throws SQLException JavaDoc {
430         try {
431             if (this.wrappedStmt != null) {
432                 ((PreparedStatement JavaDoc) this.wrappedStmt).setObject(parameterIndex,
433                     x, scale);
434             } else {
435                 throw new SQLException JavaDoc("No operations allowed after statement closed",
436                     SQLError.SQL_STATE_GENERAL_ERROR);
437             }
438         } catch (SQLException JavaDoc sqlEx) {
439             checkAndFireConnectionError(sqlEx);
440         }
441     }
442
443     /* (non-Javadoc)
444      * @see java.sql.PreparedStatement#getParameterMetaData()
445      */

446     public ParameterMetaData JavaDoc getParameterMetaData() throws SQLException JavaDoc {
447         try {
448             if (this.wrappedStmt != null) {
449                 return ((PreparedStatement JavaDoc) this.wrappedStmt)
450                 .getParameterMetaData();
451             } else {
452                 throw new SQLException JavaDoc("No operations allowed after statement closed",
453                     SQLError.SQL_STATE_GENERAL_ERROR);
454             }
455         } catch (SQLException JavaDoc sqlEx) {
456             checkAndFireConnectionError(sqlEx);
457         }
458
459         return null;
460     }
461
462     /* (non-Javadoc)
463      * @see java.sql.PreparedStatement#setRef(int, java.sql.Ref)
464      */

465     public void setRef(int parameterIndex, Ref JavaDoc x) throws SQLException JavaDoc {
466         try {
467             if (this.wrappedStmt != null) {
468                 ((PreparedStatement JavaDoc) this.wrappedStmt).setRef(parameterIndex, x);
469             } else {
470                 throw new SQLException JavaDoc("No operations allowed after statement closed",
471                     SQLError.SQL_STATE_GENERAL_ERROR);
472             }
473         } catch (SQLException JavaDoc sqlEx) {
474             checkAndFireConnectionError(sqlEx);
475         }
476     }
477
478     /* (non-Javadoc)
479      * @see java.sql.PreparedStatement#setShort(int, short)
480      */

481     public void setShort(int parameterIndex, short x) throws SQLException JavaDoc {
482         try {
483             if (this.wrappedStmt != null) {
484                 ((PreparedStatement JavaDoc) this.wrappedStmt).setShort(parameterIndex,
485                     x);
486             } else {
487                 throw new SQLException JavaDoc("No operations allowed after statement closed",
488                     SQLError.SQL_STATE_GENERAL_ERROR);
489             }
490         } catch (SQLException JavaDoc sqlEx) {
491             checkAndFireConnectionError(sqlEx);
492         }
493     }
494
495     /* (non-Javadoc)
496      * @see java.sql.PreparedStatement#setString(int, java.lang.String)
497      */

498     public void setString(int parameterIndex, String JavaDoc x)
499         throws SQLException JavaDoc {
500         try {
501             if (this.wrappedStmt != null) {
502                 ((PreparedStatement JavaDoc) this.wrappedStmt).setString(parameterIndex,
503                     x);
504             } else {
505                 throw new SQLException JavaDoc("No operations allowed after statement closed",
506                     SQLError.SQL_STATE_GENERAL_ERROR);
507             }
508         } catch (SQLException JavaDoc sqlEx) {
509             checkAndFireConnectionError(sqlEx);
510         }
511     }
512
513     /* (non-Javadoc)
514      * @see java.sql.PreparedStatement#setTime(int, java.sql.Time)
515      */

516     public void setTime(int parameterIndex, Time JavaDoc x) throws SQLException JavaDoc {
517         try {
518             if (this.wrappedStmt != null) {
519                 ((PreparedStatement JavaDoc) this.wrappedStmt).setTime(parameterIndex, x);
520             } else {
521                 throw new SQLException JavaDoc("No operations allowed after statement closed",
522                     SQLError.SQL_STATE_GENERAL_ERROR);
523             }
524         } catch (SQLException JavaDoc sqlEx) {
525             checkAndFireConnectionError(sqlEx);
526         }
527     }
528
529     /* (non-Javadoc)
530      * @see java.sql.PreparedStatement#setTime(int, java.sql.Time, java.util.Calendar)
531      */

532     public void setTime(int parameterIndex, Time JavaDoc x, Calendar JavaDoc cal)
533         throws SQLException JavaDoc {
534         try {
535             if (this.wrappedStmt != null) {
536                 ((PreparedStatement JavaDoc) this.wrappedStmt).setTime(parameterIndex,
537                     x, cal);
538             } else {
539                 throw new SQLException JavaDoc("No operations allowed after statement closed",
540                     SQLError.SQL_STATE_GENERAL_ERROR);
541             }
542         } catch (SQLException JavaDoc sqlEx) {
543             checkAndFireConnectionError(sqlEx);
544         }
545     }
546
547     /* (non-Javadoc)
548      * @see java.sql.PreparedStatement#setTimestamp(int, java.sql.Timestamp)
549      */

550     public void setTimestamp(int parameterIndex, Timestamp JavaDoc x)
551         throws SQLException JavaDoc {
552         try {
553             if (this.wrappedStmt != null) {
554                 ((PreparedStatement JavaDoc) this.wrappedStmt).setTimestamp(parameterIndex,
555                     x);
556             } else {
557                 throw new SQLException JavaDoc("No operations allowed after statement closed",
558                     SQLError.SQL_STATE_GENERAL_ERROR);
559             }
560         } catch (SQLException JavaDoc sqlEx) {
561             checkAndFireConnectionError(sqlEx);
562         }
563     }
564
565     /* (non-Javadoc)
566      * @see java.sql.PreparedStatement#setTimestamp(int, java.sql.Timestamp, java.util.Calendar)
567      */

568     public void setTimestamp(int parameterIndex, Timestamp JavaDoc x, Calendar JavaDoc cal)
569         throws SQLException JavaDoc {
570         try {
571             if (this.wrappedStmt != null) {
572                 ((PreparedStatement JavaDoc) this.wrappedStmt).setTimestamp(parameterIndex,
573                     x, cal);
574             } else {
575                 throw new SQLException JavaDoc("No operations allowed after statement closed",
576                     SQLError.SQL_STATE_GENERAL_ERROR);
577             }
578         } catch (SQLException JavaDoc sqlEx) {
579             checkAndFireConnectionError(sqlEx);
580         }
581     }
582
583     /* (non-Javadoc)
584      * @see java.sql.PreparedStatement#setURL(int, java.net.URL)
585      */

586     public void setURL(int parameterIndex, URL JavaDoc x) throws SQLException JavaDoc {
587         try {
588             if (this.wrappedStmt != null) {
589                 ((PreparedStatement JavaDoc) this.wrappedStmt).setURL(parameterIndex, x);
590             } else {
591                 throw new SQLException JavaDoc("No operations allowed after statement closed",
592                     SQLError.SQL_STATE_GENERAL_ERROR);
593             }
594         } catch (SQLException JavaDoc sqlEx) {
595             checkAndFireConnectionError(sqlEx);
596         }
597     }
598
599     /**
600      * DOCUMENT ME!
601      *
602      * @param parameterIndex DOCUMENT ME!
603      * @param x DOCUMENT ME!
604      * @param length DOCUMENT ME!
605      *
606      * @throws SQLException DOCUMENT ME!
607      *
608      * @see java.sql.PreparedStatement#setUnicodeStream(int,
609      * java.io.InputStream, int)
610      * @deprecated
611      */

612     public void setUnicodeStream(int parameterIndex, InputStream JavaDoc x, int length)
613         throws SQLException JavaDoc {
614         try {
615             if (this.wrappedStmt != null) {
616                 ((PreparedStatement JavaDoc) this.wrappedStmt).setUnicodeStream(parameterIndex,
617                     x, length);
618             } else {
619                 throw new SQLException JavaDoc("No operations allowed after statement closed",
620                     SQLError.SQL_STATE_GENERAL_ERROR);
621             }
622         } catch (SQLException JavaDoc sqlEx) {
623             checkAndFireConnectionError(sqlEx);
624         }
625     }
626
627     /* (non-Javadoc)
628      * @see java.sql.PreparedStatement#addBatch()
629      */

630     public void addBatch() throws SQLException JavaDoc {
631         try {
632             if (this.wrappedStmt != null) {
633                 ((PreparedStatement JavaDoc) this.wrappedStmt).addBatch();
634             } else {
635                 throw new SQLException JavaDoc("No operations allowed after statement closed",
636                     SQLError.SQL_STATE_GENERAL_ERROR);
637             }
638         } catch (SQLException JavaDoc sqlEx) {
639             checkAndFireConnectionError(sqlEx);
640         }
641     }
642
643     /* (non-Javadoc)
644      * @see java.sql.PreparedStatement#clearParameters()
645      */

646     public void clearParameters() throws SQLException JavaDoc {
647         try {
648             if (this.wrappedStmt != null) {
649                 ((PreparedStatement JavaDoc) this.wrappedStmt).clearParameters();
650             } else {
651                 throw new SQLException JavaDoc("No operations allowed after statement closed",
652                     SQLError.SQL_STATE_GENERAL_ERROR);
653             }
654         } catch (SQLException JavaDoc sqlEx) {
655             checkAndFireConnectionError(sqlEx);
656         }
657     }
658
659     /* (non-Javadoc)
660      * @see java.sql.PreparedStatement#execute()
661      */

662     public boolean execute() throws SQLException JavaDoc {
663         try {
664             if (this.wrappedStmt != null) {
665                 return ((PreparedStatement JavaDoc) this.wrappedStmt).execute();
666             } else {
667                 throw new SQLException JavaDoc("No operations allowed after statement closed",
668                     SQLError.SQL_STATE_GENERAL_ERROR);
669             }
670         } catch (SQLException JavaDoc sqlEx) {
671             checkAndFireConnectionError(sqlEx);
672         }
673
674         return false; // we actually never get here, but the compiler can't figure
675

676         // that out
677
}
678
679     /* (non-Javadoc)
680      * @see java.sql.PreparedStatement#executeQuery()
681      */

682     public ResultSet JavaDoc executeQuery() throws SQLException JavaDoc {
683         try {
684             if (this.wrappedStmt != null) {
685                 return ((PreparedStatement JavaDoc) this.wrappedStmt).executeQuery();
686             } else {
687                 throw new SQLException JavaDoc("No operations allowed after statement closed",
688                     SQLError.SQL_STATE_GENERAL_ERROR);
689             }
690         } catch (SQLException JavaDoc sqlEx) {
691             checkAndFireConnectionError(sqlEx);
692         }
693
694         return null; // we actually never get here, but the compiler can't figure
695

696         // that out
697
}
698
699     /* (non-Javadoc)
700      * @see java.sql.PreparedStatement#executeUpdate()
701      */

702     public int executeUpdate() throws SQLException JavaDoc {
703         try {
704             if (this.wrappedStmt != null) {
705                 return ((PreparedStatement JavaDoc) this.wrappedStmt).executeUpdate();
706             } else {
707                 throw new SQLException JavaDoc("No operations allowed after statement closed",
708                     SQLError.SQL_STATE_GENERAL_ERROR);
709             }
710         } catch (SQLException JavaDoc sqlEx) {
711             checkAndFireConnectionError(sqlEx);
712         }
713
714         return -1; // we actually never get here, but the compiler can't figure
715

716         // that out
717
}
718 }
719
Popular Tags