View Javadoc

1   package org.apache.torque.engine.platform;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
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  }