|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbutler.sql.query.Query
public class Query
Database query. A query is a representation for a select SQL statement.
Field Summary | |
---|---|
protected java.util.List |
_cols
|
protected RecordComparator |
_comparator
|
protected Filter |
_filter
|
protected int |
_maxNoOfRec
|
protected java.lang.String |
_name
|
protected Table |
_table
|
protected boolean |
_uniqueSort
|
Constructor Summary | |
---|---|
Query(Query q)
|
|
Query(java.lang.String xml)
Deprecated. Use Query.parse |
|
Query(Table table)
|
Method Summary | |
---|---|
void |
addColumn(AggregateFunction func,
Column col)
Adds a column which should be calculated with an aggregate function (sum, count, etc). |
void |
addColumn(Column col)
Adds a column to retrieve. |
void |
addFunctionColumn(java.lang.String name,
ColumnFunction func)
Adds a function column. |
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. |
void |
addSortCriteria(int pos,
boolean ascending)
Add sort-critera (order by) to query, with positional parameters. |
void |
addSortCriteria(java.lang.String alias,
Column col,
boolean ascending)
Add sort-critera (order by) to query. |
void |
addSubQuery(Query q)
|
void |
checkPermission()
|
Query |
copy()
|
QueryInstance |
createInstance()
Creates a instance of this query. |
java.util.Map |
createTableDictonary()
|
static Column |
getColumn(org.dom4j.Element element,
Query q)
|
java.util.List |
getColumns()
Returns a list of the columns to retrieve. |
RecordComparator |
getComparator()
|
Filter |
getFilter()
Returns the filter. |
Filter |
getFilter(java.lang.Object id)
|
Filter |
getHaving()
|
Join |
getJoinByAlias(java.lang.String alias)
|
java.util.List |
getJoins()
Returns the joins for this query. |
Table |
getMainTable()
Returns the main (start) table for this query. |
int |
getMaxNoOfRecords()
|
java.lang.String |
getName()
Returns the query name. |
protected static java.util.List |
getPhysicalColumns(java.util.List cols)
|
java.util.List |
getSortCriterias()
|
java.lang.String |
getSQL()
Returns the resulting select SQL statement. |
java.util.List |
getSubQueries()
|
Table |
getTable()
|
java.util.List |
getUnions()
Returns the unions for this query. |
boolean |
is2D()
|
boolean |
isNested()
Returns if this query is nested into an other query. |
boolean |
isUnion()
Returns if this query is part of a union. |
boolean |
isUniqueSort()
Returns if the sort criterias will give a unique sort. |
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 |
join(Table table,
Filter filter)
Joins another table using a filter (instead of a foreign key). |
Join |
join(Table table,
java.lang.String alias)
|
void |
modifyFilter(QueryParams params)
|
java.util.Iterator |
newIterator(java.sql.ResultSet rs,
java.lang.Object source)
Creates a new Iterator for a ResultSet. |
Join |
outerJoin(ForeignKey fk)
Joins another table to this query by a given foreign key, using left outer join. |
Join |
outerJoin(Table table)
Joins another table to this query by a given table, using left outer join. |
Join |
outerJoin(Table table,
Filter filter)
Joins another table using a filter (instead of a foreign key). |
static Query |
parse(java.io.InputStream inStream)
|
static Query |
parse(java.lang.String xml)
|
static Query |
parseQuery(org.dom4j.Element element)
|
Join |
recursiveJoin(Table table)
Joins another table to this query by a given table, using a recursive. |
protected void |
registerJoin(java.lang.String alias,
Join join)
|
RecordList |
run()
|
protected void |
setAggregate(boolean flag)
|
void |
setAlias(java.lang.String value)
|
void |
setDistinct(boolean flag)
|
void |
setFilter(Filter filter)
Sets the filter (where-clause). |
void |
setHaving(Filter filter)
|
void |
setMaxNoOfRecords(int value)
|
void |
setName(java.lang.String name)
Sets the query name |
void |
setNested(boolean flag)
|
void |
setRecordComparator(RecordComparator comparator)
|
void |
setSortCriterias(java.util.List sortCriterias)
Replaces the current sort-criteria (order by) of the query with the given list. |
protected void |
setUnion(boolean flag)
Sets if this query is a subquery in a union. |
void |
setUniqueSort(boolean flag)
|
java.lang.String |
toXML()
|
void |
toXML(org.xml.sax.ContentHandler handler)
|
void |
union(Query unionQuery)
Make a union of this query and the other query. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String _name
protected Table _table
protected Filter _filter
protected java.util.List _cols
protected RecordComparator _comparator
protected boolean _uniqueSort
protected int _maxNoOfRec
Constructor Detail |
---|
public Query(Table table) throws java.lang.Exception
java.lang.Exception
public Query(java.lang.String xml) throws java.lang.Exception
java.lang.Exception
public Query(Query q)
Method Detail |
---|
public void setName(java.lang.String name)
public java.lang.String getName()
public void setNested(boolean flag)
public void addColumn(Column col)
public void addFunctionColumn(java.lang.String name, ColumnFunction func) throws java.lang.Exception
java.lang.Exception
public void addColumn(AggregateFunction func, Column col) throws java.lang.Exception
java.lang.Exception
public java.util.List getColumns()
public void setFilter(Filter filter) throws java.lang.Exception
java.lang.Exception
public Filter getFilter() throws java.lang.Exception
java.lang.Exception
public void setHaving(Filter filter)
public Filter getHaving()
public Join join(ForeignKey fk) throws java.lang.Exception
join
in interface Joinable
java.lang.Exception
public Join outerJoin(ForeignKey fk) throws java.lang.Exception
outerJoin
in interface Joinable
java.lang.Exception
public Join join(Table table) throws java.lang.Exception
java.lang.Exception
public Join join(Table table, java.lang.String alias) throws java.lang.Exception
java.lang.Exception
public Join join(Table table, Filter filter) throws java.lang.Exception
java.lang.Exception
public Join outerJoin(Table table, Filter filter) throws java.lang.Exception
java.lang.Exception
public Join outerJoin(Table table) throws java.lang.Exception
java.lang.Exception
public Join recursiveJoin(Table table) throws java.lang.Exception
java.lang.Exception
public java.util.List getJoins()
public void union(Query unionQuery)
public java.util.List getUnions()
public boolean isUnion()
public boolean isNested()
public void addSubQuery(Query q) throws java.lang.Exception
java.lang.Exception
public java.util.List getSubQueries()
public boolean isUniqueSort() throws java.lang.Exception
java.lang.Exception
protected void setUnion(boolean flag)
public void addSortCriteria(Column col, boolean ascending) throws java.lang.Exception
java.lang.Exception
public void addSortCriteria(java.lang.String alias, Column col, boolean ascending) throws java.lang.Exception
java.lang.Exception
public void addSortCriteria(Index index, boolean ascending) throws java.lang.Exception
java.lang.Exception
public void addSortCriteria(int pos, boolean ascending)
public void setSortCriterias(java.util.List sortCriterias) throws java.lang.Exception
sortCriterias
- list of new sort-criterias
java.lang.Exception
public java.util.List getSortCriterias() throws java.lang.Exception
java.lang.Exception
public void setRecordComparator(RecordComparator comparator)
public void setMaxNoOfRecords(int value)
public int getMaxNoOfRecords()
public Table getMainTable()
public QueryInstance createInstance() throws java.lang.Exception
java.lang.Exception
public RecordList run() throws java.lang.Exception
java.lang.Exception
public Table getTable()
public java.util.Iterator newIterator(java.sql.ResultSet rs, java.lang.Object source) throws java.lang.Exception
java.lang.Exception
public boolean is2D()
public RecordComparator getComparator() throws java.lang.Exception
java.lang.Exception
public java.lang.String toXML() throws java.lang.Exception
java.lang.Exception
public void toXML(org.xml.sax.ContentHandler handler) throws java.lang.Exception
java.lang.Exception
public Join getJoinByAlias(java.lang.String alias)
protected void registerJoin(java.lang.String alias, Join join)
public static Query parse(java.lang.String xml) throws java.lang.Exception
java.lang.Exception
public static Query parse(java.io.InputStream inStream) throws java.lang.Exception
java.lang.Exception
public static Query parseQuery(org.dom4j.Element element) throws java.lang.Exception
java.lang.Exception
public static Column getColumn(org.dom4j.Element element, Query q) throws java.lang.Exception
java.lang.Exception
public void checkPermission() throws java.lang.Exception
java.lang.Exception
public java.util.Map createTableDictonary() throws java.lang.Exception
java.lang.Exception
public java.lang.String getSQL() throws java.lang.Exception
java.lang.Exception
protected static java.util.List getPhysicalColumns(java.util.List cols)
protected void setAggregate(boolean flag)
public void setUniqueSort(boolean flag)
public void setDistinct(boolean flag)
public void setAlias(java.lang.String value)
public void modifyFilter(QueryParams params) throws java.lang.Exception
java.lang.Exception
public Query copy() throws java.lang.Exception
java.lang.Exception
public Filter getFilter(java.lang.Object id)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |