KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > triactive > jdo > store > OracleTypeInfo


1 /*
2  * Copyright 2004 (C) TJDO.
3  * All rights reserved.
4  *
5  * This software is distributed under the terms of the TJDO License version 1.0.
6  * See the terms of the TJDO License in the documentation provided with this software.
7  *
8  * $Id: OracleTypeInfo.java,v 1.1 2004/03/30 06:15:56 jackknifebarber Exp $
9  */

10
11 package com.triactive.jdo.store;
12
13 import java.sql.ResultSet JavaDoc;
14 import java.sql.Types JavaDoc;
15
16
17 /**
18  * Represents the metadata of a Oracle data type.
19  *
20  * @author <a HREF="mailto:mmartin5@austin.rr.com">Mike Martin</a>
21  * @version $Revision: 1.1 $
22  */

23
24 class OracleTypeInfo extends TypeInfo
25 {
26     /**
27      * Constructs a type information object from the current row of the given
28      * result set. The {@link ResultSet} object passed must have been obtained
29      * from a call to DatabaseMetaData.getTypeInfo().
30      *
31      * <p>This method only retrieves the values from the current row; the caller
32      * is required to advance to the next row with {@link ResultSet#next}.
33      *
34      * @param rs The result set returned from DatabaseMetaData.getTypeInfo().
35      */

36
37     public OracleTypeInfo(ResultSet JavaDoc rs)
38     {
39         super(rs);
40     }
41
42
43     public boolean isCompatibleWith(ColumnInfo colInfo)
44     {
45         if (super.isCompatibleWith(colInfo))
46             return true;
47
48         switch (dataType)
49         {
50             case Types.DATE:
51             case Types.TIME:
52             case Types.TIMESTAMP:
53                 /* Any of these types can be used with a column of type DATE. */
54                 if (colInfo.typeName.equalsIgnoreCase("date"))
55                     return true;
56
57                 break;
58
59             default:
60                 break;
61         }
62
63         return false;
64     }
65 }
66
Popular Tags