net.sf.jaxme.sqls.impl
Class SelectStatementImpl

java.lang.Object
  extended bynet.sf.jaxme.sqls.impl.StatementImpl
      extended bynet.sf.jaxme.sqls.impl.ConstrainedStatementImpl
          extended bynet.sf.jaxme.sqls.impl.SelectStatementImpl
All Implemented Interfaces:
ConstrainedStatement, SelectStatement, Statement

public class SelectStatementImpl
extends ConstrainedStatementImpl
implements SelectStatement

Author:
Jochen Wiedmann

Nested Class Summary
static class SelectStatementImpl.OrderColumnImpl
           
 
Nested classes inherited from class net.sf.jaxme.sqls.SelectStatement
SelectStatement.OrderColumn
 
Constructor Summary
SelectStatementImpl(SQLFactory pFactory)
          Creates a new SelectStatement and sets the creating SQLFactory.
 
Method Summary
 void addOrderColumn(ColumnReference pColumn)
          Adds a column to the ORDER BY clause.
 void addOrderColumn(ColumnReference pColumn, boolean pDescending)
          Adds a column to the ORDER BY clause.
 void addOrderColumn(SelectStatement.OrderColumn pColumn)
          Adds a column to the ORDER BY clause.
 void addResultColumn(ColumnReference pColumn)
          Adds a result column to the statement.
 int getMaxRows()
          Returns the limit of the number of rows in the result set, or zero, if the size of the result set is unlimited.
 java.util.Iterator getResultColumns()
          Returns the list of result columns.
 SelectTableReference getSelectTableReference()
          Shortcut for (SelectTableReference) getTable().
 java.util.Iterator getSelectTableReferences()
          Returns an Iterator over all the table references.
 int getSkippedRows()
          Returns the number of rows to skip at the result sets beginning.
 boolean isDistinct()
          Returns whether the statement should have a DISTINCT clause.
protected  TableReference newTableReference(Table pTable)
           
 void setDistinct(boolean pDistinct)
          Sets whether the statement should have a DISTINCT clause.
 void setMaxRows(int pMaxRows)
          Limits the size of the result set to the given number of rows.
 void setSkippedRows(int pSkippedRows)
          Indicates that the given number of rows should be skipped at the result sets beginning.
 
Methods inherited from class net.sf.jaxme.sqls.impl.ConstrainedStatementImpl
getWhere
 
Methods inherited from class net.sf.jaxme.sqls.impl.StatementImpl
getSQLFactory, getTableReference, setTable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.jaxme.sqls.ConstrainedStatement
getWhere
 
Methods inherited from interface net.sf.jaxme.sqls.Statement
getSQLFactory, getTableReference, setTable
 

Constructor Detail

SelectStatementImpl

public SelectStatementImpl(SQLFactory pFactory)

Creates a new SelectStatement and sets the creating SQLFactory.

Method Detail

addOrderColumn

public void addOrderColumn(ColumnReference pColumn)
Description copied from interface: SelectStatement

Adds a column to the ORDER BY clause. The column is sorted in ascending order.

Specified by:
addOrderColumn in interface SelectStatement

addOrderColumn

public void addOrderColumn(ColumnReference pColumn,
                           boolean pDescending)
Description copied from interface: SelectStatement

Adds a column to the ORDER BY clause. The column is sorted in ascending or descending order, depending on the parameter pDescending.

Specified by:
addOrderColumn in interface SelectStatement
Parameters:
pDescending - True for descending or false for ascending

addOrderColumn

public void addOrderColumn(SelectStatement.OrderColumn pColumn)
Description copied from interface: SelectStatement

Adds a column to the ORDER BY clause.

Specified by:
addOrderColumn in interface SelectStatement

addResultColumn

public void addResultColumn(ColumnReference pColumn)
Description copied from interface: SelectStatement

Adds a result column to the statement. By default all columns are returned.

Specified by:
addResultColumn in interface SelectStatement

getResultColumns

public java.util.Iterator getResultColumns()
Description copied from interface: SelectStatement

Returns the list of result columns.

Specified by:
getResultColumns in interface SelectStatement

setDistinct

public void setDistinct(boolean pDistinct)
Description copied from interface: SelectStatement

Sets whether the statement should have a DISTINCT clause. By default no DISTINCT clause is present.

Specified by:
setDistinct in interface SelectStatement

isDistinct

public boolean isDistinct()
Description copied from interface: SelectStatement

Returns whether the statement should have a DISTINCT clause. By default no DISTINCT clause is present.

Specified by:
isDistinct in interface SelectStatement

setMaxRows

public void setMaxRows(int pMaxRows)
Description copied from interface: SelectStatement

Limits the size of the result set to the given number of rows. Defaults to zero, in which case the size of the result set is unlimited.

Specified by:
setMaxRows in interface SelectStatement

getMaxRows

public int getMaxRows()
Description copied from interface: SelectStatement

Returns the limit of the number of rows in the result set, or zero, if the size of the result set is unlimited.

Specified by:
getMaxRows in interface SelectStatement

setSkippedRows

public void setSkippedRows(int pSkippedRows)
Description copied from interface: SelectStatement

Indicates that the given number of rows should be skipped at the result sets beginning. The default is zero, in which case no rows are skipped.

Specified by:
setSkippedRows in interface SelectStatement

getSkippedRows

public int getSkippedRows()
Description copied from interface: SelectStatement

Returns the number of rows to skip at the result sets beginning. The default is zero, in which case no rows are skipped.

Specified by:
getSkippedRows in interface SelectStatement

newTableReference

protected TableReference newTableReference(Table pTable)
Overrides:
newTableReference in class StatementImpl

getSelectTableReference

public SelectTableReference getSelectTableReference()
Description copied from interface: SelectStatement

Shortcut for (SelectTableReference) getTable().

Specified by:
getSelectTableReference in interface SelectStatement

getSelectTableReferences

public java.util.Iterator getSelectTableReferences()
Description copied from interface: SelectStatement

Returns an Iterator over all the table references.

Specified by:
getSelectTableReferences in interface SelectStatement