org.objectweb.medor.query.rdb.api
Interface RdbQueryLeaf

All Superinterfaces:
java.lang.Cloneable, QueryLeaf, QueryTree
All Known Subinterfaces:
RdbExpQueryLeaf, RdbStringQueryLeaf
All Known Implementing Classes:
AggregateRdbQueryNode, BasicRdbExpQueryLeaf, BasicRdbQueryLeaf, BasicRdbStringQueryLeaf

public interface RdbQueryLeaf
extends QueryLeaf

An RdbQueryLeaf represents a query leaf which encapsulates access to a relational database.

A SQL query is associated to an RdbQueryLeaf.

Author:
Sebastien Chassande-Barrioz
See Also:
RdbExpQueryLeaf, RdbStringQueryLeaf

Method Summary
 java.lang.String getSelectList(java.lang.String selectList, java.util.ArrayList selectFields, boolean qualified)
          Builds the SELECT clause of the query (without "SELECT ").
 java.lang.String getSqlRequest(ParameterOperand[] pos)
          Returns the associated SQL query.
 java.lang.String getSqlRequest(ParameterOperand[] pos, java.util.ArrayList selectFields)
          Returns the associated SQL query.
 boolean isSubquery()
          Is the current query leaf a subquery (in particular for the case of aggregates).
 void setIsSubquery(boolean subquery)
          Indicates whether the current RdbExpQueryLeaf is a subquery of another Rdb query leaf (in particular in the case of subqueries).
 
Methods inherited from interface org.objectweb.medor.query.api.QueryLeaf
getDataStore
 
Methods inherited from interface org.objectweb.medor.query.api.QueryTree
getDistinct, getName, getOrderBy, getTupleStructure, setDistinct, setOrderBy
 

Method Detail

getSqlRequest

public java.lang.String getSqlRequest(ParameterOperand[] pos,
                                      java.util.ArrayList selectFields)
                               throws MedorException,
                                      ExpressionException
Returns the associated SQL query.

n the case of an RdbExpQueryLeaf, the query is computed.

Returns:
the SQL query associated to the RdbQueryLeaf, as a String.
Throws:
MedorException - in the case of RdbExpQueryLeaves if the SQL request cannot be computed from the associated Expression
ExpressionException

getSqlRequest

public java.lang.String getSqlRequest(ParameterOperand[] pos)
                               throws MedorException,
                                      ExpressionException
Returns the associated SQL query.

In the case of an RdbExpQueryLeaf, the query is computed.

Returns:
the SQL query associated to the RdbQueryLeaf, as a String.
Throws:
MedorException - in the case of RdbExpQueryLeaves if the SQL request cannot be computed from the associated Expression
ExpressionException

getSelectList

public java.lang.String getSelectList(java.lang.String selectList,
                                      java.util.ArrayList selectFields,
                                      boolean qualified)
                               throws MedorException
Builds the SELECT clause of the query (without "SELECT ").

Parameters:
selectList - is the start of the SELECT clause to which the list of qualified columns is appended.
selectFields - is the fields for the SELECT clause. Such fields can either be plain fields, or can be aggregate fields
qualified - indicates whether the field names should be qualified with the table name or not.
Returns:
the list of qualified columns for the SELECT clause
Throws:
MedorException

isSubquery

public boolean isSubquery()
Is the current query leaf a subquery (in particular for the case of aggregates).

Returns:
true if the current RdbExpQueryLeaf is a subquery

setIsSubquery

public void setIsSubquery(boolean subquery)
Indicates whether the current RdbExpQueryLeaf is a subquery of another Rdb query leaf (in particular in the case of subqueries).

The default value is false.

Parameters:
subquery - is true when the current RdbExpQueryLeaf is a subquery of another Rdb query leaf/node, false otherwise.