01: /*
02: * Copyright 2006 Le Duc Bao, Ralf Joachim
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
05: * use this file except in compliance with the License. You may obtain a copy of
06: * the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13: * License for the specific language governing permissions and limitations under
14: * the License.
15: */
16: package org.castor.ddlgen.engine.hsql;
17:
18: import org.castor.ddlgen.AbstractTypeMapper;
19: import org.castor.ddlgen.DDLGenConfiguration;
20: import org.castor.ddlgen.typeinfo.NoParamType;
21: import org.castor.ddlgen.typeinfo.OptionalPrecisionDecimalsType;
22: import org.castor.ddlgen.typeinfo.RequiredLengthType;
23: import org.castor.ddlgen.typeinfo.RequiredPrecisionType;
24:
25: /**
26: * Final TypeMapper for HSQL database.
27: *
28: * @author <a href="mailto:leducbao AT gmail DOT com">Le Duc Bao</a>
29: * @author <a href="mailto:ralf DOT joachim AT syscon DOT eu">Ralf Joachim</a>
30: * @version $Revision: 5951 $ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $
31: * @since 1.1
32: */
33: public final class HsqlTypeMapper extends AbstractTypeMapper {
34: //--------------------------------------------------------------------------
35:
36: /**
37: * Construct a TypeMapper for MySQL database using given configuration to
38: * get default parameters for parameterized types.
39: *
40: * @param conf The configuration to get default parameter values from.
41: */
42: public HsqlTypeMapper(final DDLGenConfiguration conf) {
43: super (conf);
44: }
45:
46: //--------------------------------------------------------------------------
47:
48: /**
49: * {@inheritDoc}
50: */
51: protected void initialize(final DDLGenConfiguration conf) {
52: // numeric types
53: this .add(new NoParamType("bit", "BIT"));
54: this .add(new NoParamType("tinyint", "TINYINT"));
55: this .add(new NoParamType("smallint", "SMALLINT"));
56: this .add(new NoParamType("integer", "INTEGER"));
57: this .add(new NoParamType("int", "INTEGER"));
58: this .add(new NoParamType("bigint", "BIGINT"));
59:
60: this .add(new NoParamType("float", "FLOAT"));
61: this .add(new RequiredPrecisionType("double",
62: "DOUBLE PRECISION", conf));
63: this .add(new NoParamType("real", "REAL"));
64: this .add(new RequiredPrecisionType("numeric", "NUMERIC", conf));
65: this .add(new OptionalPrecisionDecimalsType("decimal",
66: "DECIMAL", conf));
67:
68: // character types
69: this .add(new RequiredLengthType("char", "CHAR", conf));
70: this .add(new RequiredLengthType("varchar", "VARCHAR", conf));
71: this .add(new NoParamType("longvarchar", "LONGVARCHAR"));
72:
73: // date and time types
74: this .add(new NoParamType("date", "DATE"));
75: this .add(new NoParamType("time", "TIME"));
76: this .add(new RequiredPrecisionType("timestamp", "TIMESTAMP",
77: conf));
78:
79: // other types
80: this .add(new NoParamType("binary", "BINARY"));
81: this .add(new NoParamType("varbinary", "VARBINARY"));
82: this .add(new NoParamType("longvarbinary", "LONGVARBINARY"));
83:
84: this .add(new NoParamType("other", "OTHER"));
85: this .add(new NoParamType("javaobject", "OBJECT"));
86: this .add(new NoParamType("blob", "OBJECT"));
87: this .add(new NoParamType("clob", "OBJECT"));
88: }
89:
90: //--------------------------------------------------------------------------
91: }
|