KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > rmijdbc > RJResultSet


1
2 /**
3  * RmiJdbc client/server JDBC Driver
4  * (C) GIE Dyade (Groupe BULL / INRIA Research Center) 1997
5  *
6  * @version 1.0
7  * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com)
8  */

9
10 package org.objectweb.rmijdbc;
11
12 import java.math.BigDecimal JavaDoc;
13 import java.sql.*;
14 import java.rmi.RemoteException JavaDoc;
15
16 // TBD: WARNING This file contains a hack for InputStream class...
17
// InputStream is not serializable, of course !
18
// The right way would be to encapsulate InputStream in a RMI remote object
19
// (hope I'll find time to do that)
20

21 /**
22  * <P>A ResultSet provides access to a table of data generated by
23  * executing a Statement. The table rows are retrieved in
24  * sequence. Within a row its column values can be accessed in any
25  * order.
26  *
27  * <P>A ResultSet maintains a cursor pointing to its current row of
28  * data. Initially the cursor is positioned before the first row.
29  * The 'next' method moves the cursor to the next row.
30  *
31  * <P>The getXXX methods retrieve column values for the current
32  * row. You can retrieve values either using the index number of the
33  * column, or by using the name of the column. In general using the
34  * column index will be more efficient. Columns are numbered from 1.
35  *
36  * <P>For maximum portability, ResultSet columns within each row should be
37  * read in left-to-right order and each column should be read only once.
38  *
39  * <P>For the getXXX methods, the JDBC driver attempts to convert the
40  * underlying data to the specified Java type and returns a suitable
41  * Java value. See the JDBC specification for allowable mappings
42  * from SQL types to Java types with the ResultSet.getXXX methods.
43  *
44  * <P>Column names used as input to getXXX methods are case insensitive.
45  * When performing a getXXX using a column name, if several columns have
46  * the same name, then the value of the first matching column will be
47  * returned.
48  *
49  * <P>A ResultSet is automatically closed by the Statement that
50  * generated it when that Statement is closed, re-executed, or is used
51  * to retrieve the next result from a sequence of multiple results.
52  *
53  * <P>The number, types and properties of a ResultSet's columns are
54  * provided by the ResulSetMetaData object returned by the getMetaData
55  * method.
56  *
57  * @see Statement#executeQuery
58  * @see Statement#getResultSet
59  * @see ResultSetMetaData
60  */

61
62 public class RJResultSet implements java.sql.ResultSet JavaDoc, java.io.Serializable JavaDoc
63 {
64
65   RJResultSetInterface rmiResultSet_;
66   Statement statement_ = null;
67
68   public RJResultSet(RJResultSetInterface r, Statement st) {
69     rmiResultSet_ = r;
70     statement_ = st;
71   }
72
73   /**
74    * A ResultSet is initially positioned before its first row; the
75    * first call to next makes the first row the current row; the
76    * second call makes the second row the current row, etc.
77    *
78    * <P>If an input stream from the previous row is open, it is
79    * implicitly closed. The ResultSet's warning chain is cleared
80    * when a new row is read.
81    *
82    * @return true if the new current row is valid; false if there
83    * are no more rows
84    */

85   public boolean next() throws java.sql.SQLException JavaDoc {
86     try {
87       return rmiResultSet_.next();
88     } catch(RemoteException JavaDoc e) {
89       throw new java.sql.SQLException JavaDoc(e.getMessage());
90     }
91   }
92
93
94   /**
95    * In some cases, it is desirable to immediately release a
96    * ResultSet's database and JDBC resources instead of waiting for
97    * this to happen when it is automatically closed; the close
98    * method provides this immediate release.
99    *
100    * <P><B>Note:</B> A ResultSet is automatically closed by the
101    * Statement that generated it when that Statement is closed,
102    * re-executed, or is used to retrieve the next result from a
103    * sequence of multiple results. A ResultSet is also automatically
104    * closed when it is garbage collected.
105    */

106   public void close() throws java.sql.SQLException JavaDoc {
107     try {
108       rmiResultSet_.close();
109     } catch(RemoteException JavaDoc e) {
110       throw new java.sql.SQLException JavaDoc(e.getMessage());
111     }
112   }
113
114   /**
115    * A column may have the value of SQL NULL; wasNull reports whether
116    * the last column read had this special value.
117    * Note that you must first call getXXX on a column to try to read
118    * its value and then call wasNull() to find if the value was
119    * the SQL NULL.
120    *
121    * @return true if last column read was SQL NULL
122    */

123   public boolean wasNull() throws java.sql.SQLException JavaDoc {
124     try {
125       return rmiResultSet_.wasNull();
126     } catch(RemoteException JavaDoc e) {
127       throw new java.sql.SQLException JavaDoc(e.getMessage());
128     }
129   }
130     
131   //======================================================================
132
// Methods for accessing results by column index
133
//======================================================================
134

135   /**
136    * Get the value of a column in the current row as a Java String.
137    *
138    * @param columnIndex the first column is 1, the second is 2, ...
139    * @return the column value; if the value is SQL NULL, the result is null
140    */

141   public String JavaDoc getString(int columnIndex) throws java.sql.SQLException JavaDoc {
142     try {
143       return rmiResultSet_.getString(columnIndex);
144     } catch(RemoteException JavaDoc e) {
145       throw new java.sql.SQLException JavaDoc(e.getMessage());
146     }
147   }
148
149   /**
150    * Get the value of a column in the current row as a Java boolean.
151    *
152    * @param columnIndex the first column is 1, the second is 2, ...
153    * @return the column value; if the value is SQL NULL, the result is false
154    */

155   public boolean getBoolean(int columnIndex) throws java.sql.SQLException JavaDoc {
156     try {
157       return rmiResultSet_.getBoolean(columnIndex);
158     } catch(RemoteException JavaDoc e) {
159       throw new java.sql.SQLException JavaDoc(e.getMessage());
160     }
161   }
162
163   /**
164    * Get the value of a column in the current row as a Java byte.
165    *
166    * @param columnIndex the first column is 1, the second is 2, ...
167    * @return the column value; if the value is SQL NULL, the result is 0
168    */

169   public byte getByte(int columnIndex) throws java.sql.SQLException JavaDoc {
170     try {
171       return rmiResultSet_.getByte(columnIndex);
172     } catch(RemoteException JavaDoc e) {
173       throw new java.sql.SQLException JavaDoc(e.getMessage());
174     }
175   }
176
177   /**
178    * Get the value of a column in the current row as a Java short.
179    *
180    * @param columnIndex the first column is 1, the second is 2, ...
181    * @return the column value; if the value is SQL NULL, the result is 0
182    */

183   public short getShort(int columnIndex) throws java.sql.SQLException JavaDoc {
184     try {
185       return rmiResultSet_.getShort(columnIndex);
186     } catch(RemoteException JavaDoc e) {
187       throw new java.sql.SQLException JavaDoc(e.getMessage());
188     }
189   }
190
191   /**
192    * Get the value of a column in the current row as a Java int.
193    *
194    * @param columnIndex the first column is 1, the second is 2, ...
195    * @return the column value; if the value is SQL NULL, the result is 0
196    */

197   public int getInt(int columnIndex) throws java.sql.SQLException JavaDoc {
198     try {
199       return rmiResultSet_.getInt(columnIndex);
200     } catch(RemoteException JavaDoc e) {
201       throw new java.sql.SQLException JavaDoc(e.getMessage());
202     }
203   }
204
205   /**
206    * Get the value of a column in the current row as a Java long.
207    *
208    * @param columnIndex the first column is 1, the second is 2, ...
209    * @return the column value; if the value is SQL NULL, the result is 0
210    */

211   public long getLong(int columnIndex) throws java.sql.SQLException JavaDoc {
212     try {
213       return rmiResultSet_.getLong(columnIndex);
214     } catch(RemoteException JavaDoc e) {
215       throw new java.sql.SQLException JavaDoc(e.getMessage());
216     }
217   }
218
219   /**
220    * Get the value of a column in the current row as a Java float.
221    *
222    * @param columnIndex the first column is 1, the second is 2, ...
223    * @return the column value; if the value is SQL NULL, the result is 0
224    */

225   public float getFloat(int columnIndex) throws java.sql.SQLException JavaDoc {
226     try {
227       return rmiResultSet_.getFloat(columnIndex);
228     } catch(RemoteException JavaDoc e) {
229       throw new java.sql.SQLException JavaDoc(e.getMessage());
230     }
231   }
232
233   /**
234    * Get the value of a column in the current row as a Java double.
235    *
236    * @param columnIndex the first column is 1, the second is 2, ...
237    * @return the column value; if the value is SQL NULL, the result is 0
238    */

239   public double getDouble(int columnIndex) throws java.sql.SQLException JavaDoc {
240     try {
241       return rmiResultSet_.getDouble(columnIndex);
242     } catch(RemoteException JavaDoc e) {
243       throw new java.sql.SQLException JavaDoc(e.getMessage());
244     }
245   }
246
247   /**
248    * Get the value of a column in the current row as a java.lang.BigDecimal object.
249    *
250    * @param columnIndex the first column is 1, the second is 2, ...
251    * @param scale the number of digits to the right of the decimal
252    * @return the column value; if the value is SQL NULL, the result is null
253    */

254   public BigDecimal JavaDoc getBigDecimal(int columnIndex, int scale)
255   throws java.sql.SQLException JavaDoc {
256     try {
257       return rmiResultSet_.getBigDecimal(columnIndex, scale);
258     } catch(RemoteException JavaDoc e) {
259       throw new java.sql.SQLException JavaDoc(e.getMessage());
260     }
261   }
262
263   /**
264    * Get the value of a column in the current row as a Java byte array.
265    * The bytes represent the raw values returned by the driver.
266    *
267    * @param columnIndex the first column is 1, the second is 2, ...
268    * @return the column value; if the value is SQL NULL, the result is null
269    */

270   public byte[] getBytes(int columnIndex) throws java.sql.SQLException JavaDoc {
271     try {
272       return rmiResultSet_.getBytes(columnIndex);
273     } catch(RemoteException JavaDoc e) {
274       throw new java.sql.SQLException JavaDoc(e.getMessage());
275     }
276   }
277
278   /**
279    * Get the value of a column in the current row as a java.sql.Date object.
280    *
281    * @param columnIndex the first column is 1, the second is 2, ...
282    * @return the column value; if the value is SQL NULL, the result is null
283    */

284   public java.sql.Date JavaDoc getDate(int columnIndex) throws java.sql.SQLException JavaDoc {
285     try {
286       return rmiResultSet_.getDate(columnIndex);
287     } catch(RemoteException JavaDoc e) {
288       throw new java.sql.SQLException JavaDoc(e.getMessage());
289     }
290   }
291
292   /**
293    * Get the value of a column in the current row as a java.sql.Time object.
294    *
295    * @param columnIndex the first column is 1, the second is 2, ...
296    * @return the column value; if the value is SQL NULL, the result is null
297    */

298   public java.sql.Time JavaDoc getTime(int columnIndex) throws java.sql.SQLException JavaDoc {
299     try {
300       return rmiResultSet_.getTime(columnIndex);
301     } catch(RemoteException JavaDoc e) {
302       throw new java.sql.SQLException JavaDoc(e.getMessage());
303     }
304   }
305
306   /**
307    * Get the value of a column in the current row as a java.sql.Timestamp object.
308    *
309    * @param columnIndex the first column is 1, the second is 2, ...
310    * @return the column value; if the value is SQL NULL, the result is null
311    */

312   public java.sql.Timestamp JavaDoc getTimestamp(int columnIndex)
313   throws java.sql.SQLException JavaDoc {
314     try {
315       return rmiResultSet_.getTimestamp(columnIndex);
316     } catch(RemoteException JavaDoc e) {
317       throw new java.sql.SQLException JavaDoc(e.getMessage());
318     }
319   }
320
321   /**
322    * A column value can be retrieved as a stream of ASCII characters
323    * and then read in chunks from the stream. This method is particularly
324    * suitable for retrieving large LONGVARCHAR values. The JDBC driver will
325    * do any necessary conversion from the database format into ASCII.
326    *
327    * <P><B>Note:</B> All the data in the returned stream must be
328    * read prior to getting the value of any other column. The next
329    * call to a get method implicitly closes the stream. . Also, a
330    * stream may return 0 for available() whether there is data
331    * available or not.
332    *
333    * @param columnIndex the first column is 1, the second is 2, ...
334    * @return a Java input stream that delivers the database column value
335    * as a stream of one byte ASCII characters. If the value is SQL NULL
336    * then the result is null.
337    */

338 // TBD There's a hack there (InputStream not serializable)
339
public java.io.InputStream JavaDoc getAsciiStream(int columnIndex)
340   throws java.sql.SQLException JavaDoc {
341     try {
342       byte[] val = rmiResultSet_.getAsciiStream(columnIndex);
343       if(val == null) return null;
344       return new java.io.ByteArrayInputStream JavaDoc(val);
345     } catch(RemoteException JavaDoc e) {
346       throw new java.sql.SQLException JavaDoc(e.getMessage());
347     }
348   }
349
350   /**
351    * A column value can be retrieved as a stream of Unicode characters
352    * and then read in chunks from the stream. This method is particularly
353    * suitable for retrieving large LONGVARCHAR values. The JDBC driver will
354    * do any necessary conversion from the database format into Unicode.
355    *
356    * <P><B>Note:</B> All the data in the returned stream must be
357    * read prior to getting the value of any other column. The next
358    * call to a get method implicitly closes the stream. . Also, a
359    * stream may return 0 for available() whether there is data
360    * available or not.
361    *
362    * @param columnIndex the first column is 1, the second is 2, ...
363    * @return a Java input stream that delivers the database column value
364    * as a stream of two byte Unicode characters. If the value is SQL NULL
365    * then the result is null.
366    */

367 // TBD There's a hack there (InputStream not serializable)
368
public java.io.InputStream JavaDoc getUnicodeStream(int columnIndex)
369   throws java.sql.SQLException JavaDoc {
370     try {
371       byte[] val = rmiResultSet_.getUnicodeStream(columnIndex);
372       if(val == null) return null;
373       return new java.io.ByteArrayInputStream JavaDoc(val);
374     } catch(RemoteException JavaDoc e) {
375       throw new java.sql.SQLException JavaDoc(e.getMessage());
376     }
377 }
378
379   /**
380    * A column value can be retrieved as a stream of uninterpreted bytes
381    * and then read in chunks from the stream. This method is particularly
382    * suitable for retrieving large LONGVARBINARY values.
383    *
384    * <P><B>Note:</B> All the data in the returned stream must be
385    * read prior to getting the value of any other column. The next
386    * call to a get method implicitly closes the stream. Also, a
387    * stream may return 0 for available() whether there is data
388    * available or not.
389    *
390    * @param columnIndex the first column is 1, the second is 2, ...
391    * @return a Java input stream that delivers the database column value
392    * as a stream of uninterpreted bytes. If the value is SQL NULL
393    * then the result is null.
394    */

395 // TBD There's a hack there (InputStream not serializable)
396
public java.io.InputStream JavaDoc getBinaryStream(int columnIndex)
397   throws java.sql.SQLException JavaDoc {
398     try {
399       byte[] val = rmiResultSet_.getBinaryStream(columnIndex);
400       if(val == null) return null;
401       return new java.io.ByteArrayInputStream JavaDoc(val);
402     } catch(RemoteException JavaDoc e) {
403       throw new java.sql.SQLException JavaDoc(e.getMessage());
404     }
405   }
406
407
408   //======================================================================
409
// Methods for accessing results by column name
410
//======================================================================
411

412   /**
413    * Get the value of a column in the current row as a Java String.
414    *
415    * @param columnName is the SQL name of the column
416    * @return the column value; if the value is SQL NULL, the result is null
417    */

418   public String JavaDoc getString(String JavaDoc columnName) throws java.sql.SQLException JavaDoc {
419     try {
420       return rmiResultSet_.getString(columnName);
421     } catch(RemoteException JavaDoc e) {
422       throw new java.sql.SQLException JavaDoc(e.getMessage());
423     }
424   }
425
426   /**
427    * Get the value of a column in the current row as a Java boolean.
428    *
429    * @param columnName is the SQL name of the column
430    * @return the column value; if the value is SQL NULL, the result is false
431    */

432   public boolean getBoolean(String JavaDoc columnName) throws java.sql.SQLException JavaDoc {
433     try {
434       return rmiResultSet_.getBoolean(columnName);
435     } catch(RemoteException JavaDoc e) {
436       throw new java.sql.SQLException JavaDoc(e.getMessage());
437     }
438   }
439
440   /**
441    * Get the value of a column in the current row as a Java byte.
442    *
443    * @param columnName is the SQL name of the column
444    * @return the column value; if the value is SQL NULL, the result is 0
445    */

446   public byte getByte(String JavaDoc columnName) throws java.sql.SQLException JavaDoc {
447     try {
448       return rmiResultSet_.getByte(columnName);
449     } catch(RemoteException JavaDoc e) {
450       throw new java.sql.SQLException JavaDoc(e.getMessage());
451     }
452   }
453
454   /**
455    * Get the value of a column in the current row as a Java short.
456    *
457    * @param columnName is the SQL name of the column
458    * @return the column value; if the value is SQL NULL, the result is 0
459    */

460   public short getShort(String JavaDoc columnName) throws java.sql.SQLException JavaDoc {
461     try {
462       return rmiResultSet_.getShort(columnName);
463     } catch(RemoteException JavaDoc e) {
464       throw new java.sql.SQLException JavaDoc(e.getMessage());
465     }
466   }
467
468   /**
469    * Get the value of a column in the current row as a Java int.
470    *
471    * @param columnName is the SQL name of the column
472    * @return the column value; if the value is SQL NULL, the result is 0
473    */

474   public int getInt(String JavaDoc columnName) throws java.sql.SQLException JavaDoc {
475     try {
476       return rmiResultSet_.getInt(columnName);
477     } catch(RemoteException JavaDoc e) {
478       throw new java.sql.SQLException JavaDoc(e.getMessage());
479     }
480   }
481
482   /**
483    * Get the value of a column in the current row as a Java long.
484    *
485    * @param columnName is the SQL name of the column
486    * @return the column value; if the value is SQL NULL, the result is 0
487    */

488   public long getLong(String JavaDoc columnName) throws java.sql.SQLException JavaDoc {
489     try {
490       return rmiResultSet_.getLong(columnName);
491     } catch(RemoteException JavaDoc e) {
492       throw new java.sql.SQLException JavaDoc(e.getMessage());
493     }
494   }
495
496   /**
497    * Get the value of a column in the current row as a Java float.
498    *
499    * @param columnName is the SQL name of the column
500    * @return the column value; if the value is SQL NULL, the result is 0
501    */

502   public float getFloat(String JavaDoc columnName) throws java.sql.SQLException JavaDoc {
503     try {
504       return rmiResultSet_.getFloat(columnName);
505     } catch(RemoteException JavaDoc e) {
506       throw new java.sql.SQLException JavaDoc(e.getMessage());
507     }
508   }
509
510   /**
511    * Get the value of a column in the current row as a Java double.
512    *
513    * @param columnName is the SQL name of the column
514    * @return the column value; if the value is SQL NULL, the result is 0
515    */

516   public double getDouble(String JavaDoc columnName) throws java.sql.SQLException JavaDoc {
517     try {
518       return rmiResultSet_.getDouble(columnName);
519     } catch(RemoteException JavaDoc e) {
520       throw new java.sql.SQLException JavaDoc(e.getMessage());
521     }
522   }
523
524   /**
525    * Get the value of a column in the current row as a java.lang.BigDecimal object.
526    *
527    * @param columnName is the SQL name of the column
528    * @param scale the number of digits to the right of the decimal
529    * @return the column value; if the value is SQL NULL, the result is null
530    */

531   public BigDecimal JavaDoc getBigDecimal(String JavaDoc columnName, int scale)
532   throws java.sql.SQLException JavaDoc {
533     try {
534       return rmiResultSet_.getBigDecimal(columnName, scale);
535     } catch(RemoteException JavaDoc e) {
536       throw new java.sql.SQLException JavaDoc(e.getMessage());
537     }
538   }
539
540   /**
541    * Get the value of a column in the current row as a Java byte array.
542    * The bytes represent the raw values returned by the driver.
543    *
544    * @param columnName is the SQL name of the column
545    * @return the column value; if the value is SQL NULL, the result is null
546    */

547   public byte[] getBytes(String JavaDoc columnName) throws java.sql.SQLException JavaDoc {
548     try {
549       return rmiResultSet_.getBytes(columnName);
550     } catch(RemoteException JavaDoc e) {
551       throw new java.sql.SQLException JavaDoc(e.getMessage());
552     }
553   }
554
555   /**
556    * Get the value of a column in the current row as a java.sql.Date object.
557    *
558    * @param columnName is the SQL name of the column
559    * @return the column value; if the value is SQL NULL, the result is null
560    */

561   public java.sql.Date JavaDoc getDate(String JavaDoc columnName) throws java.sql.SQLException JavaDoc {
562     try {
563       return rmiResultSet_.getDate(columnName);
564     } catch(RemoteException JavaDoc e) {
565       throw new java.sql.SQLException JavaDoc(e.getMessage());
566     }
567   }
568
569   /**
570    * Get the value of a column in the current row as a java.sql.Time object.
571    *
572    * @param columnName is the SQL name of the column
573    * @return the column value; if the value is SQL NULL, the result is null
574    */

575   public java.sql.Time JavaDoc getTime(String JavaDoc columnName) throws java.sql.SQLException JavaDoc {
576     try {
577       return rmiResultSet_.getTime(columnName);
578     } catch(RemoteException JavaDoc e) {
579       throw new java.sql.SQLException JavaDoc(e.getMessage());
580     }
581   }
582
583   /**
584    * Get the value of a column in the current row as a java.sql.Timestamp object.
585    *
586    * @param columnName is the SQL name of the column
587    * @return the column value; if the value is SQL NULL, the result is null
588    */

589   public java.sql.Timestamp JavaDoc getTimestamp(String JavaDoc columnName)
590   throws java.sql.SQLException JavaDoc {
591     try {
592       return rmiResultSet_.getTimestamp(columnName);
593     } catch(RemoteException JavaDoc e) {
594       throw new java.sql.SQLException JavaDoc(e.getMessage());
595     }
596   }
597
598   /**
599    * A column value can be retrieved as a stream of ASCII characters
600    * and then read in chunks from the stream. This method is particularly
601    * suitable for retrieving large LONGVARCHAR values. The JDBC driver will
602    * do any necessary conversion from the database format into ASCII.
603    *
604    * <P><B>Note:</B> All the data in the returned stream must
605    * be read prior to getting the value of any other column. The
606    * next call to a get method implicitly closes the stream.
607    *
608    * @param columnName is the SQL name of the column
609    * @return a Java input stream that delivers the database column value
610    * as a stream of one byte ASCII characters. If the value is SQL NULL
611    * then the result is null.
612    */

613 // TBD There's a hack there (InputStream not serializable)
614
public java.io.InputStream JavaDoc getAsciiStream(String JavaDoc columnName)
615   throws java.sql.SQLException JavaDoc {
616     try {
617       byte[] val = rmiResultSet_.getAsciiStream(columnName);
618       if(val == null) return null;
619       return new java.io.ByteArrayInputStream JavaDoc(val);
620     } catch(RemoteException JavaDoc e) {
621       throw new java.sql.SQLException JavaDoc(e.getMessage());
622     }
623   }
624
625   /**
626    * A column value can be retrieved as a stream of Unicode characters
627    * and then read in chunks from the stream. This method is particularly
628    * suitable for retrieving large LONGVARCHAR values. The JDBC driver will
629    * do any necessary conversion from the database format into Unicode.
630    *
631    * <P><B>Note:</B> All the data in the returned stream must
632    * be read prior to getting the value of any other column. The
633    * next call to a get method implicitly closes the stream.
634    *
635    * @param columnName is the SQL name of the column
636    * @return a Java input stream that delivers the database column value
637    * as a stream of two byte Unicode characters. If the value is SQL NULL
638    * then the result is null.
639    */

640 // TBD There's a hack there (InputStream not serializable)
641
public java.io.InputStream JavaDoc getUnicodeStream(String JavaDoc columnName)
642   throws java.sql.SQLException JavaDoc {
643     try {
644       byte[] val = rmiResultSet_.getUnicodeStream(columnName);
645       if(val == null) return null;
646       return new java.io.ByteArrayInputStream JavaDoc(val);
647     } catch(RemoteException JavaDoc e) {
648       throw new java.sql.SQLException JavaDoc(e.getMessage());
649     }
650   }
651
652   /**
653    * A column value can be retrieved as a stream of uninterpreted bytes
654    * and then read in chunks from the stream. This method is particularly
655    * suitable for retrieving large LONGVARBINARY values.
656    *
657    * <P><B>Note:</B> All the data in the returned stream must
658    * be read prior to getting the value of any other column. The
659    * next call to a get method implicitly closes the stream.
660    *
661    * @param columnName is the SQL name of the column
662    * @return a Java input stream that delivers the database column value
663    * as a stream of uninterpreted bytes. If the value is SQL NULL
664    * then the result is null.
665    */

666 // TBD There's a hack there (InputStream not serializable)
667
public java.io.InputStream JavaDoc getBinaryStream(String JavaDoc columnName)
668   throws java.sql.SQLException JavaDoc {
669     try {
670       byte[] val = rmiResultSet_.getBinaryStream(columnName);
671       if(val == null) return null;
672       return new java.io.ByteArrayInputStream JavaDoc(val);
673     } catch(RemoteException JavaDoc e) {
674       throw new java.sql.SQLException JavaDoc(e.getMessage());
675     }
676   }
677
678
679   //=====================================================================
680
// Advanced features:
681
//=====================================================================
682

683   /**
684    * <p>The first warning reported by calls on this ResultSet is
685    * returned. Subsequent ResultSet warnings will be chained to this
686    * SQLWarning.
687    *
688    * <P>The warning chain is automatically cleared each time a new
689    * row is read.
690    *
691    * <P><B>Note:</B> This warning chain only covers warnings caused
692    * by ResultSet methods. Any warning caused by statement methods
693    * (such as reading OUT parameters) will be chained on the
694    * Statement object.
695    *
696    * @return the first SQLWarning or null
697    */

698   public SQLWarning getWarnings() throws java.sql.SQLException JavaDoc {
699     try {
700       return rmiResultSet_.getWarnings();
701     } catch(RemoteException JavaDoc e) {
702       throw new java.sql.SQLException JavaDoc(e.getMessage());
703     }
704   }
705
706   /**
707    * After this call getWarnings returns null until a new warning is
708    * reported for this ResultSet.
709    */

710   public void clearWarnings() throws java.sql.SQLException JavaDoc {
711     try {
712       rmiResultSet_.clearWarnings();
713     } catch(RemoteException JavaDoc e) {
714       throw new java.sql.SQLException JavaDoc(e.getMessage());
715     }
716   }
717
718   /**
719    * Get the name of the SQL cursor used by this ResultSet.
720    *
721    * <P>In SQL, a result table is retrieved through a cursor that is
722    * named. The current row of a result can be updated or deleted
723    * using a positioned update/delete statement that references the
724    * cursor name.
725    *
726    * <P>JDBC supports this SQL feature by providing the name of the
727    * SQL cursor used by a ResultSet. The current row of a ResultSet
728    * is also the current row of this SQL cursor.
729    *
730    * <P><B>Note:</B> If positioned update is not supported a
731    * java.sql.SQLException is thrown
732    *
733    * @return the ResultSet's SQL cursor name
734    */

735   public String JavaDoc getCursorName() throws java.sql.SQLException JavaDoc {
736     try {
737       return rmiResultSet_.getCursorName();
738     } catch(RemoteException JavaDoc e) {
739       throw new java.sql.SQLException JavaDoc(e.getMessage());
740     }
741   }
742
743   /**
744    * The number, types and properties of a ResultSet's columns
745    * are provided by the getMetaData method.
746    *
747    * @return the description of a ResultSet's columns
748    */

749   public java.sql.ResultSetMetaData JavaDoc getMetaData()
750   throws java.sql.SQLException JavaDoc {
751     try {
752       return new RJResultSetMetaData(rmiResultSet_.getMetaData());
753     } catch(RemoteException JavaDoc e) {
754       throw new java.sql.SQLException JavaDoc(e.getMessage());
755     }
756   }
757
758   /**
759    * <p>Get the value of a column in the current row as a Java object.
760    *
761    * <p>This method will return the value of the given column as a
762    * Java object. The type of the Java object will be the default
763    * Java Object type corresponding to the column's SQL type,
764    * following the mapping specified in the JDBC spec.
765    *
766    * <p>This method may also be used to read datatabase specific abstract
767    * data types.
768    *
769    * @param columnIndex the first column is 1, the second is 2, ...
770    * @return A java.lang.Object holding the column value.
771    */

772   public Object JavaDoc getObject(int columnIndex) throws java.sql.SQLException JavaDoc {
773     try {
774       return rmiResultSet_.getObject(columnIndex);
775     } catch(RemoteException JavaDoc e) {
776       throw new java.sql.SQLException JavaDoc(e.getMessage());
777     }
778   }
779
780   /**
781    * <p>Get the value of a column in the current row as a Java object.
782    *
783    * <p>This method will return the value of the given column as a
784    * Java object. The type of the Java object will be the default
785    * Java Object type corresponding to the column's SQL type,
786    * following the mapping specified in the JDBC spec.
787    *
788    * <p>This method may also be used to read datatabase specific abstract
789    * data types.
790    *
791    * @param columnName is the SQL name of the column
792    * @return A java.lang.Object holding the column value.
793    */

794   public Object JavaDoc getObject(String JavaDoc columnName) throws java.sql.SQLException JavaDoc {
795     try {
796       return rmiResultSet_.getObject(columnName);
797     } catch(RemoteException JavaDoc e) {
798       throw new java.sql.SQLException JavaDoc(e.getMessage());
799     }
800   }
801
802   //----------------------------------------------------------------
803

804   /**
805    * Map a Resultset column name to a ResultSet column index.
806    *
807    * @param columnName the name of the column
808    * @return the column index
809    */

810   public int findColumn(String JavaDoc columnName) throws java.sql.SQLException JavaDoc {
811     try {
812       return rmiResultSet_.findColumn(columnName);
813     } catch(RemoteException JavaDoc e) {
814       throw new java.sql.SQLException JavaDoc(e.getMessage());
815     }
816   }
817
818 // JDBC 2.0 methods
819
// added by Mike Jennings sometime in the
820
// summer of 1999
821
// remove comments to compile for JDBC 2.0
822

823 // Implementation added Aug 2000 by Peter Hearty (peter.hearty@lutris.com).
824
public void updateTimestamp(String JavaDoc columnName,
825                             Timestamp x) throws SQLException
826   {
827     try {
828       rmiResultSet_.updateTimestamp(columnName,x);
829     } catch(RemoteException JavaDoc e) {
830       throw new java.sql.SQLException JavaDoc(e.getMessage());
831     }
832   }
833
834 public void updateTimestamp(int columnIndex,Timestamp x) throws SQLException
835   {
836     try {
837       rmiResultSet_.updateTimestamp(columnIndex,x);
838     } catch(RemoteException JavaDoc e) {
839       throw new java.sql.SQLException JavaDoc(e.getMessage());
840     }
841   }
842
843 public void updateTime(String JavaDoc columnName,Time x) throws SQLException
844   {
845     try {
846       rmiResultSet_.updateTime(columnName,x);
847     } catch(RemoteException JavaDoc e) {
848       throw new java.sql.SQLException JavaDoc(e.getMessage());
849     }
850   }
851
852
853 public void updateTime(int columnIndex,
854                        Time x) throws SQLException
855   {
856     try {
857       rmiResultSet_.updateTime(columnIndex,x);
858     } catch(RemoteException JavaDoc e) {
859       throw new java.sql.SQLException JavaDoc(e.getMessage());
860     }
861   }
862
863 public void updateString(String JavaDoc columnName,
864                          String JavaDoc x) throws SQLException
865   {
866     try {
867       rmiResultSet_.updateString(columnName,x);
868     } catch(RemoteException JavaDoc e) {
869       throw new java.sql.SQLException JavaDoc(e.getMessage());
870     }
871   }
872
873 public void updateString(int columnIndex,
874                          String JavaDoc x) throws SQLException
875   {
876     try {
877       rmiResultSet_.updateString(columnIndex,x);
878     } catch(RemoteException JavaDoc e) {
879       throw new java.sql.SQLException JavaDoc(e.getMessage());
880     }
881   }
882
883 public void updateShort(int columnIndex,
884                         short x) throws SQLException
885   {
886     try {
887       rmiResultSet_.updateShort(columnIndex,x);
888     } catch(RemoteException JavaDoc e) {
889       throw new java.sql.SQLException JavaDoc(e.getMessage());
890     }
891   }
892
893 public void updateShort(String