org.axiondb.engine.commands
Class AxionQueryContext

java.lang.Object
  extended by org.axiondb.engine.commands.AxionQueryContext

public class AxionQueryContext
extends Object

AxionQueryContext holds metadata for the Query or Sub-Query.

Version:
$Revision: 1.13 $ $Date: 2005/12/20 18:32:28 $

Constructor Summary
AxionQueryContext()
           
 
Method Summary
 void addAllSelectToResolvedSelect()
           
 void addFrom(TableIdentifier table)
          Adds a TableIdentifierto the list of tables being selected from.
 void addOrderBy(OrderNode orderby)
          Appends an OrderNodeto the order by clause for this query
 void addSelect(Selectable column)
          Adds a Selectableto the list of items being selected.
 List createLiteralList()
           
 boolean foundAggregateFunction()
           
 String getAliasName()
           
 boolean getDistinct()
          Indicates if the ResultSetgenerated from this object will contain distinct tuples.
 FromNode getFrom()
          Gets the root FromNodefor the select statement.
 TableIdentifier getFrom(int i)
          Gets the i th table being selected.
 TableIdentifier[] getFromArray()
           
 int getFromCount()
          Gets the number of tables being from.
 List getGroupBy()
          Gets Selectable in Group by clause.
 Selectable getGroupBy(int i)
          Gets Selectable in Group by clause.
 int getGroupByCount()
          Gets the number of Slectables group by in my query.
 Selectable getHaving()
           
 Literal getLimit()
           
 Literal getOffset()
           
 List getOrderBy()
          Gets the List of OrderNodein my order by clause.
 OrderNode getOrderBy(int i)
          Gets the i th OrderNodein my order by clause.
 int getOrderByCount()
          Gets the number of OrderNodes in my query.
 RowDecorator getParentRow()
           
 TableIdentifier[] getParentTables()
           
 List getResolvedSelect()
           
 RowIterator getRows()
           
 List getSelect()
           
 Selectable getSelect(int i)
          Gets the i th Selectablebeing selected.
 int getSelectCount()
          Gets the number of Selectables being selected.
 Selectable[] getSelected()
           
 int getTableCount()
           
 TableIdentifier[] getTables()
           
 TableIdentifier getTables(int i)
           
 Selectable getWhere()
          Returns the where treefor this query.
 boolean isCorrelatedSubQuery()
           
 boolean isExplain()
           
 boolean isResolved()
           
 boolean isTablePartOfSelect(TableIdentifier tid)
           
 void setAliasName(String name)
           
 void setCorrelatedSubQuery(boolean isCorrelatedSubQuery)
           
 void setDistinct(boolean distinct)
          Determines if the ResultSetgenerated from this object will contain distinct tuples (default is false).
 void setExplain(boolean explain)
           
 void setFoundAggregateFunction(boolean found)
           
 void setFrom(FromNode from)
          Sets the root FromNodefor the select statement.
 void setGroupBy(List groupby)
          Sets the group by clause for this query.
 void setHaving(Selectable having)
           
 void setLimit(Literal limit)
           
 void setOffset(Literal offset)
           
 void setOrderBy(List orderby)
          Sets the order by clause for this query.
 void setParentRow(RowDecorator row)
           
 void setParentTables(TableIdentifier[] tables)
           
 void setResolved(boolean resolved)
           
 void setResolvedSelect(List select)
           
 void setRows(RowIterator rows)
           
 void setSelect(int i, Selectable sel)
          Sets the i th Selectablebeing selected.
 void setSelect(List columns)
           
 void setSelected(Selectable[] selected)
           
 void setTables(TableIdentifier[] tables)
           
 void setWhere(Selectable where)
          Sets the where treefor this query.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AxionQueryContext

public AxionQueryContext()
Method Detail

addAllSelectToResolvedSelect

public void addAllSelectToResolvedSelect()

addFrom

public void addFrom(TableIdentifier table)
Adds a TableIdentifierto the list of tables being selected from.

Parameters:
table - a TableIdentifier
Throws:
IllegalStateException - if I have already been resolved

addOrderBy

public void addOrderBy(OrderNode orderby)
Appends an OrderNodeto the order by clause for this query

Parameters:
orderby - an OrderNodeto append
Throws:
IllegalStateException - if I have already been resolved

addSelect

public void addSelect(Selectable column)
Adds a Selectableto the list of items being selected.

Parameters:
column - the Selectableto add
Throws:
IllegalStateException - if I have already been resolved

foundAggregateFunction

public boolean foundAggregateFunction()

getAliasName

public String getAliasName()

getDistinct

public boolean getDistinct()
Indicates if the ResultSetgenerated from this object will contain distinct tuples.

Returns:
true for distinct tuples

getFrom

public FromNode getFrom()
Gets the root FromNodefor the select statement.


getFrom

public TableIdentifier getFrom(int i)
Gets the i th table being selected. Clients should treat the returned value as immutable.

Parameters:
i - the zero-based index

getFromArray

public TableIdentifier[] getFromArray()

getFromCount

public int getFromCount()
Gets the number of tables being from.


getGroupBy

public List getGroupBy()
Gets Selectable in Group by clause.


getGroupBy

public Selectable getGroupBy(int i)
Gets Selectable in Group by clause. Clients should treat the returned value as immutable.

Parameters:
i - the zero-based index

getGroupByCount

public int getGroupByCount()
Gets the number of Slectables group by in my query.


getLimit

public Literal getLimit()

getOffset

public Literal getOffset()

getOrderBy

public List getOrderBy()
Gets the List of OrderNodein my order by clause.


getOrderBy

public OrderNode getOrderBy(int i)
Gets the i th OrderNodein my order by clause. Clients should treat the returned value as immutable.

Parameters:
i - the zero-based index

getOrderByCount

public int getOrderByCount()
Gets the number of OrderNodes in my query.


getParentRow

public RowDecorator getParentRow()

getParentTables

public TableIdentifier[] getParentTables()

getResolvedSelect

public List getResolvedSelect()

getRows

public RowIterator getRows()

getSelect

public List getSelect()

getSelect

public Selectable getSelect(int i)
Gets the i th Selectablebeing selected. Clients should treat the returned value as immutable.

Parameters:
i - the zero-based index

getSelectCount

public int getSelectCount()
Gets the number of Selectables being selected.


getSelected

public Selectable[] getSelected()

getTables

public TableIdentifier[] getTables()

getTables

public TableIdentifier getTables(int i)

getTableCount

public int getTableCount()

getWhere

public Selectable getWhere()
Returns the where treefor this query. Clients should treat the returned value as immutable.

Returns:
the where treefor this query, or null.

getHaving

public Selectable getHaving()

isCorrelatedSubQuery

public boolean isCorrelatedSubQuery()

isExplain

public boolean isExplain()

isResolved

public boolean isResolved()

isTablePartOfSelect

public boolean isTablePartOfSelect(TableIdentifier tid)

setAliasName

public void setAliasName(String name)

setCorrelatedSubQuery

public void setCorrelatedSubQuery(boolean isCorrelatedSubQuery)

setDistinct

public void setDistinct(boolean distinct)
Determines if the ResultSetgenerated from this object will contain distinct tuples (default is false).

Parameters:
distinct - true for distinct tuples

setExplain

public void setExplain(boolean explain)

setFoundAggregateFunction

public void setFoundAggregateFunction(boolean found)

setFrom

public void setFrom(FromNode from)
Sets the root FromNodefor the select statement.


setGroupBy

public void setGroupBy(List groupby)
Sets the group by clause for this query.

Parameters:
groupby - a Listof Selectables.
Throws:
IllegalStateException - if I have already been resolved

setLimit

public void setLimit(Literal limit)

setOffset

public void setOffset(Literal offset)

setOrderBy

public void setOrderBy(List orderby)
Sets the order by clause for this query.

Parameters:
orderby - a Listof OrderNodes.
Throws:
IllegalStateException - if I have already been resolved

setParentRow

public void setParentRow(RowDecorator row)

setParentTables

public void setParentTables(TableIdentifier[] tables)

setResolved

public void setResolved(boolean resolved)

setResolvedSelect

public void setResolvedSelect(List select)

setRows

public void setRows(RowIterator rows)

setSelect

public void setSelect(int i,
                      Selectable sel)
Sets the i th Selectablebeing selected.

Parameters:
i - the zero-based index
sel - the new Selectable
Throws:
IllegalStateException - if I have already been resolved

setSelect

public void setSelect(List columns)

setSelected

public void setSelected(Selectable[] selected)

setTables

public void setTables(TableIdentifier[] tables)

setWhere

public void setWhere(Selectable where)
Sets the where treefor this query.

Parameters:
where - a boolean valued Selectable
Throws:
IllegalStateException - if I have already been resolved

setHaving

public void setHaving(Selectable having)

toString

public String toString()
Overrides:
toString in class Object

createLiteralList

public List createLiteralList()