001: package org.apache.ojb.broker.accesslayer.sql;
002:
003: /* Copyright 2002-2005 The Apache Software Foundation
004: *
005: * Licensed under the Apache License, Version 2.0 (the "License");
006: * you may not use this file except in compliance with the License.
007: * You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: import org.apache.ojb.broker.metadata.ClassDescriptor;
019: import org.apache.ojb.broker.platforms.Platform;
020: import org.apache.ojb.broker.query.Query;
021:
022: /**
023: * This interface defines the behaviour of an SqlGenartor component
024: * that is responsible for building sql statements.
025: *
026: * @author <a href="mailto:thma@apache.org">Thomas Mahler<a>
027: * @version $Id: SqlGenerator.java,v 1.8.2.2 2005/12/21 22:23:44 tomdz Exp $
028: */
029: public interface SqlGenerator {
030: /**
031: * generate an INSERT-Statement for M:N indirection table
032: *
033: * @param table
034: * @param pkColumns1
035: * @param pkColumns2
036: * @return String
037: */
038: public String getInsertMNStatement(String table,
039: String[] pkColumns1, String[] pkColumns2);
040:
041: /**
042: * generate a SELECT-Statement for M:N indirection table
043: * @param table the indirection table
044: * @param selectColumns selected columns
045: * @param columns for where
046: */
047: public String getSelectMNStatement(String table,
048: String[] selectColumns, String[] columns);
049:
050: /**
051: * generate a DELETE-Statement for M:N indirection table
052: *
053: * @param table
054: * @param pkColumns1
055: * @param pkColumns2
056: * @return String
057: */
058: public String getDeleteMNStatement(String table,
059: String[] pkColumns1, String[] pkColumns2);
060:
061: /**
062: * generate a select-Statement according to query
063: * @param query the Query
064: * @param cld the ClassDescriptor
065: */
066: public SelectStatement getPreparedSelectStatement(Query query,
067: ClassDescriptor cld);
068:
069: /**
070: * generate a select-Statement according to query
071: * @param query the Query
072: * @param cld the ClassDescriptor
073: */
074: public SelectStatement getSelectStatementDep(Query query,
075: ClassDescriptor cld);
076:
077: /**
078: * generate a prepared DELETE-Statement according to query
079: * @param query the Query
080: * @param cld the ClassDescriptor
081: */
082: public SqlStatement getPreparedDeleteStatement(Query query,
083: ClassDescriptor cld);
084:
085: /**
086: * generate a prepared DELETE-Statement for the Class
087: * described by cld.
088: * @param cld the ClassDescriptor
089: */
090: public SqlStatement getPreparedDeleteStatement(ClassDescriptor cld);
091:
092: /**
093: * generate a prepared INSERT-Statement for the Class
094: * described by mif.
095: * @param cld the ClassDescriptor
096: */
097: public SqlStatement getPreparedInsertStatement(ClassDescriptor cld);
098:
099: /**
100: * generate a prepared SELECT-Statement for the Class
101: * described by cld
102: * @param cld the ClassDescriptor
103: */
104: public SelectStatement getPreparedSelectByPkStatement(
105: ClassDescriptor cld);
106:
107: /**
108: * generate a prepared UPDATE-Statement for the Class
109: * described by cld
110: * @param cld the ClassDescriptor
111: */
112: public SqlStatement getPreparedUpdateStatement(ClassDescriptor cld);
113:
114: /**
115: * Answer the Platform used by the SqlGenerator
116: * @return Platform
117: */
118: public Platform getPlatform();
119:
120: }
|