|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectBasicCloneable
org.objectweb.medor.lib.BasicTupleStructure
org.objectweb.medor.query.lib.BasicQueryTree
org.objectweb.medor.query.rdb.lib.BasicRdbQueryLeaf
org.objectweb.medor.query.rdb.lib.BasicRdbExpQueryLeaf
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.
Field Summary |
Fields inherited from class org.objectweb.medor.query.rdb.lib.BasicRdbQueryLeaf |
ds, isSubquery, query, sqlFilter |
Fields inherited from class org.objectweb.medor.query.lib.BasicQueryTree |
distinct, indexes, name, orderfields |
Fields inherited from class org.objectweb.medor.lib.BasicTupleStructure |
fields, logger, name2field |
Constructor Summary | |
BasicRdbExpQueryLeaf()
|
|
BasicRdbExpQueryLeaf(DataStore ds,
QualifiedTable[] from,
java.lang.String nodeName)
Constructs a BasicRdbExpQueryLeaf from an Expression and a set of QualifiedTables. |
|
BasicRdbExpQueryLeaf(DataStore ds,
java.lang.String nodeName)
|
Method Summary | |
void |
addQualifiedTable(QualifiedTable qt)
Adds a QualifiedTable to the QueryLeaf |
RdbExpField |
addRdbField(RdbExpField rdbField)
Adds an RdbExpField to the RdbExpQueryLeaf |
RdbExpField |
addRdbField(java.lang.String name,
PType type,
java.lang.String colName,
QualifiedTable table)
Adds a Field to the RdbExpQueryLeaf |
java.lang.Object |
clone(java.lang.Object clone,
java.util.Map obj2clone)
|
boolean |
containsQualifiedTable(QualifiedTable qt)
Checks if a QualifiedTable is in the list of QualifiedTables of this QueryLeaf |
protected java.lang.String |
getFromList()
Builds the FROM clause of the query (without "FROM"). |
RdbExpField |
getGroupByField()
Gets the RdbExpField of the GroupBy Clause. |
protected static java.lang.String |
getQualifiedFieldName(RdbExpField field)
Builds the qualified name of a RdbExpField. |
QualifiedTable[] |
getQualifiedTables()
Returns the associated QualifiedTables. |
Expression |
getQueryFilter()
Retrieves the filter associated to the RbdQueryLeaf. |
RdbAdapter |
getRdbAdapter()
It retrieves the rdb adapter. |
java.lang.String |
getRdbAdapterName()
It retrieves the rdb adapter name. |
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)
Builds and returns the SQL query as a String corresponding to the current RdbExpQueryLeaf. |
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 |
setQueryFilter(Expression exp)
Sets the filter associated to the RbdQueryLeaf. |
void |
setRdbAdapter(RdbAdapter adapter)
It assigns the rdb adapter. |
void |
setRdbAdapterName(java.lang.String an)
It assignes the rdb adapter name. |
void |
setRootJoinedTables(java.util.List rootjts)
|
Methods inherited from class org.objectweb.medor.query.rdb.lib.BasicRdbQueryLeaf |
getDataStore, isSubquery, setDataStore, setIsSubquery |
Methods inherited from class org.objectweb.medor.query.lib.BasicQueryTree |
getDistinct, getName, getOrderBy, getTupleStructure, setDistinct, setOrderBy |
Methods inherited from class org.objectweb.medor.lib.BasicTupleStructure |
contains, contains, getField, getField, getFieldRank, getFields, getSize |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.objectweb.medor.query.rdb.api.RdbQueryLeaf |
isSubquery, setIsSubquery |
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.api.Cloneable |
clone |
Constructor Detail |
public BasicRdbExpQueryLeaf()
public BasicRdbExpQueryLeaf(DataStore ds, java.lang.String nodeName)
public BasicRdbExpQueryLeaf(DataStore ds, QualifiedTable[] from, java.lang.String nodeName) throws QueryLeafException
The SQL request (string) will be calculated.
ds
- is the DataStore associated to the QueryLeaf to be createdfrom
- is the array of QualifiedTables associated to the QueryLeaf
to be created
QueryLeafException
- if the QualifiedTables have all the same
names, and in this case also the same aliases.Method Detail |
public java.lang.Object clone(java.lang.Object clone, java.util.Map obj2clone) throws java.lang.CloneNotSupportedException
clone
in class BasicRdbQueryLeaf
java.lang.CloneNotSupportedException
public void setRdbAdapterName(java.lang.String an)
RdbExpQueryLeaf
setRdbAdapterName
in interface RdbExpQueryLeaf
public java.lang.String getRdbAdapterName()
RdbExpQueryLeaf
getRdbAdapterName
in interface RdbExpQueryLeaf
public void setRdbAdapter(RdbAdapter adapter)
RdbExpQueryLeaf
setRdbAdapter
in interface RdbExpQueryLeaf
public RdbAdapter getRdbAdapter()
RdbExpQueryLeaf
getRdbAdapter
in interface RdbExpQueryLeaf
public void setRootJoinedTables(java.util.List rootjts)
setRootJoinedTables
in interface RdbExpQueryLeaf
public RdbExpField addRdbField(java.lang.String name, PType type, java.lang.String colName, QualifiedTable table) throws QueryLeafException
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.
QueryLeafException
- if the QualifiedTable is not in the
set of QualifiedTables associatged with the current RdbExpQueryLeaf.public void addQualifiedTable(QualifiedTable qt)
RdbExpQueryLeaf
addQualifiedTable
in interface RdbExpQueryLeaf
qt
- the QualifiedTable to be addedpublic void removeQualifiedTable(QualifiedTable qt) throws MedorException
RdbExpQueryLeaf
removeQualifiedTable
in interface RdbExpQueryLeaf
qt
- the QualifiedTable to be added
MedorException
- if the QualifiedTable in not in the current leaf.public boolean containsQualifiedTable(QualifiedTable qt)
RdbExpQueryLeaf
containsQualifiedTable
in interface RdbExpQueryLeaf
qt
- the QualifiedTable to be tested
public RdbExpField addRdbField(RdbExpField rdbField) throws QueryLeafException
addRdbField
in interface RdbExpQueryLeaf
rdbField
- is the RdbField to be added.
QueryLeafException
public void removeRdbField(RdbExpField rdbField) throws QueryLeafException
RdbExpQueryLeaf
removeRdbField
in interface RdbExpQueryLeaf
rdbField
- is the RdbField to be added.
QueryLeafException
public java.lang.String getSqlRequest(ParameterOperand[] pos) throws MedorException, ExpressionException
RdbQueryLeaf
In the case of an RdbExpQueryLeaf, the query is computed.
getSqlRequest
in interface RdbQueryLeaf
MedorException
- in the case of RdbExpQueryLeaves if the
SQL request cannot be computed from the associated Expression
ExpressionException
public void resetSqlRequest()
RdbExpQueryLeaf
resetSqlRequest
in interface RdbExpQueryLeaf
public java.lang.String getSqlRequest(ParameterOperand[] pos, java.util.ArrayList selectFields) throws MedorException, ExpressionException
The SQL query is computed from the provided RdbExpFields (SELECT clause), QualifiedTables (FROM clause) and Expression (WHERE clause).
getSqlRequest
in interface RdbQueryLeaf
MedorException
- in the case of RdbExpQueryLeaves if the
SQL request cannot be computed from the associated Expression
ExpressionException
public void setQueryFilter(Expression exp)
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.Expression
public Expression getQueryFilter()
getQueryFilter
in interface FilteredQueryTree
Expression
public QualifiedTable[] getQualifiedTables()
getQualifiedTables
in interface RdbExpQueryLeaf
public void setGroupBy(RdbExpField groupBy) throws QueryLeafException
RdbExpQueryLeaf
setGroupBy
in interface RdbExpQueryLeaf
groupBy
- : RdbExpField
QueryLeafException
- if this RdbExpField don't appears in
the list of the fields which will be projected in Select clausepublic RdbExpField getGroupByField()
RdbExpQueryLeaf
getGroupByField
in interface RdbExpQueryLeaf
public java.lang.String getSelectList(java.lang.String selectList, java.util.ArrayList selectFields, boolean qualified)
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.
protected static java.lang.String getQualifiedFieldName(RdbExpField field)
field
- is the RdbExpField for which the qualified name is built.
protected java.lang.String getFromList()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |