This class represents a QueryLeaf that maps onto a relational database store.
It implements the case where the relational query is provided as a set of
QualifiedTables and an Expression representing the filter.
addRdbField
public RdbExpField addRdbField(String name,
PType type,
String colName,
QualifiedTable table)
throws QueryLeafException
Adds a Field to the RdbExpQueryLeaf
- addRdbField in interface RdbExpQueryLeaf
name
- is the name of the Field to be added.type
- is the PTyme of the Field to be added.colName
- is the name of the column in the associated
QualifiedTable.table
- is the QualifiedTable from which the Field is to be created.
- the created RdbExpField.
clone
public Object clone(Object clone,
Map obj2clone)
throws CloneNotSupportedException
- clone in interface BasicRdbQueryLeaf
getFromList
protected String getFromList()
Builds the FROM clause of the query (without "FROM").
- the list of qualified table names for the FROM clause tables is
appended.
getQualifiedFieldName
protected static String getQualifiedFieldName(RdbExpField field)
Builds the qualified name of a RdbExpField.
field
- is the RdbExpField for which the qualified name is built.
- the qualified name of an RdbExpField.
getQueryFilter
public Expression getQueryFilter()
Retrieves the filter associated to the RbdQueryLeaf.
- getQueryFilter in interface FilteredQueryTree
- the Medor Expression representing the filter to be applied to the
relational source tables.
getSelectList
public String getSelectList(String selectList,
ArrayList selectFields,
boolean qualified)
Builds the SELECT clause of the query (without "SELECT ").
- getSelectList in interface RdbQueryLeaf
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 fieldsqualified
- indicates whether the field names should be qualified
with the table name or not.
- the list of qualified columns for the SELECT clause
getSqlRequest
public String getSqlRequest(ParameterOperand[] pos,
ArrayList selectFields,
int rangeStartAt,
int rangeSize)
throws MedorException,
ExpressionException
Returns the associated SQL queryn giving the list of SELECT fields
as an input parameter.
In the case of an RdbExpQueryLeaf, the query is computed.
- getSqlRequest in interface RdbQueryLeaf
pos
- is an array of ParameterOperandselectFields
- is the input Array of fields for constructing the
SELECT clause.rangeStartAt
- is the offset of the first row to be returned in the
case of a range query, starting at 0.rangeSize
- is the number of rows to be returned in the case of a
range query.
- the SQL query associated to the RdbQueryLeaf, as a String.
MedorException
- in the case of RdbExpQueryLeaves if the
SQL request cannot be computed from the associated Expression
getSqlRequest
public String getSqlRequest(ParameterOperand[] pos,
int rangeStartAt,
int rangeSize)
throws MedorException,
ExpressionException
Returns the associated SQL query.
In the case of an RdbExpQueryLeaf, the query is computed.
- getSqlRequest in interface RdbQueryLeaf
pos
- is an array of ParameterOperandrangeStartAt
- is the offset of the first row to be returned in the
case of a range query, starting at 0.rangeSize
- is the number of rows to be returned in the case of a
range query.
- the SQL query associated to the RdbQueryLeaf, as a String.
MedorException
- in the case of RdbExpQueryLeaves if the
SQL request cannot be computed from the associated Expression
setQueryFilter
public void setQueryFilter(Expression exp)
Sets the filter associated to the RbdQueryLeaf.
This filter is represented by an Expression. Unlike the filter of a
QueryNode, is applies to its own Fields, instead of the Fields of its
children.
- setQueryFilter in interface FilteredQueryTree
exp
- is the Medor Expression representing the filter to be applied
to the relational source tables.