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 * Interface for RDBMS platform specific behaviour.
27 *
28 * @author <a href="mailto:mpoeschl@marmot.at">Martin Poeschl</a>
29 * @version $Id: Platform.java 473814 2006-11-11 22:30:30Z tv $
30 */
31 public interface Platform
32 {
33 /*** constant for native id method */
34 String IDENTITY = "identity";
35 /*** constant for native id method */
36 String SEQUENCE = "sequence";
37
38 /***
39 * Returns the native IdMethod (sequence|identity)
40 *
41 * @return the native IdMethod
42 */
43 String getNativeIdMethod();
44
45 /***
46 * Returns the max column length supported by the db.
47 *
48 * @return the max column length
49 */
50 int getMaxColumnNameLength();
51
52 /***
53 * Returns the db specific domain for a jdbcType.
54 *
55 * @param jdbcType the jdbcType name
56 * @return the db specific domain
57 */
58 Domain getDomainForSchemaType(SchemaType jdbcType);
59
60 /***
61 * @return The RDBMS-specific SQL fragment for <code>NULL</code>
62 * or <code>NOT NULL</code>.
63 */
64 String getNullString(boolean notNull);
65
66 /***
67 * @return The RDBMS-specific SQL fragment for autoincrement.
68 */
69 String getAutoIncrement();
70
71 /***
72 * Returns if the RDBMS-specific SQL type has a size attribute.
73 *
74 * @param sqlType the SQL type
75 * @return true if the type has a size attribute
76 */
77 boolean hasSize(String sqlType);
78
79 /***
80 * Returns if the RDBMS-specific SQL type has a scale attribute.
81 *
82 * @param sqlType the SQL type
83 * @return true if the type has a scale attribute
84 */
85 boolean hasScale(String sqlType);
86
87 /***
88 * Returns whether the "not null part" of the definition of a column
89 * should be generated before the "autoincrement part" in a "create table"
90 * statement.
91 *
92 * @return true if the "not null part" should be first,
93 * false if the "autoincrement part" should be first in a
94 * "create table" statement.
95 */
96 boolean createNotNullBeforeAutoincrement();
97 }