|
||||||||||||
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 |
---|
annotations, 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 |
addGroupBy(RdbExpField groupBy)
Adds a groupBy Field. |
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"). |
java.lang.String |
getGroupBy()
Returns the GROUP BY clause of the query leaf. |
java.lang.String |
getGroupBy(java.lang.String fromAlias)
Returns the GROUP BY clause of the query leaf. |
RdbExpField[] |
getGroupByFields()
Gets the RdbExpFields of the GroupBy Clause. |
static java.lang.String |
getQualifiedFieldName(RdbExpField field)
Builds the qualified name of a RdbExpField. |
static java.lang.String |
getQualifiedFieldName(RdbExpField field,
java.lang.String fromAlias)
|
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,
java.util.ArrayList selectFields,
boolean rangeStart,
boolean rangeSize)
Returns the associated SQL queryn giving the list of SELECT fields as an input parameter. |
java.lang.String |
getSqlRequest(ParameterOperand[] pos,
boolean rangeStartAt,
boolean rangeSize)
Returns the associated SQL query. |
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 |
setNoGroupBy(boolean noGB)
Requires that the GROUP BY clause not be output by the getSqlRequest method. |
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 |
---|
getAnnotations, 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.query.api.AnnotationsHolder |
---|
getAnnotations |
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 void resetSqlRequest()
RdbExpQueryLeaf
resetSqlRequest
in interface RdbExpQueryLeaf
public java.lang.String getSqlRequest(ParameterOperand[] pos, boolean rangeStartAt, boolean rangeSize) throws MedorException, ExpressionException
RdbQueryLeaf
In the case of an RdbExpQueryLeaf, the query is computed.
getSqlRequest
in interface RdbQueryLeaf
pos
- is an array of ParameterOperandrangeStartAt
- is true for range queries where the first row to be
returned in the case of a range query is greater than 0.rangeSize
- is true for range queries where the number of rows to be
returned in the case of a range query is less than Integer.MAXVALUE
MedorException
- in the case of RdbExpQueryLeaves if the
SQL request cannot be computed from the associated Expression
ExpressionException
public java.lang.String getSqlRequest(ParameterOperand[] pos, java.util.ArrayList selectFields, boolean rangeStart, boolean rangeSize) throws MedorException, ExpressionException
RdbQueryLeaf
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.rangeStart
- is true for range queries where the first row to be
returned in the case of a range query is greater than 0.rangeSize
- is true for range queries where the number of rows to be
returned in the case of a range query is less than Integer.MAXVALUE
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 addGroupBy(RdbExpField groupBy) throws QueryLeafException
RdbExpQueryLeaf
addGroupBy
in interface RdbExpQueryLeaf
groupBy
- : RdbExpField
QueryLeafException
- if this RdbExpField doesn't appears in
the list of the fields which will be projected in Select clausepublic RdbExpField[] getGroupByFields()
RdbExpQueryLeaf
getGroupByFields
in interface RdbExpQueryLeaf
public void setNoGroupBy(boolean noGB)
RdbExpQueryLeaf
setNoGroupBy
in interface RdbExpQueryLeaf
noGB
- is true if no GROUP BY clause should be output (false by
default).public java.lang.String getGroupBy()
RdbExpQueryLeaf
getGroupBy
in interface RdbExpQueryLeaf
public java.lang.String getGroupBy(java.lang.String fromAlias)
RdbExpQueryLeaf
getGroupBy
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.
public static java.lang.String getQualifiedFieldName(RdbExpField field)
field
- is the RdbExpField for which the qualified name is built.
public static java.lang.String getQualifiedFieldName(RdbExpField field, java.lang.String fromAlias)
protected java.lang.String getFromList()
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |