butler.sql.query
Class AggregateQuery

java.lang.Object
  extended bybutler.sql.query.Query
      extended bybutler.sql.query.AggregateQuery

public class AggregateQuery
extends Query

Query using aggregate functions.

Author:
Fredrik Bertilsson

Nested Class Summary
static class AggregateQuery.AggregateQueryInstance
          Returns the resulting select SQL statement.
static class AggregateQuery.AggregateRecordList
           
 
Nested classes inherited from class butler.sql.query.Query
Query.SQLBuilder
 
Field Summary
 
Fields inherited from class butler.sql.query.Query
_cols, _comparator, _filter, _table, _uniqueSort
 
Constructor Summary
AggregateQuery(Table tab)
           
 
Method Summary
 void addColumn(Column col)
          Adds a column to retrieve.
 void addColumn(Column col, AggregateFunction func)
           
 void addFunction(AggregateFunction func)
           
 void addSortCriteria(Column col, boolean ascending)
          Add sort-critera (order by) to query.
 void addSortCriteria(Index index, boolean ascending)
          Add sort-critera (order by) to query.
 QueryInstance createInstance()
          Creates a instance of this query.
 java.util.List getFunctions(Column col)
           
 java.util.List getJoins()
          Returns the joins for this query.
 Join join(ForeignKey fk)
          Joins another table to this query by a given foreign key.
 Join join(Table table)
          Joins another table to this query by a given table.
 Join outerJoin(ForeignKey fk)
          Joins another table to this query by a given foreign key, using left outer join.
 
Methods inherited from class butler.sql.query.Query
addColumn, addFunctionColumn, addSortCriteria, addSortCriteria, addSubQuery, checkPermission, createTableDictonary, getColumn, getColumns, getComparator, getFilter, getFilter, getFilterMap, getHaving, getJoinByAlias, getMainTable, getMaxNoOfRecords, getName, getPhysicalColumns, getSortCriterias, getSQL, getSubQueries, getTable, getUnions, isNested, isUnion, isUniqueSort, join, join, newIterator, outerJoin, outerJoin, parse, parse, parseQuery, recursiveJoin, registerFilter, registerJoin, replaceFilter, run, setAggregate, setDistinct, setFilter, setHaving, setMaxNoOfRecords, setName, setNested, setRecordComparator, setSortCriterias, setUnion, setUniqueSort, toXML, toXML, union
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AggregateQuery

public AggregateQuery(Table tab)
               throws java.lang.Exception
Method Detail

addColumn

public void addColumn(Column col)
Description copied from class: Query
Adds a column to retrieve.

Overrides:
addColumn in class Query

addColumn

public void addColumn(Column col,
                      AggregateFunction func)

addFunction

public void addFunction(AggregateFunction func)

getFunctions

public java.util.List getFunctions(Column col)

join

public Join join(ForeignKey fk)
          throws java.lang.Exception
Description copied from class: Query
Joins another table to this query by a given foreign key. Returns the resulting join.

Overrides:
join in class Query
Throws:
java.lang.Exception

outerJoin

public Join outerJoin(ForeignKey fk)
               throws java.lang.Exception
Description copied from class: Query
Joins another table to this query by a given foreign key, using left outer join. Returns the resulting join.

Overrides:
outerJoin in class Query
Throws:
java.lang.Exception

join

public Join join(Table table)
          throws java.lang.Exception
Description copied from class: Query
Joins another table to this query by a given table. If there are more than one foreign keys between the main table and this, an exception will occur. Returns the resulting join.

Overrides:
join in class Query
Throws:
java.lang.Exception

getJoins

public java.util.List getJoins()
Description copied from class: Query
Returns the joins for this query.

Overrides:
getJoins in class Query

addSortCriteria

public void addSortCriteria(Column col,
                            boolean ascending)
                     throws java.lang.Exception
Description copied from class: Query
Add sort-critera (order by) to query.

Overrides:
addSortCriteria in class Query
Throws:
java.lang.Exception

addSortCriteria

public void addSortCriteria(Index index,
                            boolean ascending)
                     throws java.lang.Exception
Description copied from class: Query
Add sort-critera (order by) to query.

Overrides:
addSortCriteria in class Query
Throws:
java.lang.Exception

createInstance

public QueryInstance createInstance()
Description copied from class: Query
Creates a instance of this query.

Overrides:
createInstance in class Query