View Javadoc

1   package org.apache.torque.engine.platform;
2   
3   /*
4    * Copyright 2001-2005 The Apache Software Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License")
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  import org.apache.torque.engine.database.model.Domain;
20  import org.apache.torque.engine.database.model.SchemaType;
21  
22  /***
23   * Interface for RDBMS platform specific behaviour.
24   *
25   * @author <a href="mailto:mpoeschl@marmot.at">Martin Poeschl</a>
26   * @version $Id: Platform.java 239626 2005-08-24 12:19:51Z henning $
27   */
28  public interface Platform
29  {
30      /*** constant for native id method */
31      static final String IDENTITY = "identity";
32      /*** constant for native id method */
33      static final String SEQUENCE = "sequence";
34  
35      /***
36       * Returns the native IdMethod (sequence|identity)
37       *
38       * @return the native IdMethod
39       */
40      String getNativeIdMethod();
41  
42      /***
43       * Returns the max column length supported by the db.
44       *
45       * @return the max column length
46       */
47      int getMaxColumnNameLength();
48  
49      /***
50       * Returns the db specific domain for a jdbcType.
51       *
52       * @param jdbcType the jdbcType name
53       * @return the db specific domain
54       */
55      Domain getDomainForSchemaType(SchemaType jdbcType);
56  
57      /***
58       * @return The RDBMS-specific SQL fragment for <code>NULL</code>
59       * or <code>NOT NULL</code>.
60       */
61      String getNullString(boolean notNull);
62  
63      /***
64       * @return The RDBMS-specific SQL fragment for autoincrement.
65       */
66      String getAutoIncrement();
67  
68      /***
69       * Returns if the RDBMS-specific SQL type has a size attribute.
70       *
71       * @param sqlType the SQL type
72       * @return true if the type has a size attribute
73       */
74      boolean hasSize(String sqlType);
75  
76      /***
77       * Returns if the RDBMS-specific SQL type has a scale attribute.
78       *
79       * @param sqlType the SQL type
80       * @return true if the type has a scale attribute
81       */
82      boolean hasScale(String sqlType);
83  }