org.sql.generation.api.grammar.builders.query
Interface QuerySpecificationBuilder

All Superinterfaces:
AbstractBuilder<QuerySpecification>, AbstractQueryBuilder<QuerySpecification>

public interface QuerySpecificationBuilder
extends AbstractQueryBuilder<QuerySpecification>

This builder builds a single SELECT query. It acts as an aggregator for ColumnsBuilder for columns in SELECT, FromBuilder for tables in FROM clause, BooleanBuilder for search condition in WHERE clause, GroupByBuilder for GROUP BY clause, another BooleanBuilder for grouping conditions in HAVING clause, and finally OrderByBuilder for ORDER BY clause.

Author:
Stanislav Muhametsin
See Also:
QuerySpecification

Method Summary
 FromBuilder getFrom()
          Gets the builder for FROM clause of this SELECT statement.
 GroupByBuilder getGroupBy()
          Gets the builder for GROUP BY clause of this SELECT statement.
 BooleanBuilder getHaving()
          Gets the builder for grouping condition in HAVING clause of this SELECT statement.
 OrderByBuilder getOrderBy()
          Gets the builder for ORDER BY clause of this SELECT statement.
 ColumnsBuilder getSelect()
          Gets the builder for columns in this SELECT statement.
 BooleanBuilder getWhere()
          Gets the builder for search condition in WHERE clause of this SELECT statement.
 QuerySpecificationBuilder limit()
          Adds the FETCH FIRST ROW ONLY expression for this query.
 QuerySpecificationBuilder limit(Integer max)
          Adds the FETCH FIRST <number> ROWS ONLY expression for this query.
 QuerySpecificationBuilder limit(NonBooleanExpression max)
          Adds the FETCH FIRST <number> ROWS ONLY expression for this query.
 QuerySpecificationBuilder offset(Integer skip)
          Adds the OFFSET <number> ROWS expression for this query.
 QuerySpecificationBuilder offset(NonBooleanExpression skip)
          Adds the OFFSET <number> ROWS expression for this query.
 QuerySpecificationBuilder setFrom(FromBuilder builder)
          Sets the builder for FROM clause of this SELECT statement.
 QuerySpecificationBuilder setGroupBy(GroupByBuilder builder)
          Sets the builder for GROUP BY clause of this SELECT statement.
 QuerySpecificationBuilder setHaving(BooleanBuilder builder)
          Sets the builder for grouping condition in HAVING clause of this SELECT statement.
 QuerySpecificationBuilder setOrderBy(OrderByBuilder builder)
          Sets the builder for ORDER BY clause of this SELECT statement.
 QuerySpecificationBuilder setSelect(ColumnsBuilder builder)
          Sets the builder for columns in SELECT statement.
 QuerySpecificationBuilder setWhere(BooleanBuilder builder)
          Sets the builder for search condition in WHERE clause of this SELECT statement.
 QuerySpecificationBuilder trimGroupBy()
          Checks that all selected columns are in GROUP BY clause.
 
Methods inherited from interface org.sql.generation.api.grammar.builders.AbstractBuilder
createExpression
 

Method Detail

getSelect

ColumnsBuilder getSelect()
Gets the builder for columns in this SELECT statement.

Returns:
The builder for columns in this SELECT statement.

getFrom

FromBuilder getFrom()
Gets the builder for FROM clause of this SELECT statement.

Returns:
The builder for FROM clause of this SELECT statement.

getWhere

BooleanBuilder getWhere()
Gets the builder for search condition in WHERE clause of this SELECT statement.

Returns:
The builder for search condition in WHERE clause of this SELECT statement.

getGroupBy

GroupByBuilder getGroupBy()
Gets the builder for GROUP BY clause of this SELECT statement.

Returns:
The builder for GROUP BY clause of this SELECT statement.

getHaving

BooleanBuilder getHaving()
Gets the builder for grouping condition in HAVING clause of this SELECT statement.

Returns:
The builder for grouping condition in HAVING clause of this SELECT statement.

getOrderBy

OrderByBuilder getOrderBy()
Gets the builder for ORDER BY clause of this SELECT statement.

Returns:
The builder for ORDER BY clause of this SELECT statement.

trimGroupBy

QuerySpecificationBuilder trimGroupBy()
Checks that all selected columns are in GROUP BY clause. If they are not, it adds them as last columns of GROUP BY clause.

Returns:
This builder.

setSelect

QuerySpecificationBuilder setSelect(ColumnsBuilder builder)
Sets the builder for columns in SELECT statement.

Returns:
This builder.

setFrom

QuerySpecificationBuilder setFrom(FromBuilder builder)
Sets the builder for FROM clause of this SELECT statement.

Returns:
This builder.

setWhere

QuerySpecificationBuilder setWhere(BooleanBuilder builder)
Sets the builder for search condition in WHERE clause of this SELECT statement.

Returns:
This builder.

setGroupBy

QuerySpecificationBuilder setGroupBy(GroupByBuilder builder)
Sets the builder for GROUP BY clause of this SELECT statement.

Returns:
This builder.

setHaving

QuerySpecificationBuilder setHaving(BooleanBuilder builder)
Sets the builder for grouping condition in HAVING clause of this SELECT statement.

Returns:
This builder.

setOrderBy

QuerySpecificationBuilder setOrderBy(OrderByBuilder builder)
Sets the builder for ORDER BY clause of this SELECT statement.

Returns:
This builder.

limit

QuerySpecificationBuilder limit()
Description copied from interface: AbstractQueryBuilder
Adds the FETCH FIRST ROW ONLY expression for this query. The resulting LimitSpecification will have its count as null.

Specified by:
limit in interface AbstractQueryBuilder<QuerySpecification>
Returns:
This builder.

limit

QuerySpecificationBuilder limit(Integer max)
Description copied from interface: AbstractQueryBuilder
Adds the FETCH FIRST <number> ROWS ONLY expression for this query. Calling this method is equivalent of calling AbstractQueryBuilder.limit(NonBooleanExpression) and passing the NumericLiteral representing the given number as the parameter.

Specified by:
limit in interface AbstractQueryBuilder<QuerySpecification>
Parameters:
max - The maximum amount of rows for this query to return. Use null to remove the FETCH FIRST <number> ROWS ONLY expression.
Returns:
This builder.

limit

QuerySpecificationBuilder limit(NonBooleanExpression max)
Description copied from interface: AbstractQueryBuilder
Adds the FETCH FIRST <number> ROWS ONLY expression for this query.

Specified by:
limit in interface AbstractQueryBuilder<QuerySpecification>
Parameters:
max - The maximum amount of rows for this query to return. May be subquery or something else that evaluates to number or NULL. Use null to remove the FETCH FIRST <number> ROWS ONLY expression.
Returns:
This builder.

offset

QuerySpecificationBuilder offset(Integer skip)
Description copied from interface: AbstractQueryBuilder
Adds the OFFSET <number> ROWS expression for this query. Calling this method is equivalen of calling AbstractQueryBuilder.offset(NonBooleanExpression) and passing the NumericLiteral representing the given number as the parameter.

Specified by:
offset in interface AbstractQueryBuilder<QuerySpecification>
Parameters:
skip - The amount of rows to skip before starting to include them into this query. Use null to remove the OFFSET <number> ROWS expression.
Returns:
This builder.

offset

QuerySpecificationBuilder offset(NonBooleanExpression skip)
Description copied from interface: AbstractQueryBuilder
Adds the OFFSET <number> ROWS expression for this query.

Specified by:
offset in interface AbstractQueryBuilder<QuerySpecification>
Parameters:
skip - The amount of rows to skip before starting to include them into this query. May be subquery or something else that evaluates to number or NULL. Use null to remove the OFFSET <number> ROWS expression.
Returns:
This builder.


Copyright © 2010-2012. All Rights Reserved.