org.objectweb.medor.query.rdb.api

Interface RdbExpQueryLeaf

All Superinterfaces:
Cloneable, FilteredQueryTree, QueryLeaf, QueryTree, RdbQueryLeaf
Known Implementing Classes:
BasicRdbExpQueryLeaf

public interface RdbExpQueryLeaf
extends RdbQueryLeaf, FilteredQueryTree

An RdbExpQueryLeaf is a particular type of RdbQueryLeaf for which the associated SQL query if not given as a SQL String, but is computed from an Expression (representing the filter) and from abstract information made of QualifiedTables, representing the FROM part of the SQL query.

The Medor optimizer can "reason" about RdbExpQueryLeaves, and merge several such query leaves into one if they have the same DataStore.

The life cycle of an RdbExpQueryLeaf is:

A RdbExpQueryLeaf can use a RdbAdapter to build a SQL query. The Rdb Adapter permits to manage the relational databases that are not conform to the jdbc specification.

Author:
Alexandre Lefebvre

Method Summary

void
addQualifiedTable(QualifiedTable qt)
Adds a QualifiedTable to the QueryLeaf
RdbExpField
addRdbField(String fieldName, PType type, String colName, QualifiedTable table)
Adds a Field to the RdbExpQueryLeaf
RdbExpField
addRdbField(RdbExpField rdbField)
Adds an RdbExpField to the RdbExpQueryLeaf.
boolean
containsQualifiedTable(QualifiedTable qt)
Checks if a QualifiedTable is in the list of QualifiedTables of this QueryLeaf
RdbExpField
getGroupByField()
Gets the RdbExpField of the GroupBy Clause.
QualifiedTable[]
getQualifiedTables()
Returns the associated QualifiedTables.
RdbAdapter
getRdbAdapter()
It retrieves the rdb adapter.
String
getRdbAdapterName()
It retrieves the rdb adapter name.
void
removeQualifiedTable(QualifiedTable qt)
Adds a QualifiedTable to the QueryLeaf
void
removeRdbField(RdbExpField rdbField)
Adds an RdbExpField to the RdbExpQueryLeaf.
void
resetSqlRequest()
In case the SQL query was already computed, resets it to null.
void
setGroupBy(RdbExpField groupBy)
Sets the groupBy Field.
void
setRdbAdapter(RdbAdapter adapter)
It assigns the rdb adapter.
void
setRdbAdapterName(String name)
It assignes the rdb adapter name.
void
setRootJoinedTables(List rootjts)

Methods inherited from interface org.objectweb.medor.query.api.FilteredQueryTree

getQueryFilter, setQueryFilter

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

Methods inherited from interface org.objectweb.medor.query.rdb.api.RdbQueryLeaf

getSelectList, getSqlRequest, getSqlRequest, isSubquery, setIsSubquery

Method Details

addQualifiedTable

public void addQualifiedTable(QualifiedTable qt)
Adds a QualifiedTable to the QueryLeaf

Parameters:
qt - the QualifiedTable to be added


addRdbField

public RdbExpField addRdbField(String fieldName,
                               PType type,
                               String colName,
                               QualifiedTable table)
            throws QueryLeafException
Adds a Field to the RdbExpQueryLeaf

Parameters:
fieldName - 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.

Returns:
the created RdbExpField.

Throws:
QueryLeafException - if the QualifiedTable is not in the set of QualifiedTables associatged with the current RdbExpQueryLeaf.


addRdbField

public RdbExpField addRdbField(RdbExpField rdbField)
            throws QueryLeafException
Adds an RdbExpField to the RdbExpQueryLeaf. The QueryLeaf associated to the RdbExpField becomes the current RdbExpQueryLeaf.

Parameters:
rdbField - is the RdbField to be added.


containsQualifiedTable

public boolean containsQualifiedTable(QualifiedTable qt)
Checks if a QualifiedTable is in the list of QualifiedTables of this QueryLeaf

Parameters:
qt - the QualifiedTable to be tested

Returns:
true if qt is in the list of QualifiedTables for this QueryLeaf


getGroupByField

public RdbExpField getGroupByField()
Gets the RdbExpField of the GroupBy Clause. It returns null if there is no Result Grouping

Returns:
an RdbExpField


getQualifiedTables

public QualifiedTable[] getQualifiedTables()
Returns the associated QualifiedTables.

Returns:
the array of associated QualifiedTables.


getRdbAdapter

public RdbAdapter getRdbAdapter()
It retrieves the rdb adapter. The RdbAdapter is used to adapt sql queries to a relational database


getRdbAdapterName

public String getRdbAdapterName()
It retrieves the rdb adapter name. The RdbAdapter is used to adapte the sql queries to a relational database


removeQualifiedTable

public void removeQualifiedTable(QualifiedTable qt)
            throws MedorException
Adds a QualifiedTable to the QueryLeaf

Parameters:
qt - the QualifiedTable to be added

Throws:
MedorException - if the QualifiedTable in not in the current leaf.


removeRdbField

public void removeRdbField(RdbExpField rdbField)
            throws QueryLeafException
Adds an RdbExpField to the RdbExpQueryLeaf. The QueryLeaf associated to the RdbExpField becomes the current RdbExpQueryLeaf.

Parameters:
rdbField - is the RdbField to be added.


resetSqlRequest

public void resetSqlRequest()
In case the SQL query was already computed, resets it to null.


setGroupBy

public void setGroupBy(RdbExpField groupBy)
            throws QueryLeafException
Sets the groupBy Field. This RdbExpField must be in The TupleStructure of this QuaryLeaf Object.

Parameters:
groupBy - : RdbExpField

Throws:
QueryLeafException - if this RdbExpField don't appears in the list of the fields which will be projected in Select clause


setRdbAdapter

public void setRdbAdapter(RdbAdapter adapter)
It assigns the rdb adapter. The RdbAdapter is used to adapt sql queries to a relational database


setRdbAdapterName

public void setRdbAdapterName(String name)
It assignes the rdb adapter name. The RdbAdapter is used to adapte the sql queries to a relational database


setRootJoinedTables

public void setRootJoinedTables(List rootjts)