001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041: package org.netbeans.modules.sql.framework.codegen;
042:
043: import com.sun.sql.framework.jdbc.DBConstants;
044:
045: /**
046: * @author Ritesh Adval
047: * @author Ahimanikya Satapathy
048: * @version $Revision$
049: */
050: public interface DB {
051:
052: public static final int ORACLE8DB = DBConstants.ORACLE8;
053: public static final int ORACLE9DB = DBConstants.ORACLE9;
054: public static final int SQLSERVERDB = DBConstants.MSSQLSERVER;
055: public static final int SYBASEDB = DBConstants.SYBASE;
056: public static final int DB2V5DB = DBConstants.DB2V5;
057: public static final int DB2V7DB = DBConstants.DB2V7;
058: public static final int DB2V8DB = DBConstants.DB2V8;
059: public static final int AXIONDB = DBConstants.AXION;
060: public static final int DERBYDB = DBConstants.DERBY;
061: public static final int PostgreSQL = DBConstants.POSTGRESQL;
062: public static final int BASEDB = DBConstants.ANSI92;
063: public static final int JDBCDB = DBConstants.JDBC;
064: public static final int MYSQLDB = DBConstants.MYSQL;
065:
066: /**
067: * get the Statements which are supported by this DB.
068: *
069: * @return Statements.
070: */
071: public Statements getStatements();
072:
073: /**
074: * get the SQLObject Generator factory for this DB.
075: *
076: * @return AbstractGeneratorFactory
077: */
078: public AbstractGeneratorFactory getGeneratorFactory();
079:
080: /**
081: * get the type Generator for this DB.
082: *
083: * @return TypeGenerator.
084: */
085: public TypeGenerator getTypeGenerator();
086:
087: /**
088: * get the name after applying DB specfic escaping.
089: *
090: * @param name name which needs to be escaped.
091: * @return name after escaping it.
092: */
093: public String getEscapedName(String name);
094:
095: /**
096: * Get the name after removing any DB specific escaping.
097: *
098: * @param name name which needs to be unescaped.
099: * @return name after unescaping it.
100: */
101: public String getUnescapedName(String name);
102:
103: /**
104: * get the name after applying DB specfic escaping.
105: *
106: * @param name name which needs to be escaped.
107: * @return name after escaping it.
108: */
109: public String getEscapedCatalogName(String name);
110:
111: /**
112: * get the name after applying DB specfic escaping.
113: *
114: * @param name name which needs to be escaped.
115: * @return name after escaping it.
116: */
117: public String getEscapedSchemaName(String name);
118:
119: /**
120: * get the maximum table name length allowed for the name of the tables in this DB.
121: *
122: * @return max table length.
123: */
124: public int getMaxTableNameLength();
125:
126: /**
127: * get the default date format string of this DB.
128: *
129: * @return default date format string.
130: */
131: public String getDefaultDateFormat();
132:
133: /**
134: * return true if this DB supports ANSI style join.
135: *
136: * @return true if ANSI style join is supported.
137: */
138: public boolean isAnsiJoinSyntaxSupported();
139:
140: /**
141: * get the data type casting rule for this DB. provides caller to check if a source
142: * data type can be converted to a target data type by this DB.
143: *
144: * @param sourceType source data type.
145: * @param targetType target data type.
146: * @return
147: */
148: public int getCastingRule(int sourceType, int targetType);
149:
150: /**
151: * get the operator factory for this data base
152: *
153: * @return operator factory
154: */
155: public SQLOperatorFactory getOperatorFactory();
156:
157: /**
158: * Returns DBType
159: *
160: * @return operator factory
161: */
162: public int getDBType();
163: }
|