KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > medor > query > rdb > api > RdbQueryLeaf


1 /**
2  * MEDOR: Middleware Enabling Distributed Object Requests
3  *
4  * Copyright (C) 2001-2003 France Telecom R&D
5  * Contact: alexandre.lefebvre@rd.francetelecom.com
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  *
21  * Initial developers: M. Alia, S. Chassande-Barrioz, A. Lefebvre
22  */

23
24 package org.objectweb.medor.query.rdb.api;
25
26 import org.objectweb.medor.query.api.QueryLeaf;
27 import org.objectweb.medor.api.MedorException;
28 import org.objectweb.medor.expression.api.ParameterOperand;
29 import org.objectweb.medor.expression.api.ExpressionException;
30
31 import java.util.ArrayList JavaDoc;
32
33 /**
34  * An RdbQueryLeaf represents a query leaf which encapsulates access to a
35  * relational database.
36  * <p>
37  * A SQL query is associated to an RdbQueryLeaf.
38  * @see org.objectweb.medor.query.rdb.api.RdbExpQueryLeaf
39  * @see org.objectweb.medor.query.rdb.api.RdbStringQueryLeaf
40  *
41  * @author Sebastien Chassande-Barrioz
42  */

43 public interface RdbQueryLeaf extends QueryLeaf {
44
45     /**
46      * Returns the associated SQL queryn giving the list of SELECT fields
47      * as an input parameter.
48      * <p>In the case of an RdbExpQueryLeaf, the query is computed.
49      * @param pos is an array of ParameterOperand
50      * @param selectFields is the input Array of fields for constructing the
51      * SELECT clause.
52      * @param rangeStartAt is true for range queries where the first row to be
53      * returned in the case of a range query is greater than 0.
54      * @param rangeSize is true for range queries where the number of rows to be
55      * returned in the case of a range query is less than Integer.MAXVALUE
56      * @return the SQL query associated to the RdbQueryLeaf, as a String.
57      * @throws MedorException in the case of RdbExpQueryLeaves if the
58      * SQL request cannot be computed from the associated Expression
59      */

60     String JavaDoc getSqlRequest(ParameterOperand[] pos,
61                          ArrayList JavaDoc selectFields,
62                          boolean rangeStartAt,
63                          boolean rangeSize)
64             throws MedorException, ExpressionException;
65
66     /**
67      * Returns the associated SQL query.
68      * <p>In the case of an RdbExpQueryLeaf, the query is computed.
69      * @param pos is an array of ParameterOperand
70      * @param rangeStartAt is true for range queries where the first row to be
71      * returned in the case of a range query is greater than 0.
72      * @param rangeSize is true for range queries where the number of rows to be
73      * returned in the case of a range query is less than Integer.MAXVALUE
74      * @return the SQL query associated to the RdbQueryLeaf, as a String.
75      * @throws MedorException in the case of RdbExpQueryLeaves if the
76      * SQL request cannot be computed from the associated Expression
77      */

78     String JavaDoc getSqlRequest(ParameterOperand[] pos,
79             boolean rangeStartAt,
80             boolean rangeSize)
81             throws MedorException, ExpressionException;
82
83     /**
84      * Builds the SELECT clause of the query (without "SELECT ").
85      * @param selectList is the start of the SELECT clause to which the list
86      * of qualified columns is appended.
87      * @param selectFields is the fields for the SELECT clause. Such fields can
88      * either be plain fields, or can be aggregate fields
89      * @param qualified indicates whether the field names should be qualified
90      * with the table name or not.
91      * @return the list of qualified columns for the SELECT clause
92      */

93     String JavaDoc getSelectList(String JavaDoc selectList, ArrayList JavaDoc selectFields,
94                          boolean qualified)
95             throws MedorException;
96
97     /**
98      * Is the current query leaf a subquery (in particular for the case of
99      * aggregates).
100      * @return true if the current RdbExpQueryLeaf is a subquery
101      */

102     boolean isSubquery();
103
104     /**
105      * Indicates whether the current RdbExpQueryLeaf is a subquery of another
106      * Rdb query leaf (in particular in the case of subqueries).
107      * <p>The default value is false.</p>
108      * @param subquery is true when the current RdbExpQueryLeaf is a subquery
109      * of another Rdb query leaf/node, false otherwise.
110      */

111     void setIsSubquery(boolean subquery);
112 }
113
Popular Tags