KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > broker > metadata > JdbcTypesHelper


1 package org.apache.ojb.broker.metadata;
2
3 /* Copyright 2003-2005 The Apache Software Foundation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 import java.io.ByteArrayOutputStream JavaDoc;
19 import java.io.IOException JavaDoc;
20 import java.io.InputStream JavaDoc;
21 import java.lang.reflect.Field JavaDoc;
22 import java.math.BigDecimal JavaDoc;
23 import java.net.URL JavaDoc;
24 import java.sql.Blob JavaDoc;
25 import java.sql.CallableStatement JavaDoc;
26 import java.sql.Clob JavaDoc;
27 import java.sql.Date JavaDoc;
28 import java.sql.Ref JavaDoc;
29 import java.sql.ResultSet JavaDoc;
30 import java.sql.SQLException JavaDoc;
31 import java.sql.Struct JavaDoc;
32 import java.sql.Time JavaDoc;
33 import java.sql.Timestamp JavaDoc;
34 import java.sql.Types JavaDoc;
35 import java.util.HashMap JavaDoc;
36 import java.util.Map JavaDoc;
37
38 import org.apache.commons.lang.BooleanUtils;
39 import org.apache.commons.lang.builder.ToStringBuilder;
40 import org.apache.ojb.broker.OJBRuntimeException;
41 import org.apache.ojb.broker.util.sequence.SequenceManagerException;
42
43 /**
44  * Helper class which provide all supported {@link JdbcType} classes
45  * (based on the {@link java.sql.Types}) as inner classes.
46  *
47  * @see JdbcType
48  * @version $Id: JdbcTypesHelper.java,v 1.1.2.3 2005/12/21 22:26:10 tomdz Exp $
49  */

50 public class JdbcTypesHelper
51 {
52     private static Map JavaDoc jdbcObjectTypesFromType = new HashMap JavaDoc();
53     private static Map JavaDoc jdbcObjectTypesFromName = new HashMap JavaDoc();
54
55     /**
56      * Hold out all JdbcType in a static maps
57      */

58     static
59     {
60         setJdbcType("array", Types.ARRAY, new T_Array());
61         setJdbcType("bigint", Types.BIGINT, new T_BigInt());
62         setJdbcType("binary", Types.BINARY, new T_Binary());
63         setJdbcType("bit", Types.BIT, new T_Bit());
64         setJdbcType("blob", Types.BLOB, new T_Blob());
65         setJdbcType("char", Types.CHAR, new T_Char());
66         setJdbcType("clob", Types.CLOB, new T_Clob());
67         setJdbcType("date", Types.DATE, new T_Date());
68         setJdbcType("decimal", Types.DECIMAL, new T_Decimal());
69         setJdbcType("double", Types.DOUBLE, new T_Double());
70         setJdbcType("float", Types.FLOAT, new T_Float());
71         setJdbcType("integer", Types.INTEGER, new T_Integer());
72         setJdbcType("longvarbinary", Types.LONGVARBINARY, new T_LongVarBinary());
73         setJdbcType("longvarchar", Types.LONGVARCHAR, new T_LongVarChar());
74         setJdbcType("numeric", Types.NUMERIC, new T_Numeric());
75         setJdbcType("real", Types.REAL, new T_Real());
76         setJdbcType("ref", Types.REF, new T_Ref());
77         setJdbcType("smallint", Types.SMALLINT, new T_SmallInt());
78         setJdbcType("struct", Types.STRUCT, new T_Struct());
79         setJdbcType("time", Types.TIME, new T_Time());
80         setJdbcType("timestamp", Types.TIMESTAMP, new T_Timestamp());
81         setJdbcType("tinyint", Types.TINYINT, new T_TinyInt());
82         setJdbcType("varbinary", Types.VARBINARY, new T_VarBinary());
83         setJdbcType("varchar", Types.VARCHAR, new T_Varchar());
84         
85 //#ifdef JDBC30
86
setJdbcType("boolean", Types.BOOLEAN, new T_Boolean());
87         setJdbcType("datalink", Types.DATALINK, new T_Datalink());
88 //#endif
89

90     }
91
92     public JdbcTypesHelper()
93     {
94         // default constructor
95
}
96
97     /**
98      * Set the {@link JdbcType} by name and index.
99      * @param typeName Name of the type
100      * @param typeIndex index of the type
101      * @param type the type
102      */

103     public static void setJdbcType(String JavaDoc typeName, int typeIndex, JdbcType type)
104     {
105         setJdbcTypeByName(typeName, type);
106         setJdbcTypeByTypesIndex(typeIndex, type);
107     }
108
109     /**
110      * Return the {@link JdbcType} for the given jdbc {@link java.sql.Types type}.
111      */

112     public static JdbcType getJdbcTypeByTypesIndex(Integer JavaDoc type)
113     {
114         return (JdbcType) jdbcObjectTypesFromType.get(type);
115     }
116
117     /**
118      * Set the {@link JdbcType} by index.
119      * @param typeIndex index of the type
120      * @param type the type
121      */

122     public static void setJdbcTypeByTypesIndex(int typeIndex, JdbcType type)
123     {
124         jdbcObjectTypesFromType.put(new Integer JavaDoc(typeIndex), type);
125     }
126
127     /**
128      * Lookup the {@link JdbcType} by name. If name was not found an exception
129      * is thrown.
130      */

131     public static JdbcType getJdbcTypeByName(String JavaDoc typeName)
132     {
133         JdbcType result = null;
134         result = (JdbcType) jdbcObjectTypesFromName.get(typeName.toLowerCase());
135         if (result == null)
136         {
137             throw new OJBRuntimeException("The type " + typeName + " can not be handled by OJB." +
138                     " Please specify only types as defined by java.sql.Types.");
139         }
140         return result;
141     }
142     
143     /**
144      * Set the {@link JdbcType} by name.
145      * @param typeName Name of the type
146      * @param type the type
147      */

148     public static void setJdbcTypeByName(String JavaDoc typeName, JdbcType type)
149     {
150         jdbcObjectTypesFromName.put(typeName, type);
151     }
152
153     /**
154      * Try to automatically assign a jdbc type for the given
155      * java type name. This method is used if e.g. in metadata a
156      * column type was not set.
157      *
158      * @see FieldDescriptor#getJdbcType
159      */

160     public static JdbcType getJdbcTypeByReflection(String JavaDoc fieldType)
161     {
162         JdbcType result;
163         
164         if (fieldType.equalsIgnoreCase(Character JavaDoc.class.getName()) || fieldType.equalsIgnoreCase("char"))
165             result = getJdbcTypeByName("char");
166         else if (fieldType.equalsIgnoreCase(Short JavaDoc.class.getName()) || fieldType.equalsIgnoreCase("short"))
167             result = getJdbcTypeByName("smallint");
168         else if (fieldType.equalsIgnoreCase(Integer JavaDoc.class.getName()) || fieldType.equalsIgnoreCase("int"))
169             result = getJdbcTypeByName("integer");
170         else if (fieldType.equalsIgnoreCase(Long JavaDoc.class.getName()) || fieldType.equalsIgnoreCase("long"))
171             result = getJdbcTypeByName("bigint");
172         else if (fieldType.equalsIgnoreCase(Byte JavaDoc.class.getName()) || fieldType.equalsIgnoreCase("byte"))
173             result = getJdbcTypeByName("tinyint");
174         else if (fieldType.equalsIgnoreCase(Float JavaDoc.class.getName()) || fieldType.equalsIgnoreCase("float"))
175             result = getJdbcTypeByName("real");
176         else if (fieldType.equalsIgnoreCase(Double JavaDoc.class.getName()) || fieldType.equalsIgnoreCase("double"))
177             result = getJdbcTypeByName("float");
178         else if (fieldType.equalsIgnoreCase(String JavaDoc.class.getName()))
179             result = getJdbcTypeByName("varchar");
180         /*
181         TODO: arminw: useful? This only will work in conjunction with a FieldConversion
182         */

183         else if (fieldType.equalsIgnoreCase(java.util.Date JavaDoc.class.getName()))
184             result = getJdbcTypeByName("date");
185         else if (fieldType.equalsIgnoreCase(Date JavaDoc.class.getName()))
186             result = getJdbcTypeByName("date");
187         else if (fieldType.equalsIgnoreCase(Time JavaDoc.class.getName()))
188             result = getJdbcTypeByName("time");
189         else if (fieldType.equalsIgnoreCase(Timestamp JavaDoc.class.getName()))
190             result = getJdbcTypeByName("timestamp");
191         else if (fieldType.equalsIgnoreCase(BigDecimal JavaDoc.class.getName()))
192             result = getJdbcTypeByName("decimal");
193         else if (fieldType.equalsIgnoreCase(Ref JavaDoc.class.getName()))
194             result = getJdbcTypeByName("ref");
195         else if (fieldType.equalsIgnoreCase(Struct JavaDoc.class.getName()))
196             result = getJdbcTypeByName("struct");
197         else if (fieldType.equalsIgnoreCase(Boolean JavaDoc.class.getName()) || fieldType.equalsIgnoreCase("boolean"))
198             result = getJdbcTypeByName("bit");
199 //#ifdef JDBC30
200
else if (fieldType.equalsIgnoreCase(URL JavaDoc.class.getName()))
201             result = getJdbcTypeByName("datalink");
202 //#endif
203
else
204             throw new OJBRuntimeException("The type " + fieldType + " can not be handled by OJB automatically."
205                     + " Please specify a type as defined by java.sql.Types in your field-descriptor");
206         return result;
207     }
208
209
210     /**
211      * Returns an java object read from the specified ResultSet column.
212      */

213     public static Object JavaDoc getObjectFromColumn(ResultSet JavaDoc rs, Integer JavaDoc jdbcType, int columnId)
214             throws SQLException JavaDoc
215     {
216         return getObjectFromColumn(rs, null, jdbcType, null, columnId);
217     }
218
219     /**
220      * Returns an java object for the given jdbcType by extract from the given
221      * CallableStatement or ResultSet.
222      * NOTE: Exactly one of the arguments of type CallableStatement or ResultSet
223      * have to be non-null.
224      * If the 'columnId' argument is equals {@link JdbcType#MIN_INT}, then the given 'columnName'
225      * argument is used to lookup column. Else the given 'columnId' is used as column index.
226      */

227     private static Object JavaDoc getObjectFromColumn(ResultSet JavaDoc rs, CallableStatement JavaDoc stmt, Integer JavaDoc jdbcType, String JavaDoc columnName, int columnId)
228             throws SQLException JavaDoc
229     {
230         return getJdbcTypeByTypesIndex(jdbcType).getObjectFromColumn(rs, stmt, columnName, columnId);
231     }
232
233     /**
234      * Returns a string representation of the given {@link java.sql.Types} value.
235      */

236     public static String JavaDoc getSqlTypeAsString(int jdbcType)
237     {
238         String JavaDoc statusName = "*can't find String representation for sql type '" + jdbcType + "'*";
239         try
240         {
241             Field JavaDoc[] fields = Types JavaDoc.class.getDeclaredFields();
242             for (int i = 0; i < fields.length; i++)
243             {
244                 if (fields[i].getInt(null) == jdbcType)
245                 {
246                     statusName = fields[i].getName();
247                     break;
248                 }
249             }
250         }
251         catch (Exception JavaDoc ignore)
252         {
253             // ignore it
254
}
255         return statusName;
256     }
257
258
259     //======================================================================================
260
// inner classes implementing JdbcType interface
261
//======================================================================================
262

263     public abstract static class BaseType implements JdbcType
264     {
265         private FieldType fieldType;
266
267         protected BaseType()
268         {
269             fieldType = FieldTypeClasses.newFieldType(this);
270         }
271
272         abstract Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc;
273
274         abstract Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc;
275
276         abstract Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc;
277         /*
278         only supported by jdk >= 1.4x, maybe useful in further versions
279         */

280         // abstract Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException;
281

282         public boolean equals(Object JavaDoc obj)
283         {
284             if (this == obj) return true;
285             boolean result = false;
286             if (obj instanceof JdbcType)
287             {
288                 result = this.getType() == ((JdbcType) obj).getType();
289             }
290             return result;
291         }
292
293         public int hashCode()
294         {
295             return getType();
296         }
297
298         public FieldType getFieldType()
299         {
300             return fieldType;
301         }
302
303         public Object JavaDoc getObjectFromColumn(CallableStatement JavaDoc stmt, int columnId) throws SQLException JavaDoc
304         {
305             return getObjectFromColumn(null, stmt, null, columnId);
306         }
307
308         public Object JavaDoc getObjectFromColumn(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
309         {
310             return getObjectFromColumn(rs, null, columnName, MIN_INT);
311         }
312
313         public Object JavaDoc getObjectFromColumn(final ResultSet JavaDoc rs, final CallableStatement JavaDoc stmt,
314                                           final String JavaDoc columnName, int columnIndex) throws SQLException JavaDoc
315         {
316             if (stmt != null)
317             {
318 // return columnIndex == MIN_INT
319
// ? readValueFromStatement(stmt, columnName) : readValueFromStatement(stmt, columnIndex);
320
if (columnIndex == MIN_INT)
321                 {
322                     throw new UnsupportedOperationException JavaDoc("Not implemented yet");
323                 }
324                 else
325                 {
326                     return readValueFromStatement(stmt, columnIndex);
327                 }
328             }
329             else
330             {
331                 return columnIndex == MIN_INT
332                         ? readValueFromResultSet(rs, columnName) : readValueFromResultSet(rs, columnIndex);
333             }
334         }
335
336         public String JavaDoc toString()
337         {
338             return new ToStringBuilder(this)
339                     .append("jdbcType", getType())
340                     .append("jdbcTypeString", getSqlTypeAsString(getType()))
341                     .append("associatedFieldType", getFieldType())
342                     .toString();
343         }
344
345 // // not used in code, but maybe useful in further versions
346
// public Object getObjectFromColumn(CallableStatement stmt, String columnName) throws SQLException
347
// {
348
// return getObjectFromColumn(null, stmt, columnName, MIN_INT);
349
// }
350
//
351
// public Object getObjectFromColumn(ResultSet rs, int columnId) throws SQLException
352
// {
353
// return getObjectFromColumn(rs, null, null, columnId);
354
// }
355

356     }
357
358
359     public static final class T_Char extends BaseType
360     {
361         public Object JavaDoc sequenceKeyConversion(Long JavaDoc identifier)
362         {
363             return identifier.toString();
364         }
365
366 // Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
367
// {
368
// return stmt.getString(columnName);
369
// }
370

371         Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc
372         {
373             return stmt.getString(columnIndex);
374         }
375
376         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
377         {
378             return rs.getString(columnName);
379         }
380
381         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc
382         {
383             return rs.getString(columnIndex);
384         }
385
386         public int getType()
387         {
388             return Types.CHAR;
389         }
390     }
391
392     public static final class T_Varchar extends BaseType
393     {
394         public Object JavaDoc sequenceKeyConversion(Long JavaDoc identifier)
395         {
396             return identifier.toString();
397         }
398
399 // Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
400
// {
401
// return stmt.getString(columnName);
402
// }
403

404         Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc
405         {
406             return stmt.getString(columnIndex);
407         }
408
409         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
410         {
411             return rs.getString(columnName);
412         }
413
414         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc
415         {
416             return rs.getString(columnIndex);
417         }
418
419         public int getType()
420         {
421             return Types.VARCHAR;
422         }
423     }
424
425     public static final class T_LongVarChar extends BaseType
426     {
427         public Object JavaDoc sequenceKeyConversion(Long JavaDoc identifier)
428         {
429             return identifier.toString();
430         }
431
432 // Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
433
// {
434
// return stmt.getString(columnName);
435
// }
436

437         Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc
438         {
439             return stmt.getString(columnIndex);
440         }
441
442         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
443         {
444             return rs.getString(columnName);
445         }
446
447         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc
448         {
449             return rs.getString(columnIndex);
450         }
451
452         public int getType()
453         {
454             return Types.LONGVARCHAR;
455         }
456     }
457
458     public static final class T_Numeric extends BaseType
459     {
460         public Object JavaDoc sequenceKeyConversion(Long JavaDoc identifier)
461         {
462             return new BigDecimal JavaDoc(identifier.longValue());
463         }
464
465 // Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
466
// {
467
// return stmt.getBigDecimal(columnName);
468
// }
469

470         Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc
471         {
472             return stmt.getBigDecimal(columnIndex);
473         }
474
475         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
476         {
477             return rs.getBigDecimal(columnName);
478         }
479
480         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc
481         {
482             return rs.getBigDecimal(columnIndex);
483         }
484
485         public int getType()
486         {
487             return Types.NUMERIC;
488         }
489     }
490
491     public static final class T_Decimal extends BaseType
492     {
493         public Object JavaDoc sequenceKeyConversion(Long JavaDoc identifier)
494         {
495             return new BigDecimal JavaDoc(identifier.longValue());
496         }
497
498 // Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
499
// {
500
// return stmt.getBigDecimal(columnName);
501
// }
502

503         Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc
504         {
505             return stmt.getBigDecimal(columnIndex);
506         }
507
508         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
509         {
510             return rs.getBigDecimal(columnName);
511         }
512
513         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc
514         {
515             return rs.getBigDecimal(columnIndex);
516         }
517
518         public int getType()
519         {
520             return Types.DECIMAL;
521         }
522     }
523
524     public static final class T_Bit extends BaseType
525     {
526         public Object JavaDoc sequenceKeyConversion(Long JavaDoc identifier) throws SequenceManagerException
527         {
528             throw new SequenceManagerException("Not supported sequence key type 'BIT'");
529         }
530
531 // Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
532
// {
533
// boolean temp = stmt.getBoolean(columnName);
534
// return (stmt.wasNull() ? null : new Boolean(temp));
535
// }
536

537         Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc
538         {
539             boolean temp = stmt.getBoolean(columnIndex);
540             return (stmt.wasNull() ? null : BooleanUtils.toBooleanObject(temp));
541         }
542
543         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
544         {
545             boolean temp = rs.getBoolean(columnName);
546             return (rs.wasNull() ? null : BooleanUtils.toBooleanObject(temp));
547         }
548
549         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc
550         {
551             boolean temp = rs.getBoolean(columnIndex);
552             return (rs.wasNull() ? null : BooleanUtils.toBooleanObject(temp));
553         }
554
555         public int getType()
556         {
557             return Types.BIT;
558         }
559     }
560
561 //#ifdef JDBC30
562
public static final class T_Boolean extends BaseType
563     {
564         public Object JavaDoc sequenceKeyConversion(final Long JavaDoc identifier) throws SequenceManagerException
565         {
566             throw new SequenceManagerException("Not supported sequence key type 'BOOLEAN'");
567         }
568
569 // Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
570
// {
571
// boolean temp = stmt.getBoolean(columnName);
572
// return (stmt.wasNull() ? null : BooleanUtils.toBooleanObject(temp));
573
// }
574

575         Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc
576         {
577             boolean temp = stmt.getBoolean(columnIndex);
578             return (stmt.wasNull() ? null : BooleanUtils.toBooleanObject(temp));
579         }
580
581         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
582         {
583             boolean temp = rs.getBoolean(columnName);
584             return (rs.wasNull() ? null : BooleanUtils.toBooleanObject(temp));
585         }
586
587         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc
588         {
589             boolean temp = rs.getBoolean(columnIndex);
590             return (rs.wasNull() ? null : BooleanUtils.toBooleanObject(temp));
591         }
592
593         public int getType()
594         {
595             return Types.BOOLEAN;
596         }
597     }
598 //#endif
599

600     public static final class T_TinyInt extends BaseType
601     {
602         public Object JavaDoc sequenceKeyConversion(final Long JavaDoc identifier)
603         {
604             return new Byte JavaDoc(identifier.byteValue());
605         }
606
607 // Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
608
// {
609
// byte temp = stmt.getByte(columnName);
610
// return (stmt.wasNull() ? null : new Byte(temp));
611
// }
612

613         Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc
614         {
615             byte temp = stmt.getByte(columnIndex);
616             return (stmt.wasNull() ? null : new Byte JavaDoc(temp));
617         }
618
619         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
620         {
621             byte temp = rs.getByte(columnName);
622             return (rs.wasNull() ? null : new Byte JavaDoc(temp));
623         }
624
625         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc
626         {
627             byte temp = rs.getByte(columnIndex);
628             return (rs.wasNull() ? null : new Byte JavaDoc(temp));
629         }
630
631         public int getType()
632         {
633             return Types.TINYINT;
634         }
635     }
636
637     public static final class T_SmallInt extends BaseType
638     {
639         public Object JavaDoc sequenceKeyConversion(Long JavaDoc identifier)
640         {
641             return new Short JavaDoc(identifier.shortValue());
642         }
643
644 // Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
645
// {
646
// short temp = stmt.getShort(columnName);
647
// return (stmt.wasNull() ? null : new Short(temp));
648
// }
649

650         Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc
651         {
652             short temp = stmt.getShort(columnIndex);
653             return (stmt.wasNull() ? null : new Short JavaDoc(temp));
654         }
655
656         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
657         {
658             short temp = rs.getShort(columnName);
659             return (rs.wasNull() ? null : new Short JavaDoc(temp));
660         }
661
662         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc
663         {
664             short temp = rs.getShort(columnIndex);
665             return (rs.wasNull() ? null : new Short JavaDoc(temp));
666         }
667
668         public int getType()
669         {
670             return Types.SMALLINT;
671         }
672     }
673
674     public static final class T_Integer extends BaseType
675     {
676         public Object JavaDoc sequenceKeyConversion(Long JavaDoc identifier)
677         {
678             return new Integer JavaDoc(identifier.intValue());
679         }
680
681 // Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
682
// {
683
// int temp = stmt.getInt(columnName);
684
// return (stmt.wasNull() ? null : new Integer(temp));
685
// }
686

687         Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc
688         {
689             int temp = stmt.getInt(columnIndex);
690             return (stmt.wasNull() ? null : new Integer JavaDoc(temp));
691         }
692
693         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
694         {
695             int temp = rs.getInt(columnName);
696             return (rs.wasNull() ? null : new Integer JavaDoc(temp));
697         }
698
699         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc
700         {
701             int temp = rs.getInt(columnIndex);
702             return (rs.wasNull() ? null : new Integer JavaDoc(temp));
703         }
704
705         public int getType()
706         {
707             return Types.INTEGER;
708         }
709     }
710
711     public static final class T_BigInt extends BaseType
712     {
713         public Object JavaDoc sequenceKeyConversion(Long JavaDoc identifier)
714         {
715             return identifier;
716         }
717
718 // Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
719
// {
720
// long temp = stmt.getLong(columnName);
721
// return (stmt.wasNull() ? null : new Long(temp));
722
// }
723

724         Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc
725         {
726             long temp = stmt.getLong(columnIndex);
727             return (stmt.wasNull() ? null : new Long JavaDoc(temp));
728         }
729
730         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
731         {
732             long temp = rs.getLong(columnName);
733             return (rs.wasNull() ? null : new Long JavaDoc(temp));
734         }
735
736         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc
737         {
738             long temp = rs.getLong(columnIndex);
739             return (rs.wasNull() ? null : new Long JavaDoc(temp));
740         }
741
742         public int getType()
743         {
744             return Types.BIGINT;
745         }
746     }
747
748     public static final class T_Real extends BaseType
749     {
750         public Object JavaDoc sequenceKeyConversion(Long JavaDoc identifier)
751         {
752             return new Float JavaDoc(identifier.floatValue());
753         }
754
755 // Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
756
// {
757
// float temp = stmt.getFloat(columnName);
758
// return (stmt.wasNull() ? null : new Float(temp));
759
// }
760

761         Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc
762         {
763             float temp = stmt.getFloat(columnIndex);
764             return (stmt.wasNull() ? null : new Float JavaDoc(temp));
765         }
766
767         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
768         {
769             float temp = rs.getFloat(columnName);
770             return (rs.wasNull() ? null : new Float JavaDoc(temp));
771         }
772
773         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc
774         {
775             float temp = rs.getFloat(columnIndex);
776             return (rs.wasNull() ? null : new Float JavaDoc(temp));
777         }
778
779         public int getType()
780         {
781             return Types.REAL;
782         }
783     }
784
785     public static final class T_Float extends BaseType
786     {
787         public Object JavaDoc sequenceKeyConversion(Long JavaDoc identifier)
788         {
789             return new Double JavaDoc(identifier.doubleValue());
790         }
791
792 // Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
793
// {
794
// double temp = stmt.getDouble(columnName);
795
// return (stmt.wasNull() ? null : new Double(temp));
796
// }
797

798         Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc
799         {
800             double temp = stmt.getDouble(columnIndex);
801             return (stmt.wasNull() ? null : new Double JavaDoc(temp));
802         }
803
804         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
805         {
806             double temp = rs.getDouble(columnName);
807             return (rs.wasNull() ? null : new Double JavaDoc(temp));
808         }
809
810         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc
811         {
812             double temp = rs.getDouble(columnIndex);
813             return (rs.wasNull() ? null : new Double JavaDoc(temp));
814         }
815
816         public int getType()
817         {
818             return Types.FLOAT;
819         }
820     }
821
822     public static final class T_Double extends BaseType
823     {
824         public Object JavaDoc sequenceKeyConversion(Long JavaDoc identifier)
825         {
826             return new Double JavaDoc(identifier.doubleValue());
827         }
828
829 // Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
830
// {
831
// double temp = stmt.getDouble(columnName);
832
// return (stmt.wasNull() ? null : new Double(temp));
833
// }
834

835         Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc
836         {
837             double temp = stmt.getDouble(columnIndex);
838             return (stmt.wasNull() ? null : new Double JavaDoc(temp));
839         }
840
841         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
842         {
843             double temp = rs.getDouble(columnName);
844             return (rs.wasNull() ? null : new Double JavaDoc(temp));
845         }
846
847         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc
848         {
849             double temp = rs.getDouble(columnIndex);
850             return (rs.wasNull() ? null : new Double JavaDoc(temp));
851         }
852
853         public int getType()
854         {
855             return Types.DOUBLE;
856         }
857     }
858
859     public static final class T_Binary extends BaseType
860     {
861         public Object JavaDoc sequenceKeyConversion(Long JavaDoc identifier)
862         {
863             return identifier.toString().getBytes();
864         }
865
866 // Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
867
// {
868
// return stmt.getBytes(columnName);
869
// }
870

871         Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc
872         {
873             return stmt.getBytes(columnIndex);
874         }
875
876         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
877         {
878             return rs.getBytes(columnName);
879         }
880
881         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc
882         {
883             return rs.getBytes(columnIndex);
884         }
885
886         public int getType()
887         {
888             return Types.BINARY;
889         }
890     }
891
892     public static final class T_VarBinary extends BaseType
893     {
894         public Object JavaDoc sequenceKeyConversion(Long JavaDoc identifier)
895         {
896             return identifier.toString().getBytes();
897         }
898
899 // Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
900
// {
901
// return stmt.getBytes(columnName);
902
// }
903

904         Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc
905         {
906             return stmt.getBytes(columnIndex);
907         }
908
909         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
910         {
911             return rs.getBytes(columnName);
912         }
913
914         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc
915         {
916             return rs.getBytes(columnIndex);
917         }
918
919         public int getType()
920         {
921             return Types.VARBINARY;
922         }
923     }
924
925     public static final class T_LongVarBinary extends BaseType
926     {
927         protected static final int BUFSZ = 2048;
928
929         /**
930          * Retrieve LONGVARBINARY InputStream data and pack into a byte array.
931          *
932          * @param is the input stream to be retrieved
933          * @return a string containing the clob data
934          * @throws java.sql.SQLException if conversion fails or the clob cannot be read
935          */

936         protected static byte[] retrieveStreamDataFromRs(InputStream JavaDoc is) throws SQLException JavaDoc
937         {
938             if (is == null)
939             {
940                 return null;
941             }
942             byte[] bytes = null;
943             ByteArrayOutputStream JavaDoc bos = null;
944             try
945             {
946                 bos = new ByteArrayOutputStream JavaDoc();
947                 int numRead;
948                 byte[] buf = new byte[BUFSZ];
949                 while ((numRead = is.read(buf, 0, buf.length)) > 0)
950                 {
951                     bos.write(buf, 0, numRead);
952                 }
953                 bytes = bos.toByteArray();
954             }
955             catch (IOException JavaDoc e)
956             {
957                 throw new SQLException JavaDoc("I/O exception retrieving LONGVARBINARY: " + e.getLocalizedMessage());
958             }
959             finally
960             {
961                 if (bos != null)
962                 {
963                     try
964                     {
965                         bos.close();
966                     }
967                     catch (Exception JavaDoc ignored)
968                     {
969                         //ignore
970
}
971                 }
972             }
973             return bytes;
974         }
975
976         public Object JavaDoc sequenceKeyConversion(Long JavaDoc identifier)
977         {
978             return identifier.toString().getBytes();
979         }
980
981 // Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
982
// {
983
// return stmt.getBytes(columnName);
984
// }
985

986         Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc
987         {
988             return stmt.getBytes(columnIndex);
989         }
990
991         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
992         {
993             return retrieveStreamDataFromRs(rs.getBinaryStream(columnName));
994         }
995
996         Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc
997         {
998             return retrieveStreamDataFromRs(rs.getBinaryStream(columnIndex));
999         }
1000
1001        public int getType()
1002        {
1003            return Types.LONGVARBINARY;
1004        }
1005    }
1006
1007    public static final class T_Date extends BaseType
1008    {
1009        public Object JavaDoc sequenceKeyConversion(Long JavaDoc identifier)
1010        {
1011            return new Date JavaDoc(identifier.longValue());
1012        }
1013
1014// Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
1015
// {
1016
// return stmt.getDate(columnName);
1017
// }
1018

1019        Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc
1020        {
1021            return stmt.getDate(columnIndex);
1022        }
1023
1024        Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
1025        {
1026            return rs.getDate(columnName);
1027        }
1028
1029        Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc
1030        {
1031            return rs.getDate(columnIndex);
1032        }
1033
1034        public int getType()
1035        {
1036            return Types.DATE;
1037        }
1038    }
1039
1040    public static final class T_Time extends BaseType
1041    {
1042        public Object JavaDoc sequenceKeyConversion(Long JavaDoc identifier)
1043        {
1044            return new Time JavaDoc(identifier.longValue());
1045        }
1046
1047// Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
1048
// {
1049
// return stmt.getTime(columnName);
1050
// }
1051

1052        Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc
1053        {
1054            return stmt.getTime(columnIndex);
1055        }
1056
1057        Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
1058        {
1059            return rs.getTime(columnName);
1060        }
1061
1062        Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc
1063        {
1064            return rs.getTime(columnIndex);
1065        }
1066
1067        public int getType()
1068        {
1069            return Types.TIME;
1070        }
1071    }
1072
1073    public static final class T_Timestamp extends BaseType
1074    {
1075        public Object JavaDoc sequenceKeyConversion(Long JavaDoc identifier)
1076        {
1077            return new Timestamp JavaDoc(identifier.longValue());
1078        }
1079
1080// Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
1081
// {
1082
// return stmt.getTimestamp(columnName);
1083
// }
1084

1085        Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc
1086        {
1087            return stmt.getTimestamp(columnIndex);
1088        }
1089
1090        Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
1091        {
1092            return rs.getTimestamp(columnName);
1093        }
1094
1095        Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc
1096        {
1097            return rs.getTimestamp(columnIndex);
1098        }
1099
1100        public int getType()
1101        {
1102            return Types.TIMESTAMP;
1103        }
1104    }
1105
1106    public static final class T_Clob extends BaseType
1107    {
1108        protected static final int BUFSZ = 32768;
1109
1110        /**
1111         * Convert CLOB to String. Safe for very large objects.
1112         *
1113         * @param aClob clob with character data
1114         * @return a string containing the clob data
1115         * @throws java.sql.SQLException if conversion fails or the clob cannot be read
1116         */

1117        protected static String JavaDoc safeClobToString(Clob JavaDoc aClob) throws SQLException JavaDoc
1118        {
1119            long length = aClob.length();
1120            if (length == 0)
1121            {
1122                return "";
1123            }
1124            StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
1125            char[] buf = new char[BUFSZ];
1126            java.io.Reader JavaDoc stream = aClob.getCharacterStream();
1127            try
1128            {
1129                int numRead;
1130                while ((numRead = stream.read(buf)) != -1)
1131                {
1132                    sb.append(buf, 0, numRead);
1133                }
1134                stream.close();
1135            }
1136            catch (IOException JavaDoc e)
1137            {
1138                throw new SQLException JavaDoc(e.getLocalizedMessage());
1139            }
1140            return sb.toString();
1141        }
1142
1143        public Object JavaDoc sequenceKeyConversion(Long JavaDoc identifier) throws SequenceManagerException
1144        {
1145            throw new SequenceManagerException("Not supported sequence key type 'CLOB'");
1146        }
1147
1148// Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
1149
// {
1150
// Clob aClob = stmt.getClob(columnName);
1151
// return (stmt.wasNull() ? null : aClob.getSubString(1L, (int) aClob.length()));
1152
// }
1153

1154        Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc
1155        {
1156            Clob JavaDoc aClob = stmt.getClob(columnIndex);
1157            return (stmt.wasNull() ? null : safeClobToString(aClob));
1158        }
1159
1160        Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
1161        {
1162            Clob JavaDoc aClob = rs.getClob(columnName);
1163            return (rs.wasNull() ? null : safeClobToString(aClob));
1164        }
1165
1166        Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc
1167        {
1168            Clob JavaDoc aClob = rs.getClob(columnIndex);
1169            return (rs.wasNull() ? null : safeClobToString(aClob));
1170        }
1171
1172        public int getType()
1173        {
1174            return Types.CLOB;
1175        }
1176    }
1177
1178    public static final class T_Blob extends BaseType
1179    {
1180        public Object JavaDoc sequenceKeyConversion(Long JavaDoc identifier) throws SequenceManagerException
1181        {
1182            throw new SequenceManagerException("Not supported sequence key type 'BLOB'");
1183        }
1184
1185// Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
1186
// {
1187
// Blob aBlob = stmt.getBlob(columnName);
1188
// return (stmt.wasNull() ? null : aBlob.getBytes(1L, (int) aBlob.length()));
1189
// }
1190

1191        Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc
1192        {
1193            Blob JavaDoc aBlob = stmt.getBlob(columnIndex);
1194            return (stmt.wasNull() ? null : aBlob.getBytes(1L, (int) aBlob.length()));
1195        }
1196
1197        Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
1198        {
1199            Blob JavaDoc aBlob = rs.getBlob(columnName);
1200            return (rs.wasNull() ? null : aBlob.getBytes(1L, (int) aBlob.length()));
1201        }
1202
1203        Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc
1204        {
1205            Blob JavaDoc aBlob = rs.getBlob(columnIndex);
1206            return (rs.wasNull() ? null : aBlob.getBytes(1L, (int) aBlob.length()));
1207        }
1208
1209        public int getType()
1210        {
1211            return Types.BLOB;
1212        }
1213    }
1214
1215    public static final class T_Array extends BaseType
1216    {
1217        public Object JavaDoc sequenceKeyConversion(Long JavaDoc identifier) throws SequenceManagerException
1218        {
1219            throw new SequenceManagerException("Not supported sequence key type 'ARRAY'");
1220        }
1221
1222// Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
1223
// {
1224
// return stmt.getArray(columnName);
1225
// }
1226

1227        Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc
1228        {
1229            return stmt.getArray(columnIndex);
1230        }
1231
1232        Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
1233        {
1234            return rs.getArray(columnName);
1235        }
1236
1237        Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc
1238        {
1239            return rs.getArray(columnIndex);
1240        }
1241
1242        public int getType()
1243        {
1244            return Types.ARRAY;
1245        }
1246    }
1247
1248    public static final class T_Struct extends BaseType
1249    {
1250        public Object JavaDoc sequenceKeyConversion(Long JavaDoc identifier) throws SequenceManagerException
1251        {
1252            throw new SequenceManagerException("Not supported sequence key type 'STRUCT'");
1253        }
1254
1255// Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
1256
// {
1257
// return stmt.getObject(columnName);
1258
// }
1259

1260        Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc
1261        {
1262            return stmt.getObject(columnIndex);
1263        }
1264
1265        Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
1266        {
1267            return rs.getObject(columnName);
1268        }
1269
1270        Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc
1271        {
1272            return rs.getObject(columnIndex);
1273        }
1274
1275        public int getType()
1276        {
1277            return Types.STRUCT;
1278        }
1279    }
1280
1281    public static final class T_Ref extends BaseType
1282    {
1283        public Object JavaDoc sequenceKeyConversion(Long JavaDoc identifier) throws SequenceManagerException
1284        {
1285            throw new SequenceManagerException("Not supported sequence key type 'REF'");
1286        }
1287
1288// Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
1289
// {
1290
// return stmt.getRef(columnName);
1291
// }
1292

1293        Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc
1294        {
1295            return stmt.getRef(columnIndex);
1296        }
1297
1298        Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
1299        {
1300            return rs.getRef(columnName);
1301        }
1302
1303        Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc
1304        {
1305            return rs.getRef(columnIndex);
1306        }
1307
1308        public int getType()
1309        {
1310            return Types.REF;
1311        }
1312    }
1313
1314//#ifdef JDBC30
1315
public static final class T_Datalink extends BaseType
1316    {
1317        public Object JavaDoc sequenceKeyConversion(Long JavaDoc identifier) throws SequenceManagerException
1318        {
1319            throw new SequenceManagerException("Not supported sequence key type 'DATALINK'");
1320        }
1321
1322// Object readValueFromStatement(CallableStatement stmt, String columnName) throws SQLException
1323
// {
1324
// return stmt.getURL(columnName);
1325
// }
1326

1327        Object JavaDoc readValueFromStatement(CallableStatement JavaDoc stmt, int columnIndex) throws SQLException JavaDoc
1328        {
1329            return stmt.getURL(columnIndex);
1330        }
1331
1332        Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, String JavaDoc columnName) throws SQLException JavaDoc
1333        {
1334            return rs.getURL(columnName);
1335        }
1336
1337        Object JavaDoc readValueFromResultSet(ResultSet JavaDoc rs, int columnIndex) throws SQLException JavaDoc
1338        {
1339            return rs.getURL(columnIndex);
1340        }
1341
1342        public int getType()
1343        {
1344            return Types.DATALINK;
1345        }
1346    }
1347//#endif
1348
}
1349
Popular Tags