KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > lateralnz > c3d > DCResultSet


1 /* ====================================================================
2  * The LateralNZ Software License, Version 1.0
3  *
4  * Copyright (c) 2003 LateralNZ. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in
15  * the documentation and/or other materials provided with the
16  * distribution.
17  *
18  * 3. The end-user documentation included with the redistribution,
19  * if any, must include the following acknowledgment:
20  * "This product includes software developed by
21  * LateralNZ (http://www.lateralnz.org/) and other third parties."
22  * Alternately, this acknowledgment may appear in the software itself,
23  * if and wherever such third-party acknowledgments normally appear.
24  *
25  * 4. The names "LateralNZ" must not be used to endorse or promote
26  * products derived from this software without prior written
27  * permission. For written permission, please
28  * contact oss@lateralnz.org.
29  *
30  * 5. Products derived from this software may not be called "Panther",
31  * or "Lateral" or "LateralNZ", nor may "PANTHER" or "LATERAL" or
32  * "LATERALNZ" appear in their name, without prior written
33  * permission of LateralNZ.
34  *
35  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
36  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
37  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
38  * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
39  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
42  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
44  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
45  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46  * SUCH DAMAGE.
47  * ====================================================================
48  *
49  * This software consists of voluntary contributions made by many
50  * individuals on behalf of LateralNZ. For more
51  * information on Lateral, please see http://www.lateralnz.com/ or
52  * http://www.lateralnz.org
53  *
54  */

55 package org.lateralnz.c3d;
56
57 import java.io.ByteArrayInputStream JavaDoc;
58 import java.io.InputStream JavaDoc;
59 import java.io.Reader JavaDoc;
60 import java.io.Serializable JavaDoc;
61 import java.io.StringReader JavaDoc;
62 import java.math.BigDecimal JavaDoc;
63 import java.net.MalformedURLException JavaDoc;
64 import java.net.URL JavaDoc;
65 import java.sql.Array JavaDoc;
66 import java.sql.Blob JavaDoc;
67 import java.sql.Clob JavaDoc;
68 import java.sql.Date JavaDoc;
69 import java.sql.Ref JavaDoc;
70 import java.sql.ResultSet JavaDoc;
71 import java.sql.ResultSetMetaData JavaDoc;
72 import java.sql.SQLException JavaDoc;
73 import java.sql.SQLWarning JavaDoc;
74 import java.sql.Statement JavaDoc;
75 import java.sql.Time JavaDoc;
76 import java.sql.Timestamp JavaDoc;
77 import java.text.ParseException JavaDoc;
78 import java.util.ArrayList JavaDoc;
79 import java.util.HashMap JavaDoc;
80
81 import org.lateralnz.common.util.Constants;
82 import org.lateralnz.common.util.DateUtils;
83 import org.lateralnz.common.util.IOUtils;
84 import org.lateralnz.common.util.StringUtils;
85
86 import org.lateralnz.c3d.util.Column;
87 import org.lateralnz.c3d.util.DBUtils;
88 import org.lateralnz.c3d.util.PositionData;
89
90 /**
91  * a resultset object to use in the cache. All operations related to updating the contents
92  * of this resultset are unsupported. See individual methods for details
93  */

94 public class DCResultSet implements ResultSet JavaDoc, Serializable JavaDoc, Constants {
95   private static final String JavaDoc CLASSNAME = DCResultSet.class.getName();
96   private static final String JavaDoc DBDATEFORMAT = "dbdateformat";
97   private static final String JavaDoc T = "t";
98   
99   private String JavaDoc cacheName;
100   private boolean closed = false; // is this resultset closed?
101
private DCResultSetMetaData metadata; // cached metadata
102
private transient DatabaseEngine dbengine; // link the database engine
103
private String JavaDoc cursorName = null; // link to the cursor name
104
private ArrayList JavaDoc rows = new ArrayList JavaDoc(); // the row data
105
private int size; // size of the rows list
106
private String JavaDoc[] colnames; // names of the columns
107
private int concurrency;
108   private int type;
109   protected long lastAccessed = System.currentTimeMillis();
110   
111   private String JavaDoc dateformat = null;
112   
113   private HashMap JavaDoc positions = new HashMap JavaDoc();
114   
115   private DCResultSet(DatabaseEngine dbengine) {
116     this.dbengine = dbengine;
117     dateformat = dbengine.getProperty(DBDATEFORMAT);
118   }
119   
120   public DCResultSet(String JavaDoc[] columnNames, ArrayList JavaDoc rows, DatabaseEngine dbengine) {
121     this(dbengine);
122     this.metadata = new DCResultSetMetaData(columnNames);
123     this.rows = rows;
124     this.size = rows.size();
125   }
126   
127   public DCResultSet(String JavaDoc cacheName, String JavaDoc sql, ResultSet JavaDoc rs, DatabaseEngine dbengine, int concurrency, int type) throws SQLException JavaDoc {
128     this(dbengine);
129     this.cacheName = cacheName;
130     this.concurrency = concurrency;
131     this.type = type;
132     
133     if (rs != null) {
134       this.cursorName = rs.getCursorName();
135       ResultSetMetaData JavaDoc rsmd = rs.getMetaData();
136       int count = rsmd.getColumnCount();
137       int i, j;
138
139       int[] types = new int[count];
140       colnames = new String JavaDoc[count];
141       for (i = 0, j = 1; i < count; i++, j++) {
142         types[i] = rsmd.getColumnType(j);
143         colnames[i] = rsmd.getColumnName(j);
144       }
145
146       int[] keyColumns = null;
147       if (!StringUtils.isEmpty(cacheName)) {
148         keyColumns = dbengine.getPrimaryKeyColumns(cacheName, rsmd);
149         if (keyColumns == null) {
150           throw new SQLException JavaDoc("unable to match columns in resultset with primary keys");
151         }
152       }
153
154       Column[] cols;
155       while (rs.next()) {
156         cols = new Column[count];
157         for (i = 0, j = 1; i < count; i++, j++) {
158           cols[i] = DBUtils.createColumn(rs, types, j);
159         }
160         if (keyColumns != null) {
161           String JavaDoc[] keyData = DBUtils.getKeyColumnData(keyColumns, rs);
162           dbengine.setKeyToResultSetLink(cacheName, keyData, sql);
163         }
164         
165         rows.add(cols);
166       }
167
168       this.metadata = new DCResultSetMetaData(rsmd);
169     }
170     else {
171       metadata = new DCResultSetMetaData();
172     }
173     
174     size = rows.size();
175     
176     if (size > 0 && cacheName != null && sql != null) {
177       dbengine.setCachedResultSet(cacheName, sql, this);
178     }
179   }
180   
181   private PositionData getPosition() throws SQLException JavaDoc {
182     return (PositionData)DBUtils.getObjectFromMap(Integer.toString(System.identityHashCode(Thread.currentThread())), positions, PositionData.class);
183   }
184   
185   private void sanityCheck() throws SQLException JavaDoc {
186 // PositionData pd = getPosition();
187
// if (pd.closed) {
188
// throw new SQLException("resultset has been closed");
189
// }
190
}
191   
192   private Column getColumn(int idx) throws SQLException JavaDoc {
193     sanityCheck();
194     if (isBeforeFirst() || isAfterLast()) {
195       throw new SQLException JavaDoc("resultset not correctly positioned");
196     }
197     else {
198       PositionData pd = getPosition();
199       IOUtils.close(pd.lastInputStream);
200       pd.lastInputStream = null;
201       IOUtils.close(pd.lastReader);
202       pd.lastReader = null;
203       pd.lastColumnWasNull = pd.currentcols[idx - 1].getNull();
204       return pd.currentcols[idx - 1];
205     }
206   }
207   
208   private void setRow(PositionData pd) {
209     if (pd.rowpos >= 0 && pd.rowpos < size) {
210       pd.currentcols = (Column[])rows.get(pd.rowpos);
211     }
212     else {
213       pd.currentcols = null;
214     }
215   }
216   
217   public boolean absolute(int param) throws SQLException JavaDoc {
218     sanityCheck();
219     PositionData pd = getPosition();
220     param--;
221     if (param < 0) {
222       pd.rowpos = -1;
223       setRow(pd);
224       return false;
225     }
226     else if (param >= size) {
227       pd.rowpos = size;
228       setRow(pd);
229       return false;
230     }
231     else {
232       pd.rowpos = param;
233       setRow(pd);
234       return true;
235     }
236   }
237   
238   public void afterLast() throws SQLException JavaDoc {
239     sanityCheck();
240     PositionData pd = getPosition();
241     pd.rowpos = size;
242     setRow(pd);
243   }
244   
245   public void beforeFirst() throws SQLException JavaDoc {
246     sanityCheck();
247     PositionData pd = getPosition();
248     pd.rowpos = -1;
249     setRow(pd);
250   }
251   
252  /**
253   * this operation is not supported
254   */

255   public void cancelRowUpdates() throws SQLException JavaDoc {
256     throw new SQLException JavaDoc("operation not supported");
257   }
258
259   public void clearWarnings() throws SQLException JavaDoc {
260   }
261   
262   public void close() throws SQLException JavaDoc {
263     PositionData pd = getPosition();
264     pd.reset();
265     positions.remove(Integer.toString(System.identityHashCode(Thread.currentThread())));
266   }
267   
268  /**
269   * this operation is not supported
270   */

271   public void deleteRow() throws SQLException JavaDoc {
272     throw new SQLException JavaDoc("operation not supported");
273   }
274   
275   public int findColumn(String JavaDoc str) throws SQLException JavaDoc {
276     sanityCheck();
277     if (StringUtils.isEmpty(str)) {
278       throw new SQLException JavaDoc("empty column name");
279     }
280     for (int i = 0; i < colnames.length; i++) {
281       if (colnames[i].equals(str)) {
282         return i + 1;
283       }
284     }
285     throw new SQLException JavaDoc("unable to find column " + str);
286   }
287   
288   public boolean first() throws SQLException JavaDoc {
289     sanityCheck();
290     if (size < 1) {
291       return false;
292     }
293     PositionData pd = getPosition();
294     pd.rowpos = 0;
295     setRow(pd);
296     return true;
297   }
298   
299  /**
300   * this operation is not supported
301   */

302   public Array JavaDoc getArray(int param) throws SQLException JavaDoc {
303     throw new SQLException JavaDoc("operation not supported");
304   }
305   
306   public Array JavaDoc getArray(String JavaDoc str) throws SQLException JavaDoc {
307     return getArray(findColumn(str));
308   }
309     
310   public InputStream JavaDoc getAsciiStream(int param) throws SQLException JavaDoc {
311     Column col = getColumn(param);
312     if (col.getNull()) {
313       return null;
314     }
315     else {
316       PositionData pd = getPosition();
317       pd.lastInputStream = new ByteArrayInputStream JavaDoc(col.getValue());
318       return pd.lastInputStream;
319     }
320   }
321   
322   public InputStream JavaDoc getAsciiStream(String JavaDoc str) throws SQLException JavaDoc {
323     return getAsciiStream(findColumn(str));
324   }
325   
326   public BigDecimal JavaDoc getBigDecimal(int param) throws SQLException JavaDoc {
327     Column col = getColumn(param);
328     if (col.getNull()) {
329       return null;
330     }
331     else {
332       return new BigDecimal JavaDoc(new String JavaDoc(col.getValue()));
333     }
334   }
335   
336   public BigDecimal JavaDoc getBigDecimal(String JavaDoc str) throws SQLException JavaDoc {
337     return getBigDecimal(findColumn(str));
338   }
339   
340   public BigDecimal JavaDoc getBigDecimal(int param, int param1) throws SQLException JavaDoc {
341     return getBigDecimal(param);
342   }
343   
344   public BigDecimal JavaDoc getBigDecimal(String JavaDoc str, int param) throws SQLException JavaDoc {
345     return getBigDecimal(findColumn(str));
346   }
347   
348   public InputStream JavaDoc getBinaryStream(int param) throws SQLException JavaDoc {
349     Column col = getColumn(param);
350     if (col.getNull()) {
351       return null;
352     }
353     else {
354       PositionData pd = getPosition();
355       pd.lastInputStream = new ByteArrayInputStream JavaDoc(col.getValue());
356       return pd.lastInputStream;
357     }
358   }
359   
360   public InputStream JavaDoc getBinaryStream(String JavaDoc str) throws SQLException JavaDoc {
361     return getBinaryStream(findColumn(str));
362   }
363   
364  /**
365   * this operation is not supported
366   */

367   public Blob JavaDoc getBlob(int param) throws SQLException JavaDoc {
368     throw new SQLException JavaDoc("operation not supported");
369   }
370   
371   public Blob JavaDoc getBlob(String JavaDoc str) throws SQLException JavaDoc {
372     return getBlob(findColumn(str));
373   }
374   
375   public boolean getBoolean(int param) throws SQLException JavaDoc {
376     Column col = getColumn(param);
377     if (col.getNull()) {
378       return false;
379     }
380     else {
381       String JavaDoc s = new String JavaDoc(getColumn(param).getValue());
382       if (s.equalsIgnoreCase(Y) || s.equalsIgnoreCase(T) || s.equalsIgnoreCase(TRUE)) {
383         return true;
384       }
385       else {
386         return false;
387       }
388     }
389   }
390   
391   public boolean getBoolean(String JavaDoc str) throws SQLException JavaDoc {
392     return getBoolean(findColumn(str));
393   }
394   
395   public byte getByte(int param) throws SQLException JavaDoc {
396     Column col = getColumn(param);
397     if (col.getNull() || col.getValue() == null || col.getValue().length < 1) {
398       return 0;
399     }
400     else {
401       return col.getValue()[0];
402     }
403   }
404   
405   public byte getByte(String JavaDoc str) throws SQLException JavaDoc {
406     return getByte(findColumn(str));
407   }
408   
409   public byte[] getBytes(int param) throws SQLException JavaDoc {
410     return getColumn(param).getValue();
411   }
412   
413   public byte[] getBytes(String JavaDoc str) throws SQLException JavaDoc {
414     return getBytes(findColumn(str));
415   }
416   
417   public Reader JavaDoc getCharacterStream(int param) throws SQLException JavaDoc {
418     Column col = getColumn(param);
419     if (col.getNull()) {
420       return null;
421     }
422     else {
423       PositionData pd = getPosition();
424       pd.lastReader = new StringReader JavaDoc(new String JavaDoc(col.getValue()));
425       return pd.lastReader;
426     }
427   }
428   
429   public Reader JavaDoc getCharacterStream(String JavaDoc str) throws SQLException JavaDoc {
430     return getCharacterStream(findColumn(str));
431   }
432   
433  /**
434   * this operation is not supported
435   */

436   public Clob JavaDoc getClob(int param) throws SQLException JavaDoc {
437     throw new SQLException JavaDoc("operation not supported");
438   }
439   
440   public Clob JavaDoc getClob(String JavaDoc str) throws SQLException JavaDoc {
441     return getClob(findColumn(str));
442   }
443   
444   public int getConcurrency() throws SQLException JavaDoc {
445     return concurrency;
446   }
447   
448   public String JavaDoc getCursorName() throws SQLException JavaDoc {
449     return cursorName;
450   }
451   
452   public Date JavaDoc getDate(int param) throws SQLException JavaDoc {
453     Column col = getColumn(param);
454     if (col.getNull()) {
455       return null;
456     }
457     else {
458       try {
459         String JavaDoc s = new String JavaDoc(col.getValue());
460         java.util.Date JavaDoc d = DateUtils.parseDate(CLASSNAME, s, dateformat);
461         return new Date JavaDoc(d.getTime());
462       }
463       catch (ParseException JavaDoc pe) {
464         throw new SQLException JavaDoc("unexpected date format");
465       }
466     }
467   }
468   
469   public Date JavaDoc getDate(String JavaDoc str) throws SQLException JavaDoc {
470     return getDate(findColumn(str));
471   }
472   
473  /**
474   * this operation is not supported
475   */

476   public Date JavaDoc getDate(int param, java.util.Calendar JavaDoc calendar) throws SQLException JavaDoc {
477     throw new SQLException JavaDoc("operation not supported");
478   }
479   
480   public Date JavaDoc getDate(String JavaDoc str, java.util.Calendar JavaDoc calendar) throws SQLException JavaDoc {
481     return getDate(findColumn(str), calendar);
482   }
483   
484   public double getDouble(int param) throws SQLException JavaDoc {
485     Column col = getColumn(param);
486     if (col.getNull()) {
487       return 0.0d;
488     }
489     else {
490       return Double.parseDouble(new String JavaDoc(col.getValue()));
491     }
492   }
493   
494   public double getDouble(String JavaDoc str) throws SQLException JavaDoc {
495     return getDouble(findColumn(str));
496   }
497   
498   public int getFetchDirection() throws SQLException JavaDoc {
499     return ResultSet.FETCH_UNKNOWN;
500   }
501   
502  /**
503   * this operation is not supported
504   */

505   public int getFetchSize() throws SQLException JavaDoc {
506     throw new SQLException JavaDoc("operation not supported");
507   }
508   
509   public float getFloat(int param) throws SQLException JavaDoc {
510     Column col = getColumn(param);
511     if (col.getNull()) {
512       return 0.0f;
513     }
514     else {
515       return Float.parseFloat(new String JavaDoc(col.getValue()));
516     }
517   }
518   
519   public float getFloat(String JavaDoc str) throws SQLException JavaDoc {
520     return getFloat(findColumn(str));
521   }
522   
523   public int getInt(int param) throws SQLException JavaDoc {
524     Column col = getColumn(param);
525     if (col.getNull()) {
526       return 0;
527     }
528     else {
529       return Integer.parseInt(new String JavaDoc(col.getValue()));
530     }
531   }
532   
533   public int getInt(String JavaDoc str) throws SQLException JavaDoc {
534     return getInt(findColumn(str));
535   }
536   
537   public long getLong(int param) throws SQLException JavaDoc {
538     Column col = getColumn(param);
539     if (col.getNull()) {
540       return 0l;
541     }
542     else {
543       return Long.parseLong(new String JavaDoc(col.getValue()));
544     }
545   }
546   
547   public long getLong(String JavaDoc str) throws SQLException JavaDoc {
548     return getLong(findColumn(str));
549   }
550   
551   public ResultSetMetaData JavaDoc getMetaData() throws SQLException JavaDoc {
552     return metadata;
553   }
554   
555  /**
556   * this operation is not supported
557   */

558   public Object JavaDoc getObject(int param) throws SQLException JavaDoc {
559     throw new SQLException JavaDoc("operation not supported");
560   }
561   
562   public Object JavaDoc getObject(String JavaDoc str) throws SQLException JavaDoc {
563     return getObject(findColumn(str));
564   }
565   
566  /**
567   * this operation is not supported
568   */

569   public Object JavaDoc getObject(int param, java.util.Map JavaDoc map) throws SQLException JavaDoc {
570     throw new SQLException JavaDoc("operation not supported");
571   }
572   
573   public Object JavaDoc getObject(String JavaDoc str, java.util.Map JavaDoc map) throws SQLException JavaDoc {
574     return getObject(findColumn(str), map);
575   }
576   
577  /**
578   * this operation is not supported
579   */

580   public Ref JavaDoc getRef(int param) throws SQLException JavaDoc {
581     throw new SQLException JavaDoc("operation not supported");
582   }
583   
584   public Ref JavaDoc getRef(String JavaDoc str) throws SQLException JavaDoc {
585     return getRef(findColumn(str));
586   }
587   
588   public int getRow() throws SQLException JavaDoc {
589     PositionData pd = getPosition();
590     return pd.rowpos + 1;
591   }
592   
593   public int getRowCount() {
594     return size;
595   }
596   
597   public short getShort(int param) throws SQLException JavaDoc {
598     Column col = getColumn(param);
599     if (col.getNull()) {
600       return 0;
601     }
602     else {
603       return Short.parseShort(new String JavaDoc(col.getValue()));
604     }
605   }
606   
607   public short getShort(String JavaDoc str) throws SQLException JavaDoc {
608     return getShort(findColumn(str));
609   }
610   
611  /**
612   * this always returns null
613   */

614   public Statement JavaDoc getStatement() throws SQLException JavaDoc {
615     return null;
616   }
617   
618   public String JavaDoc getString(int param) throws SQLException JavaDoc {
619     Column col = getColumn(param);
620     if (col.getNull()) {
621       return null;
622     }
623     else {
624       return new String JavaDoc(col.getValue());
625     }
626   }
627
628   public String JavaDoc getString(String JavaDoc str) throws SQLException JavaDoc {
629     return getString(findColumn(str));
630   }
631   
632   public Time JavaDoc getTime(int param) throws SQLException JavaDoc {
633     Column col = getColumn(param);
634     if (col.getNull()) {
635       return null;
636     }
637     else {
638       String JavaDoc s = new String JavaDoc(col.getValue());
639       if (s.indexOf('.') >= 0) {
640         s = s.substring(0, s.indexOf('.'));
641       }
642       return Time.valueOf(s);
643     }
644   }
645
646   public Time JavaDoc getTime(String JavaDoc str) throws SQLException JavaDoc {
647     return getTime(findColumn(str));
648   }
649   
650  /**
651   * this operation is not supported
652   */

653   public Time JavaDoc getTime(int param, java.util.Calendar JavaDoc calendar) throws SQLException JavaDoc {
654     throw new SQLException JavaDoc("operation not supported");
655   }
656   
657   public Time JavaDoc getTime(String JavaDoc str, java.util.Calendar JavaDoc calendar) throws SQLException JavaDoc {
658     return getTime(findColumn(str), calendar);
659   }
660   
661   public Timestamp JavaDoc getTimestamp(int param) throws SQLException JavaDoc {
662     Column col = getColumn(param);
663     if (col.getNull()) {
664       return null;
665     }
666     else {
667       return Timestamp.valueOf(new String JavaDoc(col.getValue()));
668     }
669   }
670   
671   public Timestamp JavaDoc getTimestamp(String JavaDoc str) throws SQLException JavaDoc {
672     return getTimestamp(findColumn(str));
673   }
674     
675  /**
676   * this operation is not supported
677   */

678   public Timestamp JavaDoc getTimestamp(int param, java.util.Calendar JavaDoc calendar) throws SQLException JavaDoc {
679     throw new SQLException JavaDoc("operation not supported");
680   }
681   
682   public Timestamp JavaDoc getTimestamp(String JavaDoc str, java.util.Calendar JavaDoc calendar) throws SQLException JavaDoc {
683     return getTimestamp(findColumn(str), calendar);
684   }
685   
686   public int getType() throws SQLException JavaDoc {
687     return type;
688   }
689   
690   public URL JavaDoc getURL(int param) throws SQLException JavaDoc {
691     Column col = getColumn(param);
692     if (col.getNull()) {
693       return null;
694     }
695     else {
696       try {
697         return new URL JavaDoc(new String JavaDoc(col.getValue()));
698       }
699       catch (MalformedURLException JavaDoc mue) {
700         throw new SQLException JavaDoc("not a url");
701       }
702     }
703   }
704   
705   public URL JavaDoc getURL(String JavaDoc str) throws SQLException JavaDoc {
706     return getURL(findColumn(str));
707   }
708   
709  /**
710   * this operation is not supported
711   */

712   public InputStream JavaDoc getUnicodeStream(String JavaDoc str) throws SQLException JavaDoc {
713     throw new SQLException JavaDoc("operation not supported");
714   }
715   
716  /**
717   * this operation is not supported
718   */

719   public InputStream JavaDoc getUnicodeStream(int param) throws SQLException JavaDoc {
720     throw new SQLException JavaDoc("operation not supported");
721   }
722   
723   public SQLWarning JavaDoc getWarnings() throws SQLException JavaDoc {
724     return null;
725   }
726   
727  /**
728   * this operation is not supported
729   */

730   public void insertRow() throws SQLException JavaDoc {
731     throw new SQLException JavaDoc("operation not supported");
732   }
733   
734   public boolean isAfterLast() throws SQLException JavaDoc {
735     sanityCheck();
736     PositionData pd = getPosition();
737     return pd.rowpos >= size;
738   }
739   
740   public boolean isBeforeFirst() throws SQLException JavaDoc {
741     sanityCheck();
742     PositionData pd = getPosition();
743     return pd.rowpos < 0;
744   }
745   
746   public boolean isFirst() throws SQLException JavaDoc {
747     sanityCheck();
748     PositionData pd = getPosition();
749     return pd.rowpos == 0;
750   }
751   
752   public boolean isLast() throws SQLException JavaDoc {
753     sanityCheck();
754     PositionData pd = getPosition();
755     return pd.rowpos == size-1;
756   }
757   
758   public boolean last() throws SQLException JavaDoc {
759     sanityCheck();
760     if (size < 1) {
761       return false;
762     }
763     PositionData pd = getPosition();
764     pd.rowpos = size-1;
765     setRow(pd);
766     return true;
767   }
768   
769  /**
770   * this operation is not supported
771   */

772   public void moveToCurrentRow() throws SQLException JavaDoc {
773     throw new SQLException JavaDoc("operation not supported");
774   }
775   
776  /**
777   * this operation is not supported
778   */

779   public void moveToInsertRow() throws SQLException JavaDoc {
780     throw new SQLException JavaDoc("operation not supported");
781   }
782   
783   public boolean next() throws SQLException JavaDoc {
784     sanityCheck();
785     if (isBeforeFirst()) {
786       return first();
787     }
788     else {
789       PositionData pd = getPosition();
790       pd.rowpos++;
791       if (pd.rowpos >= size) {
792         return false;
793       }
794       else {
795         setRow(pd);
796         return true;
797       }
798     }
799   }
800   
801   public boolean previous() throws SQLException JavaDoc {
802     sanityCheck();
803     PositionData pd = getPosition();
804     pd.rowpos--;
805     if (pd.rowpos < 0) {
806       return false;
807     }
808     else {
809       setRow(pd);
810       return true;
811     }
812   }
813   
814  /**
815   * this operation is not supported
816   */

817   public void refreshRow() throws SQLException JavaDoc {
818     throw new SQLException JavaDoc("operation not supported");
819   }
820   
821   public boolean relative(int param) throws SQLException JavaDoc {
822     return false;
823   }
824   
825   public boolean rowDeleted() throws SQLException JavaDoc {
826     return false;
827   }
828   
829   public boolean rowInserted() throws SQLException JavaDoc {
830     return false;
831   }
832   
833   public boolean rowUpdated() throws SQLException JavaDoc {
834     return false;
835   }
836   
837  /**
838   * this operation is not supported
839   */

840   public void setFetchDirection(int param) throws SQLException JavaDoc {
841     throw new SQLException JavaDoc("operation not supported");
842   }
843   
844  /**
845   * this operation is not supported
846   */

847   public void setFetchSize(int param) throws SQLException JavaDoc {
848     throw new SQLException JavaDoc("operation not supported");
849   }
850   
851   /**
852    * this operation is not supported
853    */

854   public void updateArray(String JavaDoc str, Array JavaDoc array) throws SQLException JavaDoc {
855     throw new SQLException JavaDoc("operation not supported");
856   }
857   
858   /**
859    * this operation is not supported
860    */

861   public void updateArray(int param, Array JavaDoc array) throws SQLException JavaDoc {
862     throw new SQLException JavaDoc("operation not supported");
863   }
864   
865   /**
866    * this operation is not supported
867    */

868   public void updateAsciiStream(String JavaDoc str, InputStream JavaDoc inputStream, int param) throws SQLException JavaDoc {
869     throw new SQLException JavaDoc("operation not supported");
870   }
871   
872   /**
873    * this operation is not supported
874    */

875   public void updateAsciiStream(int param, InputStream JavaDoc inputStream, int param2) throws SQLException JavaDoc {
876     throw new SQLException JavaDoc("operation not supported");
877   }
878   
879   /**
880    * this operation is not supported
881    */

882   public void updateBigDecimal(String JavaDoc str, BigDecimal JavaDoc bigDecimal) throws SQLException JavaDoc {
883     throw new SQLException JavaDoc("operation not supported");
884   }
885   
886   /**
887    * this operation is not supported
888    */

889   public void updateBigDecimal(int param, BigDecimal JavaDoc bigDecimal) throws SQLException JavaDoc {
890     throw new SQLException JavaDoc("operation not supported");
891   }
892   
893   /**
894    * this operation is not supported
895    */

896   public void updateBinaryStream(int param, InputStream JavaDoc inputStream, int param2) throws SQLException JavaDoc {
897     throw new SQLException JavaDoc("operation not supported");
898   }
899   
900   /**
901    * this operation is not supported
902    */

903   public void updateBinaryStream(String JavaDoc str, InputStream JavaDoc inputStream, int param) throws SQLException JavaDoc {
904     throw new SQLException JavaDoc("operation not supported");
905   }
906   
907   /**
908    * this operation is not supported
909    */

910   public void updateBlob(int param, java.sql.Blob JavaDoc blob) throws SQLException JavaDoc {
911     throw new SQLException JavaDoc("operation not supported");
912   }
913   
914   /**
915    * this operation is not supported
916    */

917   public void updateBlob(String JavaDoc str, java.sql.Blob JavaDoc blob) throws SQLException JavaDoc {
918     throw new SQLException JavaDoc("operation not supported");
919   }
920   
921   /**
922    * this operation is not supported
923    */

924   public void updateBoolean(int param, boolean param1) throws SQLException JavaDoc {
925     throw new SQLException JavaDoc("operation not supported");
926   }
927   
928   /**
929    * this operation is not supported
930    */

931   public void updateBoolean(String JavaDoc str, boolean param) throws SQLException JavaDoc {
932     throw new SQLException JavaDoc("operation not supported");
933   }
934   
935   /**
936    * this operation is not supported
937    */

938   public void updateByte(int param, byte param1) throws SQLException JavaDoc {
939     throw new SQLException JavaDoc("operation not supported");
940   }
941   
942   /**
943    * this operation is not supported
944    */

945   public void updateByte(String JavaDoc str, byte param) throws SQLException JavaDoc {
946     throw new SQLException JavaDoc("operation not supported");
947   }
948   
949   /**
950    * this operation is not supported
951    */

952   public void updateBytes(int param, byte[] values) throws SQLException JavaDoc {
953     throw new SQLException JavaDoc("operation not supported");
954   }
955   
956   /**
957    * this operation is not supported
958    */

959   public void updateBytes(String JavaDoc str, byte[] values) throws SQLException JavaDoc {
960     throw new SQLException JavaDoc("operation not supported");
961   }
962   
963   /**
964    * this operation is not supported
965    */

966   public void updateCharacterStream(int param, java.io.Reader JavaDoc reader, int param2) throws SQLException JavaDoc {
967     throw new SQLException JavaDoc("operation not supported");
968   }
969   
970   /**
971    * this operation is not supported
972    */

973   public void updateCharacterStream(String JavaDoc str, java.io.Reader JavaDoc reader, int param) throws SQLException JavaDoc {
974     throw new SQLException JavaDoc("operation not supported");
975   }
976   
977   /**
978    * this operation is not supported
979    */

980   public void updateClob(String JavaDoc str, java.sql.Clob JavaDoc clob) throws SQLException JavaDoc {
981     throw new SQLException JavaDoc("operation not supported");
982   }
983   
984   /**
985    * this operation is not supported
986    */

987   public void updateClob(int param, java.sql.Clob JavaDoc clob) throws SQLException JavaDoc {
988     throw new SQLException JavaDoc("operation not supported");
989   }
990   
991   /**
992    * this operation is not supported
993    */

994   public void updateDate(int param, Date JavaDoc date) throws SQLException JavaDoc {
995     throw new SQLException JavaDoc("operation not supported");
996   }
997   
998   /**
999    * this operation is not supported
1000   */

1001  public void updateDate(String JavaDoc str, Date JavaDoc date) throws SQLException JavaDoc {
1002    throw new SQLException JavaDoc("operation not supported");
1003  }
1004  
1005  /**
1006   * this operation is not supported
1007   */

1008  public void updateDouble(int param, double param1) throws SQLException JavaDoc {
1009    throw new SQLException JavaDoc("operation not supported");
1010  }
1011  
1012  /**
1013   * this operation is not supported
1014   */

1015  public void updateDouble(String JavaDoc str, double param) throws SQLException JavaDoc {
1016    throw new SQLException JavaDoc("operation not supported");
1017  }
1018  
1019  /**
1020   * this operation is not supported
1021   */

1022  public void updateFloat(String JavaDoc str, float param) throws SQLException JavaDoc {
1023    throw new SQLException JavaDoc("operation not supported");
1024  }
1025  
1026  /**
1027   * this operation is not supported
1028   */

1029  public void updateFloat(int param, float param1) throws SQLException JavaDoc {
1030    throw new SQLException JavaDoc("operation not supported");
1031  }
1032  
1033  /**
1034   * this operation is not supported
1035   */

1036  public void updateInt(String JavaDoc str, int param) throws SQLException JavaDoc {
1037    throw new SQLException JavaDoc("operation not supported");
1038  }
1039  
1040  /**
1041   * this operation is not supported
1042   */

1043  public void updateInt(int param, int param1) throws SQLException JavaDoc {
1044    throw new SQLException JavaDoc("operation not supported");
1045  }
1046  
1047  /**
1048   * this operation is not supported
1049   */

1050  public void updateLong(int param, long param1) throws SQLException JavaDoc {
1051    throw new SQLException JavaDoc("operation not supported");
1052  }
1053  
1054  /**
1055   * this operation is not supported
1056   */

1057  public void updateLong(String JavaDoc str, long param) throws SQLException JavaDoc {
1058    throw new SQLException JavaDoc("operation not supported");
1059  }
1060  
1061  /**
1062   * this operation is not supported
1063   */

1064  public void updateNull(String JavaDoc str) throws SQLException JavaDoc {
1065    throw new SQLException JavaDoc("operation not supported");
1066  }
1067  
1068  /**
1069   * this operation is not supported
1070   */

1071  public void updateNull(int param) throws SQLException JavaDoc {
1072    throw new SQLException JavaDoc("operation not supported");
1073  }
1074  
1075  /**
1076   * this operation is not supported
1077   */

1078  public void updateObject(String JavaDoc str, Object JavaDoc obj) throws SQLException JavaDoc {
1079    throw new SQLException JavaDoc("operation not supported");
1080  }
1081  
1082  /**
1083   * this operation is not supported
1084   */

1085  public void updateObject(int param, Object JavaDoc obj) throws SQLException JavaDoc {
1086    throw new SQLException JavaDoc("operation not supported");
1087  }
1088  
1089  /**
1090   * this operation is not supported */

1091  public void updateObject(int param, Object JavaDoc obj, int param2) throws SQLException JavaDoc {
1092    throw new SQLException JavaDoc("operation not supported");
1093  }
1094  
1095  /**
1096   * this operation is not supported
1097   */

1098  public void updateObject(String JavaDoc str, Object JavaDoc obj, int param) throws SQLException JavaDoc {
1099    throw new SQLException JavaDoc("operation not supported");
1100  }
1101  
1102  /**
1103   * this operation is not supported
1104   */

1105  public void updateRef(int param, java.sql.Ref JavaDoc ref) throws SQLException JavaDoc {
1106    throw new SQLException JavaDoc("operation not supported");
1107  }
1108  
1109  /**
1110   * this operation is not supported
1111   */

1112  public void updateRef(String JavaDoc str, java.sql.Ref JavaDoc ref) throws SQLException JavaDoc {
1113    throw new SQLException JavaDoc("operation not supported");
1114  }
1115  
1116  /**
1117   * this operation is not supported
1118   */
public void updateRow() throws SQLException JavaDoc {
1119    throw new SQLException JavaDoc("operation not supported");
1120  }
1121  
1122  /**
1123   * this operation is not supported
1124   */

1125   public void updateShort(int param, short param1) throws SQLException JavaDoc {
1126    throw new SQLException JavaDoc("operation not supported");
1127  }
1128  
1129  /**
1130   * this operation is not supported
1131   */

1132   public void updateShort(String JavaDoc str, short param) throws SQLException JavaDoc {
1133    throw new SQLException JavaDoc("operation not supported");
1134  }
1135  
1136  /**
1137   * this operation is not supported
1138   */

1139   public void updateString(int param, String JavaDoc str) throws SQLException JavaDoc {
1140    throw new SQLException JavaDoc("operation not supported");
1141  }
1142  
1143  /**
1144   * this operation is not supported
1145   */

1146   public void updateString(String JavaDoc str, String JavaDoc str1) throws SQLException JavaDoc {
1147    throw new SQLException JavaDoc("operation not supported");
1148  }
1149  
1150  /**
1151   * this operation is not supported
1152   */

1153   public void updateTime(String JavaDoc str, Time JavaDoc time) throws SQLException JavaDoc {
1154    throw new SQLException JavaDoc("operation not supported");
1155  }
1156  
1157  /**
1158   * this operation is not supported
1159   */

1160   public void updateTime(int param, Time JavaDoc time) throws SQLException JavaDoc {
1161    throw new SQLException JavaDoc("operation not supported");
1162  }
1163  
1164  /**
1165   * this operation is not supported
1166   */

1167   public void updateTimestamp(String JavaDoc str, Timestamp JavaDoc timestamp) throws SQLException JavaDoc {
1168    throw new SQLException JavaDoc("operation not supported");
1169  }
1170  
1171  /**
1172   * this operation is not supported
1173   */

1174   public void updateTimestamp(int param, Timestamp JavaDoc timestamp) throws SQLException JavaDoc {
1175    throw new SQLException JavaDoc("operation not supported");
1176  }
1177  
1178  public boolean wasNull() throws SQLException JavaDoc {
1179    sanityCheck();
1180    PositionData pd = getPosition();
1181    return pd.lastColumnWasNull;
1182  }
1183}
Popular Tags