KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ws > jaxme > sqls > SQLGenerator


1 /*
2  * Copyright 2003, 2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15
16  */

17 package org.apache.ws.jaxme.sqls;
18
19 import java.util.Collection JavaDoc;
20
21
22 /** <p>An SQL generator.</p>
23  *
24  * @author <a HREF="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
25  */

26 public interface SQLGenerator {
27   /** <p>Generates a <code>CREATE SCHEMA</code> statement. Doesn't create
28    * <code>CREATE TABLE</code> or similar statements.</p>
29    */

30   public Collection JavaDoc getCreate(Schema pSchema);
31
32   /** <p>Generates <code>CREATE</code> statements for the schema.</p>
33    * @param pAll If this parameter is set to true, then the method is
34    * equivalent to {@link #getCreate(Schema)}. Otherwise the returned
35    * collection will also include <code>CREATE</code> statements for
36    * all the tables and indexes in the schema. These additional statements
37    * are created by invoking {@link #getCreate(Table,boolean)} for all the
38    * tables in the schema.</p>
39    */

40   public Collection JavaDoc getCreate(Schema pSchema, boolean pAll);
41
42   /** <p>Generates a DROP SCHEMA statement. Doesn't create
43    * <code>DROP TABLE</code> or similar statements.</p>
44    */

45   public Collection JavaDoc getDrop(Schema pSchema);
46
47   /** <p>Generates <code>DROP</code> statements for the schema.</p>
48    * @param pAll If this parameter is set to true, then the method is
49    * equivalent to {@link #getDrop(Schema)}. Otherwise the returned
50    * collection will also include <code>DROP</code> statements for
51    * all the tables and indexes in the schema. These additional statements
52    * are created by invoking {@link #getDrop(Table,boolean)} for all the
53    * tables in the schema.</p>
54    */

55   public Collection JavaDoc getDrop(Schema pSchema, boolean pAll);
56
57   /** <p>Generates a CREATE TABLE statement. Doesn't create
58    * <code>CREATE INDEX</code> or similar statements.</p>
59    */

60   public Collection JavaDoc getCreate(Table pTable);
61
62   /** <p>Generates <code>CREATE</code> statements for the table.</p>
63    * @param pAll If this parameter is set to true, then the method is
64    * equivalent to {@link #getCreate(Table)}. Otherwise the returned
65    * collection will also include <code>CREATE</code> statements for
66    * the indexes, which are defined on the table. These additional
67    * statements are created by invoking {@link #getCreate(Index)}
68    * and {@link #getCreate(ForeignKey)} for all the indexes in the
69    * schema.</p>
70    */

71   public Collection JavaDoc getCreate(Table pTable, boolean pAll);
72
73   /** <p>Generates a DROP TABLE statement. Doesn't create
74    * <code>DROP INDEX</code> or similar statements.</p>
75    */

76   public Collection JavaDoc getDrop(Table pTable);
77
78   /** <p>Generates <code>DROP</code> statements for the table.</p>
79    * @param pAll If this parameter is set to true, then the method is
80    * equivalent to {@link #getDrop(Table)}. Otherwise the returned
81    * collection will also include <code>DROP</code> statements for
82    * the indexes, which are defined on the table. These additional
83    * statements are created by invoking {@link #getDrop(Index)}
84    * and {@link #getDrop(ForeignKey)} for all the indexes in the
85    * schema.</p>
86    */

87   public Collection JavaDoc getDrop(Table pTable, boolean pAll);
88
89   /** <p>Generates a CREATE INDEX statement.</p>
90    */

91   public Collection JavaDoc getCreate(Index pIndex);
92
93   /** <p>Generates a DROP INDEX statement.</p>
94    */

95   public Collection JavaDoc getDrop(Index pIndex);
96
97   /** <p>Generates a CREATE FOREIGN KEY statement.</p>
98    */

99   public Collection JavaDoc getCreate(ForeignKey pKey);
100
101   /** <p>Generates a DROP FOEIGN KEY statement.</p>
102    */

103   public Collection JavaDoc getDrop(ForeignKey pKey);
104
105   /** <p>Generates an INSERT, UPDATE, DELETE or SELECT statement.</p>
106    */

107   public String JavaDoc getQuery(Statement pStatement);
108
109   /** <p>Generates the WHERE clause of a SELECT, UPDATE, or DELETE statement.</p>
110    */

111   public String JavaDoc getConstraint(Constraint pConstraint);
112
113   /** <p>Returns the <code>WHERE ... ORDER BY ...</code> part
114    * of the SELECT statement.</p>
115    */

116   public String JavaDoc getWhereClause(SelectStatement pQuery);
117
118   /** <p>Sets the statement terminator. A non-null value will be
119    * appended to all generated statements. Defaults to null.</p>
120    */

121   public void setStatementTerminator(String JavaDoc pTerminator);
122
123   /** <p>Returns the statement terminator. A non-null value will be
124    * appended to all generated statements. Defaults to null.</p>
125    */

126   public String JavaDoc getStatementTerminator();
127
128   /** <p>Sets the line terminator. A non-null value indicates that
129    * the generated statements should be made human readable by splitting
130    * them over multiple lines. A null value ensures that a statement
131    * consists of a single line only. Defaults to "\n".</p>
132    */

133   public void setLineTerminator(String JavaDoc pTerminator);
134
135   /** <p>Returns the line terminator. A non-null value indicates that
136    * the generated statements should be made human readable by splitting
137    * them over multiple lines. A null value ensures that a statement
138    * consists of a single line only. Defaults to "\n".</p>
139    */

140   public String JavaDoc getLineTerminator();
141 }
142
Popular Tags