KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > resource > adapter > jdbc > WrappedResultSet


1 /*
2  * JBoss, Home of Professional Open Source
3  * Copyright 2005, JBoss Inc., and individual contributors as indicated
4  * by the @authors tag. See the copyright.txt in the distribution for a
5  * full listing of individual contributors.
6  *
7  * This is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as
9  * published by the Free Software Foundation; either version 2.1 of
10  * the License, or (at your option) any later version.
11  *
12  * This software is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this software; if not, write to the Free
19  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21  */

22 package org.jboss.resource.adapter.jdbc;
23
24 import java.io.InputStream JavaDoc;
25 import java.io.Reader JavaDoc;
26 import java.math.BigDecimal JavaDoc;
27 import java.net.URL JavaDoc;
28 import java.sql.Array JavaDoc;
29 import java.sql.Blob JavaDoc;
30 import java.sql.Clob JavaDoc;
31 import java.sql.Date JavaDoc;
32 import java.sql.Ref JavaDoc;
33 import java.sql.ResultSet JavaDoc;
34 import java.sql.ResultSetMetaData JavaDoc;
35 import java.sql.SQLException JavaDoc;
36 import java.sql.SQLWarning JavaDoc;
37 import java.sql.Statement JavaDoc;
38 import java.sql.Time JavaDoc;
39 import java.sql.Timestamp JavaDoc;
40 import java.util.Calendar JavaDoc;
41 import java.util.Map JavaDoc;
42
43 /**
44  * A wrapper for a result set
45  *
46  * @author <a HREF="mailto:adrian@jboss.com">Adrian Brock</a>
47  * @version $Revision: 54958 $
48  */

49 public class WrappedResultSet implements ResultSet JavaDoc
50 {
51    /** The wrapped statement */
52    private WrappedStatement statement;
53
54    /** The real result set */
55    private ResultSet JavaDoc resultSet;
56
57    /** Whether we are closed */
58    private boolean closed = false;
59
60    /** The state lock */
61    private Object JavaDoc lock = new Object JavaDoc();
62    
63    /**
64     * Create a new wrapped result set
65     *
66     * @param statement the wrapped statement
67     * @param resultSet the real result set
68     */

69    public WrappedResultSet(WrappedStatement statement, ResultSet JavaDoc resultSet)
70    {
71       if (statement == null)
72          throw new IllegalArgumentException JavaDoc("Null statement!");
73       if (resultSet == null)
74          throw new IllegalArgumentException JavaDoc("Null result set!");
75       this.statement = statement;
76       this.resultSet = resultSet;
77    }
78
79    public boolean equals(Object JavaDoc o)
80    {
81       if (o == null)
82          return false;
83       else if (o == this)
84          return true;
85       else if (o instanceof WrappedResultSet)
86          return (resultSet.equals(((WrappedResultSet) o).resultSet));
87       else if (o instanceof ResultSet JavaDoc)
88          return resultSet.equals(o);
89       return false;
90    }
91
92    public int hashCode()
93    {
94       return resultSet.hashCode();
95    }
96
97    public String JavaDoc toString()
98    {
99       return resultSet.toString();
100    }
101
102    public ResultSet JavaDoc getUnderlyingResultSet() throws SQLException JavaDoc
103    {
104       checkState();
105       return resultSet;
106    }
107
108    public boolean absolute(int row) throws SQLException JavaDoc
109    {
110       checkState();
111       try
112       {
113          return resultSet.absolute(row);
114       }
115       catch (Throwable JavaDoc t)
116       {
117          throw checkException(t);
118       }
119    }
120
121    public void afterLast() throws SQLException JavaDoc
122    {
123       checkState();
124       try
125       {
126          resultSet.afterLast();
127       }
128       catch (Throwable JavaDoc t)
129       {
130          throw checkException(t);
131       }
132    }
133
134    public void beforeFirst() throws SQLException JavaDoc
135    {
136       checkState();
137       try
138       {
139          resultSet.beforeFirst();
140       }
141       catch (Throwable JavaDoc t)
142       {
143          throw checkException(t);
144       }
145    }
146
147    public void cancelRowUpdates() throws SQLException JavaDoc
148    {
149       checkState();
150       try
151       {
152          resultSet.cancelRowUpdates();
153       }
154       catch (Throwable JavaDoc t)
155       {
156          throw checkException(t);
157       }
158    }
159
160    public void clearWarnings() throws SQLException JavaDoc
161    {
162       checkState();
163       try
164       {
165          resultSet.clearWarnings();
166       }
167       catch (Throwable JavaDoc t)
168       {
169          throw checkException(t);
170       }
171    }
172
173    public void close() throws SQLException JavaDoc
174    {
175       synchronized (lock)
176       {
177          if (closed)
178            return;
179          closed = true;
180       }
181       statement.unregisterResultSet(this);
182       internalClose();
183    }
184
185    public void deleteRow() throws SQLException JavaDoc
186    {
187       checkState();
188       try
189       {
190          resultSet.deleteRow();
191       }
192       catch (Throwable JavaDoc t)
193       {
194          throw checkException(t);
195       }
196    }
197
198    public int findColumn(String JavaDoc columnName) throws SQLException JavaDoc
199    {
200       checkState();
201       try
202       {
203          return resultSet.findColumn(columnName);
204       }
205       catch (Throwable JavaDoc t)
206       {
207          throw checkException(t);
208       }
209    }
210
211    public boolean first() throws SQLException JavaDoc
212    {
213       checkState();
214       try
215       {
216          return resultSet.first();
217       }
218       catch (Throwable JavaDoc t)
219       {
220          throw checkException(t);
221       }
222    }
223
224    public Array JavaDoc getArray(int i) throws SQLException JavaDoc
225    {
226       checkState();
227       try
228       {
229          return resultSet.getArray(i);
230       }
231       catch (Throwable JavaDoc t)
232       {
233          throw checkException(t);
234       }
235    }
236
237    public Array JavaDoc getArray(String JavaDoc colName) throws SQLException JavaDoc
238    {
239       checkState();
240       try
241       {
242          return resultSet.getArray(colName);
243       }
244       catch (Throwable JavaDoc t)
245       {
246          throw checkException(t);
247       }
248    }
249
250    public InputStream JavaDoc getAsciiStream(int columnIndex) throws SQLException JavaDoc
251    {
252       checkState();
253       try
254       {
255          return resultSet.getAsciiStream(columnIndex);
256       }
257       catch (Throwable JavaDoc t)
258       {
259          throw checkException(t);
260       }
261    }
262
263    public InputStream JavaDoc getAsciiStream(String JavaDoc columnName) throws SQLException JavaDoc
264    {
265       checkState();
266       try
267       {
268          return resultSet.getAsciiStream(columnName);
269       }
270       catch (Throwable JavaDoc t)
271       {
272          throw checkException(t);
273       }
274    }
275
276    public BigDecimal JavaDoc getBigDecimal(int columnIndex) throws SQLException JavaDoc
277    {
278       checkState();
279       try
280       {
281          return resultSet.getBigDecimal(columnIndex);
282       }
283       catch (Throwable JavaDoc t)
284       {
285          throw checkException(t);
286       }
287    }
288
289    /**
290     * @deprecated
291     */

292    public BigDecimal JavaDoc getBigDecimal(int columnIndex, int scale) throws SQLException JavaDoc
293    {
294       checkState();
295       try
296       {
297          return resultSet.getBigDecimal(columnIndex, scale);
298       }
299       catch (Throwable JavaDoc t)
300       {
301          throw checkException(t);
302       }
303    }
304
305    public BigDecimal JavaDoc getBigDecimal(String JavaDoc columnName) throws SQLException JavaDoc
306    {
307       checkState();
308       try
309       {
310          return resultSet.getBigDecimal(columnName);
311       }
312       catch (Throwable JavaDoc t)
313       {
314          throw checkException(t);
315       }
316    }
317
318    /**
319     * @deprecated
320     */

321    public BigDecimal JavaDoc getBigDecimal(String JavaDoc columnName, int scale) throws SQLException JavaDoc
322    {
323       checkState();
324       try
325       {
326          return resultSet.getBigDecimal(columnName, scale);
327       }
328       catch (Throwable JavaDoc t)
329       {
330          throw checkException(t);
331       }
332    }
333
334    public InputStream JavaDoc getBinaryStream(int columnIndex) throws SQLException JavaDoc
335    {
336       checkState();
337       try
338       {
339          return resultSet.getBinaryStream(columnIndex);
340       }
341       catch (Throwable JavaDoc t)
342       {
343          throw checkException(t);
344       }
345    }
346
347    public InputStream JavaDoc getBinaryStream(String JavaDoc columnName) throws SQLException JavaDoc
348    {
349       checkState();
350       try
351       {
352          return resultSet.getBinaryStream(columnName);
353       }
354       catch (Throwable JavaDoc t)
355       {
356          throw checkException(t);
357       }
358    }
359
360    public Blob JavaDoc getBlob(int i) throws SQLException JavaDoc
361    {
362       checkState();
363       try
364       {
365          return resultSet.getBlob(i);
366       }
367       catch (Throwable JavaDoc t)
368       {
369          throw checkException(t);
370       }
371    }
372
373    public Blob JavaDoc getBlob(String JavaDoc colName) throws SQLException JavaDoc
374    {
375       checkState();
376       try
377       {
378          return resultSet.getBlob(colName);
379       }
380       catch (Throwable JavaDoc t)
381       {
382          throw checkException(t);
383       }
384    }
385
386    public boolean getBoolean(int columnIndex) throws SQLException JavaDoc
387    {
388       checkState();
389       try
390       {
391          return resultSet.getBoolean(columnIndex);
392       }
393       catch (Throwable JavaDoc t)
394       {
395          throw checkException(t);
396       }
397    }
398
399    public boolean getBoolean(String JavaDoc columnName) throws SQLException JavaDoc
400    {
401       checkState();
402       try
403       {
404          return resultSet.getBoolean(columnName);
405       }
406       catch (Throwable JavaDoc t)
407       {
408          throw checkException(t);
409       }
410    }
411
412    public byte getByte(int columnIndex) throws SQLException JavaDoc
413    {
414       checkState();
415       try
416       {
417          return resultSet.getByte(columnIndex);
418       }
419       catch (Throwable JavaDoc t)
420       {
421          throw checkException(t);
422       }
423    }
424
425    public byte getByte(String JavaDoc columnName) throws SQLException JavaDoc
426    {
427       checkState();
428       try
429       {
430          return resultSet.getByte(columnName);
431       }
432       catch (Throwable JavaDoc t)
433       {
434          throw checkException(t);
435       }
436    }
437
438    public byte[] getBytes(int columnIndex) throws SQLException JavaDoc
439    {
440       checkState();
441       try
442       {
443          return resultSet.getBytes(columnIndex);
444       }
445       catch (Throwable JavaDoc t)
446       {
447          throw checkException(t);
448       }
449    }
450
451    public byte[] getBytes(String JavaDoc columnName) throws SQLException JavaDoc
452    {
453       checkState();
454       try
455       {
456          return resultSet.getBytes(columnName);
457       }
458       catch (Throwable JavaDoc t)
459       {
460          throw checkException(t);
461       }
462    }
463
464    public Reader JavaDoc getCharacterStream(int columnIndex) throws SQLException JavaDoc
465    {
466       checkState();
467       try
468       {
469          return resultSet.getCharacterStream(columnIndex);
470       }
471       catch (Throwable JavaDoc t)
472       {
473          throw checkException(t);
474       }
475    }
476
477    public Reader JavaDoc getCharacterStream(String JavaDoc columnName) throws SQLException JavaDoc
478    {
479       checkState();
480       try
481       {
482          return resultSet.getCharacterStream(columnName);
483       }
484       catch (Throwable JavaDoc t)
485       {
486          throw checkException(t);
487       }
488    }
489
490    public Clob JavaDoc getClob(int i) throws SQLException JavaDoc
491    {
492       checkState();
493       try
494       {
495          return resultSet.getClob(i);
496       }
497       catch (Throwable JavaDoc t)
498       {
499          throw checkException(t);
500       }
501    }
502
503    public Clob JavaDoc getClob(String JavaDoc colName) throws SQLException JavaDoc
504    {
505       checkState();
506       try
507       {
508          return resultSet.getClob(colName);
509       }
510       catch (Throwable JavaDoc t)
511       {
512          throw checkException(t);
513       }
514    }
515
516    public int getConcurrency() throws SQLException JavaDoc
517    {
518       checkState();
519       try
520       {
521          return resultSet.getConcurrency();
522       }
523       catch (Throwable JavaDoc t)
524       {
525          throw checkException(t);
526       }
527    }
528
529    public String JavaDoc getCursorName() throws SQLException JavaDoc
530    {
531       checkState();
532       try
533       {
534          return resultSet.getCursorName();
535       }
536       catch (Throwable JavaDoc t)
537       {
538          throw checkException(t);
539       }
540    }
541
542    public Date JavaDoc getDate(int columnIndex) throws SQLException JavaDoc
543    {
544       checkState();
545       try
546       {
547          return resultSet.getDate(columnIndex);
548       }
549       catch (Throwable JavaDoc t)
550       {
551          throw checkException(t);
552       }
553    }
554
555    public Date JavaDoc getDate(int columnIndex, Calendar JavaDoc cal) throws SQLException JavaDoc
556    {
557       checkState();
558       try
559       {
560          return resultSet.getDate(columnIndex, cal);
561       }
562       catch (Throwable JavaDoc t)
563       {
564          throw checkException(t);
565       }
566    }
567
568    public Date JavaDoc getDate(String JavaDoc columnName) throws SQLException JavaDoc
569    {
570       checkState();
571       try
572       {
573          return resultSet.getDate(columnName);
574       }
575       catch (Throwable JavaDoc t)
576       {
577          throw checkException(t);
578       }
579    }
580
581    public Date JavaDoc getDate(String JavaDoc columnName, Calendar JavaDoc cal) throws SQLException JavaDoc
582    {
583       checkState();
584       try
585       {
586          return resultSet.getDate(columnName, cal);
587       }
588       catch (Throwable JavaDoc t)
589       {
590          throw checkException(t);
591       }
592    }
593
594    public double getDouble(int columnIndex) throws SQLException JavaDoc
595    {
596       checkState();
597       try
598       {
599          return resultSet.getDouble(columnIndex);
600       }
601       catch (Throwable JavaDoc t)
602       {
603          throw checkException(t);
604       }
605    }
606
607    public double getDouble(String JavaDoc columnName) throws SQLException JavaDoc
608    {
609       checkState();
610       try
611       {
612          return resultSet.getDouble(columnName);
613       }
614       catch (Throwable JavaDoc t)
615       {
616          throw checkException(t);
617       }
618    }
619
620    public int getFetchDirection() throws SQLException JavaDoc
621    {
622       checkState();
623       try
624       {
625          return resultSet.getFetchDirection();
626       }
627       catch (Throwable JavaDoc t)
628       {
629          throw checkException(t);
630       }
631    }
632
633    public int getFetchSize() throws SQLException JavaDoc
634    {
635       checkState();
636       try
637       {
638          return resultSet.getFetchSize();
639       }
640       catch (Throwable JavaDoc t)
641       {
642          throw checkException(t);
643       }
644    }
645
646    public float getFloat(int columnIndex) throws SQLException JavaDoc
647    {
648       checkState();
649       try
650       {
651          return resultSet.getFloat(columnIndex);
652       }
653       catch (Throwable JavaDoc t)
654       {
655          throw checkException(t);
656       }
657    }
658
659    public float getFloat(String JavaDoc columnName) throws SQLException JavaDoc
660    {
661       checkState();
662       try
663       {
664          return resultSet.getFloat(columnName);
665       }
666       catch (Throwable JavaDoc t)
667       {
668          throw checkException(t);
669       }
670    }
671
672    public int getInt(int columnIndex) throws SQLException JavaDoc
673    {
674       checkState();
675       try
676       {
677          return resultSet.getInt(columnIndex);
678       }
679       catch (Throwable JavaDoc t)
680       {
681          throw checkException(t);
682       }
683    }
684
685    public int getInt(String JavaDoc columnName) throws SQLException JavaDoc
686    {
687       checkState();
688       try
689       {
690          return resultSet.getInt(columnName);
691       }
692       catch (Throwable JavaDoc t)
693       {
694          throw checkException(t);
695       }
696    }
697
698    public long getLong(int columnIndex) throws SQLException JavaDoc
699    {
700       checkState();
701       try
702       {
703          return resultSet.getLong(columnIndex);
704       }
705       catch (Throwable JavaDoc t)
706       {
707          throw checkException(t);
708       }
709    }
710
711    public long getLong(String JavaDoc columnName) throws SQLException JavaDoc
712    {
713       checkState();
714       try
715       {
716          return resultSet.getLong(columnName);
717       }
718       catch (Throwable JavaDoc t)
719       {
720          throw checkException(t);
721       }
722    }
723
724    public ResultSetMetaData JavaDoc getMetaData() throws SQLException JavaDoc
725    {
726       checkState();
727       try
728       {
729          return resultSet.getMetaData();
730       }
731       catch (Throwable JavaDoc t)
732       {
733          throw checkException(t);
734       }
735    }
736
737    public Object JavaDoc getObject(int columnIndex) throws SQLException JavaDoc
738    {
739       checkState();
740       try
741       {
742          return resultSet.getObject(columnIndex);
743       }
744       catch (Throwable JavaDoc t)
745       {
746          throw checkException(t);
747       }
748    }
749
750    public Object JavaDoc getObject(int i, Map JavaDoc map) throws SQLException JavaDoc
751    {
752       checkState();
753       try
754       {
755          return resultSet.getObject(i, map);
756       }
757       catch (Throwable JavaDoc t)
758       {
759          throw checkException(t);
760       }
761    }
762
763    public Object JavaDoc getObject(String JavaDoc columnName) throws SQLException JavaDoc
764    {
765       checkState();
766       try
767       {
768          return resultSet.getObject(columnName);
769       }
770       catch (Throwable JavaDoc t)
771       {
772          throw checkException(t);
773       }
774    }
775
776    public Object JavaDoc getObject(String JavaDoc colName, Map JavaDoc map) throws SQLException JavaDoc
777    {
778       checkState();
779       try
780       {
781          return resultSet.getObject(colName, map);
782       }
783       catch (Throwable JavaDoc t)
784       {
785          throw checkException(t);
786       }
787    }
788
789    public Ref JavaDoc getRef(int i) throws SQLException JavaDoc
790    {
791       checkState();
792       try
793       {
794          return resultSet.getRef(i);
795       }
796       catch (Throwable JavaDoc t)
797       {
798          throw checkException(t);
799       }
800    }
801
802    public Ref JavaDoc getRef(String JavaDoc colName) throws SQLException JavaDoc
803    {
804       checkState();
805       try
806       {
807          return resultSet.getRef(colName);
808       }
809       catch (Throwable JavaDoc t)
810       {
811          throw checkException(t);
812       }
813    }
814
815    public int getRow() throws SQLException JavaDoc
816    {
817       checkState();
818       try
819       {
820          return resultSet.getRow();
821       }
822       catch (Throwable JavaDoc t)
823       {
824          throw checkException(t);
825       }
826    }
827
828    public short getShort(int columnIndex) throws SQLException JavaDoc
829    {
830       checkState();
831       try
832       {
833          return resultSet.getShort(columnIndex);
834       }
835       catch (Throwable JavaDoc t)
836       {
837          throw checkException(t);
838       }
839    }
840
841    public short getShort(String JavaDoc columnName) throws SQLException JavaDoc
842    {
843       checkState();
844       try
845       {
846          return resultSet.getShort(columnName);
847       }
848       catch (Throwable JavaDoc t)
849       {
850          throw checkException(t);
851       }
852    }
853
854    public Statement JavaDoc getStatement() throws SQLException JavaDoc
855    {
856       checkState();
857       return statement;
858    }
859
860    public String JavaDoc getString(int columnIndex) throws SQLException JavaDoc
861    {
862       checkState();
863       try
864       {
865          return resultSet.getString(columnIndex);
866       }
867       catch (Throwable JavaDoc t)
868       {
869          throw checkException(t);
870       }
871    }
872
873    public String JavaDoc getString(String JavaDoc columnName) throws SQLException JavaDoc
874    {
875       checkState();
876       try
877       {
878          return resultSet.getString(columnName);
879       }
880       catch (Throwable JavaDoc t)
881       {
882          throw checkException(t);
883       }
884    }
885
886    public Time JavaDoc getTime(int columnIndex) throws SQLException JavaDoc
887    {
888       checkState();
889       try
890       {
891          return resultSet.getTime(columnIndex);
892       }
893       catch (Throwable JavaDoc t)
894       {
895          throw checkException(t);
896       }
897    }
898
899    public Time JavaDoc getTime(int columnIndex, Calendar JavaDoc cal) throws SQLException JavaDoc
900    {
901       checkState();
902       try
903       {
904          return resultSet.getTime(columnIndex, cal);
905       }
906       catch (Throwable JavaDoc t)
907       {
908          throw checkException(t);
909       }
910    }
911
912    public Time JavaDoc getTime(String JavaDoc columnName) throws SQLException JavaDoc
913    {
914       checkState();
915       try
916       {
917          return resultSet.getTime(columnName);
918       }
919       catch (Throwable JavaDoc t)
920       {
921          throw checkException(t);
922       }
923    }
924
925    public Time JavaDoc getTime(String JavaDoc columnName, Calendar JavaDoc cal) throws SQLException JavaDoc
926    {
927       checkState();
928       try
929       {
930          return resultSet.getTime(columnName, cal);
931       }
932       catch (Throwable JavaDoc t)
933       {
934          throw checkException(t);
935       }
936    }
937
938    public Timestamp JavaDoc getTimestamp(int columnIndex) throws SQLException JavaDoc
939    {
940       checkState();
941       try
942       {
943          return resultSet.getTimestamp(columnIndex);
944       }
945       catch (Throwable JavaDoc t)
946       {
947          throw checkException(t);
948       }
949    }
950
951    public Timestamp JavaDoc getTimestamp(int columnIndex, Calendar JavaDoc cal) throws SQLException JavaDoc
952    {
953       checkState();
954       try
955       {
956          return resultSet.getTimestamp(columnIndex, cal);
957       }
958       catch (Throwable JavaDoc t)
959       {
960          throw checkException(t);
961       }
962    }
963
964    public Timestamp JavaDoc getTimestamp(String JavaDoc columnName) throws SQLException JavaDoc
965    {
966       checkState();
967       try
968       {
969          return resultSet.getTimestamp(columnName);
970       }
971       catch (Throwable JavaDoc t)
972       {
973          throw checkException(t);
974       }
975    }
976
977    public Timestamp JavaDoc getTimestamp(String JavaDoc columnName, Calendar JavaDoc cal) throws SQLException JavaDoc
978    {
979       checkState();
980       try
981       {
982          return resultSet.getTimestamp(columnName, cal);
983       }
984       catch (Throwable JavaDoc t)
985       {
986          throw checkException(t);
987       }
988    }
989
990    public int getType() throws SQLException JavaDoc
991    {
992       checkState();
993       try
994       {
995          return resultSet.getType();
996       }
997       catch (Throwable JavaDoc t)
998       {
999          throw checkException(t);
1000      }
1001   }
1002
1003   /**
1004    * @deprecated
1005    */

1006   public InputStream JavaDoc getUnicodeStream(int columnIndex) throws SQLException JavaDoc
1007   {
1008      checkState();
1009      try
1010      {
1011         return resultSet.getUnicodeStream(columnIndex);
1012      }
1013      catch (Throwable JavaDoc t)
1014      {
1015         throw checkException(t);
1016      }
1017   }
1018
1019   /**
1020    * @deprecated
1021    */

1022   public InputStream JavaDoc getUnicodeStream(String JavaDoc columnName) throws SQLException JavaDoc
1023   {
1024      try
1025      {
1026         return resultSet.getUnicodeStream(columnName);
1027      }
1028      catch (Throwable JavaDoc t)
1029      {
1030         throw checkException(t);
1031      }
1032   }
1033
1034   public URL JavaDoc getURL(int columnIndex) throws SQLException JavaDoc
1035   {
1036      checkState();
1037      try
1038      {
1039         return resultSet.getURL(columnIndex);
1040      }
1041      catch (Throwable JavaDoc t)
1042      {
1043         throw checkException(t);
1044      }
1045   }
1046
1047   public URL JavaDoc getURL(String JavaDoc columnName) throws SQLException JavaDoc
1048   {
1049      checkState();
1050      try
1051      {
1052         return resultSet.getURL(columnName);
1053      }
1054      catch (Throwable JavaDoc t)
1055      {
1056         throw checkException(t);
1057      }
1058   }
1059
1060   public SQLWarning JavaDoc getWarnings() throws SQLException JavaDoc
1061   {
1062      checkState();
1063      try
1064      {
1065         return resultSet.getWarnings();
1066      }
1067      catch (Throwable JavaDoc t)
1068      {
1069         throw checkException(t);
1070      }
1071   }
1072
1073   public void insertRow() throws SQLException JavaDoc
1074   {
1075      checkState();
1076      try
1077      {
1078         resultSet.insertRow();
1079      }
1080      catch (Throwable JavaDoc t)
1081      {
1082         throw checkException(t);
1083      }
1084   }
1085
1086   public boolean isAfterLast() throws SQLException JavaDoc
1087   {
1088      checkState();
1089      try
1090      {
1091         return resultSet.isAfterLast();
1092      }
1093      catch (Throwable JavaDoc t)
1094      {
1095         throw checkException(t);
1096      }
1097   }
1098
1099   public boolean isBeforeFirst() throws SQLException JavaDoc
1100   {
1101      checkState();
1102      try
1103      {
1104         return resultSet.isBeforeFirst();
1105      }
1106      catch (Throwable JavaDoc t)
1107      {
1108         throw checkException(t);
1109      }
1110   }
1111
1112   public boolean isFirst() throws SQLException JavaDoc
1113   {
1114      checkState();
1115      try
1116      {
1117         return resultSet.isFirst();
1118      }
1119      catch (Throwable JavaDoc t)
1120      {
1121         throw checkException(t);
1122      }
1123   }
1124
1125   public boolean isLast() throws SQLException JavaDoc
1126   {
1127      checkState();
1128      try
1129      {
1130         return resultSet.isLast();
1131      }
1132      catch (Throwable JavaDoc t)
1133      {
1134         throw checkException(t);
1135      }
1136   }
1137
1138   public boolean last() throws SQLException JavaDoc
1139   {
1140      checkState();
1141      try
1142      {
1143         return resultSet.last();
1144      }
1145      catch (Throwable JavaDoc t)
1146      {
1147         throw checkException(t);
1148      }
1149   }
1150
1151   public void moveToCurrentRow() throws SQLException JavaDoc
1152   {
1153      checkState();
1154      try
1155      {
1156         resultSet.moveToCurrentRow();
1157      }
1158      catch (Throwable JavaDoc t)
1159      {
1160         throw checkException(t);
1161      }
1162   }
1163
1164   public void moveToInsertRow() throws SQLException JavaDoc
1165   {
1166      checkState();
1167      try
1168      {
1169         resultSet.moveToInsertRow();
1170      }
1171      catch (Throwable JavaDoc t)
1172      {
1173         throw checkException(t);
1174      }
1175   }
1176
1177   public boolean next() throws SQLException JavaDoc
1178   {
1179      checkState();
1180      try
1181      {
1182         return resultSet.next();
1183      }
1184      catch (Throwable JavaDoc t)
1185      {
1186         throw checkException(t);
1187      }
1188   }
1189
1190   public boolean previous() throws SQLException JavaDoc
1191   {
1192      checkState();
1193      try
1194      {
1195         return resultSet.previous();
1196      }
1197      catch (Throwable JavaDoc t)
1198      {
1199         throw checkException(t);
1200      }
1201   }
1202
1203   public void refreshRow() throws SQLException JavaDoc
1204   {
1205      checkState();
1206      try
1207      {
1208         resultSet.refreshRow();
1209      }
1210      catch (Throwable JavaDoc t)
1211      {
1212         throw checkException(t);
1213      }
1214   }
1215
1216   public boolean relative(int rows) throws SQLException JavaDoc
1217   {
1218      checkState();
1219      try
1220      {
1221         return resultSet.relative(rows);
1222      }
1223      catch (Throwable JavaDoc t)
1224      {
1225         throw checkException(t);
1226      }
1227   }
1228
1229   public boolean rowDeleted() throws SQLException JavaDoc
1230   {
1231      checkState();
1232      try
1233      {
1234         return resultSet.rowDeleted();
1235      }
1236      catch (Throwable JavaDoc t)
1237      {
1238         throw checkException(t);
1239      }
1240   }
1241
1242   public boolean rowInserted() throws SQLException JavaDoc
1243   {
1244      checkState();
1245      try
1246      {
1247         return resultSet.rowInserted();
1248      }
1249      catch (Throwable JavaDoc t)
1250      {
1251         throw checkException(t);
1252      }
1253   }
1254
1255   public boolean rowUpdated() throws SQLException JavaDoc
1256   {
1257      checkState();
1258      try
1259      {
1260         return resultSet.rowUpdated();
1261      }
1262      catch (Throwable JavaDoc t)
1263      {
1264         throw checkException(t);
1265      }
1266   }
1267
1268   public void setFetchDirection(int direction) throws SQLException JavaDoc
1269   {
1270      checkState();
1271      try
1272      {
1273         resultSet.setFetchDirection(direction);
1274      }
1275      catch (Throwable JavaDoc t)
1276      {
1277         throw checkException(t);
1278      }
1279   }
1280
1281   public void setFetchSize(int rows) throws SQLException JavaDoc
1282   {
1283      checkState();
1284      try
1285      {
1286         resultSet.setFetchSize(rows);
1287      }
1288      catch (Throwable JavaDoc t)
1289      {
1290         throw checkException(t);
1291      }
1292   }
1293
1294   public void updateArray(int columnIndex, Array JavaDoc x) throws SQLException JavaDoc
1295   {
1296      checkState();
1297      try
1298      {
1299         resultSet.updateArray(columnIndex, x);
1300      }
1301      catch (Throwable JavaDoc t)
1302      {
1303         throw checkException(t);
1304      }
1305   }
1306
1307   public void updateArray(String JavaDoc columnName, Array JavaDoc x) throws SQLException JavaDoc
1308   {
1309      checkState();
1310      try
1311      {
1312         resultSet.updateArray(columnName, x);
1313      }
1314      catch (Throwable JavaDoc t)
1315      {
1316         throw checkException(t);
1317      }
1318   }
1319
1320   public void updateAsciiStream(int columnIndex, InputStream JavaDoc x, int length) throws SQLException JavaDoc
1321   {
1322      checkState();
1323      try
1324      {
1325         resultSet.updateAsciiStream(columnIndex, x, length);
1326      }
1327      catch (Throwable JavaDoc t)
1328      {
1329         throw checkException(t);
1330      }
1331   }
1332
1333   public void updateAsciiStream(String JavaDoc columnName, InputStream JavaDoc x, int length) throws SQLException JavaDoc
1334   {
1335      checkState();
1336      try
1337      {
1338         resultSet.updateAsciiStream(columnName, x, length);
1339      }
1340      catch (Throwable JavaDoc t)
1341      {
1342         throw checkException(t);
1343      }
1344   }
1345
1346   public void updateBigDecimal(int columnIndex, BigDecimal JavaDoc x) throws SQLException JavaDoc
1347   {
1348      checkState();
1349      try
1350      {
1351         resultSet.updateBigDecimal(columnIndex, x);
1352      }
1353      catch (Throwable JavaDoc t)
1354      {
1355         throw checkException(t);
1356      }
1357   }
1358
1359   public void updateBigDecimal(String JavaDoc columnName, BigDecimal JavaDoc x) throws SQLException JavaDoc
1360   {
1361      checkState();
1362      try
1363      {
1364         resultSet.updateBigDecimal(columnName, x);
1365      }
1366      catch (Throwable JavaDoc t)
1367      {
1368         throw checkException(t);
1369      }
1370   }
1371
1372   public void updateBinaryStream(int columnIndex, InputStream JavaDoc x, int length) throws SQLException JavaDoc
1373   {
1374      checkState();
1375      try
1376      {
1377         resultSet.updateBinaryStream(columnIndex, x, length);
1378      }
1379      catch (Throwable JavaDoc t)
1380      {
1381         throw checkException(t);
1382      }
1383   }
1384
1385   public void updateBinaryStream(String JavaDoc columnName, InputStream JavaDoc x, int length) throws SQLException JavaDoc
1386   {
1387      checkState();
1388      try
1389      {
1390         resultSet.updateBinaryStream(columnName, x, length);
1391      }
1392      catch (Throwable JavaDoc t)
1393      {
1394         throw checkException(t);
1395      }
1396   }
1397
1398   public void updateBlob(int columnIndex, Blob JavaDoc x) throws SQLException JavaDoc
1399   {
1400      checkState();
1401      try
1402      {
1403         resultSet.updateBlob(columnIndex, x);
1404      }
1405      catch (Throwable JavaDoc t)
1406      {
1407         throw checkException(t);
1408      }
1409   }
1410
1411   public void updateBlob(String JavaDoc columnName, Blob JavaDoc x) throws SQLException JavaDoc
1412   {
1413      checkState();
1414      try
1415      {
1416         resultSet.updateBlob(columnName, x);
1417      }
1418      catch (Throwable JavaDoc t)
1419      {
1420         throw checkException(t);
1421      }
1422   }
1423
1424   public void updateBoolean(int columnIndex, boolean x) throws SQLException JavaDoc
1425   {
1426      checkState();
1427      try
1428      {
1429         resultSet.updateBoolean(columnIndex, x);
1430      }
1431      catch (Throwable JavaDoc t)
1432      {
1433         throw checkException(t);
1434      }
1435   }
1436
1437   public void updateBoolean(String JavaDoc columnName, boolean x) throws SQLException JavaDoc
1438   {
1439      checkState();
1440      try
1441      {
1442         resultSet.updateBoolean(columnName, x);
1443      }
1444      catch (Throwable JavaDoc t)
1445      {
1446         throw checkException(t);
1447      }
1448   }
1449
1450   public void updateByte(int columnIndex, byte x) throws SQLException JavaDoc
1451   {
1452      checkState();
1453      try
1454      {
1455         resultSet.updateByte(columnIndex, x);
1456      }
1457      catch (Throwable JavaDoc t)
1458      {
1459         throw checkException(t);
1460      }
1461   }
1462
1463   public void updateByte(String JavaDoc columnName, byte x) throws SQLException JavaDoc
1464   {
1465      checkState();
1466      try
1467      {
1468         resultSet.updateByte(columnName, x);
1469      }
1470      catch (Throwable JavaDoc t)
1471      {
1472         throw checkException(t);
1473      }
1474   }
1475
1476   public void updateBytes(int columnIndex, byte[] x) throws SQLException JavaDoc
1477   {
1478      checkState();
1479      try
1480      {
1481         resultSet.updateBytes(columnIndex, x);
1482      }
1483      catch (Throwable JavaDoc t)
1484      {
1485         throw checkException(t);
1486      }
1487   }
1488
1489   public void updateBytes(String JavaDoc columnName, byte[] x) throws SQLException JavaDoc
1490   {
1491      checkState();
1492      try
1493      {
1494         resultSet.updateBytes(columnName, x);
1495      }
1496      catch (Throwable JavaDoc t)
1497      {
1498         throw checkException(t);
1499      }
1500   }
1501
1502   public void updateCharacterStream(int columnIndex, Reader JavaDoc x, int length) throws SQLException JavaDoc
1503   {
1504      checkState();
1505      try
1506      {
1507         resultSet.updateCharacterStream(columnIndex, x, length);
1508      }
1509      catch (Throwable JavaDoc t)
1510      {
1511         throw checkException(t);
1512      }
1513   }
1514
1515   public void updateCharacterStream(String JavaDoc columnName, Reader JavaDoc reader, int length) throws SQLException JavaDoc
1516   {
1517      checkState();
1518      try
1519      {
1520         resultSet.updateCharacterStream(columnName, reader, length);
1521      }
1522      catch (Throwable JavaDoc t)
1523      {
1524         throw checkException(t);
1525      }
1526   }
1527
1528   public void updateClob(int columnIndex, Clob JavaDoc x) throws SQLException JavaDoc
1529   {
1530      checkState();
1531      try
1532      {
1533         resultSet.updateClob(columnIndex, x);
1534      }
1535      catch (Throwable JavaDoc t)
1536      {
1537         throw checkException(t);
1538      }
1539   }
1540
1541   public void updateClob(String JavaDoc columnName, Clob JavaDoc x) throws SQLException JavaDoc
1542   {
1543      checkState();
1544      try
1545      {
1546         resultSet.updateClob(columnName, x);
1547      }
1548      catch (Throwable JavaDoc t)
1549      {
1550         throw checkException(t);
1551      }
1552   }
1553
1554   public void updateDate(int columnIndex, Date JavaDoc x) throws SQLException JavaDoc
1555   {
1556      checkState();
1557      try
1558      {
1559         resultSet.updateDate(columnIndex, x);
1560      }
1561      catch (Throwable JavaDoc t)
1562      {
1563         throw checkException(t);
1564      }
1565   }
1566
1567   public void updateDate(String JavaDoc columnName, Date JavaDoc x) throws SQLException JavaDoc
1568   {
1569      checkState();
1570      try
1571      {
1572         resultSet.updateDate(columnName, x);
1573      }
1574      catch (Throwable JavaDoc t)
1575      {
1576         throw checkException(t);
1577      }
1578   }
1579
1580   public void updateDouble(int columnIndex, double x) throws SQLException JavaDoc
1581   {
1582      checkState();
1583      try
1584      {
1585         resultSet.updateDouble(columnIndex, x);
1586      }
1587      catch (Throwable JavaDoc t)
1588      {
1589         throw checkException(t);
1590      }
1591   }
1592
1593   public void updateDouble(String JavaDoc columnName, double x) throws SQLException JavaDoc
1594   {
1595      checkState();
1596      try
1597      {
1598         resultSet.updateDouble(columnName, x);
1599      }
1600      catch (Throwable JavaDoc t)
1601      {
1602         throw checkException(t);
1603      }
1604   }
1605
1606   public void updateFloat(int columnIndex, float x) throws SQLException JavaDoc
1607   {
1608      checkState();
1609      try
1610      {
1611         resultSet.updateFloat(columnIndex, x);
1612      }
1613      catch (Throwable JavaDoc t)
1614      {
1615         throw checkException(t);
1616      }
1617   }
1618
1619   public void updateFloat(String JavaDoc columnName, float x) throws SQLException JavaDoc
1620   {
1621      checkState();
1622      try
1623      {
1624         resultSet.updateFloat(columnName, x);
1625      }
1626      catch (Throwable JavaDoc t)
1627      {
1628         throw checkException(t);
1629      }
1630   }
1631
1632   public void updateInt(int columnIndex, int x) throws SQLException JavaDoc
1633   {
1634      checkState();
1635      try
1636      {
1637         resultSet.updateInt(columnIndex, x);
1638      }
1639      catch (Throwable JavaDoc t)
1640      {
1641         throw checkException(t);
1642      }
1643   }
1644
1645   public void updateInt(String JavaDoc columnName, int x) throws SQLException JavaDoc
1646   {
1647      checkState();
1648      try
1649      {
1650         resultSet.updateInt(columnName, x);
1651      }
1652      catch (Throwable JavaDoc t)
1653      {
1654         throw checkException(t);
1655      }
1656   }
1657
1658   public void updateLong(int columnIndex, long x) throws SQLException JavaDoc
1659   {
1660      checkState();
1661      try
1662      {
1663         resultSet.updateLong(columnIndex, x);
1664      }
1665      catch (Throwable JavaDoc t)
1666      {
1667         throw checkException(t);
1668      }
1669   }
1670
1671   public void updateLong(String JavaDoc columnName, long x) throws SQLException JavaDoc
1672   {
1673      checkState();
1674      try
1675      {
1676         resultSet.updateLong(columnName, x);
1677      }
1678      catch (Throwable JavaDoc t)
1679      {
1680         throw checkException(t);
1681      }
1682   }
1683
1684   public void updateNull(int columnIndex) throws SQLException JavaDoc
1685   {
1686      checkState();
1687      try
1688      {
1689         resultSet.updateNull(columnIndex);
1690      }
1691      catch (Throwable JavaDoc t)
1692      {
1693         throw checkException(t);
1694      }
1695   }
1696
1697   public void updateNull(String JavaDoc columnName) throws SQLException JavaDoc
1698   {
1699      checkState();
1700      try
1701      {
1702         resultSet.updateNull(columnName);
1703      }
1704      catch (Throwable JavaDoc t)
1705      {
1706         throw checkException(t);
1707      }
1708   }
1709
1710   public void updateObject(int columnIndex, Object JavaDoc x) throws SQLException JavaDoc
1711   {
1712      checkState();
1713      try
1714      {
1715         resultSet.updateObject(columnIndex, x);
1716      }
1717      catch (Throwable JavaDoc t)
1718      {
1719         throw checkException(t);
1720      }
1721   }
1722
1723   public void updateObject(int columnIndex, Object JavaDoc x, int scale) throws SQLException JavaDoc
1724   {
1725      checkState();
1726      try
1727      {
1728         resultSet.updateObject(columnIndex, x, scale);
1729      }
1730      catch (Throwable JavaDoc t)
1731      {
1732         throw checkException(t);
1733      }
1734   }
1735
1736   public void updateObject(String JavaDoc columnName, Object JavaDoc x) throws SQLException JavaDoc
1737   {
1738      checkState();
1739      try
1740      {
1741         resultSet.updateObject(columnName, x);
1742      }
1743      catch (Throwable JavaDoc t)
1744      {
1745         throw checkException(t);
1746      }
1747   }
1748
1749   public void updateObject(String JavaDoc columnName, Object JavaDoc x, int scale) throws SQLException JavaDoc
1750   {
1751      checkState();
1752      try
1753      {
1754         resultSet.updateObject(columnName, x, scale);
1755      }
1756      catch (Throwable JavaDoc t)
1757      {
1758         throw checkException(t);
1759      }
1760   }
1761
1762   public void updateRef(int columnIndex, Ref JavaDoc x) throws SQLException JavaDoc
1763   {
1764      checkState();
1765      try
1766      {
1767         resultSet.updateRef(columnIndex, x);
1768      }
1769      catch (Throwable JavaDoc t)
1770      {
1771         throw checkException(t);
1772      }
1773   }
1774
1775   public void updateRef(String JavaDoc columnName, Ref JavaDoc x) throws SQLException JavaDoc
1776   {
1777      checkState();
1778      try
1779      {
1780         resultSet.updateRef(columnName, x);
1781      }
1782      catch (Throwable JavaDoc t)
1783      {
1784         throw checkException(t);
1785      }
1786   }
1787
1788   public void updateRow() throws SQLException JavaDoc
1789   {
1790      checkState();
1791      try
1792      {
1793         resultSet.updateRow();
1794      }
1795      catch (Throwable JavaDoc t)
1796      {
1797         throw checkException(t);
1798      }
1799   }
1800
1801   public void updateShort(int columnIndex, short x) throws SQLException JavaDoc
1802   {
1803      checkState();
1804      try
1805      {
1806         resultSet.updateShort(columnIndex, x);
1807      }
1808      catch (Throwable JavaDoc t)
1809      {
1810         throw checkException(t);
1811      }
1812   }
1813
1814   public void updateShort(String JavaDoc columnName, short x) throws SQLException JavaDoc
1815   {
1816      checkState();
1817      try
1818      {
1819         resultSet.updateShort(columnName, x);
1820      }
1821      catch (Throwable JavaDoc t)
1822      {
1823         throw checkException(t);
1824      }
1825   }
1826
1827   public void updateString(int columnIndex, String JavaDoc x) throws SQLException JavaDoc
1828   {
1829      checkState();
1830      try
1831      {
1832         resultSet.updateString(columnIndex, x);
1833      }
1834      catch (Throwable JavaDoc t)
1835      {
1836         throw checkException(t);
1837      }
1838   }
1839
1840   public void updateString(String JavaDoc columnName, String JavaDoc x) throws SQLException JavaDoc
1841   {
1842      checkState();
1843      try
1844      {
1845         resultSet.updateString(columnName, x);
1846      }
1847      catch (Throwable JavaDoc t)
1848      {
1849         throw checkException(t);
1850      }
1851   }
1852
1853   public void updateTime(int columnIndex, Time JavaDoc x) throws SQLException JavaDoc
1854   {
1855      checkState();
1856      try
1857      {
1858         resultSet.updateTime(columnIndex, x);
1859      }
1860      catch (Throwable JavaDoc t)
1861      {
1862         throw checkException(t);
1863      }
1864   }
1865
1866   public void updateTime(String JavaDoc columnName, Time JavaDoc x) throws SQLException JavaDoc
1867   {
1868      checkState();
1869      try
1870      {
1871         resultSet.updateTime(columnName, x);
1872      }
1873      catch (Throwable JavaDoc t)
1874      {
1875         throw checkException(t);
1876      }
1877   }
1878
1879   public void updateTimestamp(int columnIndex, Timestamp JavaDoc x) throws SQLException JavaDoc
1880   {
1881      checkState();
1882      try
1883      {
1884         resultSet.updateTimestamp(columnIndex, x);
1885      }
1886      catch (Throwable JavaDoc t)
1887      {
1888         throw checkException(t);
1889      }
1890   }
1891
1892   public void updateTimestamp(String JavaDoc columnName, Timestamp JavaDoc x) throws SQLException JavaDoc
1893   {
1894      checkState();
1895      try
1896      {
1897         resultSet.updateTimestamp(columnName, x);
1898      }
1899      catch (Throwable JavaDoc t)
1900      {
1901         throw checkException(t);
1902      }
1903   }
1904
1905   public boolean wasNull() throws SQLException JavaDoc
1906   {
1907      checkState();
1908      try
1909      {
1910         return resultSet.wasNull();
1911      }
1912      catch (Throwable JavaDoc t)
1913      {
1914         throw checkException(t);
1915      }
1916   }
1917
1918   SQLException JavaDoc checkException(Throwable JavaDoc t) throws SQLException JavaDoc
1919   {
1920      throw statement.checkException(t);
1921   }
1922   
1923   void internalClose() throws SQLException JavaDoc
1924   {
1925      synchronized (lock)
1926      {
1927         closed = true;
1928      }
1929      resultSet.close();
1930   }
1931
1932   void checkState() throws SQLException JavaDoc
1933   {
1934      synchronized (lock)
1935      {
1936         if (closed)
1937            throw new SQLException JavaDoc("The result set is closed.");
1938      }
1939   }
1940}
Popular Tags