KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > oracle > toplink > essentials > platform > database > CloudscapePlatform


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the "License"). You may not use this file except
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * HEADER in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  */

21 // Copyright (c) 1998, 2006, Oracle. All rights reserved.
22
package oracle.toplink.essentials.platform.database;
23
24 import java.util.*;
25 import oracle.toplink.essentials.internal.databaseaccess.*;
26
27 /**
28  * <p><b>Purpose</b>: Provides CloudScape DBMS specific behaviour.
29  *
30  * @since TOPLink/Java 3.0
31  */

32 public class CloudscapePlatform extends oracle.toplink.essentials.platform.database.DatabasePlatform {
33
34     /**
35      * INTERNAL:
36      * Seems compatible with informix.
37      */

38     protected Hashtable buildFieldTypes() {
39         Hashtable fieldTypeMapping;
40
41         fieldTypeMapping = new Hashtable();
42         fieldTypeMapping.put(Boolean JavaDoc.class, new FieldTypeDefinition("SMALLINT default 0", false));
43
44         fieldTypeMapping.put(Integer JavaDoc.class, new FieldTypeDefinition("INTEGER", false));
45         fieldTypeMapping.put(Long JavaDoc.class, new FieldTypeDefinition("NUMERIC", 19));
46         fieldTypeMapping.put(Float JavaDoc.class, new FieldTypeDefinition("FLOAT(16)", false));
47         fieldTypeMapping.put(Double JavaDoc.class, new FieldTypeDefinition("FLOAT(32)", false));
48         fieldTypeMapping.put(Short JavaDoc.class, new FieldTypeDefinition("SMALLINT", false));
49         fieldTypeMapping.put(Byte JavaDoc.class, new FieldTypeDefinition("SMALLINT", false));
50         fieldTypeMapping.put(java.math.BigInteger JavaDoc.class, new FieldTypeDefinition("DECIMAL", 32));
51         fieldTypeMapping.put(java.math.BigDecimal JavaDoc.class, new FieldTypeDefinition("DECIMAL", 32).setLimits(32, -19, 19));
52         fieldTypeMapping.put(Number JavaDoc.class, new FieldTypeDefinition("DECIMAL", 32).setLimits(32, -19, 19));
53
54         fieldTypeMapping.put(String JavaDoc.class, new FieldTypeDefinition("VARCHAR", 255));
55         fieldTypeMapping.put(Character JavaDoc.class, new FieldTypeDefinition("CHAR", 1));
56         fieldTypeMapping.put(Byte JavaDoc[].class, new FieldTypeDefinition("BYTE", false));
57         fieldTypeMapping.put(Character JavaDoc[].class, new FieldTypeDefinition("TEXT", false));
58         fieldTypeMapping.put(byte[].class, new FieldTypeDefinition("BYTE", false));
59         fieldTypeMapping.put(char[].class, new FieldTypeDefinition("TEXT", false));
60         fieldTypeMapping.put(java.sql.Blob JavaDoc.class, new FieldTypeDefinition("BYTE", false));
61         fieldTypeMapping.put(java.sql.Clob JavaDoc.class, new FieldTypeDefinition("TEXT", false));
62
63         fieldTypeMapping.put(java.sql.Date JavaDoc.class, new FieldTypeDefinition("DATE", false));
64         fieldTypeMapping.put(java.sql.Time JavaDoc.class, new FieldTypeDefinition("DATETIME HOUR TO SECOND", false));
65         fieldTypeMapping.put(java.sql.Timestamp JavaDoc.class, new FieldTypeDefinition("DATETIME YEAR TO FRACTION(5)", false));
66
67         return fieldTypeMapping;
68     }
69
70     /**
71      * INTERNAL:
72      * Answers whether platform is CloudScape
73      */

74     public boolean isCloudscape() {
75         return true;
76     }
77
78     /**
79      * INTERNAL:
80      * JDBC defines an outer join syntax which many drivers do not support. So we normally avoid it.
81      */

82     public boolean shouldUseJDBCOuterJoinSyntax() {
83         return false;// not sure if cloudscape likes this or not. Still investigating.
84
}
85 }
86
Popular Tags