001: /*
002: * The contents of this file are subject to the terms of the Common Development
003: * and Distribution License (the License). You may not use this file except in
004: * compliance with the License.
005: *
006: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007: * or http://www.netbeans.org/cddl.txt.
008: *
009: * When distributing Covered Code, include this CDDL Header Notice in each file
010: * and include the License file at http://www.netbeans.org/cddl.txt.
011: * If applicable, add the following below the CDDL Header, with the fields
012: * enclosed by brackets [] replaced by your own identifying information:
013: * "Portions Copyrighted [year] [name of copyright owner]"
014: *
015: * The Original Software is NetBeans. The Initial Developer of the Original
016: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
017: * Microsystems, Inc. All Rights Reserved.
018: */
019: package org.netbeans.modules.sql.framework.codegen.derby;
020:
021: import java.sql.Types;
022: import java.util.HashMap;
023: import java.util.Map;
024:
025: import org.netbeans.modules.sql.framework.codegen.AbstractTypeGenerator;
026: import org.netbeans.modules.sql.framework.codegen.DataType;
027:
028: /**
029: * For Derby Database code generations using from JDBC Code generation.
030: * @author karthik
031: */
032: public class DerbyTypeGenerator extends AbstractTypeGenerator {
033:
034: private static Map<Integer, DataType> supportedDataTypes;
035:
036: public Map createSupportedDataTypesMap() {
037: if (supportedDataTypes == null) {
038: supportedDataTypes = new HashMap<Integer, DataType>();
039: }
040: supportedDataTypes.put(new Integer(Types.BIT), DataType.BIT);
041: supportedDataTypes.put(new Integer(Types.BOOLEAN),
042: DataType.BOOLEAN);
043:
044: supportedDataTypes.put(new Integer(Types.BIGINT),
045: DataType.BIGINT);
046: supportedDataTypes.put(new Integer(Types.SMALLINT),
047: DataType.SMALLINT);
048: supportedDataTypes.put(new Integer(Types.TINYINT),
049: DataType.TINYINT);
050: supportedDataTypes.put(new Integer(Types.INTEGER),
051: DataType.INTEGER);
052:
053: supportedDataTypes.put(new Integer(Types.DECIMAL),
054: DataType.DECIMAL);
055: supportedDataTypes.put(new Integer(Types.DOUBLE),
056: DataType.DOUBLE_PRECISION);
057: supportedDataTypes
058: .put(new Integer(Types.FLOAT), DataType.FLOAT);
059: supportedDataTypes.put(new Integer(Types.NUMERIC),
060: DataType.NUMERIC);
061: supportedDataTypes.put(new Integer(Types.REAL), DataType.REAL);
062:
063: supportedDataTypes.put(new Integer(Types.DATE), DataType.DATE);
064: supportedDataTypes.put(new Integer(Types.TIME), DataType.TIME);
065: supportedDataTypes.put(new Integer(Types.TIMESTAMP),
066: DataType.TIMESTAMP);
067:
068: supportedDataTypes.put(new Integer(Types.CHAR), DataType.CHAR);
069: supportedDataTypes.put(new Integer(Types.LONGVARCHAR),
070: DataType.LONGVARCHAR);
071: supportedDataTypes.put(new Integer(Types.VARCHAR),
072: DataType.VARCHAR);
073:
074: supportedDataTypes.put(new Integer(Types.JAVA_OBJECT),
075: DataType.JAVA_OBJECT);
076: supportedDataTypes.put(new Integer(Types.OTHER),
077: DataType.VARCHAR);
078:
079: supportedDataTypes.put(new Integer(Types.BINARY),
080: DataType.BINARY);
081: supportedDataTypes.put(new Integer(Types.VARBINARY),
082: DataType.VARBINARY);
083: supportedDataTypes.put(new Integer(Types.LONGVARBINARY),
084: DataType.LONGVARBINARY);
085:
086: supportedDataTypes.put(new Integer(Types.BLOB), DataType.BLOB);
087: supportedDataTypes.put(new Integer(Types.CLOB), DataType.CLOB);
088: supportedDataTypes
089: .put(new Integer(Types.ARRAY), DataType.ARRAY);
090:
091: supportedDataTypes.put(new Integer(Types.DISTINCT),
092: DataType.DISTINCT);
093: supportedDataTypes.put(new Integer(Types.REF), DataType.REF);
094: supportedDataTypes.put(new Integer(Types.STRUCT),
095: DataType.STRUCT);
096: supportedDataTypes.put(new Integer(Types.DATALINK),
097: DataType.DATALINK);
098: supportedDataTypes.put(new Integer(Types.NULL), DataType.NULL);
099:
100: return supportedDataTypes;
101: }
102: }
|