1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45 package org.melati.poem.dbms.test.sql;
46
47 import java.io.InputStream;
48 import java.io.Reader;
49 import java.math.BigDecimal;
50 import java.net.URL;
51 import java.sql.Array;
52 import java.sql.Blob;
53 import java.sql.Clob;
54 import java.sql.Connection;
55 import java.sql.Date;
56 import java.sql.ParameterMetaData;
57 import java.sql.PreparedStatement;
58 import java.sql.Ref;
59 import java.sql.ResultSet;
60 import java.sql.ResultSetMetaData;
61 import java.sql.SQLException;
62 import java.sql.SQLWarning;
63 import java.sql.Time;
64 import java.sql.Timestamp;
65 import java.util.Calendar;
66
67
68
69
70
71
72
73
74 public abstract class ThrowingPreparedStatementJdbc3
75 extends Thrower
76 implements PreparedStatement {
77
78 PreparedStatement it = null;
79
80
81
82
83
84 public void addBatch() throws SQLException {
85 if (shouldThrow(this.getClass().getInterfaces()[0], "addBatch"))
86 throw new SQLException("PreparedStatement bombed");
87 it.addBatch();
88 }
89
90
91
92
93
94
95 public void clearParameters() throws SQLException {
96 if (shouldThrow(this.getClass().getInterfaces()[0], "clearParameters"))
97 throw new SQLException("PreparedStatement bombed");
98 it.clearParameters();
99 }
100
101
102
103
104
105
106 public boolean execute() throws SQLException {
107 if (shouldThrow(this.getClass().getInterfaces()[0], "execute"))
108 throw new SQLException("PreparedStatement bombed");
109
110 return it.execute();
111 }
112
113
114
115
116
117
118 public ResultSet executeQuery() throws SQLException {
119 if (shouldThrow(this.getClass().getInterfaces()[0], "executeQuery"))
120 throw new SQLException("PreparedStatement bombed");
121
122 return new ThrowingResultSet(it.executeQuery());
123 }
124
125
126
127
128
129
130 public int executeUpdate() throws SQLException {
131 if (shouldThrow(this.getClass().getInterfaces()[0], "executeUpdate"))
132 throw new SQLException("PreparedStatement bombed");
133
134 return it.executeUpdate();
135 }
136
137
138
139
140
141
142 public ResultSetMetaData getMetaData() throws SQLException {
143 if (shouldThrow(this.getClass().getInterfaces()[0], "getMetaData"))
144 throw new SQLException("PreparedStatement bombed");
145
146 return new ThrowingResultSetMetaData(it.getMetaData());
147 }
148
149
150
151
152
153
154 public ParameterMetaData getParameterMetaData() throws SQLException {
155 if (shouldThrow(this.getClass().getInterfaces()[0], "getParameterMetaData"))
156 throw new SQLException("PreparedStatement bombed");
157
158 return new ThrowingParameterMetaData(it.getParameterMetaData());
159 }
160
161
162
163
164
165
166 public void setArray(int i, Array x) throws SQLException {
167 if (shouldThrow(this.getClass().getInterfaces()[0], "setArray"))
168 throw new SQLException("PreparedStatement bombed");
169 it.setArray(i, x);
170 }
171
172
173
174
175
176
177
178 public void setAsciiStream(int parameterIndex, InputStream x, int length)
179 throws SQLException {
180 if (shouldThrow(this.getClass().getInterfaces()[0], "setAsciiStream"))
181 throw new SQLException("PreparedStatement bombed");
182 it.setAsciiStream(parameterIndex, x, length);
183 }
184
185
186
187
188
189
190 public void setBigDecimal(int parameterIndex, BigDecimal x)
191 throws SQLException {
192 if (shouldThrow(this.getClass().getInterfaces()[0], "setBigDecimal"))
193 throw new SQLException("PreparedStatement bombed");
194 it.setBigDecimal(parameterIndex, x);
195 }
196
197
198
199
200
201
202
203 public void setBinaryStream(int parameterIndex, InputStream x, int length)
204 throws SQLException {
205 if (shouldThrow(this.getClass().getInterfaces()[0], "setBinaryStream"))
206 throw new SQLException("PreparedStatement bombed");
207 it.setBinaryStream(parameterIndex, x, length);
208 }
209
210
211
212
213
214
215 public void setBlob(int i, Blob x) throws SQLException {
216 if (shouldThrow(this.getClass().getInterfaces()[0], "setBlob"))
217 throw new SQLException("PreparedStatement bombed");
218 it.setBlob(i, x);
219 }
220
221
222
223
224
225
226 public void setBoolean(int parameterIndex, boolean x) throws SQLException {
227 if (shouldThrow(this.getClass().getInterfaces()[0], "setBoolean"))
228 throw new SQLException("PreparedStatement bombed");
229 it.setBoolean(parameterIndex, x);
230 }
231
232
233
234
235
236
237 public void setByte(int parameterIndex, byte x) throws SQLException {
238 if (shouldThrow(this.getClass().getInterfaces()[0], "setByte"))
239 throw new SQLException("PreparedStatement bombed");
240 it.setByte(parameterIndex, x);
241 }
242
243
244
245
246
247
248 public void setBytes(int parameterIndex, byte[] x) throws SQLException {
249 if (shouldThrow(this.getClass().getInterfaces()[0], "setBytes"))
250 throw new SQLException("PreparedStatement bombed");
251 it.setBytes(parameterIndex, x);
252 }
253
254
255
256
257
258
259
260 public void setCharacterStream(int parameterIndex, Reader reader, int length)
261 throws SQLException {
262 if (shouldThrow(this.getClass().getInterfaces()[0], "setCharacterStream"))
263 throw new SQLException("PreparedStatement bombed");
264 it.setCharacterStream(parameterIndex, reader, length);
265 }
266
267
268
269
270
271
272 public void setClob(int i, Clob x) throws SQLException {
273 if (shouldThrow(this.getClass().getInterfaces()[0], "setClob"))
274 throw new SQLException("PreparedStatement bombed");
275 it.setClob(i, x);
276 }
277
278
279
280
281
282
283 public void setDate(int parameterIndex, Date x) throws SQLException {
284 if (shouldThrow(this.getClass().getInterfaces()[0], "setDate"))
285 throw new SQLException("PreparedStatement bombed");
286 it.setDate(parameterIndex, x);
287 }
288
289
290
291
292
293
294
295 public void setDate(int parameterIndex, Date x, Calendar cal)
296 throws SQLException {
297 if (shouldThrow(this.getClass().getInterfaces()[0], "setDate"))
298 throw new SQLException("PreparedStatement bombed");
299 it.setDate(parameterIndex, x, cal);
300 }
301
302
303
304
305
306
307 public void setDouble(int parameterIndex, double x) throws SQLException {
308 if (shouldThrow(this.getClass().getInterfaces()[0], "setDouble"))
309 throw new SQLException("PreparedStatement bombed");
310 it.setDouble(parameterIndex, x);
311 }
312
313
314
315
316
317
318 public void setFloat(int parameterIndex, float x) throws SQLException {
319 if (shouldThrow(this.getClass().getInterfaces()[0], "setFloat"))
320 throw new SQLException("PreparedStatement bombed");
321 it.setFloat(parameterIndex, x);
322 }
323
324
325
326
327
328
329 public void setInt(int parameterIndex, int x) throws SQLException {
330 if (shouldThrow(this.getClass().getInterfaces()[0], "setInt"))
331 throw new SQLException("PreparedStatement bombed");
332 it.setInt(parameterIndex, x);
333 }
334
335
336
337
338
339
340 public void setLong(int parameterIndex, long x) throws SQLException {
341 if (shouldThrow(this.getClass().getInterfaces()[0], "setLong"))
342 throw new SQLException("PreparedStatement bombed");
343 it.setLong(parameterIndex, x);
344 }
345
346
347
348
349
350
351 public void setNull(int parameterIndex, int sqlType) throws SQLException {
352 if (shouldThrow(this.getClass().getInterfaces()[0], "setNull"))
353 throw new SQLException("PreparedStatement bombed");
354 it.setNull(parameterIndex, sqlType);
355 }
356
357
358
359
360
361
362 public void setNull(int paramIndex, int sqlType, String typeName)
363 throws SQLException {
364 if (shouldThrow(this.getClass().getInterfaces()[0], "setNull"))
365 throw new SQLException("PreparedStatement bombed");
366 it.setNull(paramIndex, sqlType, typeName);
367 }
368
369
370
371
372
373
374 public void setObject(int parameterIndex, Object x) throws SQLException {
375 if (shouldThrow(this.getClass().getInterfaces()[0], "setObject"))
376 throw new SQLException("PreparedStatement bombed");
377 it.setObject(parameterIndex, x);
378 }
379
380
381
382
383
384
385 public void setObject(int parameterIndex, Object x, int targetSqlType)
386 throws SQLException {
387 if (shouldThrow(this.getClass().getInterfaces()[0], "setObject"))
388 throw new SQLException("PreparedStatement bombed");
389 it.setObject(parameterIndex, x, targetSqlType);
390 }
391
392
393
394
395
396
397 public void setObject(int parameterIndex, Object x, int targetSqlType,
398 int scale) throws SQLException {
399 if (shouldThrow(this.getClass().getInterfaces()[0], "setObject"))
400 throw new SQLException("PreparedStatement bombed");
401 it.setObject(parameterIndex, x, targetSqlType, scale);
402 }
403
404
405
406
407
408
409 public void setRef(int i, Ref x) throws SQLException {
410 if (shouldThrow(this.getClass().getInterfaces()[0], "setRef"))
411 throw new SQLException("PreparedStatement bombed");
412 it.setRef(i, x);
413 }
414
415
416
417
418
419
420 public void setShort(int parameterIndex, short x) throws SQLException {
421 if (shouldThrow(this.getClass().getInterfaces()[0], "setShort"))
422 throw new SQLException("PreparedStatement bombed");
423 it.setShort(parameterIndex, x);
424 }
425
426
427
428
429
430
431 public void setString(int parameterIndex, String x) throws SQLException {
432 if (shouldThrow(this.getClass().getInterfaces()[0], "setString"))
433 throw new SQLException("PreparedStatement bombed");
434 it.setString(parameterIndex, x);
435 }
436
437
438
439
440
441
442 public void setTime(int parameterIndex, Time x) throws SQLException {
443 if (shouldThrow(this.getClass().getInterfaces()[0], "setTime"))
444 throw new SQLException("PreparedStatement bombed");
445 it.setTime(parameterIndex, x);
446 }
447
448
449
450
451
452
453
454 public void setTime(int parameterIndex, Time x, Calendar cal)
455 throws SQLException {
456 if (shouldThrow(this.getClass().getInterfaces()[0], "setTime"))
457 throw new SQLException("PreparedStatement bombed");
458 it.setTime(parameterIndex, x, cal);
459 }
460
461
462
463
464
465
466 public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException {
467 if (shouldThrow(this.getClass().getInterfaces()[0], "setTimestamp"))
468 throw new SQLException("PreparedStatement bombed");
469 it.setTimestamp(parameterIndex, x);
470 }
471
472
473
474
475
476
477
478 public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal)
479 throws SQLException {
480 if (shouldThrow(this.getClass().getInterfaces()[0], "setTimestamp"))
481 throw new SQLException("PreparedStatement bombed");
482 it.setTimestamp(parameterIndex, x, cal);
483 }
484
485
486
487
488
489
490 public void setURL(int parameterIndex, URL x) throws SQLException {
491 if (shouldThrow(this.getClass().getInterfaces()[0], "setURL"))
492 throw new SQLException("PreparedStatement bombed");
493 it.setURL(parameterIndex, x);
494 }
495
496
497
498
499
500
501
502 public void setUnicodeStream(int parameterIndex, InputStream x, int length)
503 throws SQLException {
504 if (shouldThrow(this.getClass().getInterfaces()[0], "setUnicodeStream"))
505 throw new SQLException("PreparedStatement bombed");
506 it.setUnicodeStream(parameterIndex, x, length);
507 }
508
509
510
511
512
513
514 public void addBatch(String sql) throws SQLException {
515 if (shouldThrow(this.getClass().getInterfaces()[0], "addBatch"))
516 throw new SQLException("PreparedStatement bombed");
517 it.addBatch();
518 }
519
520
521
522
523
524
525 public void cancel() throws SQLException {
526 if (shouldThrow(this.getClass().getInterfaces()[0], "cancel"))
527 throw new SQLException("PreparedStatement bombed");
528 it.cancel();
529 }
530
531
532
533
534
535
536 public void clearBatch() throws SQLException {
537 if (shouldThrow(this.getClass().getInterfaces()[0], "clearBatch"))
538 throw new SQLException("PreparedStatement bombed");
539 it.clearBatch();
540 }
541
542
543
544
545
546
547 public void clearWarnings() throws SQLException {
548 if (shouldThrow(this.getClass().getInterfaces()[0], "clearWarnings"))
549 throw new SQLException("PreparedStatement bombed");
550 it.clearWarnings();
551 }
552
553
554
555
556
557
558 public void close() throws SQLException {
559 if (shouldThrow(this.getClass().getInterfaces()[0], "close"))
560 throw new SQLException("PreparedStatement bombed");
561 it.close();
562 }
563
564
565
566
567
568
569 public boolean execute(String sql) throws SQLException {
570 if (shouldThrow(this.getClass().getInterfaces()[0], "execute"))
571 throw new SQLException("PreparedStatement bombed");
572
573 return it.execute(sql);
574 }
575
576
577
578
579
580
581 public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
582 if (shouldThrow(this.getClass().getInterfaces()[0], "execute"))
583 throw new SQLException("PreparedStatement bombed");
584
585 return it.execute(sql, autoGeneratedKeys);
586 }
587
588
589
590
591
592
593 public boolean execute(String sql, int[] columnIndexes) throws SQLException {
594 if (shouldThrow(this.getClass().getInterfaces()[0], "execute"))
595 throw new SQLException("PreparedStatement bombed");
596
597 return it.execute(sql, columnIndexes);
598 }
599
600
601
602
603
604
605 public boolean execute(String sql, String[] columnNames) throws SQLException {
606 if (shouldThrow(this.getClass().getInterfaces()[0], "execute"))
607 throw new SQLException("PreparedStatement bombed");
608
609 return it.execute(sql, columnNames);
610 }
611
612
613
614
615
616
617 public int[] executeBatch() throws SQLException {
618 if (shouldThrow(this.getClass().getInterfaces()[0], "executeBatch"))
619 throw new SQLException("PreparedStatement bombed");
620
621 return it.executeBatch();
622 }
623
624
625
626
627
628
629 public ResultSet executeQuery(String sql) throws SQLException {
630 if (shouldThrow(this.getClass().getInterfaces()[0], "executeQuery"))
631 throw new SQLException("PreparedStatement bombed");
632
633 return new ThrowingResultSet(it.executeQuery(sql));
634 }
635
636
637
638
639
640
641 public int executeUpdate(String sql) throws SQLException {
642 if (shouldThrow(this.getClass().getInterfaces()[0], "executeUpdate"))
643 throw new SQLException("PreparedStatement bombed");
644
645 return it.executeUpdate(sql);
646 }
647
648
649
650
651
652
653 public int executeUpdate(String sql, int autoGeneratedKeys)
654 throws SQLException {
655 if (shouldThrow(this.getClass().getInterfaces()[0], "executeUpdate"))
656 throw new SQLException("PreparedStatement bombed");
657
658 return it.executeUpdate(sql, autoGeneratedKeys);
659 }
660
661
662
663
664
665
666 public int executeUpdate(String sql, int[] columnIndexes) throws SQLException {
667 if (shouldThrow(this.getClass().getInterfaces()[0], "executeUpdate"))
668 throw new SQLException("PreparedStatement bombed");
669
670 return it.executeUpdate(sql, columnIndexes);
671 }
672
673
674
675
676
677
678 public int executeUpdate(String sql, String[] columnNames)
679 throws SQLException {
680 if (shouldThrow(this.getClass().getInterfaces()[0], "executeUpdate"))
681 throw new SQLException("PreparedStatement bombed");
682
683 return it.executeUpdate(sql, columnNames);
684 }
685
686
687
688
689
690
691 public Connection getConnection() throws SQLException {
692 if (shouldThrow(this.getClass().getInterfaces()[0], "getConnection"))
693 throw new SQLException("PreparedStatement bombed");
694
695 return new ThrowingConnection(it.getConnection());
696 }
697
698
699
700
701
702
703 public int getFetchDirection() throws SQLException {
704 if (shouldThrow(this.getClass().getInterfaces()[0], "getFetchDirection"))
705 throw new SQLException("PreparedStatement bombed");
706
707 return it.getFetchDirection();
708 }
709
710
711
712
713
714
715 public int getFetchSize() throws SQLException {
716 if (shouldThrow(this.getClass().getInterfaces()[0], "getFetchSize"))
717 throw new SQLException("PreparedStatement bombed");
718
719 return it.getFetchSize();
720 }
721
722
723
724
725
726
727 public ResultSet getGeneratedKeys() throws SQLException {
728 if (shouldThrow(this.getClass().getInterfaces()[0], "getGeneratedKeys"))
729 throw new SQLException("PreparedStatement bombed");
730
731 return new ThrowingResultSet(it.getGeneratedKeys());
732 }
733
734
735
736
737
738
739 public int getMaxFieldSize() throws SQLException {
740 if (shouldThrow(this.getClass().getInterfaces()[0], "getMaxFieldSize"))
741 throw new SQLException("PreparedStatement bombed");
742
743 return it.getMaxFieldSize();
744 }
745
746
747
748
749
750
751 public int getMaxRows() throws SQLException {
752 if (shouldThrow(this.getClass().getInterfaces()[0], "getMaxRows"))
753 throw new SQLException("PreparedStatement bombed");
754
755 return it.getMaxRows();
756 }
757
758
759
760
761
762
763 public boolean getMoreResults() throws SQLException {
764 if (shouldThrow(this.getClass().getInterfaces()[0], "getMoreResults"))
765 throw new SQLException("PreparedStatement bombed");
766
767 return it.getMoreResults();
768 }
769
770
771
772
773
774
775 public boolean getMoreResults(int current) throws SQLException {
776 if (shouldThrow(this.getClass().getInterfaces()[0], "getMoreResults"))
777 throw new SQLException("PreparedStatement bombed");
778
779 return it.getMoreResults(current);
780 }
781
782
783
784
785
786
787 public int getQueryTimeout() throws SQLException {
788 if (shouldThrow(this.getClass().getInterfaces()[0], "getQueryTimeout"))
789 throw new SQLException("PreparedStatement bombed");
790
791 return it.getQueryTimeout();
792 }
793
794
795
796
797
798
799 public ResultSet getResultSet() throws SQLException {
800 if (shouldThrow(this.getClass().getInterfaces()[0], "getResultSet"))
801 throw new SQLException("PreparedStatement bombed");
802
803 return new ThrowingResultSet(it.getResultSet());
804 }
805
806
807
808
809
810
811 public int getResultSetConcurrency() throws SQLException {
812 if (shouldThrow(this.getClass().getInterfaces()[0], "getResultSetConcurrency"))
813 throw new SQLException("PreparedStatement bombed");
814
815 return it.getResultSetConcurrency();
816 }
817
818
819
820
821
822
823 public int getResultSetHoldability() throws SQLException {
824 if (shouldThrow(this.getClass().getInterfaces()[0], "getResultSetHoldability"))
825 throw new SQLException("PreparedStatement bombed");
826
827 return it.getResultSetHoldability();
828 }
829
830
831
832
833
834
835 public int getResultSetType() throws SQLException {
836 if (shouldThrow(this.getClass().getInterfaces()[0], "getResultSetType"))
837 throw new SQLException("PreparedStatement bombed");
838
839 return it.getResultSetType();
840 }
841
842
843
844
845
846
847 public int getUpdateCount() throws SQLException {
848 if (shouldThrow(this.getClass().getInterfaces()[0], "getUpdateCount"))
849 throw new SQLException("PreparedStatement bombed");
850
851 return it.getUpdateCount();
852 }
853
854
855
856
857
858
859 public SQLWarning getWarnings() throws SQLException {
860 if (shouldThrow(this.getClass().getInterfaces()[0], "getWarnings"))
861 throw new SQLException("PreparedStatement bombed");
862
863 return it.getWarnings();
864 }
865
866
867
868
869
870
871 public void setCursorName(String name) throws SQLException {
872 if (shouldThrow(this.getClass().getInterfaces()[0], "setCursorName"))
873 throw new SQLException("PreparedStatement bombed");
874 it.setCursorName(name);
875 }
876
877
878
879
880
881
882 public void setEscapeProcessing(boolean enable) throws SQLException {
883 if (shouldThrow(this.getClass().getInterfaces()[0], "setEscapeProcessing"))
884 throw new SQLException("PreparedStatement bombed");
885 it.setEscapeProcessing(enable);
886 }
887
888
889
890
891
892
893 public void setFetchDirection(int direction) throws SQLException {
894 if (shouldThrow(this.getClass().getInterfaces()[0], "setFetchDirection"))
895 throw new SQLException("PreparedStatement bombed");
896 it.setFetchDirection(direction);
897 }
898
899
900
901
902
903
904 public void setFetchSize(int rows) throws SQLException {
905 if (shouldThrow(this.getClass().getInterfaces()[0], "setFetchSize"))
906 throw new SQLException("PreparedStatement bombed");
907 it.setFetchSize(rows);
908 }
909
910
911
912
913
914
915 public void setMaxFieldSize(int max) throws SQLException {
916 if (shouldThrow(this.getClass().getInterfaces()[0], "setMaxFieldSize"))
917 throw new SQLException("PreparedStatement bombed");
918 it.setMaxFieldSize(max);
919 }
920
921
922
923
924
925
926 public void setMaxRows(int max) throws SQLException {
927 if (shouldThrow(this.getClass().getInterfaces()[0], "setMaxRows"))
928 throw new SQLException("PreparedStatement bombed");
929 it.setMaxRows(max);
930 }
931
932
933
934
935
936
937 public void setQueryTimeout(int seconds) throws SQLException {
938 if (shouldThrow(this.getClass().getInterfaces()[0], "setQueryTimeout"))
939 throw new SQLException("PreparedStatement bombed");
940 it.setQueryTimeout(seconds);
941 }
942
943
944 }