View Javadoc

1   /*
2    * Created on 3.2.2005
3    * azachar
4    */
5   package net.mlw.vlh.adapter.jdbc.objectWrapper;
6   
7   import java.io.InputStream;
8   import java.io.Reader;
9   import java.math.BigDecimal;
10  import java.net.URL;
11  import java.sql.Array;
12  import java.sql.Blob;
13  import java.sql.Clob;
14  import java.sql.Date;
15  import java.sql.Ref;
16  import java.sql.ResultSet;
17  import java.sql.ResultSetMetaData;
18  import java.sql.SQLException;
19  import java.sql.SQLWarning;
20  import java.sql.Statement;
21  import java.sql.Time;
22  import java.sql.Timestamp;
23  import java.util.Calendar;
24  import java.util.Map;
25  
26  import net.mlw.vlh.adapter.util.ObjectValidator;
27  
28  /***
29   * Add validator support, that validate ResultSet, if is not valid, move to next
30   * or previous result set. This implementation ensures that the validation method
31   * is invoked only once per object.
32   * 
33   * @author Andrej Zachar
34   * @version $Revision: 1.8 $ $Date: 2005/09/16 12:17:07 $
35   */
36  public class ResultSetDecorator implements ResultSet
37  {
38  
39     private static final int INITIAL_CAPACITY = 100;
40  
41     private ResultSet _resultSet;
42  
43     private ObjectValidator _validator;
44  
45     private int _currentRow;
46  
47     private int[] _index;
48  
49     private int _size;
50  
51     private boolean _isComplete;
52  
53     /***
54      * Default constructor
55      * @param set
56      * @param objectwrapper
57      */
58     public ResultSetDecorator(ResultSet rs, ObjectValidator objectValidator)
59     {
60        super();
61        setValidator(objectValidator);
62        setResultSet(rs); // the method calls reset() as well
63     }
64  
65     /***
66      * @see java.sql.ResultSet#beforeFirst()
67      */
68     public void beforeFirst() throws SQLException
69     {
70  
71        if (!_resultSet.isBeforeFirst())
72        {
73           _resultSet.beforeFirst();
74        }
75        _currentRow = 0;
76     }
77  
78     /***
79      * @see java.sql.ResultSet#isBeforeFirst()
80      */
81     public boolean isBeforeFirst() throws SQLException
82     {
83        return (_currentRow == 0);
84     }
85  
86     /***
87      * @see java.sql.ResultSet#first()
88      */
89     public boolean first() throws SQLException
90     {
91        return move(1);
92     }
93  
94     /***
95      * @see java.sql.ResultSet#isFirst()
96      */
97     public boolean isFirst() throws SQLException
98     {
99        return (_currentRow == 1);
100    }
101 
102    /***
103     * @see java.sql.ResultSet#last()
104     */
105    public boolean last() throws SQLException
106    {
107       if (_isComplete)
108       {
109          // the end has been already reached
110          return move(_size);
111       }
112       else
113       {
114          afterLast();
115          return previous();
116       }
117    }
118 
119    /***
120     * @see java.sql.ResultSet#isLast()
121     */
122    public boolean isLast() throws SQLException
123    {
124       if (_isComplete)
125       {
126          // the end has been already reached
127          return (_currentRow == _size);
128       }
129       else
130       {
131          boolean result = next();
132          previous();
133          return result;
134       }
135    }
136 
137    /***
138     * @see java.sql.ResultSet#afterLast()
139     */
140    public void afterLast() throws SQLException
141    {
142       if (_isComplete)
143       {
144          // the end has been already reached
145          _resultSet.afterLast();
146          _currentRow = _size + 1;
147       }
148       else
149       {
150          lastKnown();
151          while (nextValid())
152             ;
153       }
154    }
155 
156    /***
157     * @see java.sql.ResultSet#isAfterLast()
158     */
159    public boolean isAfterLast() throws SQLException
160    {
161       return _isComplete && (_currentRow > _size);
162    }
163 
164    /***
165     * @see java.sql.ResultSet#next()
166     */
167    public boolean next() throws SQLException
168    {
169       return move(_currentRow + 1);
170    }
171 
172    /***
173     * @see java.sql.ResultSet#previous()
174     */
175    public boolean previous() throws SQLException
176    {
177       return move(_currentRow - 1);
178    }
179 
180    /***
181     * @see java.sql.ResultSet#relative(int)
182     */
183    public boolean relative(int rows) throws SQLException
184    {
185       if (rows == 0)
186       {
187          return _resultSet.relative(0);
188       }
189 
190       return move(_currentRow + rows);
191    }
192 
193    /***
194     * @see java.sql.ResultSet#absolute(int)
195     */
196    public boolean absolute(int row) throws SQLException
197    {
198       if (row > 0)
199       {
200          return move(row);
201       }
202       else if (row < 0)
203       {
204          if (!_isComplete)
205          {
206             // ensure the end has been already reached
207             afterLast();
208          }
209          return move(_size + row + 1);
210       }
211       else
212       {
213          // row == 0
214          beforeFirst();
215          return false;
216       }
217    }
218 
219    private boolean move(int row) throws SQLException
220    {
221       if (row > 0)
222       {
223          if (row <= _size)
224          {
225             _currentRow = row;
226             int absolute = _index[_currentRow - 1];
227             if (absolute != _resultSet.getRow())
228             {
229                return _resultSet.absolute(absolute);
230             }
231             else
232             {
233                return true;
234             }
235          }
236          else
237          {
238             if (_isComplete)
239             {
240                afterLast();
241                return false;
242             }
243             else
244             {
245                lastKnown();
246                boolean result = true;
247                while (result && (_currentRow < row))
248                {
249                   result = nextValid();
250                }
251                return result;
252             }
253          }
254       }
255       else
256       {
257          beforeFirst();
258          return false;
259       }
260    }
261 
262    private void lastKnown() throws SQLException
263    {
264       if (_size > 0)
265       {
266          _currentRow = _size;
267          int absolute = _index[_currentRow - 1];
268          if (absolute != _resultSet.getRow())
269          {
270             _resultSet.absolute(absolute);
271          }
272       }
273       else
274       {
275          beforeFirst();
276       }
277    }
278 
279    private boolean nextValid() throws SQLException
280    {
281       boolean result;
282 
283       do
284       {
285          result = _resultSet.next();
286       }
287       while (result && !_validator.isAcceptable(_resultSet.getObject(1)));
288 
289       _currentRow++;
290 
291       if (result)
292       {
293          _size = _currentRow;
294          ensureCapacity(_size);
295          _index[_currentRow - 1] = _resultSet.getRow();
296       }
297       else
298       {
299          _isComplete = true;
300       }
301 
302       return result;
303    }
304 
305    private void ensureCapacity(int minCapacity)
306    {
307       int oldCapacity = _index.length;
308       if (minCapacity > oldCapacity)
309       {
310          int[] oldData = _index;
311          int newCapacity = (oldCapacity * 3) / 2 + 1;
312          if (newCapacity < minCapacity)
313          {
314             newCapacity = minCapacity;
315          }
316          _index = new int[newCapacity];
317          System.arraycopy(oldData, 0, _index, 0, oldCapacity);
318       }
319    }
320 
321    /* ###### delegated methods ###### */
322 
323    /***
324     * @see java.sql.ResultSet#getConcurrency()
325     */
326    public int getConcurrency() throws SQLException
327    {
328       return _resultSet.getConcurrency();
329    }
330 
331    /***
332     * @see java.sql.ResultSet#getFetchDirection()
333     */
334    public int getFetchDirection() throws SQLException
335    {
336       return _resultSet.getFetchDirection();
337    }
338 
339    /***
340     * @see java.sql.ResultSet#getFetchSize()
341     */
342    public int getFetchSize() throws SQLException
343    {
344       return _resultSet.getFetchSize();
345    }
346 
347    /***
348     * @see java.sql.ResultSet#getRow()
349     */
350    public int getRow() throws SQLException
351    {
352       return _currentRow;
353    }
354 
355    /***
356     * @see java.sql.ResultSet#getType()
357     */
358    public int getType() throws SQLException
359    {
360       return _resultSet.getType();
361    }
362 
363    /***
364     * @see java.sql.ResultSet#cancelRowUpdates()
365     */
366    public void cancelRowUpdates() throws SQLException
367    {
368       _resultSet.cancelRowUpdates();
369    }
370 
371    /***
372     * @see java.sql.ResultSet#clearWarnings()
373     */
374    public void clearWarnings() throws SQLException
375    {
376       _resultSet.clearWarnings();
377    }
378 
379    /***
380     * @see java.sql.ResultSet#close()
381     */
382    public void close() throws SQLException
383    {
384       _resultSet.close();
385    }
386 
387    /***
388     * @see java.sql.ResultSet#deleteRow()
389     */
390    public void deleteRow() throws SQLException
391    {
392       _resultSet.deleteRow();
393    }
394 
395    /***
396     * @see java.sql.ResultSet#insertRow()
397     */
398    public void insertRow() throws SQLException
399    {
400       _resultSet.insertRow();
401    }
402 
403    /***
404     * @see java.sql.ResultSet#moveToCurrentRow()
405     */
406    public void moveToCurrentRow() throws SQLException
407    {
408       _resultSet.moveToCurrentRow();
409    }
410 
411    /***
412     * @see java.sql.ResultSet#moveToInsertRow()
413     */
414    public void moveToInsertRow() throws SQLException
415    {
416       _resultSet.moveToInsertRow();
417    }
418 
419    /***
420     * @see java.sql.ResultSet#refreshRow()
421     */
422    public void refreshRow() throws SQLException
423    {
424       _resultSet.refreshRow();
425    }
426 
427    /***
428     * @see java.sql.ResultSet#updateRow()
429     */
430    public void updateRow() throws SQLException
431    {
432       _resultSet.updateRow();
433    }
434 
435    /***
436     * @see java.sql.ResultSet#rowDeleted()
437     */
438    public boolean rowDeleted() throws SQLException
439    {
440       return _resultSet.rowDeleted();
441    }
442 
443    /***
444     * @see java.sql.ResultSet#rowInserted()
445     */
446    public boolean rowInserted() throws SQLException
447    {
448       return _resultSet.rowInserted();
449    }
450 
451    /***
452     * @see java.sql.ResultSet#rowUpdated()
453     */
454    public boolean rowUpdated() throws SQLException
455    {
456       return _resultSet.rowUpdated();
457    }
458 
459    /***
460     * @see java.sql.ResultSet#wasNull()
461     */
462    public boolean wasNull() throws SQLException
463    {
464       return _resultSet.wasNull();
465    }
466 
467    /***
468     * @see java.sql.ResultSet#getByte(int)
469     */
470    public byte getByte(int columnIndex) throws SQLException
471    {
472       return _resultSet.getByte(columnIndex);
473    }
474 
475    /***
476     * @see java.sql.ResultSet#getDouble(int)
477     */
478    public double getDouble(int columnIndex) throws SQLException
479    {
480       return _resultSet.getDouble(columnIndex);
481    }
482 
483    /***
484     * @see java.sql.ResultSet#getFloat(int)
485     */
486    public float getFloat(int columnIndex) throws SQLException
487    {
488       return _resultSet.getFloat(columnIndex);
489    }
490 
491    /***
492     * @see java.sql.ResultSet#getInt(int)
493     */
494    public int getInt(int columnIndex) throws SQLException
495    {
496       return _resultSet.getInt(columnIndex);
497    }
498 
499    /***
500     * @see java.sql.ResultSet#getLong(int)
501     */
502    public long getLong(int columnIndex) throws SQLException
503    {
504       return _resultSet.getLong(columnIndex);
505    }
506 
507    /***
508     * @see java.sql.ResultSet#getShort(int)
509     */
510    public short getShort(int columnIndex) throws SQLException
511    {
512       return _resultSet.getShort(columnIndex);
513    }
514 
515    /***
516     * @see java.sql.ResultSet#setFetchDirection(int)
517     */
518    public void setFetchDirection(int direction) throws SQLException
519    {
520       _resultSet.setFetchDirection(direction);
521    }
522 
523    /***
524     * @see java.sql.ResultSet#setFetchSize(int)
525     */
526    public void setFetchSize(int rows) throws SQLException
527    {
528       _resultSet.setFetchSize(rows);
529    }
530 
531    /***
532     * @see java.sql.ResultSet#updateNull(int)
533     */
534    public void updateNull(int columnIndex) throws SQLException
535    {
536       _resultSet.updateNull(columnIndex);
537    }
538 
539    /***
540     * @see java.sql.ResultSet#getBoolean(int)
541     */
542    public boolean getBoolean(int columnIndex) throws SQLException
543    {
544       return _resultSet.getBoolean(columnIndex);
545    }
546 
547    /***
548     * @see java.sql.ResultSet#getBytes(int)
549     */
550    public byte[] getBytes(int columnIndex) throws SQLException
551    {
552       return _resultSet.getBytes(columnIndex);
553    }
554 
555    /***
556     * @see java.sql.ResultSet#updateByte(int, byte)
557     */
558    public void updateByte(int columnIndex, byte x) throws SQLException
559    {
560       _resultSet.updateByte(columnIndex, x);
561    }
562 
563    /***
564     * @see java.sql.ResultSet#updateDouble(int, double)
565     */
566    public void updateDouble(int columnIndex, double x) throws SQLException
567    {
568       _resultSet.updateDouble(columnIndex, x);
569    }
570 
571    /***
572     * @see java.sql.ResultSet#updateFloat(int, float)
573     */
574    public void updateFloat(int columnIndex, float x) throws SQLException
575    {
576       _resultSet.updateFloat(columnIndex, x);
577    }
578 
579    /***
580     * @see java.sql.ResultSet#updateInt(int, int)
581     */
582    public void updateInt(int columnIndex, int x) throws SQLException
583    {
584       _resultSet.updateInt(columnIndex, x);
585    }
586 
587    /***
588     * @see java.sql.ResultSet#updateLong(int, long)
589     */
590    public void updateLong(int columnIndex, long x) throws SQLException
591    {
592       _resultSet.updateLong(columnIndex, x);
593    }
594 
595    /***
596     * @see java.sql.ResultSet#updateShort(int, short)
597     */
598    public void updateShort(int columnIndex, short x) throws SQLException
599    {
600       _resultSet.updateShort(columnIndex, x);
601    }
602 
603    /***
604     * @see java.sql.ResultSet#updateBoolean(int, boolean)
605     */
606    public void updateBoolean(int columnIndex, boolean x) throws SQLException
607    {
608       _resultSet.updateBoolean(columnIndex, x);
609    }
610 
611    /***
612     * @see java.sql.ResultSet#updateBytes(int, byte[])
613     */
614    public void updateBytes(int columnIndex, byte[] x) throws SQLException
615    {
616       _resultSet.updateBytes(columnIndex, x);
617    }
618 
619    /***
620     * @see java.sql.ResultSet#getAsciiStream(int)
621     */
622    public InputStream getAsciiStream(int columnIndex) throws SQLException
623    {
624       return _resultSet.getAsciiStream(columnIndex);
625    }
626 
627    /***
628     * @see java.sql.ResultSet#getBinaryStream(int)
629     */
630    public InputStream getBinaryStream(int columnIndex) throws SQLException
631    {
632       return _resultSet.getBinaryStream(columnIndex);
633    }
634 
635    /***
636     * @see java.sql.ResultSet#getUnicodeStream(int)
637     * @deprecated
638     */
639    public InputStream getUnicodeStream(int columnIndex) throws SQLException
640    {
641       return _resultSet.getUnicodeStream(columnIndex);
642    }
643 
644    /***
645     * @see java.sql.ResultSet#updateAsciiStream(int, java.io.InputStream, int)
646     */
647    public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException
648    {
649       _resultSet.updateAsciiStream(columnIndex, x, length);
650    }
651 
652    /***
653     * @see java.sql.ResultSet#updateBinaryStream(int, java.io.InputStream, int)
654     */
655    public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException
656    {
657       _resultSet.updateBinaryStream(columnIndex, x, length);
658    }
659 
660    /***
661     * @see java.sql.ResultSet#getCharacterStream(int)
662     */
663    public Reader getCharacterStream(int columnIndex) throws SQLException
664    {
665       return _resultSet.getCharacterStream(columnIndex);
666    }
667 
668    /***
669     * @see java.sql.ResultSet#updateCharacterStream(int, java.io.Reader, int)
670     */
671    public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException
672    {
673       _resultSet.updateCharacterStream(columnIndex, x, length);
674    }
675 
676    /***
677     * @see java.sql.ResultSet#getObject(int)
678     */
679    public Object getObject(int columnIndex) throws SQLException
680    {
681       return _resultSet.getObject(columnIndex);
682    }
683 
684    /***
685     * @see java.sql.ResultSet#updateObject(int, java.lang.Object)
686     */
687    public void updateObject(int columnIndex, Object x) throws SQLException
688    {
689       _resultSet.updateObject(columnIndex, x);
690    }
691 
692    /***
693     * @see java.sql.ResultSet#updateObject(int, java.lang.Object, int)
694     */
695    public void updateObject(int columnIndex, Object x, int scale) throws SQLException
696    {
697       _resultSet.updateObject(columnIndex, x, scale);
698    }
699 
700    /***
701     * @see java.sql.ResultSet#getCursorName()
702     */
703    public String getCursorName() throws SQLException
704    {
705       return _resultSet.getCursorName();
706    }
707 
708    /***
709     * @see java.sql.ResultSet#getString(int)
710     */
711    public String getString(int columnIndex) throws SQLException
712    {
713       return _resultSet.getString(columnIndex);
714    }
715 
716    /***
717     * @see java.sql.ResultSet#updateString(int, java.lang.String)
718     */
719    public void updateString(int columnIndex, String x) throws SQLException
720    {
721       _resultSet.updateString(columnIndex, x);
722    }
723 
724    /***
725     * @see java.sql.ResultSet#getByte(java.lang.String)
726     */
727    public byte getByte(String columnName) throws SQLException
728    {
729       return _resultSet.getByte(columnName);
730    }
731 
732    /***
733     * @see java.sql.ResultSet#getDouble(java.lang.String)
734     */
735    public double getDouble(String columnName) throws SQLException
736    {
737       return _resultSet.getDouble(columnName);
738    }
739 
740    /***
741     * @see java.sql.ResultSet#getFloat(java.lang.String)
742     */
743    public float getFloat(String columnName) throws SQLException
744    {
745       return _resultSet.getFloat(columnName);
746    }
747 
748    /***
749     * @see java.sql.ResultSet#findColumn(java.lang.String)
750     */
751    public int findColumn(String columnName) throws SQLException
752    {
753       return _resultSet.findColumn(columnName);
754    }
755 
756    /***
757     * @see java.sql.ResultSet#getInt(java.lang.String)
758     */
759    public int getInt(String columnName) throws SQLException
760    {
761       return _resultSet.getInt(columnName);
762    }
763 
764    /***
765     * @see java.sql.ResultSet#getLong(java.lang.String)
766     */
767    public long getLong(String columnName) throws SQLException
768    {
769       return _resultSet.getLong(columnName);
770    }
771 
772    /***
773     * @see java.sql.ResultSet#getShort(java.lang.String)
774     */
775    public short getShort(String columnName) throws SQLException
776    {
777       return _resultSet.getShort(columnName);
778    }
779 
780    /***
781     * @see java.sql.ResultSet#updateNull(java.lang.String)
782     */
783    public void updateNull(String columnName) throws SQLException
784    {
785       _resultSet.updateNull(columnName);
786    }
787 
788    /***
789     * @see java.sql.ResultSet#getBoolean(java.lang.String)
790     */
791    public boolean getBoolean(String columnName) throws SQLException
792    {
793       return _resultSet.getBoolean(columnName);
794    }
795 
796    /***
797     * @see java.sql.ResultSet#getBytes(java.lang.String)
798     */
799    public byte[] getBytes(String columnName) throws SQLException
800    {
801       return _resultSet.getBytes(columnName);
802    }
803 
804    /***
805     * @see java.sql.ResultSet#updateByte(java.lang.String, byte)
806     */
807    public void updateByte(String columnName, byte x) throws SQLException
808    {
809       _resultSet.updateByte(columnName, x);
810    }
811 
812    /***
813     * @see java.sql.ResultSet#updateDouble(java.lang.String, double)
814     */
815    public void updateDouble(String columnName, double x) throws SQLException
816    {
817       _resultSet.updateDouble(columnName, x);
818    }
819 
820    /***
821     * @see java.sql.ResultSet#updateFloat(java.lang.String, float)
822     */
823    public void updateFloat(String columnName, float x) throws SQLException
824    {
825       _resultSet.updateFloat(columnName, x);
826    }
827 
828    /***
829     * @see java.sql.ResultSet#updateInt(java.lang.String, int)
830     */
831    public void updateInt(String columnName, int x) throws SQLException
832    {
833       _resultSet.updateInt(columnName, x);
834    }
835 
836    /***
837     * @see java.sql.ResultSet#updateLong(java.lang.String, long)
838     */
839    public void updateLong(String columnName, long x) throws SQLException
840    {
841       _resultSet.updateLong(columnName, x);
842    }
843 
844    /***
845     * @see java.sql.ResultSet#updateShort(java.lang.String, short)
846     */
847    public void updateShort(String columnName, short x) throws SQLException
848    {
849       _resultSet.updateShort(columnName, x);
850    }
851 
852    /***
853     * @see java.sql.ResultSet#updateBoolean(java.lang.String, boolean)
854     */
855    public void updateBoolean(String columnName, boolean x) throws SQLException
856    {
857       _resultSet.updateBoolean(columnName, x);
858    }
859 
860    /***
861     * @see java.sql.ResultSet#updateBytes(java.lang.String, byte[])
862     */
863    public void updateBytes(String columnName, byte[] x) throws SQLException
864    {
865       _resultSet.updateBytes(columnName, x);
866    }
867 
868    /***
869     * @see java.sql.ResultSet#getBigDecimal(int)
870     */
871    public BigDecimal getBigDecimal(int columnIndex) throws SQLException
872    {
873       return _resultSet.getBigDecimal(columnIndex);
874    }
875 
876    /***
877     * @see java.sql.ResultSet#getBigDecimal(int, int)
878     * @deprecated
879     */
880    public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException
881    {
882       return _resultSet.getBigDecimal(columnIndex, scale);
883    }
884 
885    /***
886     * @see java.sql.ResultSet#updateBigDecimal(int, java.math.BigDecimal)
887     */
888    public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException
889    {
890       _resultSet.updateBigDecimal(columnIndex, x);
891    }
892 
893    /***
894     * @see java.sql.ResultSet#getURL(int)
895     */
896    public URL getURL(int columnIndex) throws SQLException
897    {
898       return _resultSet.getURL(columnIndex);
899    }
900 
901    /***
902     * @see java.sql.ResultSet#getArray(int)
903     */
904    public Array getArray(int i) throws SQLException
905    {
906       return _resultSet.getArray(i);
907    }
908 
909    /***
910     * @see java.sql.ResultSet#updateArray(int, java.sql.Array)
911     */
912    public void updateArray(int columnIndex, Array x) throws SQLException
913    {
914       _resultSet.updateArray(columnIndex, x);
915    }
916 
917    /***
918     * @see java.sql.ResultSet#getBlob(int)
919     */
920    public Blob getBlob(int i) throws SQLException
921    {
922       return _resultSet.getBlob(i);
923    }
924 
925    /***
926     * @see java.sql.ResultSet#updateBlob(int, java.sql.Blob)
927     */
928    public void updateBlob(int columnIndex, Blob x) throws SQLException
929    {
930       _resultSet.updateBlob(columnIndex, x);
931    }
932 
933    /***
934     * @see java.sql.ResultSet#getClob(int)
935     */
936    public Clob getClob(int i) throws SQLException
937    {
938       return _resultSet.getClob(i);
939    }
940 
941    /***
942     * @see java.sql.ResultSet#updateClob(int, java.sql.Clob)
943     */
944    public void updateClob(int columnIndex, Clob x) throws SQLException
945    {
946       _resultSet.updateClob(columnIndex, x);
947    }
948 
949    /***
950     * @see java.sql.ResultSet#getDate(int)
951     */
952    public Date getDate(int columnIndex) throws SQLException
953    {
954       return _resultSet.getDate(columnIndex);
955    }
956 
957    /***
958     * @see java.sql.ResultSet#updateDate(int, java.sql.Date)
959     */
960    public void updateDate(int columnIndex, Date x) throws SQLException
961    {
962       _resultSet.updateDate(columnIndex, x);
963    }
964 
965    /***
966     * @see java.sql.ResultSet#getRef(int)
967     */
968    public Ref getRef(int i) throws SQLException
969    {
970       return _resultSet.getRef(i);
971    }
972 
973    /***
974     * @see java.sql.ResultSet#updateRef(int, java.sql.Ref)
975     */
976    public void updateRef(int columnIndex, Ref x) throws SQLException
977    {
978       _resultSet.updateRef(columnIndex, x);
979    }
980 
981    /***
982     * @see java.sql.ResultSet#getMetaData()
983     */
984    public ResultSetMetaData getMetaData() throws SQLException
985    {
986       return _resultSet.getMetaData();
987    }
988 
989    /***
990     * @see java.sql.ResultSet#getWarnings()
991     */
992    public SQLWarning getWarnings() throws SQLException
993    {
994       return _resultSet.getWarnings();
995    }
996 
997    /***
998     * @see java.sql.ResultSet#getStatement()
999     */
1000    public Statement getStatement() throws SQLException
1001    {
1002       return _resultSet.getStatement();
1003    }
1004 
1005    /***
1006     * @see java.sql.ResultSet#getTime(int)
1007     */
1008    public Time getTime(int columnIndex) throws SQLException
1009    {
1010       return _resultSet.getTime(columnIndex);
1011    }
1012 
1013    /***
1014     * @see java.sql.ResultSet#updateTime(int, java.sql.Time)
1015     */
1016    public void updateTime(int columnIndex, Time x) throws SQLException
1017    {
1018       _resultSet.updateTime(columnIndex, x);
1019    }
1020 
1021    /***
1022     * @see java.sql.ResultSet#getTimestamp(int)
1023     */
1024    public Timestamp getTimestamp(int columnIndex) throws SQLException
1025    {
1026       return _resultSet.getTimestamp(columnIndex);
1027    }
1028 
1029    /***
1030     * @see java.sql.ResultSet#updateTimestamp(int, java.sql.Timestamp)
1031     */
1032    public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException
1033    {
1034       _resultSet.updateTimestamp(columnIndex, x);
1035    }
1036 
1037    /***
1038     * @see java.sql.ResultSet#getAsciiStream(java.lang.String)
1039     */
1040    public InputStream getAsciiStream(String columnName) throws SQLException
1041    {
1042       return _resultSet.getAsciiStream(columnName);
1043    }
1044 
1045    /***
1046     * @see java.sql.ResultSet#getBinaryStream(java.lang.String)
1047     */
1048    public InputStream getBinaryStream(String columnName) throws SQLException
1049    {
1050       return _resultSet.getBinaryStream(columnName);
1051    }
1052 
1053    /***
1054     * @see java.sql.ResultSet#getUnicodeStream(java.lang.String)
1055     * @deprecated
1056     */
1057    public InputStream getUnicodeStream(String columnName) throws SQLException
1058    {
1059       return _resultSet.getUnicodeStream(columnName);
1060    }
1061 
1062    /***
1063     * @see java.sql.ResultSet#updateAsciiStream(java.lang.String,
1064     *      java.io.InputStream, int)
1065     */
1066    public void updateAsciiStream(String columnName, InputStream x, int length) throws SQLException
1067    {
1068       _resultSet.updateAsciiStream(columnName, x, length);
1069    }
1070 
1071    /***
1072     * @see java.sql.ResultSet#updateBinaryStream(java.lang.String,
1073     *      java.io.InputStream, int)
1074     */
1075    public void updateBinaryStream(String columnName, InputStream x, int length) throws SQLException
1076    {
1077       _resultSet.updateBinaryStream(columnName, x, length);
1078    }
1079 
1080    /***
1081     * @see java.sql.ResultSet#getCharacterStream(java.lang.String)
1082     */
1083    public Reader getCharacterStream(String columnName) throws SQLException
1084    {
1085       return _resultSet.getCharacterStream(columnName);
1086    }
1087 
1088    /***
1089     * @see java.sql.ResultSet#updateCharacterStream(java.lang.String,
1090     *      java.io.Reader, int)
1091     */
1092    public void updateCharacterStream(String columnName, Reader reader, int length) throws SQLException
1093    {
1094       _resultSet.updateCharacterStream(columnName, reader, length);
1095    }
1096 
1097    /***
1098     * @see java.sql.ResultSet#getObject(java.lang.String)
1099     */
1100    public Object getObject(String columnName) throws SQLException
1101    {
1102       return _resultSet.getObject(columnName);
1103    }
1104 
1105    /***
1106     * @see java.sql.ResultSet#updateObject(java.lang.String, java.lang.Object)
1107     */
1108    public void updateObject(String columnName, Object x) throws SQLException
1109    {
1110       _resultSet.updateObject(columnName, x);
1111    }
1112 
1113    /***
1114     * @see java.sql.ResultSet#updateObject(java.lang.String, java.lang.Object,
1115     *      int)
1116     */
1117    public void updateObject(String columnName, Object x, int scale) throws SQLException
1118    {
1119       _resultSet.updateObject(columnName, x, scale);
1120    }
1121 
1122    /***
1123     * @see java.sql.ResultSet#getObject(int, java.util.Map)
1124     */
1125    public Object getObject(int i, Map map) throws SQLException
1126    {
1127       return _resultSet.getObject(i, map);
1128    }
1129 
1130    /***
1131     * @see java.sql.ResultSet#getString(java.lang.String)
1132     */
1133    public String getString(String columnName) throws SQLException
1134    {
1135       return _resultSet.getString(columnName);
1136    }
1137 
1138    /***
1139     * @see java.sql.ResultSet#updateString(java.lang.String, java.lang.String)
1140     */
1141    public void updateString(String columnName, String x) throws SQLException
1142    {
1143       _resultSet.updateString(columnName, x);
1144    }
1145 
1146    /***
1147     * @see java.sql.ResultSet#getBigDecimal(java.lang.String)
1148     */
1149    public BigDecimal getBigDecimal(String columnName) throws SQLException
1150    {
1151       return _resultSet.getBigDecimal(columnName);
1152    }
1153 
1154    /***
1155     * @see java.sql.ResultSet#getBigDecimal(java.lang.String, int)
1156     * @deprecated
1157     */
1158    public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException
1159    {
1160       return _resultSet.getBigDecimal(columnName, scale);
1161    }
1162 
1163    /***
1164     * @see java.sql.ResultSet#updateBigDecimal(java.lang.String,
1165     *      java.math.BigDecimal)
1166     */
1167    public void updateBigDecimal(String columnName, BigDecimal x) throws SQLException
1168    {
1169       _resultSet.updateBigDecimal(columnName, x);
1170    }
1171 
1172    /***
1173     * @see java.sql.ResultSet#getURL(java.lang.String)
1174     */
1175    public URL getURL(String columnName) throws SQLException
1176    {
1177       return _resultSet.getURL(columnName);
1178    }
1179 
1180    /***
1181     * @see java.sql.ResultSet#getArray(java.lang.String)
1182     */
1183    public Array getArray(String colName) throws SQLException
1184    {
1185       return _resultSet.getArray(colName);
1186    }
1187 
1188    /***
1189     * @see java.sql.ResultSet#updateArray(java.lang.String, java.sql.Array)
1190     */
1191    public void updateArray(String columnName, Array x) throws SQLException
1192    {
1193       _resultSet.updateArray(columnName, x);
1194    }
1195 
1196    /***
1197     * @see java.sql.ResultSet#getBlob(java.lang.String)
1198     */
1199    public Blob getBlob(String colName) throws SQLException
1200    {
1201       return _resultSet.getBlob(colName);
1202    }
1203 
1204    /***
1205     * @see java.sql.ResultSet#updateBlob(java.lang.String, java.sql.Blob)
1206     */
1207    public void updateBlob(String columnName, Blob x) throws SQLException
1208    {
1209       _resultSet.updateBlob(columnName, x);
1210    }
1211 
1212    /***
1213     * @see java.sql.ResultSet#getClob(java.lang.String)
1214     */
1215    public Clob getClob(String colName) throws SQLException
1216    {
1217       return _resultSet.getClob(colName);
1218    }
1219 
1220    /***
1221     * @see java.sql.ResultSet#updateClob(java.lang.String, java.sql.Clob)
1222     */
1223    public void updateClob(String columnName, Clob x) throws SQLException
1224    {
1225       _resultSet.updateClob(columnName, x);
1226    }
1227 
1228    /***
1229     * @see java.sql.ResultSet#getDate(java.lang.String)
1230     */
1231    public Date getDate(String columnName) throws SQLException
1232    {
1233       return _resultSet.getDate(columnName);
1234    }
1235 
1236    /***
1237     * @see java.sql.ResultSet#updateDate(java.lang.String, java.sql.Date)
1238     */
1239    public void updateDate(String columnName, Date x) throws SQLException
1240    {
1241       _resultSet.updateDate(columnName, x);
1242    }
1243 
1244    /***
1245     * @see java.sql.ResultSet#getDate(int, java.util.Calendar)
1246     */
1247    public Date getDate(int columnIndex, Calendar cal) throws SQLException
1248    {
1249       return _resultSet.getDate(columnIndex, cal);
1250    }
1251 
1252    /***
1253     * @see java.sql.ResultSet#getRef(java.lang.String)
1254     */
1255    public Ref getRef(String colName) throws SQLException
1256    {
1257       return _resultSet.getRef(colName);
1258    }
1259 
1260    /***
1261     * @see java.sql.ResultSet#updateRef(java.lang.String, java.sql.Ref)
1262     */
1263    public void updateRef(String columnName, Ref x) throws SQLException
1264    {
1265       _resultSet.updateRef(columnName, x);
1266    }
1267 
1268    /***
1269     * @see java.sql.ResultSet#getTime(java.lang.String)
1270     */
1271    public Time getTime(String columnName) throws SQLException
1272    {
1273       return _resultSet.getTime(columnName);
1274    }
1275 
1276    /***
1277     * @see java.sql.ResultSet#updateTime(java.lang.String, java.sql.Time)
1278     */
1279    public void updateTime(String columnName, Time x) throws SQLException
1280    {
1281       _resultSet.updateTime(columnName, x);
1282    }
1283 
1284    /***
1285     * @see java.sql.ResultSet#getTime(int, java.util.Calendar)
1286     */
1287    public Time getTime(int columnIndex, Calendar cal) throws SQLException
1288    {
1289       return _resultSet.getTime(columnIndex, cal);
1290    }
1291 
1292    /***
1293     * @see java.sql.ResultSet#getTimestamp(java.lang.String)
1294     */
1295    public Timestamp getTimestamp(String columnName) throws SQLException
1296    {
1297       return _resultSet.getTimestamp(columnName);
1298    }
1299 
1300    /***
1301     * @see java.sql.ResultSet#updateTimestamp(java.lang.String,
1302     *      java.sql.Timestamp)
1303     */
1304    public void updateTimestamp(String columnName, Timestamp x) throws SQLException
1305    {
1306       _resultSet.updateTimestamp(columnName, x);
1307    }
1308 
1309    /***
1310     * @see java.sql.ResultSet#getTimestamp(int, java.util.Calendar)
1311     */
1312    public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException
1313    {
1314       return _resultSet.getTimestamp(columnIndex, cal);
1315    }
1316 
1317    /***
1318     * @see java.sql.ResultSet#getObject(java.lang.String, java.util.Map)
1319     */
1320    public Object getObject(String colName, Map map) throws SQLException
1321    {
1322       return _resultSet.getObject(colName, map);
1323    }
1324 
1325    /***
1326     * @see java.sql.ResultSet#getDate(java.lang.String, java.util.Calendar)
1327     */
1328    public Date getDate(String columnName, Calendar cal) throws SQLException
1329    {
1330       return _resultSet.getDate(columnName, cal);
1331    }
1332 
1333    /***
1334     * @see java.sql.ResultSet#getTime(java.lang.String, java.util.Calendar)
1335     */
1336    public Time getTime(String columnName, Calendar cal) throws SQLException
1337    {
1338       return _resultSet.getTime(columnName, cal);
1339    }
1340 
1341    /***
1342     * @see java.sql.ResultSet#getTimestamp(java.lang.String,
1343     *      java.util.Calendar)
1344     */
1345    public Timestamp getTimestamp(String columnName, Calendar cal) throws SQLException
1346    {
1347       return _resultSet.getTimestamp(columnName, cal);
1348    }
1349 
1350    /* ###### getters / setters ###### */
1351 
1352    /***
1353     * @return Returns the validator.
1354     */
1355    public ObjectValidator getValidator()
1356    {
1357       return _validator;
1358    }
1359 
1360    /***
1361     * @param validator The validator to set.
1362     */
1363    public void setValidator(ObjectValidator validator)
1364    {
1365       _validator = validator;
1366    }
1367 
1368    /***
1369     * @return Returns the rs.
1370     */
1371    public ResultSet getResultSet()
1372    {
1373       return _resultSet;
1374    }
1375 
1376    /***
1377     * @param rs The rs to set.
1378     */
1379    public void setResultSet(ResultSet rs)
1380    {
1381       if (rs != _resultSet)
1382       {
1383          _resultSet = rs;
1384          reset();
1385       }
1386    }
1387 
1388    private void reset()
1389    {
1390       _index = new int[INITIAL_CAPACITY];
1391       _currentRow = 0;
1392       _size = 0;
1393       _isComplete = false;
1394    }
1395 }