1 package org.apache.torque.engine.platform;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.torque.engine.database.model.Domain;
23 import org.apache.torque.engine.database.model.SchemaType;
24
25 /***
26 * Derby Platform implementation.
27 *
28 * @author <a href="mailto:johnnymac@tiscali.be">Johnny Macchione</a>
29 * @version $Id: PlatformDerbyImpl.java 473814 2006-11-11 22:30:30Z tv $
30 */
31 public class PlatformDerbyImpl extends PlatformDefaultImpl
32 {
33
34 /***
35 * Default constructor.
36 */
37 public PlatformDerbyImpl()
38 {
39 super();
40 initialize();
41 }
42
43 /***
44 * Initializes db specific domain mapping.
45 */
46 private void initialize()
47 {
48 setSchemaDomainMapping(new Domain(SchemaType.LONGVARCHAR, "LONG VARCHAR"));
49
50
51
52
53
54
55
56
57
58
59
60 setSchemaDomainMapping(new Domain(SchemaType.VARBINARY, "LONG VARCHAR FOR BIT DATA"));
61 setSchemaDomainMapping(new Domain(SchemaType.LONGVARBINARY, "LONG VARCHAR FOR BIT DATA"));
62 setSchemaDomainMapping(new Domain(SchemaType.LONGVARCHAR, "LONG VARCHAR"));
63 }
64
65 /***
66 * @see Platform#getMaxColumnNameLength()
67 */
68 public int getMaxColumnNameLength()
69 {
70 return 128;
71 }
72
73 /***
74 * @see Platform#getAutoIncrement()
75 */
76 public String getAutoIncrement()
77 {
78 return "GENERATED BY DEFAULT AS IDENTITY";
79 }
80
81 /***
82 * @see Platform#getNativeIdMethod()
83 */
84 public String getNativeIdMethod()
85 {
86 return Platform.IDENTITY;
87 }
88
89 /***
90 * @see Platform#hasScale(String)
91 */
92 public boolean hasScale(String sqlType)
93 {
94 return "NUMERIC".equals(sqlType) || "DECIMAL".equals(sqlType);
95 }
96
97 /***
98 * @see Platform#hasSize(String)
99 */
100 public boolean hasSize(String sqlType)
101 {
102 return "NUMERIC".equals(sqlType) || "DECIMAL".equals(sqlType)
103 || "VARCHAR".equals(sqlType) || "CHAR".equals(sqlType)
104 || "BINARY".equals(sqlType)
105 || "BLOB".equals(sqlType) || "CLOB".equals(sqlType);
106 }
107 }