org.objectweb.medor.query.rdb.api
Interface RdbExpQueryLeaf
- Cloneable, FilteredQueryTree, QueryLeaf, QueryTree, RdbQueryLeaf
- BasicRdbExpQueryLeaf
public interface RdbExpQueryLeaf
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:
- create the leaf (constructor)
- add the fields (addRdbField)
- add the expression which is built on the fields
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.
-
Alexandre Lefebvre
addQualifiedTable
public void addQualifiedTable(QualifiedTable qt)
Adds a QualifiedTable to the QueryLeaf
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
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.
- the created RdbExpField.
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.
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
qt
- the QualifiedTable to be tested
- 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
- an RdbExpField
getQualifiedTables
public QualifiedTable[] getQualifiedTables()
Returns the associated QualifiedTables.
- 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
qt
- the QualifiedTable to be added
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.
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.
groupBy
- : RdbExpField
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)