KickJava   Java API By Example, From Geeks To Geeks.

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


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.Iterator JavaDoc;
20
21
22 /** <p>Interface of a SELECT statement.</p>
23  *
24  * @author <a HREF="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
25  */

26 public interface SelectStatement extends ConstrainedStatement {
27     /** Provides a single column for an <code>ORDER BY</code>
28      * clause.
29      */

30     public interface OrderColumn {
31       /** <p>Returns the ordered column. Typically, this is
32        * a {@link ColumnReference}. However, it may as well
33        * be a {@link Function} or a piece of {@link RawSQLCode}.</p>
34        */

35       public Object JavaDoc getColumn();
36
37       /** <p>Returns whether ascending (false) or descending (true)
38        * sorting is requested.</p>
39        */

40       public boolean isDescending();
41    }
42
43    /** <p>Shortcut for <code>(SelectTableReference) getTable()</code>.</p>
44     */

45    public SelectTableReference getSelectTableReference();
46
47    /** <p>Returns an Iterator over all the table references.</p>
48     */

49    public Iterator JavaDoc getSelectTableReferences();
50
51    /** <p>Adds a column to the ORDER BY clause.</p>
52     */

53    public void addOrderColumn(OrderColumn pColumn);
54
55    /** <p>Adds a column to the ORDER BY clause. The column is sorted in
56     * ascending order.</p>
57     */

58    public void addOrderColumn(Object JavaDoc pColumn);
59
60    /** <p>Adds a column to the ORDER BY clause. The column is sorted in
61     * ascending or descending order, depending on the parameter
62     * <code>pDescending</code>.</p>
63     * @param pDescending True for descending or false for ascending
64     */

65    public void addOrderColumn(Object JavaDoc pColumn, boolean pDescending);
66
67    /** <p>Adds a result column to the statement. By default all columns
68     * are returned.</p>
69     */

70    public void addResultColumn(ColumnReference pColumn);
71
72    /** <p>Returns the list of result columns.</p>
73     */

74    public Iterator JavaDoc getResultColumns();
75
76    /** <p>Returns the list of order columns. The elements
77     * returned by the iterator are instances of
78     * {@link SelectStatement.OrderColumn}.</p>
79     */

80    public Iterator JavaDoc getOrderColumns();
81
82    /** <p>Sets whether the statement should have a DISTINCT clause. By
83     * default no DISTINCT clause is present.</p>
84     */

85    public void setDistinct(boolean pDistinct);
86
87    /** <p>Returns whether the statement should have a DISTINCT clause. By
88     * default no DISTINCT clause is present.</p>
89     */

90    public boolean isDistinct();
91
92    /** <p>Limits the size of the result set to the given number of rows.
93     * Defaults to zero, in which case the size of the result set is
94     * unlimited.</p>
95     */

96    public void setMaxRows(int pMaxRows);
97
98    /** <p>Returns the limit of the number of rows in the result set, or
99     * zero, if the size of the result set is unlimited.</p>
100     */

101    public int getMaxRows();
102
103    /** <p>Indicates that the given number of rows should be skipped at the
104     * result sets beginning. The default is zero, in which case no rows
105     * are skipped.</p>
106     */

107    public void setSkippedRows(int pSkippedRows);
108
109    /** <p>Returns the number of rows to skip at the result sets beginning.
110     * The default is zero, in which case no rows are skipped.</p>
111     */

112    public int getSkippedRows();
113
114    /** <p>Creates a view, which may be used to embed the statement into
115     * a separate query.</p>
116     */

117    public Table createView(Table.Name pName);
118
119
120    /** <p>Creates a view, which may be used to embed the statement into
121     * a separate query.</p>
122     */

123    public Table createView(String JavaDoc pName);
124 }
125
Popular Tags