org.objectweb.medor.query.rdb.lib
Class BasicRdbStringQueryLeaf

java.lang.Object
  |
  +--org.objectweb.medor.lib.BasicTupleStructure
        |
        +--org.objectweb.medor.query.lib.BasicQueryTree
              |
              +--org.objectweb.medor.query.rdb.lib.BasicRdbStringQueryLeaf
All Implemented Interfaces:
Cloneable, java.lang.Cloneable, QueryLeaf, QueryTree, RdbQueryLeaf, RdbStringQueryLeaf, TupleStructure

public class BasicRdbStringQueryLeaf
extends BasicQueryTree
implements RdbStringQueryLeaf, TupleStructure

This class represents a QueryLeaf that maps onto a relational database store.


Field Summary
 
Fields inherited from class org.objectweb.medor.query.lib.BasicQueryTree
distinct, indexes, name, orderfields
 
Fields inherited from class org.objectweb.medor.lib.BasicTupleStructure
fields, name2field
 
Constructor Summary
BasicRdbStringQueryLeaf(DataStore ds, java.lang.String request, java.lang.String nodeName)
          Constructs a BasicRdbStringQueryLeaf from an SQL string.
 
Method Summary
 RdbField addRdbField(java.lang.String name, PType type, java.lang.String colName)
          Adds a Field to the RdbExpQueryLeaf
 DataStore getDataStore()
           
 boolean getDistinct()
          Tests whether the results should be distinct or not.
 java.lang.String getName()
          It returns the name of the query tree.
 java.lang.String getSqlRequest(ParameterOperand[] pos)
          Returns the associated SQL query.
 TupleStructure getTupleStructure()
          Returns the TupleStructure associated to the QueryTree.
 void setDistinct(boolean d)
          Indicates whether evaluating the QueryTree should return unique results (duplicate elimination) or not.
 
Methods inherited from class org.objectweb.medor.query.lib.BasicQueryTree
clone, getOrderBy, setOrderBy
 
Methods inherited from class org.objectweb.medor.lib.BasicTupleStructure
contains, contains, getField, getField, getFieldRank, getFields, getSize
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.medor.query.api.QueryTree
getOrderBy, setOrderBy
 
Methods inherited from interface org.objectweb.medor.api.TupleStructure
contains, contains, getField, getField, getFieldRank, getFields, getSize
 
Methods inherited from interface org.objectweb.medor.api.Cloneable
clone
 

Constructor Detail

BasicRdbStringQueryLeaf

public BasicRdbStringQueryLeaf(DataStore ds,
                               java.lang.String request,
                               java.lang.String nodeName)
Constructs a BasicRdbStringQueryLeaf from an SQL string.

Method Detail

addRdbField

public RdbField addRdbField(java.lang.String name,
                            PType type,
                            java.lang.String colName)
Description copied from interface: RdbStringQueryLeaf
Adds a Field to the RdbExpQueryLeaf

Specified by:
addRdbField in interface RdbStringQueryLeaf
Parameters:
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.
Returns:
the created RdbExpField.

getSqlRequest

public java.lang.String getSqlRequest(ParameterOperand[] pos)
Description copied from interface: RdbQueryLeaf
Returns the associated SQL query. In the case of an RdbExpQueryLeaf, the query is computed.

Specified by:
getSqlRequest in interface RdbQueryLeaf
Returns:
the SQL query associated to the RdbQueryLeaf, as a String.

getName

public java.lang.String getName()
Description copied from interface: QueryTree
It returns the name of the query tree.

Specified by:
getName in interface QueryTree
Overrides:
getName in class BasicQueryTree

getDistinct

public boolean getDistinct()
Description copied from interface: QueryTree
Tests whether the results should be distinct or not.

Specified by:
getDistinct in interface QueryTree
Overrides:
getDistinct in class BasicQueryTree
Returns:
true if there results should be distinct, false otherwise.

setDistinct

public void setDistinct(boolean d)
Description copied from interface: QueryTree
Indicates whether evaluating the QueryTree should return unique results (duplicate elimination) or not.

The default should be that duplicates are not eliminated (distinct is false).

Specified by:
setDistinct in interface QueryTree
Overrides:
setDistinct in class BasicQueryTree
Parameters:
d - is true if duplicates should be eliminated, false otherwise.

getDataStore

public DataStore getDataStore()
Specified by:
getDataStore in interface QueryLeaf

getTupleStructure

public TupleStructure getTupleStructure()
Description copied from interface: QueryTree
Returns the TupleStructure associated to the QueryTree. Note that the Fields cannot be added by manipulating the TupleStructure, but by using either constructors in the case of a QueryLeaf, or by using the addXXXFields methods in the case of QueryNodes.

Specified by:
getTupleStructure in interface QueryTree
Overrides:
getTupleStructure in class BasicQueryTree