KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > h2 > jdbc > JdbcResultSet


1 /*
2  * Copyright 2004-2006 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
3  * Initial Developer: H2 Group
4  */

5 package org.h2.jdbc;
6
7 import java.io.InputStream JavaDoc;
8 import java.io.Reader JavaDoc;
9 import java.math.BigDecimal JavaDoc;
10 import java.net.URL JavaDoc;
11 import java.sql.*;
12 import java.util.Calendar JavaDoc;
13 import java.util.Map JavaDoc;
14
15 import org.h2.engine.Constants;
16 import org.h2.engine.SessionInterface;
17 import org.h2.message.*;
18 import org.h2.result.ResultInterface;
19 import org.h2.result.UpdatableRow;
20 import org.h2.util.ByteUtils;
21 import org.h2.util.DateTimeUtils;
22 import org.h2.util.IOUtils;
23 import org.h2.util.MathUtils;
24 import org.h2.util.StringUtils;
25 import org.h2.value.DataType;
26 import org.h2.value.Value;
27 import org.h2.value.ValueBoolean;
28 import org.h2.value.ValueByte;
29 import org.h2.value.ValueBytes;
30 import org.h2.value.ValueDate;
31 import org.h2.value.ValueDecimal;
32 import org.h2.value.ValueDouble;
33 import org.h2.value.ValueFloat;
34 import org.h2.value.ValueInt;
35 import org.h2.value.ValueLong;
36 import org.h2.value.ValueNull;
37 import org.h2.value.ValueShort;
38 import org.h2.value.ValueString;
39 import org.h2.value.ValueTime;
40 import org.h2.value.ValueTimestamp;
41
42 /**
43  * Represents a result set. Column names are case-insensitive, quotes are not supported. The first column has the column
44  * index 1.
45  */

46 public class JdbcResultSet extends TraceObject implements ResultSet {
47     private SessionInterface session;
48     private ResultInterface result;
49     private JdbcConnection conn;
50     private JdbcStatement stat;
51     private int columnCount;
52     private boolean wasNull;
53     private Value[] insertRow;
54     private Value[] updateRow;
55     private boolean closeStatement;
56
57     /**
58      * Moves the cursor to the next row of the result set.
59      *
60      * @return true if successfull, false if there are no more rows
61      */

62     public boolean next() throws SQLException {
63         try {
64             debugCodeCall("next");
65             checkClosed();
66             return result.next();
67         } catch(Throwable JavaDoc e) {
68             throw logAndConvert(e);
69         }
70     }
71
72     /**
73      * Gets the meta data of this result set.
74      *
75      * @return the meta data
76      */

77     public ResultSetMetaData getMetaData() throws SQLException {
78         try {
79             int id = getNextId(TraceObject.RESULT_SET_META_DATA);
80             if(debug()) {
81                 debugCodeAssign("ResultSetMetaData", TraceObject.RESULT_SET_META_DATA, id);
82                 debugCodeCall("getMetaData");
83             }
84             checkClosed();
85             JdbcResultSetMetaData meta = new JdbcResultSetMetaData(this, result, session.getTrace(), id);
86             return meta;
87         } catch(Throwable JavaDoc e) {
88             throw logAndConvert(e);
89         }
90     }
91
92     /**
93      * Returns whether the last column accessed was a null value.
94      *
95      * @return true if the last column accessed was a null value
96      */

97     public boolean wasNull() throws SQLException {
98         try {
99             debugCodeCall("wasNull");
100             checkClosed();
101             return wasNull;
102         } catch(Throwable JavaDoc e) {
103             throw logAndConvert(e);
104         }
105     }
106
107     /**
108      * Searches for a specific column in the result set. A case-insensitive search is made.
109      *
110      * @param columnName the name of the column label
111      * @return the column index (1,2,...)
112      * @throws SQLException if the column is not found or if the result set is closed
113      */

114     public int findColumn(String JavaDoc columnName) throws SQLException {
115         try {
116             debugCodeCall("findColumn", columnName);
117             return getColumnIndex(columnName);
118         } catch(Throwable JavaDoc e) {
119             throw logAndConvert(e);
120         }
121     }
122
123     /**
124      * Closes the result set.
125      */

126     public void close() throws SQLException {
127         try {
128             debugCodeCall("close");
129             closeInternal();
130         } catch(Throwable JavaDoc e) {
131             throw logAndConvert(e);
132         }
133     }
134
135     void closeInternal() throws SQLException {
136         if (result != null) {
137             try {
138                 result.close();
139                 if(closeStatement && stat != null) {
140                     stat.close();
141                 }
142             } finally {
143                 columnCount = 0;
144                 result = null;
145                 stat = null;
146                 conn = null;
147                 insertRow = null;
148                 updateRow = null;
149             }
150         }
151     }
152
153     /**
154      * Returns the statement that created this object.
155      *
156      * @return the statement or prepared statement, or null if created by a DatabaseMetaData call.
157      */

158     public Statement getStatement() throws SQLException {
159         try {
160             debugCodeCall("getStatement");
161             checkClosed();
162             if(closeStatement) {
163                 // if the result set was opened by a DatabaseMetaData call
164
return null;
165             }
166             return stat;
167         } catch(Throwable JavaDoc e) {
168             throw logAndConvert(e);
169         }
170     }
171
172     /**
173      * Gets the first warning reported by calls on this object.
174      *
175      * @return null
176      */

177     public SQLWarning getWarnings() throws SQLException {
178         try {
179             debugCodeCall("getWarnings");
180             checkClosed();
181             return null;
182         } catch(Throwable JavaDoc e) {
183             throw logAndConvert(e);
184         }
185     }
186
187     /**
188      * Clears all warnings.
189      */

190     public void clearWarnings() throws SQLException {
191         try {
192             debugCodeCall("clearWarnings");
193             checkClosed();
194         } catch(Throwable JavaDoc e) {
195             throw logAndConvert(e);
196         }
197     }
198
199     // =============================================================
200

201     /**
202      * Returns the value of the specified column as a String.
203      *
204      * @param columnIndex (1,2,...)
205      * @return the value
206      * @throws SQLException if the column is not found or if the result set is closed
207      */

208     public String JavaDoc getString(int columnIndex) throws SQLException {
209         try {
210             debugCodeCall("getString", columnIndex);
211             return get(columnIndex).getString();
212         } catch(Throwable JavaDoc e) {
213             throw logAndConvert(e);
214         }
215     }
216
217     /**
218      * Returns the value of the specified column as a String.
219      *
220      * @param columnName the name of the column label
221      * @return the value
222      * @throws SQLException if the column is not found or if the result set is closed
223      */

224     public String JavaDoc getString(String JavaDoc columnName) throws SQLException {
225         try {
226             debugCodeCall("getString", columnName);
227             return get(columnName).getString();
228         } catch(Throwable JavaDoc e) {
229             throw logAndConvert(e);
230         }
231     }
232
233     /**
234      * Returns the value of the specified column as an int.
235      *
236      * @param columnIndex (1,2,...)
237      * @return the value
238      * @throws SQLException if the column is not found or if the result set is closed
239      */

240     public int getInt(int columnIndex) throws SQLException {
241         try {
242             debugCodeCall("getInt", columnIndex);
243             return get(columnIndex).getInt();
244         } catch(Throwable JavaDoc e) {
245             throw logAndConvert(e);
246         }
247     }
248
249     /**
250      * Returns the value of the specified column as an int.
251      *
252      * @param columnName the name of the column label
253      * @return the value
254      * @throws SQLException if the column is not found or if the result set is closed
255      */

256     public int getInt(String JavaDoc columnName) throws SQLException {
257         try {
258             debugCodeCall("getInt", columnName);
259             return get(columnName).getInt();
260         } catch(Throwable JavaDoc e) {
261             throw logAndConvert(e);
262         }
263     }
264
265     /**
266      * Returns the value of the specified column as a String.
267      *
268      * @param columnIndex (1,2,...)
269      * @return the value
270      * @throws SQLException if the column is not found or if the result set is closed
271      */

272     public BigDecimal JavaDoc getBigDecimal(int columnIndex) throws SQLException {
273         try {
274             debugCodeCall("getBigDecimal", columnIndex);
275             return get(columnIndex).getBigDecimal();
276         } catch(Throwable JavaDoc e) {
277             throw logAndConvert(e);
278         }
279     }
280
281     /**
282      * Returns the value of the specified column as a java.sql.Date.
283      *
284      * @param columnIndex (1,2,...)
285      * @return the value
286      * @throws SQLException if the column is not found or if the result set is closed
287      */

288     public Date getDate(int columnIndex) throws SQLException {
289         try {
290             debugCodeCall("getDate", columnIndex);
291             return get(columnIndex).getDate();
292         } catch(Throwable JavaDoc e) {
293             throw logAndConvert(e);
294         }
295     }
296
297     /**
298      * Returns the value of the specified column as a java.sql.Time.
299      *
300      * @param columnIndex (1,2,...)
301      * @return the value
302      * @throws SQLException if the column is not found or if the result set is closed
303      */

304     public Time getTime(int columnIndex) throws SQLException {
305         try {
306             debugCodeCall("getTime", columnIndex);
307             return get(columnIndex).getTime();
308         } catch(Throwable JavaDoc e) {
309             throw logAndConvert(e);
310         }
311     }
312
313     /**
314      * Returns the value of the specified column as a java.sql.Timestamp.
315      *
316      * @param columnIndex (1,2,...)
317      * @return the value
318      * @throws SQLException if the column is not found or if the result set is closed
319      */

320     public Timestamp getTimestamp(int columnIndex) throws SQLException {
321         try {
322             debugCodeCall("getTimestamp", columnIndex);
323             return get(columnIndex).getTimestamp();
324         } catch(Throwable JavaDoc e) {
325             throw logAndConvert(e);
326         }
327     }
328
329     /**
330      * Returns the value of the specified column as a String.
331      *
332      * @param columnName the name of the column label
333      * @return the value
334      * @throws SQLException if the column is not found or if the result set is closed
335      */

336     public BigDecimal JavaDoc getBigDecimal(String JavaDoc columnName) throws SQLException {
337         try {
338             debugCodeCall("getBigDecimal", columnName);
339             return get(columnName).getBigDecimal();
340         } catch(Throwable JavaDoc e) {
341             throw logAndConvert(e);
342         }
343     }
344
345     /**
346      * Returns the value of the specified column as a java.sql.Date.
347      *
348      * @param columnName the name of the column label
349      * @return the value
350      * @throws SQLException if the column is not found or if the result set is closed
351      */

352     public Date getDate(String JavaDoc columnName) throws SQLException {
353         try {
354             debugCodeCall("getDate", columnName);
355             return get(columnName).getDate();
356         } catch(Throwable JavaDoc e) {
357             throw logAndConvert(e);
358         }
359     }
360
361     /**
362      * Returns the value of the specified column as a java.sql.Time.
363      *
364      * @param columnName the name of the column label
365      * @return the value
366      * @throws SQLException if the column is not found or if the result set is closed
367      */

368     public Time getTime(String JavaDoc columnName) throws SQLException {
369         try {
370             debugCodeCall("getTime", columnName);
371             return get(columnName).getTime();
372         } catch(Throwable JavaDoc e) {
373             throw logAndConvert(e);
374         }
375     }
376
377     /**
378      * Returns the value of the specified column as a java.sql.Timestamp.
379      *
380      * @param columnName the name of the column label
381      * @return the value
382      * @throws SQLException if the column is not found or if the result set is closed
383      */

384     public Timestamp getTimestamp(String JavaDoc columnName) throws SQLException {
385         try {
386             debugCodeCall("getTimestamp", columnName);
387             return get(columnName).getTimestamp();
388         } catch(Throwable JavaDoc e) {
389             throw logAndConvert(e);
390         }
391     }
392
393     /**
394      * Returns a column value as a Java object. For BINARY data, the data is deserialized into a Java Object.
395      *
396      * @param columnIndex (1,2,...)
397      * @return the value or null
398      * @throws SQLException if the column is not found or if the result set is closed
399      */

400     public Object JavaDoc getObject(int columnIndex) throws SQLException {
401         try {
402             debugCodeCall("getObject", columnIndex);
403             Value v = get(columnIndex);
404             if(Constants.SERIALIZE_JAVA_OBJECTS) {
405                 if (v.getType() == Value.JAVA_OBJECT) {
406                     return ByteUtils.deserialize(v.getBytesNoCopy());
407                 }
408             }
409             return v.getObject();
410         } catch(Throwable JavaDoc e) {
411             throw logAndConvert(e);
412         }
413     }
414
415     /**
416      * Returns a column value as a Java object. For BINARY data, the data is deserialized into a Java Object.
417      *
418      * @param columnName the name of the column label
419      * @return the value or null
420      * @throws SQLException if the column is not found or if the result set is closed
421      */

422     public Object JavaDoc getObject(String JavaDoc columnName) throws SQLException {
423         try {
424             debugCodeCall("getObject", columnName);
425             Value v = get(columnName);
426             if(Constants.SERIALIZE_JAVA_OBJECTS) {
427                 if (v.getType() == Value.JAVA_OBJECT) {
428                     return ByteUtils.deserialize(v.getBytesNoCopy());
429                 }
430             }
431             return v.getObject();
432         } catch(Throwable JavaDoc e) {
433             throw logAndConvert(e);
434         }
435     }
436
437     /**
438      * Returns the value of the specified column as a boolean.
439      *
440      * @param columnIndex (1,2,...)
441      * @return the value
442      * @throws SQLException if the column is not found or if the result set is closed
443      */

444     public boolean getBoolean(int columnIndex) throws SQLException {
445         try {
446             debugCodeCall("getBoolean", columnIndex);
447             Boolean JavaDoc v = get(columnIndex).getBoolean();
448             return v == null ? false : v.booleanValue();
449         } catch(Throwable JavaDoc e) {
450             throw logAndConvert(e);
451         }
452     }
453
454     /**
455      * Returns the value of the specified column as a boolean.
456      *
457      * @param columnName the name of the column label
458      * @return the value
459      * @throws SQLException if the column is not found or if the result set is closed
460      */

461     public boolean getBoolean(String JavaDoc columnName) throws SQLException {
462         try {
463             debugCodeCall("getBoolean", columnName);
464             Boolean JavaDoc v = get(columnName).getBoolean();
465             return v == null ? false : v.booleanValue();
466         } catch(Throwable JavaDoc e) {
467             throw logAndConvert(e);
468         }
469     }
470
471     /**
472      * Returns the value of the specified column as a byte.
473      *
474      * @param columnIndex (1,2,...)
475      * @return the value
476      * @throws SQLException if the column is not found or if the result set is closed
477      */

478     public byte getByte(int columnIndex) throws SQLException {
479         try {
480             debugCodeCall("getByte", columnIndex);
481             return get(columnIndex).getByte();
482         } catch(Throwable JavaDoc e) {
483             throw logAndConvert(e);
484         }
485     }
486
487     /**
488      * Returns the value of the specified column as a byte.
489      *
490      * @param columnName the name of the column label
491      * @return the value
492      * @throws SQLException if the column is not found or if the result set is closed
493      */

494     public byte getByte(String JavaDoc columnName) throws SQLException {
495         try {
496             debugCodeCall("getByte", columnName);
497             return get(columnName).getByte();
498         } catch(Throwable JavaDoc e) {
499             throw logAndConvert(e);
500         }
501     }
502
503     /**
504      * Returns the value of the specified column as a short.
505      *
506      * @param columnIndex (1,2,...)
507      * @return the value
508      * @throws SQLException if the column is not found or if the result set is closed
509      */

510     public short getShort(int columnIndex) throws SQLException {
511         try {
512             debugCodeCall("getShort", columnIndex);
513             return get(columnIndex).getShort();
514         } catch(Throwable JavaDoc e) {
515             throw logAndConvert(e);
516         }
517     }
518
519     /**
520      * Returns the value of the specified column as a short.
521      *
522      * @param columnName the name of the column label
523      * @return the value
524      * @throws SQLException if the column is not found or if the result set is closed
525      */

526     public short getShort(String JavaDoc columnName) throws SQLException {
527         try {
528             debugCodeCall("getShort", columnName);
529             return get(columnName).getShort();
530         } catch(Throwable JavaDoc e) {
531             throw logAndConvert(e);
532         }
533     }
534
535     /**
536      * Returns the value of the specified column as a long.
537      *
538      * @param columnIndex (1,2,...)
539      * @return the value
540      * @throws SQLException if the column is not found or if the result set is closed
541      */

542     public long getLong(int columnIndex) throws SQLException {
543         try {
544             debugCodeCall("getLong", columnIndex);
545             return get(columnIndex).getLong();
546         } catch(Throwable JavaDoc e) {
547             throw logAndConvert(e);
548         }
549     }
550
551     /**
552      * Returns the value of the specified column as a long.
553      *
554      * @param columnName the name of the column label
555      * @return the value
556      * @throws SQLException if the column is not found or if the result set is closed
557      */

558     public long getLong(String JavaDoc columnName) throws SQLException {
559         try {
560             debugCodeCall("getLong", columnName);
561             return get(columnName).getLong();
562         } catch(Throwable JavaDoc e) {
563             throw logAndConvert(e);
564         }
565     }
566
567     /**
568      * Returns the value of the specified column as a float.
569      *
570      * @param columnIndex (1,2,...)
571      * @return the value
572      * @throws SQLException if the column is not found or if the result set is closed
573      */

574     public float getFloat(int columnIndex) throws SQLException {
575         try {
576             debugCodeCall("getFloat", columnIndex);
577             return get(columnIndex).getFloat();
578         } catch(Throwable JavaDoc e) {
579             throw logAndConvert(e);
580         }
581     }
582
583     /**
584      * Returns the value of the specified column as a float.
585      *
586      * @param columnName the name of the column label
587      * @return the value
588      * @throws SQLException if the column is not found or if the result set is closed
589      */

590     public float getFloat(String JavaDoc columnName) throws SQLException {
591         try {
592             debugCodeCall("getFloat", columnName);
593             return get(columnName).getFloat();
594         } catch(Throwable JavaDoc e) {
595             throw logAndConvert(e);
596         }
597     }
598
599     /**
600      * Returns the value of the specified column as a double.
601      *
602      * @param columnIndex (1,2,...)
603      * @return the value
604      * @throws SQLException if the column is not found or if the result set is closed
605      */

606     public double getDouble(int columnIndex) throws SQLException {
607         try {
608             debugCodeCall("getDouble", columnIndex);
609             return get(columnIndex).getDouble();
610         } catch(Throwable JavaDoc e) {
611             throw logAndConvert(e);
612         }
613     }
614
615     /**
616      * Returns the value of the specified column as a double.
617      *
618      * @param columnName the name of the column label
619      * @return the value
620      * @throws SQLException if the column is not found or if the result set is closed
621      */

622     public double getDouble(String JavaDoc columnName) throws SQLException {
623         try {
624             debugCodeCall("getDouble", columnName);
625             return get(columnName).getDouble();
626         } catch(Throwable JavaDoc e) {
627             throw logAndConvert(e);
628         }
629     }
630
631     /**
632      * Returns the value of the specified column as a String.
633      * @deprecated
634      *
635      * @param columnName
636      * @return the value
637      * @throws SQLException if the column is not found or if the result set is closed
638      */

639     public BigDecimal JavaDoc getBigDecimal(String JavaDoc columnName, int scale) throws SQLException {
640         try {
641             if(debug()) {
642                 debugCode("getBigDecimal(" + StringUtils.quoteJavaString(columnName)+", "+scale+");");
643             }
644             if(scale < 0) {
645                 throw Message.getInvalidValueException(""+scale, "scale");
646             }
647             BigDecimal JavaDoc bd = get(columnName).getBigDecimal();
648             return bd == null ? null : MathUtils.setScale(bd, scale);
649         } catch(Throwable JavaDoc e) {
650             throw logAndConvert(e);
651         }
652     }
653
654     /**
655      * Returns the value of the specified column as a String.
656      * @deprecated
657      *
658      * @param columnIndex (1,2,...)
659      * @return the value
660      * @throws SQLException if the column is not found or if the result set is closed
661      */

662     public BigDecimal JavaDoc getBigDecimal(int columnIndex, int scale) throws SQLException {
663         try {
664             if(debug()) {
665                 debugCode("getBigDecimal(" + columnIndex+", "+scale+");");
666             }
667             if(scale < 0) {
668                 throw Message.getInvalidValueException(""+scale, "scale");
669             }
670             BigDecimal JavaDoc bd = get(columnIndex).getBigDecimal();
671             return bd == null ? null : MathUtils.setScale(bd, scale);
672         } catch(Throwable JavaDoc e) {
673             throw logAndConvert(e);
674         }
675     }
676
677     /**
678      * This feature is deprecated.
679      * @deprecated
680      *
681      * @throws SQLException Unsupported Feature (SQL State 0A000)
682      */

683     public InputStream JavaDoc getUnicodeStream(int columnIndex) throws SQLException {
684         try {
685             debugCodeCall("getUnicodeStream", columnIndex);
686             throw Message.getUnsupportedException();
687         } catch(Throwable JavaDoc e) {
688             throw logAndConvert(e);
689         }
690     }
691
692     /**
693      * This feature is deprecated.
694      * @deprecated
695      *
696      * @throws SQLException Unsupported Feature (SQL State 0A000)
697      */

698     public InputStream JavaDoc getUnicodeStream(String JavaDoc columnName) throws SQLException {
699         try {
700             debugCodeCall("getUnicodeStream", columnName);
701             throw Message.getUnsupportedException();
702         } catch(Throwable JavaDoc e) {
703             throw logAndConvert(e);
704         }
705     }
706
707     /**
708      * Gets a column as a object using the specified type mapping.
709      *
710      * @throws SQLException Unsupported Feature (SQL State 0A000)
711      */

712     public Object JavaDoc getObject(int columnIndex, Map JavaDoc map) throws SQLException {
713         try {
714             if(debug()) {
715                 debugCode("getObject(" + columnIndex + ", map);");
716             }
717             throw Message.getUnsupportedException();
718         } catch(Throwable JavaDoc e) {
719             throw logAndConvert(e);
720         }
721     }
722
723     /**
724      * Gets a column as a object using the specified type mapping.
725      *
726      * @throws SQLException Unsupported Feature (SQL State 0A000)
727      */

728     public Object JavaDoc getObject(String JavaDoc columnName, Map JavaDoc map) throws SQLException {
729         try {
730             if(debug()) {
731                 debugCode("getObject(" + quote(columnName) + ", map);");
732             }
733             throw Message.getUnsupportedException();
734         } catch(Throwable JavaDoc e) {
735             throw logAndConvert(e);
736         }
737     }
738
739     /**
740      * Gets a column as a reference.
741      *
742      * @throws SQLException Unsupported Feature (SQL State 0A000)
743      */

744     public Ref getRef(int columnIndex) throws SQLException {
745         try {
746             debugCodeCall("getRef", columnIndex);
747             throw Message.getUnsupportedException();
748         } catch(Throwable JavaDoc e) {
749             throw logAndConvert(e);
750         }
751     }
752
753     /**
754      * Gets a column as a reference.
755      *
756      * @throws SQLException Unsupported Feature (SQL State 0A000)
757      */

758     public Ref getRef(String JavaDoc columnName) throws SQLException {
759         try {
760             debugCodeCall("getRef", columnName);
761             throw Message.getUnsupportedException();
762         } catch(Throwable JavaDoc e) {
763             throw logAndConvert(e);
764         }
765     }
766
767     /**
768      * Returns the value of the specified column as a java.sql.Date using a specified timezone.
769      *
770      * @param columnIndex (1,2,...)
771      * @param calendar the calendar
772      * @return the value
773      * @throws SQLException if the column is not found or if the result set is closed
774      */

775     public Date getDate(int columnIndex, Calendar JavaDoc calendar) throws SQLException {
776         try {
777             if(debug()) {
778                 debugCode("getDate(" + columnIndex + ", calendar)");
779             }
780             Date x = get(columnIndex).getDate();
781             return DateTimeUtils.convertDateToCalendar(x, calendar);
782         } catch(Throwable JavaDoc e) {
783             throw logAndConvert(e);
784         }
785     }
786
787     /**
788      * Returns the value of the specified column as a java.sql.Date using a specified timezone.
789      *
790      * @param columnName the name of the column label
791      * @param calendar the calendar
792      * @return the value
793      * @throws SQLException if the column is not found or if the result set is closed
794      */

795     public Date getDate(String JavaDoc columnName, Calendar JavaDoc calendar) throws SQLException {
796         try {
797             if(debug()) {
798                 debugCode("getDate(" + StringUtils.quoteJavaString(columnName) + ", calendar)");
799             }
800             Date x = get(columnName).getDate();
801             return DateTimeUtils.convertDateToCalendar(x, calendar);
802         } catch(Throwable JavaDoc e) {
803             throw logAndConvert(e);
804         }
805     }
806
807     /**
808      * Returns the value of the specified column as a java.sql.Time using a specified timezone.
809      *
810      * @param columnIndex (1,2,...)
811      * @param calendar the calendar
812      * @return the value
813      * @throws SQLException if the column is not found or if the result set is closed
814      */

815     public Time getTime(int columnIndex, Calendar JavaDoc calendar) throws SQLException {
816         try {
817             if(debug()) {
818                 debugCode("getTime(" + columnIndex + ", calendar)");
819             }
820             Time x = get(columnIndex).getTime();
821             return DateTimeUtils.convertTimeToCalendar(x, calendar);
822         } catch(Throwable JavaDoc e) {
823             throw logAndConvert(e);
824         }
825     }
826
827     /**
828      * Returns the value of the specified column as a java.sql.Time using a specified timezone.
829      *
830      * @param columnName the name of the column label
831      * @param calendar the calendar
832      * @return the value
833      * @throws SQLException if the column is not found or if the result set is closed
834      */

835     public Time getTime(String JavaDoc columnName, Calendar JavaDoc calendar) throws SQLException {
836         try {
837             if(debug()) {
838                 debugCode("getTime(" + StringUtils.quoteJavaString(columnName) + ", calendar)");
839             }
840             Time x = get(columnName).getTime();
841             return DateTimeUtils.convertTimeToCalendar(x, calendar);
842         } catch(Throwable JavaDoc e) {
843             throw logAndConvert(e);
844         }
845     }
846
847     /**
848      * Returns the value of the specified column as a java.sql.Timestamp using a specified timezone.
849      *
850      * @param columnIndex (1,2,...)
851      * @param calendar the calendar
852      * @return the value
853      * @throws SQLException if the column is not found or if the result set is closed
854      */

855     public Timestamp getTimestamp(int columnIndex, Calendar JavaDoc calendar) throws SQLException {
856         try {
857             if(debug()) {
858                 debugCode("getTimestamp(" + columnIndex + ", calendar)");
859             }
860             Timestamp x = get(columnIndex).getTimestamp();
861             return DateTimeUtils.convertTimestampToCalendar(x, calendar);
862         } catch(Throwable JavaDoc e) {
863             throw logAndConvert(e);
864         }
865     }
866
867     /**
868      * Returns the value of the specified column as a java.sql.Timestamp.
869      *
870      * @param columnName the name of the column label
871      * @param calendar the calendar
872      * @return the value
873      * @throws SQLException if the column is not found or if the result set is closed
874      */

875     public Timestamp getTimestamp(String JavaDoc columnName, Calendar JavaDoc calendar) throws SQLException {
876         try {
877             if(debug()) {
878                 debugCode("getTimestamp(" + StringUtils.quoteJavaString(columnName) + ", calendar)");
879             }
880             Timestamp x = get(columnName).getTimestamp();
881             return DateTimeUtils.convertTimestampToCalendar(x, calendar);
882         } catch(Throwable JavaDoc e) {
883             throw logAndConvert(e);
884         }
885     }
886
887     /**
888      * Returns the value of the specified column as a Blob.
889      *
890      * @param columnName the name of the column label
891      * @return the value
892      * @throws SQLException if the column is not found or if the result set is closed
893      */

894     public Blob getBlob(int columnIndex) throws SQLException {
895         try {
896             int id = getNextId(TraceObject.BLOB);
897             debugCodeAssign("Blob", TraceObject.BLOB, id);
898             debugCodeCall("getBlob", columnIndex);
899             Value v = get(columnIndex);
900             return v == ValueNull.INSTANCE ? null : new JdbcBlob(session, conn, v, id);
901         } catch(Throwable JavaDoc e) {
902             throw logAndConvert(e);
903         }
904     }
905
906     /**
907      * Returns the value of the specified column as a Blob.
908      *
909      * @param columnIndex (1,2,...)
910      * @return the value
911      * @throws SQLException if the column is not found or if the result set is closed
912      */

913     public Blob getBlob(String JavaDoc columnName) throws SQLException {
914         try {
915             int id = getNextId(TraceObject.BLOB);
916             debugCodeAssign("Blob", TraceObject.BLOB, id);
917             debugCodeCall("getBlob", columnName);
918             Value v = get(columnName);
919             return v == ValueNull.INSTANCE ? null : new JdbcBlob(session, conn, v, id);
920         } catch(Throwable JavaDoc e) {
921             throw logAndConvert(e);
922         }
923     }
924
925     /**
926      * Returns the value of the specified column as a byte array.
927      *
928      * @param columnIndex (1,2,...)
929      * @return the value
930      * @throws SQLException if the column is not found or if the result set is closed
931      */

932     public byte[] getBytes(int columnIndex) throws SQLException {
933         try {
934             debugCodeCall("getBytes", columnIndex);
935             return get(columnIndex).getBytes();
936         } catch(Throwable JavaDoc e) {
937             throw logAndConvert(e);
938         }
939     }
940
941     /**
942      * Returns the value of the specified column as a byte array.
943      *
944      * @param columnName the name of the column label
945      * @return the value
946      * @throws SQLException if the column is not found or if the result set is closed
947      */

948     public byte[] getBytes(String JavaDoc columnName) throws SQLException {
949         try {
950             debugCodeCall("getBytes", columnName);
951             return get(columnName).getBytes();
952         } catch(Throwable JavaDoc e) {
953             throw logAndConvert(e);
954         }
955     }
956
957     /**
958      * Returns the value of the specified column as input stream.
959      *
960      * @param columnIndex (1,2,...)
961      * @return the value
962      * @throws SQLException if the column is not found or if the result set is closed
963      */

964     public InputStream JavaDoc getBinaryStream(int columnIndex) throws SQLException {
965         try {
966             debugCodeCall("getBinaryStream", columnIndex);
967             return get(columnIndex).getInputStream();
968         } catch(Throwable JavaDoc e) {
969             throw logAndConvert(e);
970         }
971     }
972
973     /**
974      * Returns the value of the specified column as input stream.
975      *
976      * @param columnName the name of the column label
977      * @return the value
978      * @throws SQLException if the column is not found or if the result set is closed
979      */

980     public InputStream JavaDoc getBinaryStream(String JavaDoc columnName) throws SQLException {
981         try {
982             debugCodeCall("getBinaryStream", columnName);
983             return get(columnName).getInputStream();
984         } catch(Throwable JavaDoc e) {
985             throw logAndConvert(e);
986         }
987     }
988
989
990     /**
991      * Returns the value of the specified column as a Clob.
992      *
993      * @param columnName the name of the column label
994      * @return the value
995      * @throws SQLException if the column is not found or if the result set is closed
996      */

997     public Clob getClob(int columnIndex) throws SQLException {
998         try {
999             int id = getNextId(TraceObject.CLOB);
1000            debugCodeAssign("Clob", TraceObject.CLOB, id);
1001            debugCodeCall("getClob", columnIndex);
1002            Value v = get(columnIndex);
1003            return v == ValueNull.INSTANCE ? null : new JdbcClob(session, conn, v, id);
1004        } catch(Throwable JavaDoc e) {
1005            throw logAndConvert(e);
1006        }
1007    }
1008
1009    /**
1010     * Returns the value of the specified column as a Clob.
1011     *
1012     * @param columnIndex (1,2,...)
1013     * @return the value
1014     * @throws SQLException if the column is not found or if the result set is closed
1015     */

1016    public Clob getClob(String JavaDoc columnName) throws SQLException {
1017        try {
1018            int id = getNextId(TraceObject.CLOB);
1019            debugCodeAssign("Clob", TraceObject.CLOB, id);
1020            debugCodeCall("getClob", columnName);
1021            Value v = get(columnName);
1022            return v == ValueNull.INSTANCE ? null : new JdbcClob(session, conn, v, id);
1023        } catch(Throwable JavaDoc e) {
1024            throw logAndConvert(e);
1025        }
1026    }
1027
1028    /**
1029     * Returns the value of the specified column as a Array.
1030     *
1031     * @throws SQLException Unsupported Feature (SQL State 0A000)
1032     */

1033    public Array getArray(int columnIndex) throws SQLException {
1034        try {
1035            debugCodeCall("getArray", columnIndex);
1036            throw Message.getUnsupportedException();
1037        } catch(Throwable JavaDoc e) {
1038            throw logAndConvert(e);
1039        }
1040    }
1041
1042    /**
1043     * Returns the value of the specified column as a Array.
1044     *
1045     * @throws SQLException Unsupported Feature (SQL State 0A000)
1046     */

1047    public Array getArray(String JavaDoc columnName) throws SQLException {
1048        try {
1049            debugCodeCall("getArray", columnName);
1050            throw Message.getUnsupportedException();
1051        } catch(Throwable JavaDoc e) {
1052            throw logAndConvert(e);
1053        }
1054    }
1055
1056    /**
1057     * Returns the value of the specified column as input stream.
1058     *
1059     * @param columnIndex (1,2,...)
1060     * @return the value
1061     * @throws SQLException if the column is not found or if the result set is closed
1062     */

1063    public InputStream JavaDoc getAsciiStream(int columnIndex) throws SQLException {
1064        try {
1065            debugCodeCall("getAsciiStream", columnIndex);
1066            String JavaDoc s = get(columnIndex).getString();
1067            // TODO ascii stream: convert the reader to a ascii stream
1068
return s == null ? null : IOUtils.getInputStream(s);
1069        } catch(Throwable JavaDoc e) {
1070            throw logAndConvert(e);
1071        }
1072    }
1073
1074    /**
1075     * Returns the value of the specified column as input stream.
1076     *
1077     * @param columnName the name of the column label
1078     * @return the value
1079     * @throws SQLException if the column is not found or if the result set is closed
1080     */

1081    public InputStream JavaDoc getAsciiStream(String JavaDoc columnName) throws SQLException {
1082        try {
1083            debugCodeCall("getAsciiStream", columnName);
1084            String JavaDoc s = get(columnName).getString();
1085            // TODO ascii stream: convert the reader to a ascii stream
1086
return IOUtils.getInputStream(s);
1087        } catch(Throwable JavaDoc e) {
1088            throw logAndConvert(e);
1089        }
1090    }
1091
1092    /**
1093     * Returns the value of the specified column as input stream.
1094     *
1095     * @param columnIndex (1,2,...)
1096     * @return the value
1097     * @throws SQLException if the column is not found or if the result set is closed
1098     */

1099    public Reader JavaDoc getCharacterStream(int columnIndex) throws SQLException {
1100        try {
1101            debugCodeCall("getCharacterStream", columnIndex);
1102            return get(columnIndex).getReader();
1103        } catch(Throwable JavaDoc e) {
1104            throw logAndConvert(e);
1105        }
1106    }
1107
1108    /**
1109     * Returns the value of the specified column as input stream.
1110     *
1111     * @param columnName the name of the column label
1112     * @return the value
1113     * @throws SQLException if the column is not found or if the result set is closed
1114     */

1115    public Reader JavaDoc getCharacterStream(String JavaDoc columnName) throws SQLException {
1116        try {
1117            debugCodeCall("getCharacterStream", columnName);
1118            return get(columnName).getReader();
1119        } catch(Throwable JavaDoc e) {
1120            throw logAndConvert(e);
1121        }
1122    }
1123
1124    /**
1125     * THIS FEATURE IS NOT SUPPORTED.
1126     *
1127     * @throws SQLException Unsupported Feature (SQL State 0A000)
1128     */

1129    public URL JavaDoc getURL(int columnIndex) throws SQLException {
1130        try {
1131            debugCodeCall("getURL", columnIndex);
1132            throw Message.getUnsupportedException();
1133        } catch(Throwable JavaDoc e) {
1134            throw logAndConvert(e);
1135        }
1136    }
1137
1138    /**
1139     * THIS FEATURE IS NOT SUPPORTED.
1140     *
1141     * @throws SQLException Unsupported Feature (SQL State 0A000)
1142     */

1143    public URL JavaDoc getURL(String JavaDoc columnName) throws SQLException {
1144        try {
1145            debugCodeCall("getURL", columnName);
1146            throw Message.getUnsupportedException();
1147        } catch(Throwable JavaDoc e) {
1148            throw logAndConvert(e);
1149        }
1150    }
1151
1152    // =============================================================
1153

1154    /**
1155     * Updates a column in the current or insert row.
1156     *
1157     * @param columnIndex (1,2,...)
1158     * @throws SQLException if the result set is closed
1159     */

1160    public void updateNull(int columnIndex) throws SQLException {
1161        try {
1162            debugCodeCall("updateNull", columnIndex);
1163            update(columnIndex, ValueNull.INSTANCE);
1164        } catch(Throwable JavaDoc e) {
1165            throw logAndConvert(e);
1166        }
1167    }
1168
1169    /**
1170     * Updates a column in the current or insert row.
1171     *
1172     * @param columnName the name of the column label
1173     * @throws SQLException if the result set is closed
1174     */

1175    public void updateNull(String JavaDoc columnName) throws SQLException {
1176        try {
1177            debugCodeCall("updateNull", columnName);
1178            update(columnName, ValueNull.INSTANCE);
1179        } catch(Throwable JavaDoc e) {
1180            throw logAndConvert(e);
1181        }
1182    }
1183
1184    /**
1185     * Updates a column in the current or insert row.
1186     *
1187     * @param columnIndex (1,2,...)
1188     * @param x the value
1189     * @throws SQLException if the result set is closed
1190     */

1191    public void updateBoolean(int columnIndex, boolean x) throws SQLException {
1192        try {
1193            if(debug()) {
1194                debugCode("updateBoolean("+columnIndex+", "+x+");");
1195            }
1196            update(columnIndex, ValueBoolean.get(x));
1197        } catch(Throwable JavaDoc e) {
1198            throw logAndConvert(e);
1199        }
1200    }
1201
1202    /**
1203     * Updates a column in the current or insert row.
1204     *
1205     * @param columnName the name of the column label
1206     * @param x the value
1207     * @throws SQLException if result set is closed
1208     */

1209    public void updateBoolean(String JavaDoc columnName, boolean x) throws SQLException {
1210        try {
1211            if(debug()) {
1212                debugCode("updateBoolean("+quote(columnName)+", "+x+");");
1213            }
1214            update(columnName, ValueBoolean.get(x));
1215        } catch(Throwable JavaDoc e) {
1216            throw logAndConvert(e);
1217        }
1218    }
1219
1220    /**
1221     * Updates a column in the current or insert row.
1222     *
1223     * @param columnIndex (1,2,...)
1224     * @param x the value
1225     * @throws SQLException if the result set is closed
1226     */

1227    public void updateByte(int columnIndex, byte x) throws SQLException {
1228        try {
1229            if(debug()) {
1230                debugCode("updateByte("+columnIndex+", "+x+");");
1231            }
1232            update(columnIndex, ValueByte.get(x));
1233        } catch(Throwable JavaDoc e) {
1234            throw logAndConvert(e);
1235        }
1236    }
1237
1238    /**
1239     * Updates a column in the current or insert row.
1240     *
1241     * @param columnName the name of the column label
1242     * @param x the value
1243     * @throws SQLException if the result set is closed
1244     */

1245    public void updateByte(String JavaDoc columnName, byte x) throws SQLException {
1246        try {
1247            if(debug()) {
1248                debugCode("updateByte("+columnName+", "+x+");");
1249            }
1250            update(columnName, ValueByte.get(x));
1251        } catch(Throwable JavaDoc e) {
1252            throw logAndConvert(e);
1253        }
1254    }
1255
1256    /**
1257     * Updates a column in the current or insert row.
1258     *
1259     * @param columnIndex (1,2,...)
1260     * @param x the value
1261     * @throws SQLException if the result set is closed
1262     */

1263    public void updateBytes(int columnIndex, byte[] x) throws SQLException {
1264        try {
1265            if(debug()) {
1266                debugCode("updateBytes("+columnIndex+", x);");
1267            }
1268            update(columnIndex, x == null ? (Value) ValueNull.INSTANCE : ValueBytes.get(x));
1269        } catch(Throwable JavaDoc e) {
1270            throw logAndConvert(e);
1271        }
1272    }
1273
1274    /**
1275     * Updates a column in the current or insert row.
1276     *
1277     * @param columnName the name of the column label
1278     * @param x the value
1279     * @throws SQLException if the result set is closed
1280     */

1281    public void updateBytes(String JavaDoc columnName, byte[] x) throws SQLException {
1282        try {
1283            if(debug()) {
1284                debugCode("updateBytes("+quote(columnName)+", x);");
1285            }
1286            update(columnName, x == null ? (Value) ValueNull.INSTANCE : ValueBytes.get(x));
1287        } catch(Throwable JavaDoc e) {
1288            throw logAndConvert(e);
1289        }
1290    }
1291
1292    /**
1293     * Updates a column in the current or insert row.
1294     *
1295     * @param columnIndex (1,2,...)
1296     * @param x the value
1297     * @throws SQLException if the result set is closed
1298     */

1299    public void updateShort(int columnIndex, short x) throws SQLException {
1300        try {
1301            if(debug()) {
1302                debugCode("updateShort("+columnIndex+", "+x+");");
1303            }
1304            update(columnIndex, ValueShort.get(x));
1305        } catch(Throwable JavaDoc e) {
1306            throw logAndConvert(e);
1307        }
1308    }
1309
1310    /**
1311     * Updates a column in the current or insert row.
1312     *
1313     * @param columnName the name of the column label
1314     * @param x the value
1315     * @throws SQLException if the result set is closed
1316     */

1317    public void updateShort(String JavaDoc columnName, short x) throws SQLException {
1318        try {
1319            if(debug()) {
1320                debugCode("updateShort("+quote(columnName)+", "+x+");");
1321            }
1322            update(columnName, ValueShort.get(x));
1323        } catch(Throwable JavaDoc e) {
1324            throw logAndConvert(e);
1325        }
1326    }
1327
1328    /**
1329     * Updates a column in the current or insert row.
1330     *
1331     * @param columnIndex (1,2,...)
1332     * @param x the value
1333     * @throws SQLException if the result set is closed
1334     */

1335    public void updateInt(int columnIndex, int x) throws SQLException {
1336        try {
1337            if(debug()) {
1338                debugCode("updateInt("+columnIndex+", "+x+");");
1339            }
1340            update(columnIndex, ValueInt.get(x));
1341        } catch(Throwable JavaDoc e) {
1342            throw logAndConvert(e);
1343        }
1344    }
1345
1346    /**
1347     * Updates a column in the current or insert row.
1348     *
1349     * @param columnName the name of the column label
1350     * @param x the value
1351     * @throws SQLException if the result set is closed
1352     */

1353    public void updateInt(String JavaDoc columnName, int x) throws SQLException {
1354        try {
1355            if(debug()) {
1356                debugCode("updateInt("+quote(columnName)+", "+x+");");
1357            }
1358            update(columnName, ValueInt.get(x));
1359        } catch(Throwable JavaDoc e) {
1360            throw logAndConvert(e);
1361        }
1362    }
1363
1364    /**
1365     * Updates a column in the current or insert row.
1366     *
1367     * @param columnIndex (1,2,...)
1368     * @param x the value
1369     * @throws SQLException if the result set is closed
1370     */

1371    public void updateLong(int columnIndex, long x) throws SQLException {
1372        try {
1373            if(debug()) {
1374                debugCode("updateLong("+columnIndex+", "+x+");");
1375            }
1376            update(columnIndex, ValueLong.get(x));
1377        } catch(Throwable JavaDoc e) {
1378            throw logAndConvert(e);
1379        }
1380    }
1381
1382    /**
1383     * Updates a column in the current or insert row.
1384     *
1385     * @param columnName the name of the column label
1386     * @param x the value
1387     * @throws SQLException if the result set is closed
1388     */

1389    public void updateLong(String JavaDoc columnName, long x) throws SQLException {
1390        try {
1391            if(debug()) {
1392                debugCode("updateLong("+quote(columnName)+", "+x+");");
1393            }
1394            update(columnName, ValueLong.get(x));
1395        } catch(Throwable JavaDoc e) {
1396            throw logAndConvert(e);
1397        }
1398    }
1399
1400    /**
1401     * Updates a column in the current or insert row.
1402     *
1403     * @param columnIndex (1,2,...)
1404     * @param x the value
1405     * @throws SQLException if the result set is closed
1406     */

1407    public void updateFloat(int columnIndex, float x) throws SQLException {
1408        try {
1409            if(debug()) {
1410                debugCode("updateFloat("+columnIndex+", "+x+"f);");
1411            }
1412            update(columnIndex, ValueFloat.get(x));
1413        } catch(Throwable JavaDoc e) {
1414            throw logAndConvert(e);
1415        }
1416    }
1417
1418    /**
1419     * Updates a column in the current or insert row.
1420     *
1421     * @param columnName the name of the column label
1422     * @param x the value
1423     * @throws SQLException if the result set is closed
1424     */

1425    public void updateFloat(String JavaDoc columnName, float x) throws SQLException {
1426        try {
1427            if(debug()) {
1428                debugCode("updateFloat("+quote(columnName)+", "+x+"f);");
1429            }
1430            update(columnName, ValueFloat.get(x));
1431        } catch(Throwable JavaDoc e) {
1432            throw logAndConvert(e);
1433        }
1434    }
1435
1436    /**
1437     * Updates a column in the current or insert row.
1438     *
1439     * @param columnIndex (1,2,...)
1440     * @param x the value
1441     * @throws SQLException if the result set is closed
1442     */

1443    public void updateDouble(int columnIndex, double x) throws SQLException {
1444        try {
1445            if(debug()) {
1446                debugCode("updateDouble("+columnIndex+", "+x+");");
1447            }
1448            update(columnIndex, ValueDouble.get(x));
1449        } catch(Throwable JavaDoc e) {
1450            throw logAndConvert(e);
1451        }
1452    }
1453
1454    /**
1455     * Updates a column in the current or insert row.
1456     *
1457     * @param columnName the name of the column label
1458     * @param x the value
1459     * @throws SQLException if the result set is closed
1460     */

1461    public void updateDouble(String JavaDoc columnName, double x) throws SQLException {
1462        try {
1463            if(debug()) {
1464                debugCode("updateDouble("+quote(columnName)+", "+x+");");
1465            }
1466            update(columnName, ValueDouble.get(x));
1467        } catch(Throwable JavaDoc e) {
1468            throw logAndConvert(e);
1469        }
1470    }
1471
1472    /**
1473     * Updates a column in the current or insert row.
1474     *
1475     * @param columnIndex (1,2,...)
1476     * @param x the value
1477     * @throws SQLException if the result set is closed
1478     */

1479    public void updateBigDecimal(int columnIndex, BigDecimal JavaDoc x) throws SQLException {
1480        try {
1481            if(debug()) {
1482                debugCode("updateBigDecimal("+columnIndex+", x);");
1483            }
1484            update(columnIndex, x == null ? (Value) ValueNull.INSTANCE : ValueDecimal.get(x));
1485        } catch(Throwable JavaDoc e) {
1486            throw logAndConvert(e);
1487        }
1488    }
1489
1490    /**
1491     * Updates a column in the current or insert row.
1492     *
1493     * @param columnName the name of the column label
1494     * @param x the value
1495     * @throws SQLException if the result set is closed
1496     */

1497    public void updateBigDecimal(String JavaDoc columnName, BigDecimal JavaDoc x) throws SQLException {
1498        try {
1499            if(debug()) {
1500                debugCode("updateBigDecimal("+quote(columnName)+", x);");
1501            }
1502            update(columnName, x == null ? (Value) ValueNull.INSTANCE : ValueDecimal.get(x));
1503        } catch(Throwable JavaDoc e) {
1504            throw logAndConvert(e);
1505        }
1506    }
1507
1508    /**
1509     * Updates a column in the current or insert row.
1510     *
1511     * @param columnIndex (1,2,...)
1512     * @param x the value
1513     * @throws SQLException if the result set is closed
1514     */

1515    public void updateString(int columnIndex, String JavaDoc x) throws SQLException {
1516        try {
1517            if(debug()) {
1518                debugCode("updateString("+columnIndex+", "+quote(x)+");");
1519            }
1520            update(columnIndex, x == null ? (Value) ValueNull.INSTANCE : ValueString.get(x));
1521        } catch(Throwable JavaDoc e) {
1522            throw logAndConvert(e);
1523        }
1524    }
1525
1526    /**
1527     * Updates a column in the current or insert row.
1528     *
1529     * @param columnName the name of the column label
1530     * @param x the value
1531     * @throws SQLException if the result set is closed
1532     */

1533    public void updateString(String JavaDoc columnName, String JavaDoc x) throws SQLException {
1534        try {
1535            if(debug()) {
1536                debugCode("updateString("+quote(columnName)+", "+quote(x)+");");
1537            }
1538            update(columnName, x == null ? (Value) ValueNull.INSTANCE : ValueString.get(x));
1539        } catch(Throwable JavaDoc e) {
1540            throw logAndConvert(e);
1541        }
1542    }
1543
1544    /**
1545     * Updates a column in the current or insert row.
1546     *
1547     * @param columnIndex (1,2,...)
1548     * @param x the value
1549     * @throws SQLException if the result set is closed
1550     */

1551    public void updateDate(int columnIndex, Date x) throws SQLException {
1552        try {
1553            if(debug()) {
1554                debugCode("updateDate("+columnIndex+", x);");
1555            }
1556            update(columnIndex, x == null ? (Value) ValueNull.INSTANCE : ValueDate.get(x));
1557        } catch(Throwable JavaDoc e) {
1558            throw logAndConvert(e);
1559        }
1560    }
1561
1562    /**
1563     * Updates a column in the current or insert row.
1564     *
1565     * @param columnName the name of the column label
1566     * @param x the value
1567     * @throws SQLException if the result set is closed
1568     */

1569    public void updateDate(String JavaDoc columnName, Date x) throws SQLException {
1570        try {
1571            if(debug()) {
1572                debugCode("updateDate("+quote(columnName)+", x);");
1573            }
1574            update(columnName, x == null ? (Value) ValueNull.INSTANCE : ValueDate.get(x));
1575        } catch(Throwable JavaDoc e) {
1576            throw logAndConvert(e);
1577        }
1578    }
1579
1580    /**
1581     * Updates a column in the current or insert row.
1582     *
1583     * @param columnIndex (1,2,...)
1584     * @param x the value
1585     * @throws SQLException if the result set is closed
1586     */

1587    public void updateTime(int columnIndex, Time x) throws SQLException {
1588        try {
1589            if(debug()) {
1590                debugCode("updateTime("+columnIndex+", x);");
1591            }
1592            update(columnIndex, x == null ? (Value) ValueNull.INSTANCE : ValueTime.get(x));
1593        } catch(Throwable JavaDoc e) {
1594            throw logAndConvert(e);
1595        }
1596    }
1597
1598    /**
1599     * Updates a column in the current or insert row.
1600     *
1601     * @param columnName the name of the column label
1602     * @param x the value
1603     * @throws SQLException if the result set is closed
1604     */

1605    public void updateTime(String JavaDoc columnName, Time x) throws SQLException {
1606        try {
1607            if(debug()) {
1608                debugCode("updateTime("+quote(columnName)+", x);");
1609            }
1610            update(columnName, x == null ? (Value) ValueNull.INSTANCE : ValueTime.get(x));
1611        } catch(Throwable JavaDoc e) {
1612            throw logAndConvert(e);
1613        }
1614    }
1615
1616    /**
1617     * Updates a column in the current or insert row.
1618     *
1619     * @param columnIndex (1,2,...)
1620     * @param x the value
1621     * @throws SQLException if the result set is closed
1622     */

1623    public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException {
1624        try {
1625            if(debug()) {
1626                debugCode("updateTimestamp("+columnIndex+", x);");
1627            }
1628            update(columnIndex, x == null ? (Value) ValueNull.INSTANCE : ValueTimestamp.get(x));
1629        } catch(Throwable JavaDoc e) {
1630            throw logAndConvert(e);
1631        }
1632    }
1633
1634    /**
1635     * Updates a column in the current or insert row.
1636     *
1637     * @param columnName the name of the column label
1638     * @param x the value
1639     * @throws SQLException if the result set is closed
1640     */

1641    public void updateTimestamp(String JavaDoc columnName, Timestamp x) throws SQLException {
1642        try {
1643            if(debug()) {
1644                debugCode("updateTimestamp("+quote(columnName)+", x);");
1645            }
1646            update(columnName, x == null ? (Value) ValueNull.INSTANCE : ValueTimestamp.get(x));
1647        } catch(Throwable JavaDoc e) {
1648            throw logAndConvert(e);
1649        }
1650    }
1651
1652    /**
1653     * Updates a column in the current or insert row.
1654     *
1655     * @param columnIndex (1,2,...)
1656     * @param x the value
1657     * @param length the number of characters
1658     * @throws SQLException if the result set is closed
1659     */

1660    public void updateAsciiStream(int columnIndex, InputStream JavaDoc x, int length) throws SQLException {
1661        updateAsciiStream(columnIndex, x, (long) length);
1662    }
1663    
1664    /**
1665     * Updates a column in the current or insert row.
1666     *
1667     * @param columnIndex (1,2,...)
1668     * @param x the value
1669     * @param length the number of characters
1670     * @throws SQLException if the result set is closed
1671     */

1672    public void updateAsciiStream(int columnIndex, InputStream JavaDoc x) throws SQLException {
1673        updateAsciiStream(columnIndex, x, -1);
1674    }
1675
1676    /**
1677     * Updates a column in the current or insert row.
1678     *
1679     * @param columnIndex (1,2,...)
1680     * @param x the value
1681     * @param length the number of characters
1682     * @throws SQLException if the result set is closed
1683     */

1684    public void updateAsciiStream(int columnIndex, InputStream JavaDoc x, long length) throws SQLException {
1685        try {
1686            if(debug()) {
1687                debugCode("updateAsciiStream("+columnIndex+", x, "+length+");");
1688            }
1689            checkClosed();
1690            Value v = conn.createClob(IOUtils.getAsciiReader(x), length);
1691            update(columnIndex, v);
1692        } catch(Throwable JavaDoc e) {
1693            throw logAndConvert(e);
1694        }
1695    }
1696
1697    /**
1698     * Updates a column in the current or insert row.
1699     *
1700     * @param columnName the name of the column label
1701     * @param x the value
1702     * @param length the number of characters
1703     * @throws SQLException if the result set is closed
1704     */

1705    public void updateAsciiStream(String JavaDoc columnName, InputStream JavaDoc x, int length) throws SQLException {
1706        updateAsciiStream(columnName, x, (long) length);
1707    }
1708
1709    /**
1710     * Updates a column in the current or insert row.
1711     *
1712     * @param columnName the name of the column label
1713     * @param x the value
1714     * @param length the number of characters
1715     * @throws SQLException if the result set is closed
1716     */

1717    public void updateAsciiStream(String JavaDoc columnName, InputStream JavaDoc x) throws SQLException {
1718        updateAsciiStream(columnName, x, -1);
1719    }
1720
1721    /**
1722     * Updates a column in the current or insert row.
1723     *
1724     * @param columnName the name of the column label
1725     * @param x the value
1726     * @param length the number of characters
1727     * @throws SQLException if the result set is closed
1728     */

1729    public void updateAsciiStream(String JavaDoc columnName, InputStream JavaDoc x, long length) throws SQLException {
1730        try {
1731            if(debug()) {
1732                debugCode("updateAsciiStream("+quote(columnName)+", x, "+length+");");
1733            }
1734            checkClosed();
1735            Value v = conn.createClob(IOUtils.getAsciiReader(x), length);
1736            update(columnName, v);
1737        } catch(Throwable JavaDoc e) {
1738            throw logAndConvert(e);
1739        }
1740    }
1741
1742    /**
1743     * Updates a column in the current or insert row.
1744     *
1745     * @param columnIndex (1,2,...)
1746     * @param x the value
1747     * @param length the number of characters
1748     * @throws SQLException if the result set is closed
1749     */

1750    public void updateBinaryStream(int columnIndex, InputStream JavaDoc x, int length) throws SQLException {
1751        updateBinaryStream(columnIndex, x, (long) length);
1752    }
1753
1754    /**
1755     * Updates a column in the current or insert row.
1756     *
1757     * @param columnIndex (1,2,...)
1758     * @param x the value
1759     * @throws SQLException if the result set is closed
1760     */

1761    public void updateBinaryStream(int columnIndex, InputStream JavaDoc x) throws SQLException {
1762        updateBinaryStream(columnIndex, x, -1);
1763    }
1764
1765    /**
1766     * Updates a column in the current or insert row.
1767     *
1768     * @param columnIndex (1,2,...)
1769     * @param x the value
1770     * @param length the number of characters
1771     * @throws SQLException if the result set is closed
1772     */

1773    public void updateBinaryStream(int columnIndex, InputStream JavaDoc x, long length) throws SQLException {
1774        try {
1775            if(debug()) {
1776                debugCode("updateBinaryStream("+columnIndex+", x, "+length+");");
1777            }
1778            checkClosed();
1779            Value v = conn.createBlob(x, length);
1780            update(columnIndex, v);
1781        } catch(Throwable JavaDoc e) {
1782            throw logAndConvert(e);
1783        }
1784    }
1785
1786    /**
1787     * Updates a column in the current or insert row.
1788     *
1789     * @param columnName the name of the column label
1790     * @param x the value
1791     * @throws SQLException if the result set is closed
1792     */

1793    public void updateBinaryStream(String JavaDoc columnName, InputStream JavaDoc x) throws SQLException {
1794        updateBinaryStream(columnName, x, -1);
1795    }
1796
1797    /**
1798     * Updates a column in the current or insert row.
1799     *
1800     * @param columnName the name of the column label
1801     * @param x the value
1802     * @param length the number of characters
1803     * @throws SQLException if the result set is closed
1804     */

1805    public void updateBinaryStream(String JavaDoc columnName, InputStream JavaDoc x, int length) throws SQLException {
1806        updateBinaryStream(columnName, x, (long) length);
1807    }
1808    
1809    /**
1810     * Updates a column in the current or insert row.
1811     *
1812     * @param columnName the name of the column label
1813     * @param x the value
1814     * @param length the number of characters
1815     * @throws SQLException if the result set is closed
1816     */

1817    public void updateBinaryStream(String JavaDoc columnName, InputStream JavaDoc x, long length) throws SQLException {
1818        try {
1819            if(debug()) {
1820                debugCode("updateBinaryStream("+quote(columnName)+", x, "+length+");");
1821            }
1822            checkClosed();
1823            Value v = conn.createBlob(x, length);
1824            update(columnName, v);
1825        } catch(Throwable JavaDoc e) {
1826            throw logAndConvert(e);
1827        }
1828    }
1829
1830    /**
1831     * Updates a column in the current or insert row.
1832     *
1833     * @param columnIndex (1,2,...)
1834     * @param x the value
1835     * @param length the number of characters
1836     * @throws SQLException if the result set is closed
1837     */

1838    public void updateCharacterStream(int columnIndex, Reader JavaDoc x, long length) throws SQLException {
1839        try {
1840            if(debug()) {
1841                debugCode("updateCharacterStream("+columnIndex+", x, "+length+");");
1842            }
1843            checkClosed();
1844            Value v = conn.createClob(x, length);
1845            update(columnIndex, v);
1846        } catch(Throwable JavaDoc e) {
1847            throw logAndConvert(e);
1848        }
1849    }
1850
1851    /**
1852     * Updates a column in the current or insert row.
1853     *
1854     * @param columnIndex (1,2,...)
1855     * @param x the value
1856     * @param length the number of characters
1857     * @throws SQLException if the result set is closed
1858     */

1859    public void updateCharacterStream(int columnIndex, Reader JavaDoc x, int length) throws SQLException {
1860        updateCharacterStream(columnIndex, x, (long) length);
1861    }
1862
1863    /**
1864     * Updates a column in the current or insert row.
1865     *
1866     * @param columnIndex (1,2,...)
1867     * @param x the value
1868     * @throws SQLException if the result set is closed
1869     */

1870    public void updateCharacterStream(int columnIndex, Reader JavaDoc x) throws SQLException {
1871        updateCharacterStream(columnIndex, x, -1);
1872    }
1873
1874    /**
1875     * Updates a column in the current or insert row.
1876     *
1877     * @param columnName the name of the column label
1878     * @param x the value
1879     * @param length the number of characters
1880     * @throws SQLException if the result set is closed
1881     */

1882    public void updateCharacterStream(String JavaDoc columnName, Reader JavaDoc x, int length) throws SQLException {
1883        updateCharacterStream(columnName, x, (long) length);
1884    }
1885    
1886    /**
1887     * Updates a column in the current or insert row.
1888     *
1889     * @param columnName the name of the column label
1890     * @param x the value
1891     * @throws SQLException if the result set is closed
1892     */

1893    public void updateCharacterStream(String JavaDoc columnName, Reader JavaDoc x) throws SQLException {
1894        updateCharacterStream(columnName, x, -1);
1895    }
1896    
1897    /**
1898     * Updates a column in the current or insert row.
1899     *
1900     * @param columnName the name of the column label
1901     * @param x the value
1902     * @param length the number of characters
1903     * @throws SQLException if the result set is closed
1904     */

1905    public void updateCharacterStream(String JavaDoc columnName, Reader JavaDoc x, long length) throws SQLException {
1906        try {
1907            if(debug()) {
1908                debugCode("updateCharacterStream("+quote(columnName)+", x, "+length+");");
1909            }
1910            checkClosed();
1911            Value v = conn.createClob(x, length);
1912            update(columnName, v);
1913        } catch(Throwable JavaDoc e) {
1914            throw logAndConvert(e);
1915        }
1916    }
1917
1918    /**
1919     * Updates a column in the current or insert row.
1920     *
1921     * @param columnIndex (1,2,...)
1922     * @param x the value
1923     * @param scale is ignored
1924     * @throws SQLException if the result set is closed
1925     */

1926    public void updateObject(int columnIndex, Object JavaDoc x, int scale) throws SQLException {
1927        try {
1928            if(debug()) {
1929                debugCode("updateObject("+columnIndex+", x, "+scale+");");
1930            }
1931            update(columnIndex, DataType.convertToValue(session, x, Value.UNKNOWN));
1932        } catch(Throwable JavaDoc e) {
1933            throw logAndConvert(e);
1934        }
1935    }
1936
1937    /**
1938     * Updates a column in the current or insert row.
1939     *
1940     * @param columnName the name of the column label
1941     * @param x the value
1942     * @param scale is ignored
1943     * @throws SQLException if the result set is closed
1944     */

1945    public void updateObject(String JavaDoc columnName, Object JavaDoc x, int scale) throws SQLException {
1946        try {
1947            if(debug()) {
1948                debugCode("updateObject("+quote(columnName)+", x, "+scale+");");
1949            }
1950            update(columnName, DataType.convertToValue(session, x, Value.UNKNOWN));
1951        } catch(Throwable JavaDoc e) {
1952            throw logAndConvert(e);
1953        }
1954    }
1955
1956    /**
1957     * Updates a column in the current or insert row.
1958     *
1959     * @param columnIndex (1,2,...)
1960     * @param x the value
1961     * @throws SQLException if the result set is closed
1962     */

1963    public void updateObject(int columnIndex, Object JavaDoc x) throws SQLException {
1964        try {
1965            if(debug()) {
1966                debugCode("updateObject("+columnIndex+", x);");
1967            }
1968            update(columnIndex, DataType.convertToValue(session, x, Value.UNKNOWN));
1969        } catch(Throwable JavaDoc e) {
1970            throw logAndConvert(e);
1971        }
1972    }
1973
1974    /**
1975     * Updates a column in the current or insert row.
1976     *
1977     * @param columnName the name of the column label
1978     * @param x the value
1979     * @throws SQLException if the result set is closed
1980     */

1981    public void updateObject(String JavaDoc columnName, Object JavaDoc x) throws SQLException {
1982        try {
1983            if(debug()) {
1984                debugCode("updateObject("+quote(columnName)+", x);");
1985            }
1986            update(columnName, DataType.convertToValue(session, x, Value.UNKNOWN));
1987        } catch(Throwable JavaDoc e) {
1988            throw logAndConvert(e);
1989        }
1990    }
1991
1992    /**
1993     * THIS FEATURE IS NOT SUPPORTED.
1994     *
1995     * @throws SQLException Unsupported Feature (SQL State 0A000)
1996     */

1997    public void updateRef(int columnIndex, Ref x) throws SQLException {
1998        try {
1999            if(debug()) {
2000                debugCode("updateRef("+columnIndex+", x);");
2001            }
2002            throw Message.getUnsupportedException();
2003        } catch(Throwable JavaDoc e) {
2004            throw logAndConvert(e);
2005        }
2006    }
2007
2008    /**
2009     * THIS FEATURE IS NOT SUPPORTED.
2010     *
2011     * @throws SQLException Unsupported Feature (SQL State 0A000)
2012     */

2013    public void updateRef(String JavaDoc columnName, Ref x) throws SQLException {
2014        try {
2015            if(debug()) {
2016                debugCode("updateRef("+quote(columnName)+", x);");
2017            }
2018            throw Message.getUnsupportedException();
2019        } catch(Throwable JavaDoc e) {
2020            throw logAndConvert(e);
2021        }
2022    }
2023
2024    /**
2025     * Updates a column in the current or insert row.
2026     *
2027     * @param columnIndex (1,2,...)
2028     * @param x the value
2029     * @throws SQLException if the result set is closed
2030     */

2031    public void updateBlob(int columnIndex, InputStream JavaDoc x) throws SQLException {
2032        updateBlob(columnIndex, x, -1);
2033    }
2034
2035    /**
2036     * Updates a column in the current or insert row.
2037     *
2038     * @param columnIndex (1,2,...)
2039     * @param x the value
2040     * @param length the length
2041     * @throws SQLException if the result set is closed
2042     */

2043    public void updateBlob(int columnIndex, InputStream JavaDoc x, long length) throws SQLException {
2044        try {
2045            if(debug()) {
2046                debugCode("updateBlob("+columnIndex+", x, " + length + ");");
2047            }
2048            Value v = conn.createBlob(x, length);
2049            update(columnIndex, v);
2050        } catch(Throwable JavaDoc e) {
2051            throw logAndConvert(e);
2052        }
2053    }
2054
2055    /**
2056     * Updates a column in the current or insert row.
2057     *
2058     * @param columnIndex (1,2,...)
2059     * @param x the value
2060     * @throws SQLException if the result set is closed
2061     */

2062    public void updateBlob(int columnIndex, Blob x) throws SQLException {
2063        try {
2064            if(debug()) {
2065                debugCode("updateBlob("+columnIndex+", x);");
2066            }
2067            Value v;
2068            if(x == null) {
2069                v = ValueNull.INSTANCE;
2070            } else {
2071                v = conn.createBlob(x.getBinaryStream(), -1);
2072            }
2073            update(columnIndex, v);
2074        } catch(Throwable JavaDoc e) {
2075            throw logAndConvert(e);
2076        }
2077    }
2078
2079    /**
2080     * Updates a column in the current or insert row.
2081     *
2082     * @param columnName the name of the column label
2083     * @param x the value
2084     * @throws SQLException if the result set is closed
2085     */

2086    public void updateBlob(String JavaDoc columnName, Blob x) throws SQLException {
2087        try {
2088            if(debug()) {
2089                debugCode("updateBlob("+quote(columnName)+", x);");
2090            }
2091            Value v;
2092            if(x == null) {
2093                v = ValueNull.INSTANCE;
2094            } else {
2095                v = conn.createBlob(x.getBinaryStream(), -1);
2096            }
2097            update(columnName, v);
2098        } catch(Throwable JavaDoc e) {
2099            throw logAndConvert(e);
2100        }
2101    }
2102
2103    /**
2104     * Updates a column in the current or insert row.
2105     *
2106     * @param columnName the name of the column label
2107     * @param x the value
2108     * @throws SQLException if the result set is closed
2109     */

2110    public void updateBlob(String JavaDoc columnName, InputStream JavaDoc x) throws SQLException {
2111        updateBlob(columnName, x, -1);
2112    }
2113    
2114    /**
2115     * Updates a column in the current or insert row.
2116     *
2117     * @param columnName the name of the column label
2118     * @param x the value
2119     * @param length the length
2120     * @throws SQLException if the result set is closed
2121     */

2122    public void updateBlob(String JavaDoc columnName, InputStream JavaDoc x, long length) throws SQLException {
2123        try {
2124            if(debug()) {
2125                debugCode("updateBlob("+quote(columnName)+", x, " + length + ");");
2126            }
2127            Value v = conn.createBlob(x, -1);
2128            update(columnName, v);
2129        } catch(Throwable JavaDoc e) {
2130            throw logAndConvert(e);
2131        }
2132    }
2133
2134    /**
2135     * Updates a column in the current or insert row.
2136     *
2137     * @param columnIndex (1,2,...)
2138     * @param x the value
2139     * @throws SQLException if the result set is closed
2140     */

2141    public void updateClob(int columnIndex, Clob x) throws SQLException {
2142        try {
2143            if(debug()) {
2144                debugCode("updateClob("+columnIndex+", x);");
2145            }
2146            checkClosed();
2147            Value v;
2148            if(x == null) {
2149                v = ValueNull.INSTANCE;
2150            } else {
2151                v = conn.createClob(x.getCharacterStream(), -1);
2152            }
2153            update(columnIndex, v);
2154        } catch(Throwable JavaDoc e) {
2155            throw logAndConvert(e);
2156        }
2157    }
2158
2159    /**
2160     * Updates a column in the current or insert row.
2161     *
2162     * @param columnIndex (1,2,...)
2163     * @param x the value
2164     * @throws SQLException if the result set is closed
2165     */

2166    public void updateClob(int columnIndex, Reader JavaDoc x) throws SQLException {
2167        updateClob(columnIndex, x, -1);
2168    }
2169    
2170    /**
2171     * Updates a column in the current or insert row.
2172     *
2173     * @param columnIndex (1,2,...)
2174     * @param x the value
2175     * @param length the length
2176     * @throws SQLException if the result set is closed
2177     */

2178    public void updateClob(int columnIndex, Reader JavaDoc x, long length) throws SQLException {
2179        try {
2180            if(debug()) {
2181                debugCode("updateClob("+columnIndex+", x, " + length + ");");
2182            }
2183            checkClosed();
2184            Value v = conn.createClob(x, length);
2185            update(columnIndex, v);
2186        } catch(Throwable JavaDoc e) {
2187            throw logAndConvert(e);
2188        }
2189    }
2190    
2191    /**
2192     * Updates a column in the current or insert row.
2193     *
2194     * @param columnName the name of the column label
2195     * @param x the value
2196     * @throws SQLException if the result set is closed
2197     */

2198    public void updateClob(String JavaDoc columnName, Clob x) throws SQLException {
2199        try {
2200            if(debug()) {
2201                debugCode("updateClob("+quote(columnName)+", x);");
2202            }
2203            checkClosed();
2204            Value v;
2205            if(x == null) {
2206                v = ValueNull.INSTANCE;
2207            } else {
2208                v = conn.createClob(x.getCharacterStream(), -1);
2209            }
2210            update(columnName, v);
2211        } catch(Throwable JavaDoc e) {
2212            throw logAndConvert(e);
2213        }
2214    }
2215    
2216    /**
2217     * Updates a column in the current or insert row.
2218     *
2219     * @param columnName the name of the column label
2220     * @param x the value
2221     * @throws SQLException if the result set is closed
2222     */

2223    public void updateClob(String JavaDoc columnName, Reader JavaDoc x) throws SQLException {
2224        updateClob(columnName, x, -1);
2225    }
2226
2227    /**
2228     * Updates a column in the current or insert row.
2229     *
2230     * @param columnName the name of the column label
2231     * @param x the value
2232     * @param length the length
2233     * @throws SQLException if the result set is closed
2234     */

2235    public void updateClob(String JavaDoc columnName, Reader JavaDoc x, long length) throws SQLException {
2236        try {
2237            if(debug()) {
2238                debugCode("updateClob("+quote(columnName)+", x);");
2239            }
2240            checkClosed();
2241            Value v = conn.createClob(x, length);
2242            update(columnName, v);
2243        } catch(Throwable JavaDoc e) {
2244            throw logAndConvert(e);
2245        }
2246    }
2247
2248    /**
2249     * THIS FEATURE IS NOT SUPPORTED.
2250     *
2251     * @throws SQLException Unsupported Feature (SQL State 0A000)
2252     */

2253    public void updateArray(int columnIndex, Array x) throws SQLException {
2254        try {
2255            if(debug()) {
2256                debugCode("updateArray("+columnIndex+", x);");
2257            }
2258            throw Message.getUnsupportedException();
2259        } catch(Throwable JavaDoc e) {
2260            throw logAndConvert(e);
2261        }
2262    }
2263
2264    /**
2265     * THIS FEATURE IS NOT SUPPORTED.
2266     *
2267     * @throws SQLException Unsupported Feature (SQL State 0A000)
2268     */

2269    public void updateArray(String JavaDoc columnName, Array x) throws SQLException {
2270        try {
2271            if(debug()) {
2272                debugCode("updateArray("+quote(columnName)+", x);");
2273            }
2274            throw Message.getUnsupportedException();
2275        } catch(Throwable JavaDoc e) {
2276            throw logAndConvert(e);
2277        }
2278    }
2279
2280    /**
2281     * Gets the cursor name if it was defined. Not all databases support cursor names, and this feature is superseded by
2282     * updateXXX methods. This method throws a SQLException because cursor names are not supported. This is as defined
2283     * in the in the JDBC specs.
2284     *
2285     * @throws SQLException Unsupported Feature (SQL State 0A000)
2286     */

2287    public String JavaDoc getCursorName() throws SQLException {
2288        try {
2289            debugCodeCall("getCursorName");
2290            throw Message.getUnsupportedException();
2291        } catch(Throwable JavaDoc e) {
2292            throw logAndConvert(e);
2293        }
2294    }
2295
2296    /**
2297     * Gets the current row number. The first row is row 1, the second 2 and so on. This method returns 0 before the
2298     * first and after the last row.
2299     *
2300     * @return the row number
2301     */

2302    public int getRow() throws SQLException {
2303        try {
2304            debugCodeCall("getRow");
2305            checkClosed();
2306            int rowId = result.getRowId();
2307            if (rowId >= result.getRowCount()) {
2308                return 0;
2309            } else {
2310                return rowId + 1;
2311            }
2312        } catch(Throwable JavaDoc e) {
2313            throw logAndConvert(e);
2314        }
2315    }
2316
2317    /**
2318     * Gets the result set concurrency.
2319     *
2320     * @return ResultSet.CONCUR_UPDATABLE
2321     */

2322    public int getConcurrency() throws SQLException {
2323        try {
2324            debugCodeCall("getConcurrency");
2325            checkClosed();
2326            UpdatableRow upd = new UpdatableRow(conn, result, session);
2327            return upd.isUpdatable() ? ResultSet.CONCUR_UPDATABLE : ResultSet.CONCUR_READ_ONLY;
2328        } catch(Throwable JavaDoc e) {
2329            throw logAndConvert(e);
2330        }
2331    }
2332
2333    /**
2334     * Gets the fetch direction.
2335     *
2336     * @return the direction: FETCH_FORWARD
2337     */

2338    public int getFetchDirection() throws SQLException {
2339        try {
2340            debugCodeCall("getFetchDirection");
2341            checkClosed();
2342            return ResultSet.FETCH_FORWARD;
2343        } catch(Throwable JavaDoc e) {
2344            throw logAndConvert(e);
2345        }
2346    }
2347
2348    /**
2349     * Gets the number of rows suggested to read in one step.
2350     *
2351     * @return the current fetch size
2352     */

2353    public int getFetchSize() throws SQLException {
2354        try {
2355            debugCodeCall("getFetchSize");
2356            checkClosed();
2357            return 0;
2358        } catch(Throwable JavaDoc e) {
2359            throw logAndConvert(e);
2360        }
2361    }
2362
2363    /**
2364     * Sets the number of rows suggested to read in one step. This value cannot be higher than the maximum rows
2365     * (setMaxRows) set by the statement or prepared statement, otherwise an exception is throws.
2366     *
2367     * @param rowCount the number of rows
2368     */

2369    public void setFetchSize(int rowCount) throws SQLException {
2370        try {
2371            debugCodeCall("setFetchSize", rowCount);
2372            checkClosed();
2373            if (rowCount < 0) {
2374                throw Message.getInvalidValueException("" + rowCount, "rowCount");
2375            }
2376            if (rowCount > 0) {
2377                if (stat != null) {
2378                    int maxRows = stat.getMaxRows();
2379                    if (maxRows > 0 && rowCount > maxRows) {
2380                        throw Message.getInvalidValueException("" + rowCount, "rowCount");
2381                    }
2382                }
2383            }
2384        } catch(Throwable JavaDoc e) {
2385            throw logAndConvert(e);
2386        }
2387    }
2388
2389    /**
2390     * Sets (changes) the fetch direction for this result set. This method should only be called for scrollable
2391     * result sets, otherwise it will throw an exception (no matter what direction is used).
2392     *
2393     * @param direction the new fetch direction
2394     * @throws SQLException Unsupported Feature (SQL State 0A000) if the method is called for a forward-only result set
2395     */

2396        public void setFetchDirection(int direction) throws SQLException {
2397            try {
2398                debugCodeCall("setFetchDirection", direction);
2399                throw Message.getUnsupportedException();
2400            } catch(Throwable JavaDoc e) {
2401                throw logAndConvert(e);
2402            }
2403        }
2404
2405    /**
2406     * Get the result set type.
2407     *
2408     * @return the result set type (TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE or TYPE_SCROLL_SENSITIVE)
2409     * @throws SQLException if the column is not found or if the result set is closed
2410     */

2411    public int getType() throws SQLException {
2412        try {
2413            debugCodeCall("getType");
2414            checkClosed();
2415            return stat == null ? ResultSet.TYPE_FORWARD_ONLY : stat.resultSetType;
2416        } catch(Throwable JavaDoc e) {
2417            throw logAndConvert(e);
2418        }
2419    }
2420
2421    /**
2422     * Checks if the current position is before the first row, that means next() was not called yet.
2423     *
2424     * @return if the current position is before the first row
2425     * @throws SQLException if the result set is closed
2426     */

2427    public boolean isBeforeFirst() throws SQLException {
2428        try {
2429            debugCodeCall("isBeforeFirst");
2430            checkClosed();
2431            return result.getRowId() < 0;
2432        } catch(Throwable JavaDoc e) {
2433            throw logAndConvert(e);
2434        }
2435    }
2436
2437    /**
2438     * Checks if the current position is after the last row, that means next() was called and returned false.
2439     *
2440     * @return if the current position is after the last row
2441     * @throws SQLException if the result set is closed
2442     */

2443    public boolean isAfterLast() throws SQLException {
2444        try {
2445            debugCodeCall("isAfterLast");
2446            checkClosed();
2447            int row = result.getRowId();
2448            int count = result.getRowCount();
2449            return row >= count || count == 0;
2450        } catch(Throwable JavaDoc e) {
2451            throw logAndConvert(e);
2452        }
2453    }
2454
2455    /**
2456     * Checks if the current position is row 1, that means next() was called once and returned true.
2457     *
2458     * @return if the current position is the first row
2459     * @throws SQLException if the result set is closed
2460     */

2461    public boolean isFirst() throws SQLException {
2462        try {
2463            debugCodeCall("isFirst");
2464            checkClosed();
2465            int row = result.getRowId();
2466            return row == 0 && row < result.getRowCount();
2467        } catch(Throwable JavaDoc e) {
2468            throw logAndConvert(e);
2469        }
2470    }
2471
2472    /**
2473     * Checks if the current position is the last row, that means next() was called and did not yet returned false, but
2474     * will in the next call.
2475     *
2476     * @return if the current position is the last row
2477     * @throws SQLException if the result set is closed
2478     */

2479    public boolean isLast() throws SQLException {
2480        try {
2481            debugCodeCall("isLast");
2482            checkClosed();
2483            int row = result.getRowId();
2484            return row >= 0 && row == result.getRowCount() - 1;
2485        } catch(Throwable JavaDoc e) {
2486            throw logAndConvert(e);
2487        }
2488    }
2489
2490    /**
2491     * Moves the current position to before the first row, that means resets the result set.
2492     *
2493     * @throws SQLException if the result set is closed
2494     */

2495    public void beforeFirst() throws SQLException {
2496        try {
2497            debugCodeCall("beforeFirst");
2498            checkClosed();
2499            result.reset();
2500        } catch(Throwable JavaDoc e) {
2501            throw logAndConvert(e);
2502        }
2503    }
2504
2505    /**
2506     * Moves the current position to after the last row, that means after the end.
2507     *
2508     * @throws SQLException if the result set is closed
2509     */

2510    public void afterLast() throws SQLException {
2511        try {
2512            debugCodeCall("afterLast");
2513            checkClosed();
2514            while (result.next()) {
2515                // nothing
2516
}
2517        } catch(Throwable JavaDoc e) {
2518            throw logAndConvert(e);
2519        }
2520}
2521
2522    /**
2523     * Moves the current position to the first row. This is the same as calling beforeFirst() followed by next().
2524     *
2525     * @return true if there is a row available, false if not
2526     * @throws SQLException if the result set is closed
2527     */

2528    public boolean first() throws SQLException {
2529        try {
2530            debugCodeCall("first");
2531            checkClosed();
2532            result.reset();
2533            return result.next();
2534        } catch(Throwable JavaDoc e) {
2535            throw logAndConvert(e);
2536        }
2537    }
2538
2539    /**
2540     * Moves the current position to the last row.
2541     *
2542     * @return true if there is a row available, false if not
2543     * @throws SQLException if the result set is closed
2544     */

2545    public boolean last() throws SQLException {
2546        try {
2547            debugCodeCall("last");
2548            checkClosed();
2549            return absolute(-1);
2550        } catch(Throwable JavaDoc e) {
2551            throw logAndConvert(e);
2552        }
2553    }
2554
2555    /**
2556     * Moves the current position to a specific row.
2557     *
2558     * @param rowNumber the row number. 0 is not allowed, 1 means the first row, 2 the second. -1 means the last row, -2
2559     * the row before the last row. If the value is too large, the position is moved after the last row, if
2560     * if the value is too small it is moved before the first row.
2561     * @return true if there is a row available, false if not
2562     * @throws SQLException if the result set is closed
2563     */

2564    public boolean absolute(int rowNumber) throws SQLException {
2565        try {
2566            debugCodeCall("absolute", rowNumber);
2567            checkClosed();
2568            if (rowNumber < 0) {
2569                rowNumber = result.getRowCount() + rowNumber + 1;
2570            } else if (rowNumber > result.getRowCount() + 1) {
2571                rowNumber = result.getRowCount() + 1;
2572            }
2573// if (rowNumber == 0) {
2574
// throw Message.getInvalidValueException("" + rowNumber, "rowNumber");
2575
// } else
2576
if (rowNumber <= result.getRowId()) {
2577                result.reset();
2578            }
2579            while (result.getRowId() + 1 < rowNumber) {
2580                result.next();
2581            }
2582            int row = result.getRowId();
2583            return row >= 0 && row < result.getRowCount();
2584        } catch(Throwable JavaDoc e) {
2585            throw logAndConvert(e);
2586        }
2587    }
2588
2589    // TODO javadoc: check that there are no - - in the javadoc
2590
/**
2591     * Moves the current position to a specific row relative to the current row.
2592     *
2593     * @param rowCount 0 means don't do anything, 1 is the next row, -1 the previous. If the value is too large, the
2594     * position is moved after the last row, if if the value is too small it is moved before the first row.
2595     * @return true if there is a row available, false if not
2596     * @throws SQLException if the result set is closed
2597     */

2598    public boolean relative(int rowCount) throws SQLException {
2599        try {
2600            debugCodeCall("relative", rowCount);
2601            checkClosed();
2602            int row = result.getRowId() + 1 + rowCount;
2603            if (row < 0) {
2604                row = 0;
2605            } else if (row > result.getRowCount()) {
2606                row = result.getRowCount() + 1;
2607            }
2608            return absolute(row);
2609        } catch(Throwable JavaDoc e) {
2610            throw logAndConvert(e);
2611        }
2612    }
2613
2614    /**
2615     * Moves the cursor to the last row, or row before first row if the current position is the first row.
2616     *
2617     * @return true if there is a row available, false if not
2618     * @throws SQLException if the result set is closed
2619     */

2620    public boolean previous() throws SQLException {
2621        try {
2622            debugCodeCall("previous");
2623            checkClosed();
2624            return relative(-1);
2625        } catch(Throwable JavaDoc e) {
2626            throw logAndConvert(e);
2627        }
2628    }
2629
2630    /**
2631     * Moves the current position to the insert row. The current row is remembered.
2632     *
2633     * @throws SQLException if the result set is closed
2634     */

2635    public void moveToInsertRow() throws SQLException {
2636        try {
2637            debugCodeCall("moveToInsertRow");
2638            checkClosed();
2639            insertRow = new Value[columnCount];
2640        } catch(Throwable JavaDoc e) {
2641            throw logAndConvert(e);
2642        }
2643    }
2644
2645    /**
2646     * Moves the current position to the current row.
2647     *
2648     * @throws SQLException if the result set is closed
2649     */

2650    public void moveToCurrentRow() throws SQLException {
2651        try {
2652            debugCodeCall("moveToCurrentRow");
2653            checkClosed();
2654            insertRow = null;
2655        } catch(Throwable JavaDoc e) {
2656            throw logAndConvert(e);
2657        }
2658    }
2659
2660    /**
2661     * Detects if the row was updated (by somebody else or the caller).
2662     *
2663     * @return false because this driver does detect this
2664     */

2665    public boolean rowUpdated() throws SQLException {
2666        try {
2667            debugCodeCall("rowUpdated");
2668            return false;
2669        } catch(Throwable JavaDoc e) {
2670            throw logAndConvert(e);
2671        }
2672    }
2673
2674    /**
2675     * Detects if the row was inserted.
2676     *
2677     * @return false because this driver does detect this
2678     */

2679    public boolean rowInserted() throws SQLException {
2680        try {
2681            debugCodeCall("rowInserted");
2682            return false;
2683        } catch(Throwable JavaDoc e) {
2684            throw logAndConvert(e);
2685        }
2686    }
2687
2688    /**
2689     * Detects if the row was deleted (by somebody else or the caller).
2690     *
2691     * @return false because this driver does detect this
2692     */

2693    public boolean rowDeleted() throws SQLException {
2694        try {
2695            debugCodeCall("rowDeleted");
2696            return false;
2697        } catch(Throwable JavaDoc e) {
2698            throw logAndConvert(e);
2699        }
2700    }
2701
2702    /**
2703     * Inserts the current row. The current position must be the insert row.
2704     *
2705     * @throws SQLException if the result set is closed or if not on the insert row
2706     */

2707    public void insertRow() throws SQLException {
2708        try {
2709            debugCodeCall("insertRow");
2710            checkClosed();
2711            if (insertRow == null) {
2712                throw Message.getSQLException(Message.NOT_ON_UPDATABLE_ROW);
2713            }
2714            getUpdatableRow().insertRow(insertRow);
2715            insertRow = null;
2716        } catch(Throwable JavaDoc e) {
2717            throw logAndConvert(e);
2718        }
2719    }
2720
2721    /**
2722     * Updates the current row.
2723     *
2724     * @throws SQLException if the result set is closed or if the current row is the insert row or if not on a valid row
2725     */

2726    public void updateRow() throws SQLException {
2727        try {
2728            debugCodeCall("updateRow");
2729            checkClosed();
2730            if (insertRow != null) {
2731                throw Message.getSQLException(Message.NOT_ON_UPDATABLE_ROW);
2732            }
2733            checkOnValidRow();
2734            if (updateRow != null) {
2735                getUpdatableRow().updateRow(result.currentRow(), updateRow);
2736                updateRow = null;
2737            }
2738        } catch(Throwable JavaDoc e) {
2739            throw logAndConvert(e);
2740        }
2741    }
2742
2743    /**
2744     * Deletes the current row.
2745     *
2746     * @throws SQLException if the result set is closed or if the current row is the insert row or if not on a valid row
2747     */

2748    public void deleteRow() throws SQLException {
2749        try {
2750            debugCodeCall("deleteRow");
2751            checkClosed();
2752            if (insertRow != null) {
2753                throw Message.getSQLException(Message.NOT_ON_UPDATABLE_ROW);
2754            }
2755            checkOnValidRow();
2756            getUpdatableRow().deleteRow(result.currentRow());
2757            updateRow = null;
2758        } catch(Throwable JavaDoc e) {
2759            throw logAndConvert(e);
2760        }
2761    }
2762
2763    /**
2764     * Re-reads the current row from the database.
2765     *
2766     * @throws SQLException if the result set is closed or if the current row is the insert row or if the row has been
2767     * deleted or if not on a valid row
2768     */

2769    public void refreshRow() throws SQLException {
2770        try {
2771            debugCodeCall("refreshRow");
2772            checkClosed();
2773            if (insertRow != null) {
2774                throw Message.getSQLException(Message.NO_DATA_AVAILABLE);
2775            }
2776            checkOnValidRow();
2777            getUpdatableRow().refreshRow(result.currentRow());
2778            updateRow = null;
2779        } catch(Throwable JavaDoc e) {
2780            throw logAndConvert(e);
2781        }
2782    }
2783
2784    /**
2785     * Cancels updating a row.
2786     *
2787     * @throws SQLException if the result set is closed or if the current row is the insert row
2788     */

2789    public void cancelRowUpdates() throws SQLException {
2790        try {
2791            debugCodeCall("cancelRowUpdates");
2792            checkClosed();
2793            if (insertRow != null) {
2794                throw Message.getSQLException(Message.NO_DATA_AVAILABLE);
2795            }
2796            updateRow = null;
2797        } catch(Throwable JavaDoc e) {
2798            throw logAndConvert(e);
2799        }
2800    }
2801
2802    // =============================================================
2803

2804    JdbcResultSet(SessionInterface session, JdbcConnection conn, JdbcStatement stat, ResultInterface result, int id, boolean closeStatement) {
2805        setTrace(session.getTrace(), TraceObject.RESULT_SET, id);
2806        this.session = session;
2807        this.conn = conn;
2808        this.stat = stat;
2809        this.result = result;
2810        columnCount = result.getVisibleColumnCount();
2811        this.closeStatement = closeStatement;
2812    }
2813
2814    private UpdatableRow getUpdatableRow() throws SQLException {
2815        UpdatableRow upd = new UpdatableRow(conn, result, session);
2816        if(!upd.isUpdatable()) {
2817            throw Message.getSQLException(Message.NOT_ON_UPDATABLE_ROW);
2818        }
2819        return upd;
2820    }
2821
2822    int getColumnIndex(String JavaDoc columnName) throws SQLException {
2823        checkClosed();
2824        if (columnName == null) {
2825            throw Message.getInvalidValueException("columnName", null);
2826        }
2827        for (int i = 0; i < columnCount; i++) {
2828            if (columnName.equalsIgnoreCase(result.getAlias(i))) {
2829                return i + 1;
2830            }
2831        }
2832        int idx = columnName.indexOf('.');
2833        if(idx > 0) {
2834            String JavaDoc table = columnName.substring(0, idx);
2835            String JavaDoc col = columnName.substring(idx+1);
2836            for (int i = 0; i < columnCount; i++) {
2837                if (table.equals(result.getTableName(i)) && col.equalsIgnoreCase(result.getColumnName(i))) {
2838                    return i + 1;
2839                }
2840            }
2841        }
2842        throw Message.getSQLException(Message.COLUMN_NOT_FOUND_1, columnName);
2843    }
2844
2845    void checkColumnIndex(int columnIndex) throws SQLException {
2846        checkClosed();
2847        if (columnIndex < 1 || columnIndex > columnCount) {
2848            throw Message.getInvalidValueException("" + columnIndex, "columnIndex");
2849        }
2850    }
2851
2852    void checkClosed() throws SQLException {
2853        if (result == null) {
2854            throw Message.getSQLException(Message.OBJECT_CLOSED);
2855        }
2856        if (stat != null) {
2857            stat.checkClosed();
2858        }
2859        if(conn != null) {
2860            conn.checkClosed();
2861        }
2862    }
2863
2864    private void checkOnValidRow() throws SQLException {
2865        if (result.getRowId() < 0 || result.getRowId() >= result.getRowCount()) {
2866            throw Message.getSQLException(Message.NO_DATA_AVAILABLE);
2867        }
2868    }
2869
2870    private Value get(int columnIndex) throws SQLException {
2871        checkColumnIndex(columnIndex);
2872        checkOnValidRow();
2873        Value[] list = result.currentRow();
2874        Value value = list[columnIndex - 1];
2875        wasNull = value == ValueNull.INSTANCE;
2876        return value;
2877    }
2878
2879    private Value get(String JavaDoc columnName) throws SQLException {
2880        int columnIndex = getColumnIndex(columnName);
2881        return get(columnIndex);
2882    }
2883
2884    private void update(String JavaDoc columnName, Value v) throws SQLException {
2885        int columnIndex = getColumnIndex(columnName);
2886        update(columnIndex, v);
2887    }
2888
2889    private void update(int columnIndex, Value v) throws SQLException {
2890        checkColumnIndex(columnIndex);
2891        if (insertRow != null) {
2892            insertRow[columnIndex - 1] = v;
2893        } else {
2894            if (updateRow == null) {
2895                updateRow = new Value[columnCount];
2896            }
2897            updateRow[columnIndex - 1] = v;
2898        }
2899    }
2900
2901    /**
2902     * INTERNAL
2903     */

2904    public int getTraceId() {
2905        return super.getTraceId();
2906    }
2907
2908    JdbcConnection getConnection() {
2909        return conn;
2910    }
2911
2912    /**
2913     * Returns the value of the specified column as a row id.
2914     * @throws SQLException Unsupported Feature (SQL State 0A000)
2915     */

2916    //#ifdef JDK16
2917
/*
2918    public RowId getRowId(int columnIndex) throws SQLException {
2919        throw Message.getUnsupportedException();
2920    }
2921*/

2922    //#endif
2923

2924    /**
2925     * Returns the value of the specified column as a row id.
2926     * @throws SQLException Unsupported Feature (SQL State 0A000)
2927     */

2928    //#ifdef JDK16
2929
/*
2930    public RowId getRowId(String columnName) throws SQLException {
2931        throw Message.getUnsupportedException();
2932    }
2933*/

2934    //#endif
2935

2936    /**
2937     * Updates a column in the current or insert row.
2938     * @throws SQLException Unsupported Feature (SQL State 0A000)
2939     */

2940    //#ifdef JDK16
2941
/*
2942    public void updateRowId(int columnIndex, RowId x) throws SQLException {
2943        throw Message.getUnsupportedException();
2944    }
2945*/

2946    //#endif
2947

2948    /**
2949     * Updates a column in the current or insert row.
2950     * @throws SQLException Unsupported Feature (SQL State 0A000)
2951     */

2952    //#ifdef JDK16
2953
/*
2954    public void updateRowId(String columnName, RowId x) throws SQLException {
2955        throw Message.getUnsupportedException();
2956    }
2957*/

2958    //#endif
2959

2960    /**
2961     * Returns the current result set holdability.
2962     *
2963     * @return the holdability
2964     * @throws SQLException if the connection is closed
2965     */

2966    public int getHoldability() throws SQLException {
2967        try {
2968            debugCodeCall("getHoldability");
2969            return conn.getHoldability();
2970        } catch(Throwable JavaDoc e) {
2971            throw logAndConvert(e);
2972        }
2973    }
2974
2975    /**
2976     * Returns whether this result set is closed.
2977     *
2978     * @return true if the result set is closed
2979     */

2980    public boolean isClosed() throws SQLException {
2981        try {
2982            debugCodeCall("isClosed");
2983            return result == null;
2984        } catch(Throwable JavaDoc e) {
2985            throw logAndConvert(e);
2986        }
2987    }
2988
2989    /**
2990     * Updates a column in the current or insert row.
2991     *
2992     * @param columnIndex (1,2,...)
2993     * @param x the value
2994     * @throws SQLException if the result set is closed
2995     */

2996    public void updateNString(int columnIndex, String JavaDoc x) throws SQLException {
2997        try {
2998            if(debug()) {
2999                debugCode("updateNString("+columnIndex+", "+quote(x)+");");
3000            }
3001            update(columnIndex, x == null ? (Value) ValueNull.INSTANCE : ValueString.get(x));
3002        } catch(Throwable JavaDoc e) {
3003            throw logAndConvert(e);
3004        }
3005    }
3006
3007    /**
3008     * Updates a column in the current or insert row.
3009     *
3010     * @param columnIndex (1,2,...)
3011     * @param x the value
3012     * @throws SQLException if the result set is closed
3013     */

3014    public void updateNString(String JavaDoc columnName, String JavaDoc x) throws SQLException {
3015        try {
3016            if(debug()) {
3017                debugCode("updateNString("+quote(columnName)+", "+quote(x)+");");
3018            }
3019            update(columnName, x == null ? (Value) ValueNull.INSTANCE : ValueString.get(x));
3020        } catch(Throwable JavaDoc e) {
3021            throw logAndConvert(e);
3022        }
3023    }
3024
3025    /**
3026     * THIS FEATURE IS NOT SUPPORTED.
3027     *
3028     * @throws SQLException Unsupported Feature (SQL State 0A000)
3029     */

3030    //#ifdef JDK16
3031
/*
3032    public void updateNClob(int columnIndex, NClob x) throws SQLException {
3033        try {
3034            if(debug()) {
3035                debugCode("updateNClob("+columnIndex+", x);");
3036            }
3037            throw Message.getUnsupportedException();
3038        } catch(Throwable e) {
3039            throw logAndConvert(e);
3040        }
3041    }
3042*/

3043    //#endif
3044

3045    /**
3046     * THIS FEATURE IS NOT SUPPORTED.
3047     *
3048     * @throws SQLException Unsupported Feature (SQL State 0A000)
3049     */

3050    //#ifdef JDK16
3051
/*
3052    public void updateNClob(int columnIndex, Reader x) throws SQLException {
3053        try {
3054            if(debug()) {
3055                debugCode("updateNClob("+columnIndex+", x);");
3056            }
3057            throw Message.getUnsupportedException();
3058        } catch(Throwable e) {
3059            throw logAndConvert(e);
3060        }
3061    }
3062*/

3063    //#endif
3064

3065    /**
3066     * THIS FEATURE IS NOT SUPPORTED.
3067     *
3068     * @throws SQLException Unsupported Feature (SQL State 0A000)
3069     */

3070    //#ifdef JDK16
3071
/*
3072    public void updateNClob(int columnIndex, Reader x, long length) throws SQLException {
3073        try {
3074            if(debug()) {
3075                debugCode("updateNClob("+columnIndex+", x, " + length + ");");
3076            }
3077            throw Message.getUnsupportedException();
3078        } catch(Throwable e) {
3079            throw logAndConvert(e);
3080        }
3081    }
3082*/

3083    //#endif
3084

3085    /**
3086     * THIS FEATURE IS NOT SUPPORTED.
3087     *
3088     * @throws SQLException Unsupported Feature (SQL State 0A000)
3089     */

3090    //#ifdef JDK16
3091
/*
3092    public void updateNClob(String columnName, Reader x) throws SQLException {
3093        try {
3094            if(debug()) {
3095                debugCode("updateNClob("+quote(columnName)+", x);");
3096            }
3097            throw Message.getUnsupportedException();
3098        } catch(Throwable e) {
3099            throw logAndConvert(e);
3100        }
3101    }
3102*/

3103    //#endif
3104

3105    /**
3106     * THIS FEATURE IS NOT SUPPORTED.
3107     *
3108     * @throws SQLException Unsupported Feature (SQL State 0A000)
3109     */

3110    //#ifdef JDK16
3111
/*
3112    public void updateNClob(String columnName, Reader x, long length) throws SQLException {
3113        try {
3114            if(debug()) {
3115                debugCode("updateNClob("+quote(columnName)+", x, " + length+");");
3116            }
3117            throw Message.getUnsupportedException();
3118        } catch(Throwable e) {
3119            throw logAndConvert(e);
3120        }
3121    }
3122*/

3123    //#endif
3124

3125    /**
3126     * THIS FEATURE IS NOT SUPPORTED.
3127     *
3128     * @throws SQLException Unsupported Feature (SQL State 0A000)
3129     */

3130    //#ifdef JDK16
3131
/*
3132    public void updateNClob(String columnName, NClob x) throws SQLException {
3133        try {
3134            if(debug()) {
3135                debugCode("updateNClob("+quote(columnName)+", x);");
3136            }
3137            throw Message.getUnsupportedException();
3138        } catch(Throwable e) {
3139            throw logAndConvert(e);
3140        }
3141    }
3142*/

3143    //#endif
3144

3145
3146    /**
3147     * Returns the value of the specified column as a Clob.
3148     *
3149     * @param columnName the name of the column label
3150     * @return the value
3151     * @throws SQLException if the column is not found or if the result set is closed
3152     */

3153    //#ifdef JDK16
3154
/*
3155    public NClob getNClob(int columnIndex) throws SQLException {
3156        try {
3157            int id = getNextId(TraceObject.CLOB);
3158            debugCodeAssign("NClob", TraceObject.CLOB, id);
3159            debugCodeCall("getNClob", columnIndex);
3160            Value v = get(columnIndex);
3161            return v == ValueNull.INSTANCE ? null : new JdbcClob(session, conn, v, id);
3162        } catch(Throwable e) {
3163            throw logAndConvert(e);
3164        }
3165    }
3166*/

3167    //#endif
3168

3169    /**
3170     * Returns the value of the specified column as a Clob.
3171     *
3172     * @param columnIndex (1,2,...)
3173     * @return the value
3174     * @throws SQLException if the column is not found or if the result set is closed
3175     */

3176    //#ifdef JDK16
3177
/*
3178    public NClob getNClob(String columnName) throws SQLException {
3179        try {
3180            int id = getNextId(TraceObject.CLOB);
3181            debugCodeAssign("NClob", TraceObject.CLOB, id);
3182            debugCodeCall("getNClob", columnName);
3183            Value v = get(columnName);
3184            return v == ValueNull.INSTANCE ? null : new JdbcClob(session, conn, v, id);
3185        } catch(Throwable e) {
3186            throw logAndConvert(e);
3187        }
3188    }
3189*/

3190    //#endif
3191

3192    /**
3193     * Returns the value of the specified column as a SQLXML object.
3194     * @throws SQLException Unsupported Feature (SQL State 0A000)
3195     */

3196    //#ifdef JDK16
3197
/*
3198    public SQLXML getSQLXML(int columnIndex) throws SQLException {
3199        throw Message.getUnsupportedException();
3200    }
3201*/

3202    //#endif
3203

3204    /**
3205     * Returns the value of the specified column as a SQLXML object.
3206     * @throws SQLException Unsupported Feature (SQL State 0A000)
3207     */

3208    //#ifdef JDK16
3209
/*
3210    public SQLXML getSQLXML(String columnName) throws SQLException {
3211        throw Message.getUnsupportedException();
3212    }
3213*/

3214    //#endif
3215

3216    /**
3217     * Updates a column in the current or insert row.
3218     * @throws SQLException Unsupported Feature (SQL State 0A000)
3219     */

3220    //#ifdef JDK16
3221
/*
3222    public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException {
3223        throw Message.getUnsupportedException();
3224    }
3225*/

3226    //#endif
3227

3228    /**
3229     * Updates a column in the current or insert row.
3230     * @throws SQLException Unsupported Feature (SQL State 0A000)
3231     */

3232    //#ifdef JDK16
3233
/*
3234    public void updateSQLXML(String columnName, SQLXML xmlObject) throws SQLException {
3235        throw Message.getUnsupportedException();
3236    }
3237*/

3238    //#endif
3239

3240    /**
3241     * Returns the value of the specified column as a String.
3242     *
3243     * @param columnIndex (1,2,...)
3244     * @return the value
3245     * @throws SQLException if the column is not found or if the result set is closed
3246     */

3247    public String JavaDoc getNString(int columnIndex) throws SQLException {
3248        try {
3249            debugCodeCall("getNString", columnIndex);
3250            return get(columnIndex).getString();
3251        } catch(Throwable JavaDoc e) {
3252            throw logAndConvert(e);
3253        }
3254    }
3255
3256    /**
3257     * Returns the value of the specified column as a String.
3258     *
3259     * @param columnName
3260     * @return the value
3261     * @throws SQLException if the column is not found or if the result set is closed
3262     */

3263    public String JavaDoc getNString(String JavaDoc columnName) throws SQLException {
3264        try {
3265            debugCodeCall("getNString", columnName);
3266            return get(columnName).getString();
3267        } catch(Throwable JavaDoc e) {
3268            throw logAndConvert(e);
3269        }
3270    }
3271
3272    /**
3273     * Returns the value of the specified column as input stream.
3274     *
3275     * @param columnIndex (1,2,...)
3276     * @return the value
3277     * @throws SQLException if the column is not found or if the result set is closed
3278     */

3279    public Reader JavaDoc getNCharacterStream(int columnIndex) throws SQLException {
3280        try {
3281            debugCodeCall("getNCharacterStream", columnIndex);
3282            return get(columnIndex).getReader();
3283        } catch(Throwable JavaDoc e) {
3284            throw logAndConvert(e);
3285        }
3286    }
3287
3288    /**
3289     * Returns the value of the specified column as input stream.
3290     *
3291     * @param columnName the name of the column label
3292     * @return the value
3293     * @throws SQLException if the column is not found or if the result set is closed
3294     */

3295    public Reader JavaDoc getNCharacterStream(String JavaDoc columnName) throws SQLException {
3296        try {
3297            debugCodeCall("getNCharacterStream", columnName);
3298            return get(columnName).getReader();
3299        } catch(Throwable JavaDoc e) {
3300            throw logAndConvert(e);
3301        }
3302    }
3303
3304    /**
3305     * Updates a column in the current or insert row.
3306     *
3307     * @param columnIndex (1,2,...)
3308     * @param x the value
3309     * @param length the number of characters
3310     * @throws SQLException if the result set is closed
3311     */

3312    public void updateNCharacterStream(int columnIndex, Reader JavaDoc x, int length) throws SQLException {
3313        updateNCharacterStream(columnIndex, x, (long) length);
3314    }
3315
3316    /**
3317     * Updates a column in the current or insert row.
3318     *
3319     * @param columnIndex (1,2,...)
3320     * @param x the value
3321     * @throws SQLException if the result set is closed
3322     */

3323    public void updateNCharacterStream(int columnIndex, Reader JavaDoc x) throws SQLException {
3324        updateNCharacterStream(columnIndex, x, -1);
3325    }
3326
3327    /**
3328     * Updates a column in the current or insert row.
3329     *
3330     * @param columnIndex (1,2,...)
3331     * @param x the value
3332     * @param length the number of characters
3333     * @throws SQLException if the result set is closed
3334     */

3335    public void updateNCharacterStream(int columnIndex, Reader JavaDoc x, long length) throws SQLException {
3336        try {
3337            if(debug()) {
3338                debugCode("updateNCharacterStream("+columnIndex+", x, "+length+");");
3339            }
3340            Value v = conn.createClob(x, length);
3341            update(columnIndex, v);
3342        } catch(Throwable JavaDoc e) {
3343            throw logAndConvert(e);
3344        }
3345    }
3346
3347    /**
3348     * Updates a column in the current or insert row.
3349     *
3350     * @param columnName the name of the column label
3351     * @param x the value
3352     * @param length the number of characters
3353     * @throws SQLException if the result set is closed
3354     */

3355    public void updateNCharacterStream(String JavaDoc columnName, Reader JavaDoc x, int length) throws SQLException {
3356        updateNCharacterStream(columnName, x, (long) length);
3357    }
3358
3359    /**
3360     * Updates a column in the current or insert row.
3361     *
3362     * @param columnName the name of the column label
3363     * @param x the value
3364     * @throws SQLException if the result set is closed
3365     */

3366    public void updateNCharacterStream(String JavaDoc columnName, Reader JavaDoc x) throws SQLException {
3367        updateNCharacterStream(columnName, x, -1);
3368    }
3369
3370    /**
3371     * Updates a column in the current or insert row.
3372     *
3373     * @param columnName the name of the column label
3374     * @param x the value
3375     * @param length the number of characters
3376     * @throws SQLException if the result set is closed
3377     */

3378    public void updateNCharacterStream(String JavaDoc columnName, Reader JavaDoc x, long length) throws SQLException {
3379        try {
3380            if(debug()) {
3381                debugCode("updateNCharacterStream("+quote(columnName)+", x, "+length+");");
3382            }
3383            Value v = conn.createClob(x, length);
3384            update(columnName, v);
3385        } catch(Throwable JavaDoc e) {
3386            throw logAndConvert(e);
3387        }
3388    }
3389
3390    /**
3391     * Return an object of this class if possible.
3392     * @throws SQLException Unsupported Feature (SQL State 0A000)
3393     */

3394    //#ifdef JDK16
3395
/*
3396    public <T> T unwrap(Class<T> iface) throws SQLException {
3397        debugCode("unwrap");
3398        throw Message.getUnsupportedException();
3399    }
3400*/

3401    //#endif
3402

3403    /**
3404     * Checks if unwrap can return an object of this class.
3405     * @throws SQLException Unsupported Feature (SQL State 0A000)
3406     */

3407    //#ifdef JDK16
3408
/*
3409    public boolean isWrapperFor(Class<?> iface) throws SQLException {
3410        debugCode("isWrapperFor");
3411        throw Message.getUnsupportedException();
3412    }
3413*/

3414    //#endif
3415

3416}
3417
Popular Tags