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 @SuppressWarnings("deprecation")
503 public void setUnicodeStream(int parameterIndex, InputStream x, int length)
504 throws SQLException {
505 if (shouldThrow(this.getClass().getInterfaces()[0], "setUnicodeStream"))
506 throw new SQLException("PreparedStatement bombed");
507 it.setUnicodeStream(parameterIndex, x, length);
508 }
509
510
511
512
513
514
515 public void addBatch(String sql) throws SQLException {
516 if (shouldThrow(this.getClass().getInterfaces()[0], "addBatch"))
517 throw new SQLException("PreparedStatement bombed");
518 it.addBatch();
519 }
520
521
522
523
524
525
526 public void cancel() throws SQLException {
527 if (shouldThrow(this.getClass().getInterfaces()[0], "cancel"))
528 throw new SQLException("PreparedStatement bombed");
529 it.cancel();
530 }
531
532
533
534
535
536
537 public void clearBatch() throws SQLException {
538 if (shouldThrow(this.getClass().getInterfaces()[0], "clearBatch"))
539 throw new SQLException("PreparedStatement bombed");
540 it.clearBatch();
541 }
542
543
544
545
546
547
548 public void clearWarnings() throws SQLException {
549 if (shouldThrow(this.getClass().getInterfaces()[0], "clearWarnings"))
550 throw new SQLException("PreparedStatement bombed");
551 it.clearWarnings();
552 }
553
554
555
556
557
558
559 public void close() throws SQLException {
560 if (shouldThrow(this.getClass().getInterfaces()[0], "close"))
561 throw new SQLException("PreparedStatement bombed");
562 it.close();
563 }
564
565
566
567
568
569
570 public boolean execute(String sql) throws SQLException {
571 if (shouldThrow(this.getClass().getInterfaces()[0], "execute"))
572 throw new SQLException("PreparedStatement bombed");
573
574 return it.execute(sql);
575 }
576
577
578
579
580
581
582 public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
583 if (shouldThrow(this.getClass().getInterfaces()[0], "execute"))
584 throw new SQLException("PreparedStatement bombed");
585
586 return it.execute(sql, autoGeneratedKeys);
587 }
588
589
590
591
592
593
594 public boolean execute(String sql, int[] columnIndexes) throws SQLException {
595 if (shouldThrow(this.getClass().getInterfaces()[0], "execute"))
596 throw new SQLException("PreparedStatement bombed");
597
598 return it.execute(sql, columnIndexes);
599 }
600
601
602
603
604
605
606 public boolean execute(String sql, String[] columnNames) throws SQLException {
607 if (shouldThrow(this.getClass().getInterfaces()[0], "execute"))
608 throw new SQLException("PreparedStatement bombed");
609
610 return it.execute(sql, columnNames);
611 }
612
613
614
615
616
617
618 public int[] executeBatch() throws SQLException {
619 if (shouldThrow(this.getClass().getInterfaces()[0], "executeBatch"))
620 throw new SQLException("PreparedStatement bombed");
621
622 return it.executeBatch();
623 }
624
625
626
627
628
629
630 public ResultSet executeQuery(String sql) throws SQLException {
631 if (shouldThrow(this.getClass().getInterfaces()[0], "executeQuery"))
632 throw new SQLException("PreparedStatement bombed");
633
634 return new ThrowingResultSet(it.executeQuery(sql));
635 }
636
637
638
639
640
641
642 public int executeUpdate(String sql) throws SQLException {
643 if (shouldThrow(this.getClass().getInterfaces()[0], "executeUpdate"))
644 throw new SQLException("PreparedStatement bombed");
645
646 return it.executeUpdate(sql);
647 }
648
649
650
651
652
653
654 public int executeUpdate(String sql, int autoGeneratedKeys)
655 throws SQLException {
656 if (shouldThrow(this.getClass().getInterfaces()[0], "executeUpdate"))
657 throw new SQLException("PreparedStatement bombed");
658
659 return it.executeUpdate(sql, autoGeneratedKeys);
660 }
661
662
663
664
665
666
667 public int executeUpdate(String sql, int[] columnIndexes) throws SQLException {
668 if (shouldThrow(this.getClass().getInterfaces()[0], "executeUpdate"))
669 throw new SQLException("PreparedStatement bombed");
670
671 return it.executeUpdate(sql, columnIndexes);
672 }
673
674
675
676
677
678
679 public int executeUpdate(String sql, String[] columnNames)
680 throws SQLException {
681 if (shouldThrow(this.getClass().getInterfaces()[0], "executeUpdate"))
682 throw new SQLException("PreparedStatement bombed");
683
684 return it.executeUpdate(sql, columnNames);
685 }
686
687
688
689
690
691
692 public Connection getConnection() throws SQLException {
693 if (shouldThrow(this.getClass().getInterfaces()[0], "getConnection"))
694 throw new SQLException("PreparedStatement bombed");
695
696 return new ThrowingConnection(it.getConnection());
697 }
698
699
700
701
702
703
704 public int getFetchDirection() throws SQLException {
705 if (shouldThrow(this.getClass().getInterfaces()[0], "getFetchDirection"))
706 throw new SQLException("PreparedStatement bombed");
707
708 return it.getFetchDirection();
709 }
710
711
712
713
714
715
716 public int getFetchSize() throws SQLException {
717 if (shouldThrow(this.getClass().getInterfaces()[0], "getFetchSize"))
718 throw new SQLException("PreparedStatement bombed");
719
720 return it.getFetchSize();
721 }
722
723
724
725
726
727
728 public ResultSet getGeneratedKeys() throws SQLException {
729 if (shouldThrow(this.getClass().getInterfaces()[0], "getGeneratedKeys"))
730 throw new SQLException("PreparedStatement bombed");
731
732 return new ThrowingResultSet(it.getGeneratedKeys());
733 }
734
735
736
737
738
739
740 public int getMaxFieldSize() throws SQLException {
741 if (shouldThrow(this.getClass().getInterfaces()[0], "getMaxFieldSize"))
742 throw new SQLException("PreparedStatement bombed");
743
744 return it.getMaxFieldSize();
745 }
746
747
748
749
750
751
752 public int getMaxRows() throws SQLException {
753 if (shouldThrow(this.getClass().getInterfaces()[0], "getMaxRows"))
754 throw new SQLException("PreparedStatement bombed");
755
756 return it.getMaxRows();
757 }
758
759
760
761
762
763
764 public boolean getMoreResults() throws SQLException {
765 if (shouldThrow(this.getClass().getInterfaces()[0], "getMoreResults"))
766 throw new SQLException("PreparedStatement bombed");
767
768 return it.getMoreResults();
769 }
770
771
772
773
774
775
776 public boolean getMoreResults(int current) throws SQLException {
777 if (shouldThrow(this.getClass().getInterfaces()[0], "getMoreResults"))
778 throw new SQLException("PreparedStatement bombed");
779
780 return it.getMoreResults(current);
781 }
782
783
784
785
786
787
788 public int getQueryTimeout() throws SQLException {
789 if (shouldThrow(this.getClass().getInterfaces()[0], "getQueryTimeout"))
790 throw new SQLException("PreparedStatement bombed");
791
792 return it.getQueryTimeout();
793 }
794
795
796
797
798
799
800 public ResultSet getResultSet() throws SQLException {
801 if (shouldThrow(this.getClass().getInterfaces()[0], "getResultSet"))
802 throw new SQLException("PreparedStatement bombed");
803
804 return new ThrowingResultSet(it.getResultSet());
805 }
806
807
808
809
810
811
812 public int getResultSetConcurrency() throws SQLException {
813 if (shouldThrow(this.getClass().getInterfaces()[0], "getResultSetConcurrency"))
814 throw new SQLException("PreparedStatement bombed");
815
816 return it.getResultSetConcurrency();
817 }
818
819
820
821
822
823
824 public int getResultSetHoldability() throws SQLException {
825 if (shouldThrow(this.getClass().getInterfaces()[0], "getResultSetHoldability"))
826 throw new SQLException("PreparedStatement bombed");
827
828 return it.getResultSetHoldability();
829 }
830
831
832
833
834
835
836 public int getResultSetType() throws SQLException {
837 if (shouldThrow(this.getClass().getInterfaces()[0], "getResultSetType"))
838 throw new SQLException("PreparedStatement bombed");
839
840 return it.getResultSetType();
841 }
842
843
844
845
846
847
848 public int getUpdateCount() throws SQLException {
849 if (shouldThrow(this.getClass().getInterfaces()[0], "getUpdateCount"))
850 throw new SQLException("PreparedStatement bombed");
851
852 return it.getUpdateCount();
853 }
854
855
856
857
858
859
860 public SQLWarning getWarnings() throws SQLException {
861 if (shouldThrow(this.getClass().getInterfaces()[0], "getWarnings"))
862 throw new SQLException("PreparedStatement bombed");
863
864 return it.getWarnings();
865 }
866
867
868
869
870
871
872 public void setCursorName(String name) throws SQLException {
873 if (shouldThrow(this.getClass().getInterfaces()[0], "setCursorName"))
874 throw new SQLException("PreparedStatement bombed");
875 it.setCursorName(name);
876 }
877
878
879
880
881
882
883 public void setEscapeProcessing(boolean enable) throws SQLException {
884 if (shouldThrow(this.getClass().getInterfaces()[0], "setEscapeProcessing"))
885 throw new SQLException("PreparedStatement bombed");
886 it.setEscapeProcessing(enable);
887 }
888
889
890
891
892
893
894 public void setFetchDirection(int direction) throws SQLException {
895 if (shouldThrow(this.getClass().getInterfaces()[0], "setFetchDirection"))
896 throw new SQLException("PreparedStatement bombed");
897 it.setFetchDirection(direction);
898 }
899
900
901
902
903
904
905 public void setFetchSize(int rows) throws SQLException {
906 if (shouldThrow(this.getClass().getInterfaces()[0], "setFetchSize"))
907 throw new SQLException("PreparedStatement bombed");
908 it.setFetchSize(rows);
909 }
910
911
912
913
914
915
916 public void setMaxFieldSize(int max) throws SQLException {
917 if (shouldThrow(this.getClass().getInterfaces()[0], "setMaxFieldSize"))
918 throw new SQLException("PreparedStatement bombed");
919 it.setMaxFieldSize(max);
920 }
921
922
923
924
925
926
927 public void setMaxRows(int max) throws SQLException {
928 if (shouldThrow(this.getClass().getInterfaces()[0], "setMaxRows"))
929 throw new SQLException("PreparedStatement bombed");
930 it.setMaxRows(max);
931 }
932
933
934
935
936
937
938 public void setQueryTimeout(int seconds) throws SQLException {
939 if (shouldThrow(this.getClass().getInterfaces()[0], "setQueryTimeout"))
940 throw new SQLException("PreparedStatement bombed");
941 it.setQueryTimeout(seconds);
942 }
943
944
945 }