Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
SqlGenerator |
|
| 1.0;1 |
1 | package org.apache.ojb.broker.accesslayer.sql; | |
2 | ||
3 | /* Copyright 2002-2005 The Apache Software Foundation | |
4 | * | |
5 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
6 | * you may not use this file except in compliance with the License. | |
7 | * You may obtain a copy of the License at | |
8 | * | |
9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
10 | * | |
11 | * Unless required by applicable law or agreed to in writing, software | |
12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | * See the License for the specific language governing permissions and | |
15 | * limitations under the License. | |
16 | */ | |
17 | ||
18 | import org.apache.ojb.broker.metadata.ClassDescriptor; | |
19 | import org.apache.ojb.broker.platforms.Platform; | |
20 | import org.apache.ojb.broker.query.Query; | |
21 | ||
22 | /** | |
23 | * This interface defines the behaviour of an SqlGenartor component | |
24 | * that is responsible for building sql statements. | |
25 | * | |
26 | * @author <a href="mailto:thma@apache.org">Thomas Mahler<a> | |
27 | * @version $Id: SqlGenerator.java,v 1.1 2007-08-24 22:17:39 ewestfal Exp $ | |
28 | */ | |
29 | public interface SqlGenerator | |
30 | { | |
31 | /** | |
32 | * generate an INSERT-Statement for M:N indirection table | |
33 | * | |
34 | * @param table | |
35 | * @param pkColumns1 | |
36 | * @param pkColumns2 | |
37 | * @return String | |
38 | */ | |
39 | public String getInsertMNStatement(String table, String[] pkColumns1, String[] pkColumns2); | |
40 | ||
41 | /** | |
42 | * generate a SELECT-Statement for M:N indirection table | |
43 | * @param table the indirection table | |
44 | * @param selectColumns selected columns | |
45 | * @param columns for where | |
46 | */ | |
47 | public String getSelectMNStatement(String table, String[] selectColumns, String[] columns); | |
48 | ||
49 | /** | |
50 | * generate a DELETE-Statement for M:N indirection table | |
51 | * | |
52 | * @param table | |
53 | * @param pkColumns1 | |
54 | * @param pkColumns2 | |
55 | * @return String | |
56 | */ | |
57 | public String getDeleteMNStatement(String table, String[] pkColumns1, String[] pkColumns2); | |
58 | ||
59 | /** | |
60 | * generate a select-Statement according to query | |
61 | * @param query the Query | |
62 | * @param cld the ClassDescriptor | |
63 | */ | |
64 | public SelectStatement getPreparedSelectStatement(Query query, ClassDescriptor cld); | |
65 | ||
66 | /** | |
67 | * generate a select-Statement according to query | |
68 | * @param query the Query | |
69 | * @param cld the ClassDescriptor | |
70 | */ | |
71 | public SelectStatement getSelectStatementDep(Query query, ClassDescriptor cld); | |
72 | ||
73 | /** | |
74 | * generate a prepared DELETE-Statement according to query | |
75 | * @param query the Query | |
76 | * @param cld the ClassDescriptor | |
77 | */ | |
78 | public SqlStatement getPreparedDeleteStatement(Query query, ClassDescriptor cld); | |
79 | ||
80 | /** | |
81 | * generate a prepared DELETE-Statement for the Class | |
82 | * described by cld. | |
83 | * @param cld the ClassDescriptor | |
84 | */ | |
85 | public SqlStatement getPreparedDeleteStatement(ClassDescriptor cld); | |
86 | ||
87 | /** | |
88 | * generate a prepared INSERT-Statement for the Class | |
89 | * described by mif. | |
90 | * @param cld the ClassDescriptor | |
91 | */ | |
92 | public SqlStatement getPreparedInsertStatement(ClassDescriptor cld); | |
93 | ||
94 | /** | |
95 | * generate a prepared SELECT-Statement for the Class | |
96 | * described by cld | |
97 | * @param cld the ClassDescriptor | |
98 | */ | |
99 | public SelectStatement getPreparedSelectByPkStatement(ClassDescriptor cld); | |
100 | ||
101 | /** | |
102 | * generate a prepared UPDATE-Statement for the Class | |
103 | * described by cld | |
104 | * @param cld the ClassDescriptor | |
105 | */ | |
106 | public SqlStatement getPreparedUpdateStatement(ClassDescriptor cld); | |
107 | ||
108 | ||
109 | /** | |
110 | * Answer the Platform used by the SqlGenerator | |
111 | * @return Platform | |
112 | */ | |
113 | public Platform getPlatform(); | |
114 | ||
115 | } |