org.apache.openjpa.jdbc.sql
Class SelectImpl

java.lang.Object
  extended by org.apache.openjpa.jdbc.sql.SelectImpl
All Implemented Interfaces:
Joins, PathJoins, Select, SelectExecutor

public class SelectImpl
extends Object
implements Select, PathJoins

Standard Select implementation. Usage note: though this class implements Joins, it should not be used for joining directly. Instead, use the return value of newJoins().

Author:
Abe White

Nested Class Summary
static class SelectImpl.SelectResult
          A Result implementation wrapped around this select.
protected static class SelectImpl.Selects
          Helper class to track selected columns, with fast contains method.
 
Field Summary
protected  SelectImpl _outer
           
protected  SelectImpl.Selects _selects
           
 
Fields inherited from interface org.apache.openjpa.jdbc.sql.Select
EAGER_INNER, EAGER_OUTER, EAGER_PARALLEL, FROM_SELECT_ALIAS, SUBS_ANY_JOINABLE, SUBS_EXACT, SUBS_JOINABLE, SUBS_NONE, TYPE_JOINLESS, TYPE_TWO_PART
 
Constructor Summary
SelectImpl(JDBCConfiguration conf)
          Constructor.
 
Method Summary
 void addJoinClassConditions()
          Apply class conditions from relation joins.
 Joins and(Joins joins1, Joins joins2)
          AND the given joins together.
 void append(SQLBuffer buf, Joins joins)
          Append the given joins to the given buffer.
 void clearOrdering()
          Clear odering conditions.
 void clearPlaceholderSelects()
          Clear selected placeholders, and return removed select indexes.
 void clearSelects()
          Clear the existing column selects.
 SelectImpl clone(Context ctx)
           
 Joins crossJoin(Table localTable, Table foreignTable)
          Perform a cross join on the given tables.
 Context ctx()
          Return the JPQL query context of this select
 SelectExecutor eagerClone(FieldMapping key, int eagerType, boolean toMany, int sels)
          Return a select that will be eagerly executed with this one, or null if the select cannot be created for the given key and join type.
 Result execute(JDBCStore store, JDBCFetchConfiguration fetch)
          Execute this select in the context of the given store manager.
 Result execute(JDBCStore store, JDBCFetchConfiguration fetch, int lockLevel)
          Execute this select in the context of the given store manager.
protected  Result execute(StoreContext ctx, JDBCStore store, JDBCFetchConfiguration fetch, int lockLevel)
          Execute this select in the context of the given store manager.
protected  ResultSet executeQuery(Connection conn, PreparedStatement stmnt, SQLBuffer sql, boolean isLRS, JDBCStore store)
          This method is to provide override for non-JDBC or JDBC-like implementation of executing query.
 ResultSet executeQuery(Connection conn, PreparedStatement stmnt, String sql, JDBCStore store, Object[] params, Column[] cols)
          This method is to provide override for non-JDBC or JDBC-like implementation of executing query.
 SelectExecutor fullClone(int sels)
          Return a SELECT that is a complete clone of this one.
 Map getAliases()
           
 boolean getAutoDistinct()
          Whether to automatically make results distinct when relational joins would otherwise introduce duplicates.
 String getColumnAlias(Column col)
          Return the alias for the given column.
 String getColumnAlias(Column col, Joins joins)
          Return the alias for the given column.
 String getColumnAlias(Column col, Object path)
          Return the alias for the give column
 String getColumnAlias(String col, Table table)
          Return the alias for the given column.
 String getColumnAlias(String col, Table table, Joins joins)
          Return the alias for the given column.
 JDBCConfiguration getConfiguration()
          Return the select configuration.
 String getCorrelatedVariable()
          Return correlated variable name
 int getCount(JDBCStore store)
          Return the number of instances matching this select.
protected  int getCount(ResultSet rs)
          This method is to provide override for non-JDBC or JDBC-like implementation of getting count from the result set.
 DBDictionary getDictionary()
           
 SelectExecutor getEager(FieldMapping key)
          Return the eager select for the given key.
 Map getEagerMap()
          Return view of eager selects.
 Result getEagerResult(Connection conn, PreparedStatement stmnt, ResultSet rs, JDBCStore store, JDBCFetchConfiguration fetch, boolean forUpdate, SQLBuffer sql)
          This method is to provide override for non-JDBC or JDBC-like implementation of executing eager selects.
 long getEndIndex()
          The result end index.
 List getExcludedJoinedTableClassMeta()
          get joined table metadatas excluded for polymorphic queries
 int getExpectedResultCount()
          The expected result count for the query.
 Select getFromSelect()
          Another select instance that creates a temporary table from which this select pulls data.
 SQLBuffer getGrouping()
          Return the grouping SQL for this select.
 boolean getHasSubselect()
          Return the flag to indicate whether this Select has internally generated subselect
 SQLBuffer getHaving()
          Return the HAVING clause, or null if none.
 List getIdentifierAliases()
          Get the aliases for identifier columns that can be used in COUNT selects to find the number of matches.
 List getJoinedTableClassMeta()
          get joined table metadatas for polymorphic queries
 Iterator getJoinIterator()
          Return the top-level Join elements for this select.
 Joins getJoins()
          Return the top-level joins for this select.
 int getJoinSyntax()
          The join syntax for this select, as one of the syntax constants from JoinSyntaxes.
(package private)  List getOrderedIndexes()
          Return the indexes in the select list of all items we're ordering by, or null if none.
 SQLBuffer getOrdering()
          Return the ordering SQL for this select.
 Select getParent()
          Return the parent of this select, if it is a subselect.
 String getPathStr()
           
 Select getSelect()
          The select owner of this join
 List getSelectAliases()
          Return the aliases of all selected columns and all selected buffers, in the order they were selected.
 List getSelects()
          Return the actual Vals and Columns that were selected, in the order that they were selected.
 SQLBuffer getSQL()
          Get the buffer if it has been computed by a previous call to SelectExecutor.toSelect(boolean, JDBCFetchConfiguration), if any.
 long getStartIndex()
          The result start index.
 String getSubselectPath()
          Return the subselect path for this select, if it is a subselect.
 List getSubselects()
          Return this select's subselects, or empty collection if none.
 Collection getTableAliases()
          Return the set of all used table aliases.
 ClassMapping getTablePerClassMeta()
          get table-per-class metadata for polymorphic queries
 Map getTables()
           
 SQLBuffer getWhere()
          Return the WHERE clause, minus any necessary end joins.
 void groupBy(ClassMapping mapping, int subclasses, JDBCStore store, JDBCFetchConfiguration fetch)
          Group by the columns of the given mapping, possibly including subclasses.
 void groupBy(ClassMapping mapping, int subclasses, JDBCStore store, JDBCFetchConfiguration fetch, Joins joins)
          Group by the columns of the given mapping, possibly including subclasses.
 void groupBy(Column col)
          Group by the given column.
 void groupBy(Column[] cols)
          Group by the given columns.
 void groupBy(Column[] cols, Joins joins)
          Group by the given columns.
 void groupBy(Column col, Joins joins)
          Group by the given column.
 void groupBy(SQLBuffer sql)
          Add a GROUP BY clause.
 void groupBy(SQLBuffer sql, Joins joins)
          Add a GROUP BY clause.
 void groupBy(String sql)
          Add a GROUP BY clause.
 void groupBy(String sql, Joins joins)
          Add a GROUP BY clause.
 boolean hasEagerJoin(boolean toMany)
          Whether this select has an eager join of the specified type.
 boolean hasJoin(boolean toMany)
          Whether this select has a join of the specified type.
 boolean hasMultipleSelects()
          Affirm if this receiver requires more than one selects to fetch its data.
 void having(SQLBuffer sql)
          Add the given having conditions.
 void having(SQLBuffer sql, Joins joins)
          Add the given having conditions.
 void having(String sql)
          Add the given having conditions.
 void having(String sql, Joins joins)
          Add the given having conditions.
 int indexOf()
          The index of this select within the UNION, or 0.
 void insertPlaceholder(String sql, int pos)
          Insert a placeholder at the given index; use a negative index to count from the back of the select list.
 boolean isAggregate()
          Return true if this is an aggregate select.
 boolean isDirty()
          Return true if this instance has a path, any joins, or a variable.
 boolean isDistinct()
          Whether this is a SELECT DISTINCT / UNION ALL.
 boolean isEmpty()
          Whether we have any joins.
 boolean isLob()
          Return true if this select includes a LOB.
 boolean isLRS()
          Whether the result of this select should be treated as a large result set.
 boolean isOuter()
          Whether this joins path results in outer joins.
 boolean isSelected(Table table)
          Return whether the given table is being used in this select.
 Joins join(ForeignKey fk, boolean inverse, boolean toMany)
          Join the columns of the given foreign key.
 int joinCount()
          Return the maximum number of joins contained in this instance at any time.
 Joins joinRelation(String name, ForeignKey fk, ClassMapping target, int subs, boolean inverse, boolean toMany)
          Join the columns of the given foreign key, which represents a relation via the given field name.
 JoinSet joins()
          Return the set of Join elements, or null if none.
 void logEagerRelations()
          Extended trace that logs eager relations
 void moveJoinsToParent()
          Move joins that belong to subquery's parent
 Joins newJoins()
          Return a new instance to use for joining.
 Joins newOuterJoins()
          Return a new instance to use for outer joining.
protected  SelectImpl.Selects newSelects()
           
 void nullJoins()
          Null the set of Join elements.
 Joins or(Joins joins1, Joins joins2)
          OR the given joins together.
 int orderBy(Column[] cols, boolean asc, boolean sel)
          Order by the given columns.
 int orderBy(Column[] cols, boolean asc, Joins joins, boolean sel)
          Order by the given columns.
(package private)  int orderBy(Column[] cols, boolean asc, Joins joins, boolean sel, boolean aliasOrder)
          Allow unions to set aliases on order columns.
 boolean orderBy(Column col, boolean asc, boolean sel)
          Order by the given column.
 boolean orderBy(Column col, boolean asc, Joins joins, boolean sel)
          Order by the given column.
(package private)  boolean orderBy(Column col, boolean asc, Joins joins, boolean sel, boolean aliasOrder)
          Allow unions to set aliases on order columns.
 boolean orderBy(SQLBuffer sql, boolean asc, boolean sel, Value selAs)
          Add an ORDER BY clause.
(package private)  boolean orderBy(SQLBuffer sql, boolean asc, Joins joins, boolean sel, boolean aliasOrder, Value selAs)
          Allow unions to set aliases on order columns.
 boolean orderBy(SQLBuffer sql, boolean asc, Joins joins, boolean sel, Value selAs)
          Add an ORDER BY clause.
 boolean orderBy(String sql, boolean asc, boolean sel)
          Add an ORDER BY clause.
 boolean orderBy(String sql, boolean asc, Joins joins, boolean sel)
          Add an ORDER BY clause.
(package private)  boolean orderBy(String sql, boolean asc, Joins joins, boolean sel, boolean aliasOrder)
          Allow unions to set aliases on order columns.
 int orderByPrimaryKey(ClassMapping mapping, boolean asc, boolean sel)
          Order on the primary key columns of the given mapping, joining to superclasses as necessary to get all columns needed to construct an object id.
 int orderByPrimaryKey(ClassMapping mapping, boolean asc, Joins joins, boolean sel)
          Select and order on the primary key columns of the given mapping, joining to superclasses as necessary to get all columns needed to construct an object id.
 int orderByPrimaryKey(ClassMapping mapping, boolean asc, Joins joins, boolean sel, boolean aliasOrder)
          Allow unions to set aliases on order columns.
 Joins outer(Joins joins)
          Return a join set making the given joins outer joins.
 Joins outerJoin(ForeignKey fk, boolean inverse, boolean toMany)
          Join the columns of the given foreign key.
 Joins outerJoinRelation(String name, ForeignKey fk, ClassMapping target, int subs, boolean inverse, boolean toMany)
          Join the columns of the given foreign key, which represents a relation via the given field name.
 StringBuilder path()
          Return the relation path traversed by these joins, or null if none.
protected  PreparedStatement prepareStatement(Connection conn, SQLBuffer sql, JDBCFetchConfiguration fetch, int rsType, int rsConcur, boolean isLRS)
          This method is to provide override for non-JDBC or JDBC-like implementation of preparing statement.
 PreparedStatement prepareStatement(Connection conn, String sql)
          This method is to provide override for non-JDBC or JDBC-like implementation of preparing statement.
 void removeAlias(Object key)
           
 void removeTable(Object key)
           
 void select(ClassMapping mapping, int subclasses, JDBCStore store, JDBCFetchConfiguration fetch, int eager)
          Select the columns of the given mapping, possibly including subclasses.
 void select(ClassMapping mapping, int subclasses, JDBCStore store, JDBCFetchConfiguration fetch, int eager, Joins joins)
          Select the columns of the given mapping, possibly including subclasses.
 boolean select(Column col)
          Select the given column.
 int select(Column[] cols)
          Select the given columns.
 int select(Column[] cols, Joins joins)
          Select the given columns.
 boolean select(Column col, Joins joins)
          Select the given column.
(package private)  void select(Select wrapper, ClassMapping mapping, int subclasses, JDBCStore store, JDBCFetchConfiguration fetch, int eager, Joins joins, boolean ident)
          Select the given mapping.
 boolean select(SQLBuffer sql, Object id)
          Select the given SQL; the given id object is an identifier to use when retrieving the corresponding value from a Result.
 boolean select(SQLBuffer sql, Object id, Joins joins)
          Select the given SQL; the given id object is an identifier to use when retrieving the corresponding value from a Result.
 boolean select(String sql, Object id)
          Select the given SQL; the given id object is an identifier to use when retrieving the corresponding value from a Result.
 boolean select(String sql, Object id, Joins joins)
          Select the given SQL; the given id object is an identifier to use when retrieving the corresponding value from a Result.
 void selectIdentifier(ClassMapping mapping, int subclasses, JDBCStore store, JDBCFetchConfiguration fetch, int eager)
          Select the columns of the given mapping, possibly including subclasses.
 void selectIdentifier(ClassMapping mapping, int subclasses, JDBCStore store, JDBCFetchConfiguration fetch, int eager, Joins joins)
          Select the columns of the given mapping, possibly including subclasses.
 boolean selectIdentifier(Column col)
          Select the given column as one that can be used to get a count of distinct matches.
 int selectIdentifier(Column[] cols)
          Select the given columns as ones that can be used to get a count of distinct matches.
 int selectIdentifier(Column[] cols, Joins joins)
          Select the given columns as ones that can be used to get a count of distinct matches.
 boolean selectIdentifier(Column col, Joins joins)
          Select the given column as one that can be used to get a count of distinct matches.
 void selectPlaceholder(String sql)
          Select the given SQL as a placeholder for a UNION element.
 int selectPrimaryKey(ClassMapping mapping)
          Select the primary key columns of the given mapping, joining to superclasses as necessary to get all columns needed to construct an object id.
 int selectPrimaryKey(ClassMapping mapping, Joins joins)
          Select the primary key columns of the given mapping, joining to superclasses as necessary to get all columns needed to construct an object id.
 void setAggregate(boolean agg)
          Set to true for aggregate selects.
 void setAutoDistinct(boolean val)
          Whether to automatically make results distinct when relational joins would otherwise introduce duplicates.
 void setContext(Context context)
          Set JPQL query context for this select
 Joins setCorrelatedVariable(String var)
          Set the correlated variable name being traversed into with the next join.
 void setDistinct(boolean distinct)
          Whether this is a SELECT DISTINCT / UNION ALL.
 void setExcludedJoinedTableClassMeta(List meta)
          Set joined table metadatas excluded for polymorphic queries
 void setExpectedResultCount(int expectedResultCount, boolean force)
          The expected result count for the query.
 void setFromSelect(Select sel)
          Another select instance that creates a temporary table from which this select pulls data.
 void setHasSubselect(boolean hasSub)
          Set the flag to indicate whether this Select has internally generated subselect
 Joins setJoinContext(Context ctx)
          Set subquery context when traversing into the next join is in transition from parent context to subquery.
 void setJoinedTableClassMeta(List meta)
          Set joined table metadatas for polymorphic queries
 void setJoinSyntax(int joinSyntax)
          The join syntax for this select, as one of the syntax constants from JoinSyntaxes.
 void setLob(boolean lob)
          Set to true for selects that include LOB columns.
 void setLRS(boolean lrs)
          Whether the result of this select should be treated as a large result set.
 PathJoins setOuter(boolean outer)
          Mark this as an outer joins set.
 void setParent(Select parent, String path)
          Turn this select into a subselect of the given instance.
 void setRange(long start, long end)
          Set the result range for this select.
(package private)  void setRecordOrderedIndexes(boolean record)
          Allow unions to record the select list indexes of items we order by.
 void setSchemaAlias(String schemaAlias)
          Record the initial schemaAlias of a join path
 Joins setSubselect(String alias)
          Set the subquery alias.
 void setTablePerClassMeta(ClassMapping meta)
          Set table-per-class metadata for polymorphic queries
 Joins setVariable(String var)
          Set the variable name being traversed into with the next join.
 boolean supportsLocking()
          Whether this select can be executed for update.
 boolean supportsRandomAccess(boolean forUpdate)
          Return whether this select can support a random access result set type.
(package private) static String toAlias(int index)
          Helper method to return the proper table alias for the given alias index.
static String toOrderAlias(int index)
          Helper method to return the proper order alias for the given order column index.
 SQLBuffer toSelect(boolean forUpdate, JDBCFetchConfiguration fetch)
          Return this select as a SQL statement formatted for the current dictionary.
 SQLBuffer toSelectCount()
          Return this select as a COUNT SQL statement formatted for the current dictionary.
 String toString()
          Implement toString to generate SQL string for profiling/debuggging.
 void where(Joins joins)
          Add the given where conditions.
 void where(SQLBuffer sql)
          Add the given where conditions.
 void where(SQLBuffer sql, Joins joins)
          Add the given where conditions.
 void where(String sql)
          Add the given where conditions.
 void where(String sql, Joins joins)
          Add the given where conditions.
 SelectExecutor whereClone(int sels)
          Return a SELECT with the same joins and where conditions as this one.
 void whereForeignKey(ForeignKey fk, Object oid, ClassMapping mapping, JDBCStore store)
          Add where conditions setting the given foreign key to the given oid values.
 void wherePrimaryKey(Object oid, ClassMapping mapping, JDBCStore store)
          Add where conditions setting the mapping's primary key to the given oid values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_selects

protected final SelectImpl.Selects _selects

_outer

protected SelectImpl _outer
Constructor Detail

SelectImpl

public SelectImpl(JDBCConfiguration conf)
Constructor. Supply configuration.

Method Detail

getTablePerClassMeta

public ClassMapping getTablePerClassMeta()
Description copied from interface: Select
get table-per-class metadata for polymorphic queries

Specified by:
getTablePerClassMeta in interface Select

setTablePerClassMeta

public void setTablePerClassMeta(ClassMapping meta)
Description copied from interface: Select
Set table-per-class metadata for polymorphic queries

Specified by:
setTablePerClassMeta in interface Select

setJoinedTableClassMeta

public void setJoinedTableClassMeta(List meta)
Description copied from interface: Select
Set joined table metadatas for polymorphic queries

Specified by:
setJoinedTableClassMeta in interface Select

getJoinedTableClassMeta

public List getJoinedTableClassMeta()
Description copied from interface: Select
get joined table metadatas for polymorphic queries

Specified by:
getJoinedTableClassMeta in interface Select

setExcludedJoinedTableClassMeta

public void setExcludedJoinedTableClassMeta(List meta)
Description copied from interface: Select
Set joined table metadatas excluded for polymorphic queries

Specified by:
setExcludedJoinedTableClassMeta in interface Select

getExcludedJoinedTableClassMeta

public List getExcludedJoinedTableClassMeta()
Description copied from interface: Select
get joined table metadatas excluded for polymorphic queries

Specified by:
getExcludedJoinedTableClassMeta in interface Select

toAlias

static String toAlias(int index)
Helper method to return the proper table alias for the given alias index.


toOrderAlias

public static String toOrderAlias(int index)
Helper method to return the proper order alias for the given order column index.


setContext

public void setContext(Context context)
Description copied from interface: Select
Set JPQL query context for this select

Specified by:
setContext in interface Select

ctx

public Context ctx()
Description copied from interface: Select
Return the JPQL query context of this select

Specified by:
ctx in interface Select

setSchemaAlias

public void setSchemaAlias(String schemaAlias)
Description copied from interface: Select
Record the initial schemaAlias of a join path

Specified by:
setSchemaAlias in interface Select

getConfiguration

public JDBCConfiguration getConfiguration()
Description copied from interface: SelectExecutor
Return the select configuration.

Specified by:
getConfiguration in interface SelectExecutor

toSelect

public SQLBuffer toSelect(boolean forUpdate,
                          JDBCFetchConfiguration fetch)
Description copied from interface: SelectExecutor
Return this select as a SQL statement formatted for the current dictionary.

Specified by:
toSelect in interface SelectExecutor

getSQL

public SQLBuffer getSQL()
Description copied from interface: SelectExecutor
Get the buffer if it has been computed by a previous call to SelectExecutor.toSelect(boolean, JDBCFetchConfiguration), if any.

Specified by:
getSQL in interface SelectExecutor

toSelectCount

public SQLBuffer toSelectCount()
Description copied from interface: SelectExecutor
Return this select as a COUNT SQL statement formatted for the current dictionary.

Specified by:
toSelectCount in interface SelectExecutor

getAutoDistinct

public boolean getAutoDistinct()
Description copied from interface: SelectExecutor
Whether to automatically make results distinct when relational joins would otherwise introduce duplicates.

Specified by:
getAutoDistinct in interface SelectExecutor

setAutoDistinct

public void setAutoDistinct(boolean val)
Description copied from interface: SelectExecutor
Whether to automatically make results distinct when relational joins would otherwise introduce duplicates.

Specified by:
setAutoDistinct in interface SelectExecutor

isDistinct

public boolean isDistinct()
Description copied from interface: SelectExecutor
Whether this is a SELECT DISTINCT / UNION ALL.

Specified by:
isDistinct in interface SelectExecutor

setDistinct

public void setDistinct(boolean distinct)
Description copied from interface: SelectExecutor
Whether this is a SELECT DISTINCT / UNION ALL.

Specified by:
setDistinct in interface SelectExecutor

isLRS

public boolean isLRS()
Description copied from interface: SelectExecutor
Whether the result of this select should be treated as a large result set.

Specified by:
isLRS in interface SelectExecutor

setLRS

public void setLRS(boolean lrs)
Description copied from interface: SelectExecutor
Whether the result of this select should be treated as a large result set.

Specified by:
setLRS in interface SelectExecutor

getExpectedResultCount

public int getExpectedResultCount()
Description copied from interface: SelectExecutor
The expected result count for the query.

Specified by:
getExpectedResultCount in interface SelectExecutor

setExpectedResultCount

public void setExpectedResultCount(int expectedResultCount,
                                   boolean force)
Description copied from interface: SelectExecutor
The expected result count for the query.

Specified by:
setExpectedResultCount in interface SelectExecutor
force - if false, the count will be discarded if this select has any to-many eager joins that would throw off the result count

getJoinSyntax

public int getJoinSyntax()
Description copied from interface: SelectExecutor
The join syntax for this select, as one of the syntax constants from JoinSyntaxes.

Specified by:
getJoinSyntax in interface SelectExecutor

setJoinSyntax

public void setJoinSyntax(int joinSyntax)
Description copied from interface: SelectExecutor
The join syntax for this select, as one of the syntax constants from JoinSyntaxes.

Specified by:
setJoinSyntax in interface SelectExecutor

supportsRandomAccess

public boolean supportsRandomAccess(boolean forUpdate)
Description copied from interface: SelectExecutor
Return whether this select can support a random access result set type.

Specified by:
supportsRandomAccess in interface SelectExecutor

supportsLocking

public boolean supportsLocking()
Description copied from interface: SelectExecutor
Whether this select can be executed for update.

Specified by:
supportsLocking in interface SelectExecutor

hasMultipleSelects

public boolean hasMultipleSelects()
Description copied from interface: SelectExecutor
Affirm if this receiver requires more than one selects to fetch its data.

Specified by:
hasMultipleSelects in interface SelectExecutor

getCount

public int getCount(JDBCStore store)
             throws SQLException
Description copied from interface: SelectExecutor
Return the number of instances matching this select.

Specified by:
getCount in interface SelectExecutor
Throws:
SQLException

execute

public Result execute(JDBCStore store,
                      JDBCFetchConfiguration fetch)
               throws SQLException
Description copied from interface: SelectExecutor
Execute this select in the context of the given store manager.

Specified by:
execute in interface SelectExecutor
Throws:
SQLException

execute

public Result execute(JDBCStore store,
                      JDBCFetchConfiguration fetch,
                      int lockLevel)
               throws SQLException
Description copied from interface: SelectExecutor
Execute this select in the context of the given store manager.

Specified by:
execute in interface SelectExecutor
Throws:
SQLException

execute

protected Result execute(StoreContext ctx,
                         JDBCStore store,
                         JDBCFetchConfiguration fetch,
                         int lockLevel)
                  throws SQLException
Execute this select in the context of the given store manager. The context is passed in separately for profiling purposes.

Throws:
SQLException

prepareStatement

protected PreparedStatement prepareStatement(Connection conn,
                                             SQLBuffer sql,
                                             JDBCFetchConfiguration fetch,
                                             int rsType,
                                             int rsConcur,
                                             boolean isLRS)
                                      throws SQLException
This method is to provide override for non-JDBC or JDBC-like implementation of preparing statement.

Throws:
SQLException

prepareStatement

public PreparedStatement prepareStatement(Connection conn,
                                          String sql)
                                   throws SQLException
This method is to provide override for non-JDBC or JDBC-like implementation of preparing statement.

Throws:
SQLException

executeQuery

protected ResultSet executeQuery(Connection conn,
                                 PreparedStatement stmnt,
                                 SQLBuffer sql,
                                 boolean isLRS,
                                 JDBCStore store)
                          throws SQLException
This method is to provide override for non-JDBC or JDBC-like implementation of executing query.

Throws:
SQLException

executeQuery

public ResultSet executeQuery(Connection conn,
                              PreparedStatement stmnt,
                              String sql,
                              JDBCStore store,
                              Object[] params,
                              Column[] cols)
                       throws SQLException
This method is to provide override for non-JDBC or JDBC-like implementation of executing query.

Throws:
SQLException

getCount

protected int getCount(ResultSet rs)
                throws SQLException
This method is to provide override for non-JDBC or JDBC-like implementation of getting count from the result set.

Throws:
SQLException

getEagerResult

public Result getEagerResult(Connection conn,
                             PreparedStatement stmnt,
                             ResultSet rs,
                             JDBCStore store,
                             JDBCFetchConfiguration fetch,
                             boolean forUpdate,
                             SQLBuffer sql)
                      throws SQLException
This method is to provide override for non-JDBC or JDBC-like implementation of executing eager selects.

Throws:
SQLException

indexOf

public int indexOf()
Description copied from interface: Select
The index of this select within the UNION, or 0.

Specified by:
indexOf in interface Select

getSubselects

public List getSubselects()
Description copied from interface: Select
Return this select's subselects, or empty collection if none.

Specified by:
getSubselects in interface Select

getParent

public Select getParent()
Description copied from interface: Select
Return the parent of this select, if it is a subselect.

Specified by:
getParent in interface Select

getSubselectPath

public String getSubselectPath()
Description copied from interface: Select
Return the subselect path for this select, if it is a subselect.

Specified by:
getSubselectPath in interface Select

setParent

public void setParent(Select parent,
                      String path)
Description copied from interface: Select
Turn this select into a subselect of the given instance.

Specified by:
setParent in interface Select

setHasSubselect

public void setHasSubselect(boolean hasSub)
Description copied from interface: Select
Set the flag to indicate whether this Select has internally generated subselect

Specified by:
setHasSubselect in interface Select

getHasSubselect

public boolean getHasSubselect()
Description copied from interface: Select
Return the flag to indicate whether this Select has internally generated subselect

Specified by:
getHasSubselect in interface Select
Returns:

getAliases

public Map getAliases()

removeAlias

public void removeAlias(Object key)

getTables

public Map getTables()

removeTable

public void removeTable(Object key)

getFromSelect

public Select getFromSelect()
Description copied from interface: Select
Another select instance that creates a temporary table from which this select pulls data.

Specified by:
getFromSelect in interface Select

setFromSelect

public void setFromSelect(Select sel)
Description copied from interface: Select
Another select instance that creates a temporary table from which this select pulls data.

Specified by:
setFromSelect in interface Select

hasEagerJoin

public boolean hasEagerJoin(boolean toMany)
Description copied from interface: Select
Whether this select has an eager join of the specified type.

Specified by:
hasEagerJoin in interface Select

hasJoin

public boolean hasJoin(boolean toMany)
Description copied from interface: Select
Whether this select has a join of the specified type.

Specified by:
hasJoin in interface Select

isSelected

public boolean isSelected(Table table)
Description copied from interface: Select
Return whether the given table is being used in this select.

Specified by:
isSelected in interface Select

getTableAliases

public Collection getTableAliases()
Description copied from interface: Select
Return the set of all used table aliases.

Specified by:
getTableAliases in interface Select

getSelects

public List getSelects()
Description copied from interface: Select
Return the actual Vals and Columns that were selected, in the order that they were selected.

Specified by:
getSelects in interface Select

getSelectAliases

public List getSelectAliases()
Description copied from interface: Select
Return the aliases of all selected columns and all selected buffers, in the order they were selected. Each alias may be either a string or a SQLBuffer.

Specified by:
getSelectAliases in interface Select

getIdentifierAliases

public List getIdentifierAliases()
Description copied from interface: Select
Get the aliases for identifier columns that can be used in COUNT selects to find the number of matches. Each alias will be a string. If no identifier columns have been nominated, then all column alises are returned.

Specified by:
getIdentifierAliases in interface Select

getOrdering

public SQLBuffer getOrdering()
Description copied from interface: Select
Return the ordering SQL for this select.

Specified by:
getOrdering in interface Select

getGrouping

public SQLBuffer getGrouping()
Description copied from interface: Select
Return the grouping SQL for this select.

Specified by:
getGrouping in interface Select

getWhere

public SQLBuffer getWhere()
Description copied from interface: Select
Return the WHERE clause, minus any necessary end joins.

Specified by:
getWhere in interface Select

getHaving

public SQLBuffer getHaving()
Description copied from interface: Select
Return the HAVING clause, or null if none.

Specified by:
getHaving in interface Select

addJoinClassConditions

public void addJoinClassConditions()
Description copied from interface: Select
Apply class conditions from relation joins. This may affect the return values of Select.getJoins(), Select.getJoinIterator(), and Select.getWhere().

Specified by:
addJoinClassConditions in interface Select

getJoins

public Joins getJoins()
Description copied from interface: Select
Return the top-level joins for this select.

Specified by:
getJoins in interface Select

getJoinIterator

public Iterator getJoinIterator()
Description copied from interface: Select
Return the top-level Join elements for this select.

Specified by:
getJoinIterator in interface Select

getStartIndex

public long getStartIndex()
Description copied from interface: Select
The result start index.

Specified by:
getStartIndex in interface Select

getEndIndex

public long getEndIndex()
Description copied from interface: Select
The result end index.

Specified by:
getEndIndex in interface Select

setRange

public void setRange(long start,
                     long end)
Description copied from interface: Select
Set the result range for this select.

Specified by:
setRange in interface Select

getColumnAlias

public String getColumnAlias(Column col)
Description copied from interface: Select
Return the alias for the given column.

Specified by:
getColumnAlias in interface Select

getColumnAlias

public String getColumnAlias(Column col,
                             Joins joins)
Description copied from interface: Select
Return the alias for the given column.

Specified by:
getColumnAlias in interface Select

getColumnAlias

public String getColumnAlias(String col,
                             Table table)
Description copied from interface: Select
Return the alias for the given column.

Specified by:
getColumnAlias in interface Select

getColumnAlias

public String getColumnAlias(String col,
                             Table table,
                             Joins joins)
Description copied from interface: Select
Return the alias for the given column.

Specified by:
getColumnAlias in interface Select

getColumnAlias

public String getColumnAlias(Column col,
                             Object path)
Return the alias for the give column

Specified by:
getColumnAlias in interface Select

isAggregate

public boolean isAggregate()
Description copied from interface: Select
Return true if this is an aggregate select.

Specified by:
isAggregate in interface Select

setAggregate

public void setAggregate(boolean agg)
Description copied from interface: Select
Set to true for aggregate selects.

Specified by:
setAggregate in interface Select

isLob

public boolean isLob()
Description copied from interface: Select
Return true if this select includes a LOB.

Specified by:
isLob in interface Select

setLob

public void setLob(boolean lob)
Description copied from interface: Select
Set to true for selects that include LOB columns.

Specified by:
setLob in interface Select

clearSelects

public void clearSelects()
Description copied from interface: Select
Clear the existing column selects.

Specified by:
clearSelects in interface Select

select

public boolean select(SQLBuffer sql,
                      Object id)
Description copied from interface: Select
Select the given SQL; the given id object is an identifier to use when retrieving the corresponding value from a Result.

Specified by:
select in interface Select
Returns:
true if selected

select

public boolean select(SQLBuffer sql,
                      Object id,
                      Joins joins)
Description copied from interface: Select
Select the given SQL; the given id object is an identifier to use when retrieving the corresponding value from a Result.

Specified by:
select in interface Select
Returns:
true if selected

select

public boolean select(String sql,
                      Object id)
Description copied from interface: Select
Select the given SQL; the given id object is an identifier to use when retrieving the corresponding value from a Result.

Specified by:
select in interface Select
Returns:
true if selected

select

public boolean select(String sql,
                      Object id,
                      Joins joins)
Description copied from interface: Select
Select the given SQL; the given id object is an identifier to use when retrieving the corresponding value from a Result.

Specified by:
select in interface Select
Returns:
true if selected

selectPlaceholder

public void selectPlaceholder(String sql)
Description copied from interface: Select
Select the given SQL as a placeholder for a UNION element.

Specified by:
selectPlaceholder in interface Select

insertPlaceholder

public void insertPlaceholder(String sql,
                              int pos)
Insert a placeholder at the given index; use a negative index to count from the back of the select list.


clearPlaceholderSelects

public void clearPlaceholderSelects()
Clear selected placeholders, and return removed select indexes.


select

public boolean select(Column col)
Description copied from interface: Select
Select the given column.

Specified by:
select in interface Select
Returns:
true if selected

select

public boolean select(Column col,
                      Joins joins)
Description copied from interface: Select
Select the given column.

Specified by:
select in interface Select
Returns:
true if selected

select

public int select(Column[] cols)
Description copied from interface: Select
Select the given columns.

Specified by:
select in interface Select
Returns:
bit set of indexes of columns that were selected

select

public int select(Column[] cols,
                  Joins joins)
Description copied from interface: Select
Select the given columns.

Specified by:
select in interface Select
Returns:
bit set of indexes of columns that were selected

select

public void select(ClassMapping mapping,
                   int subclasses,
                   JDBCStore store,
                   JDBCFetchConfiguration fetch,
                   int eager)
Description copied from interface: Select
Select the columns of the given mapping, possibly including subclasses. This method should be called after all where conditions are added in case the given mapping batches other selects.

Specified by:
select in interface Select

select

public void select(ClassMapping mapping,
                   int subclasses,
                   JDBCStore store,
                   JDBCFetchConfiguration fetch,
                   int eager,
                   Joins joins)
Description copied from interface: Select
Select the columns of the given mapping, possibly including subclasses. This method should be called after all where conditions are added in case the given mapping batches other selects.

Specified by:
select in interface Select

select

void select(Select wrapper,
            ClassMapping mapping,
            int subclasses,
            JDBCStore store,
            JDBCFetchConfiguration fetch,
            int eager,
            Joins joins,
            boolean ident)
Select the given mapping.


selectIdentifier

public boolean selectIdentifier(Column col)
Description copied from interface: Select
Select the given column as one that can be used to get a count of distinct matches. It is not necessary to designate distinct identifiers when eagerly traversing the entire result of the select or when not using an LRSSize setting of count.

Specified by:
selectIdentifier in interface Select
Returns:
true if selected

selectIdentifier

public boolean selectIdentifier(Column col,
                                Joins joins)
Description copied from interface: Select
Select the given column as one that can be used to get a count of distinct matches. It is not necessary to designate distinct identifiers when eagerly traversing the entire result of the select or when not using an LRSSize setting of count.

Specified by:
selectIdentifier in interface Select
Returns:
true if selected

selectIdentifier

public int selectIdentifier(Column[] cols)
Description copied from interface: Select
Select the given columns as ones that can be used to get a count of distinct matches. It is not necessary to designate distinct identifiers when eagerly traversing the entire result of the select or when not using an LRSSize setting of count.

Specified by:
selectIdentifier in interface Select
Returns:
bit set of indexes of columns that were selected

selectIdentifier

public int selectIdentifier(Column[] cols,
                            Joins joins)
Description copied from interface: Select
Select the given columns as ones that can be used to get a count of distinct matches. It is not necessary to designate distinct identifiers when eagerly traversing the entire result of the select or when not using an LRSSize setting of count.

Specified by:
selectIdentifier in interface Select
Returns:
bit set of indexes of columns that were selected

selectIdentifier

public void selectIdentifier(ClassMapping mapping,
                             int subclasses,
                             JDBCStore store,
                             JDBCFetchConfiguration fetch,
                             int eager)
Description copied from interface: Select
Select the columns of the given mapping, possibly including subclasses. This method should be called after all where conditions are added in case the given mapping batches other selects. The primary key columns of the mapping can be used to get a count of distinct matches. It is not necessary to designate distinct identifiers when eagerly traversing the entire result of the select or when not using an LRSSize setting of count.

Specified by:
selectIdentifier in interface Select

selectIdentifier

public void selectIdentifier(ClassMapping mapping,
                             int subclasses,
                             JDBCStore store,
                             JDBCFetchConfiguration fetch,
                             int eager,
                             Joins joins)
Description copied from interface: Select
Select the columns of the given mapping, possibly including subclasses. This method should be called after all where conditions are added in case the given mapping batches other selects. The primary key columns of the mapping can be used to get a count of distinct matches. It is not necessary to designate distinct identifiers when eagerly traversing the entire result of the select or when not using an LRSSize setting of count.

Specified by:
selectIdentifier in interface Select

selectPrimaryKey

public int selectPrimaryKey(ClassMapping mapping)
Description copied from interface: Select
Select the primary key columns of the given mapping, joining to superclasses as necessary to get all columns needed to construct an object id.

Specified by:
selectPrimaryKey in interface Select
Returns:
bit set of indexes of pk columns that were selected

selectPrimaryKey

public int selectPrimaryKey(ClassMapping mapping,
                            Joins joins)
Description copied from interface: Select
Select the primary key columns of the given mapping, joining to superclasses as necessary to get all columns needed to construct an object id.

Specified by:
selectPrimaryKey in interface Select
Returns:
bit set of indexes of pk columns that were selected

orderByPrimaryKey

public int orderByPrimaryKey(ClassMapping mapping,
                             boolean asc,
                             boolean sel)
Description copied from interface: Select
Order on the primary key columns of the given mapping, joining to superclasses as necessary to get all columns needed to construct an object id. Optionally selects ordering data if not already selected.

Specified by:
orderByPrimaryKey in interface Select

orderByPrimaryKey

public int orderByPrimaryKey(ClassMapping mapping,
                             boolean asc,
                             Joins joins,
                             boolean sel)
Description copied from interface: Select
Select and order on the primary key columns of the given mapping, joining to superclasses as necessary to get all columns needed to construct an object id. Optionally selects ordering data if not already selected.

Specified by:
orderByPrimaryKey in interface Select

orderByPrimaryKey

public int orderByPrimaryKey(ClassMapping mapping,
                             boolean asc,
                             Joins joins,
                             boolean sel,
                             boolean aliasOrder)
Allow unions to set aliases on order columns.


orderBy

public boolean orderBy(Column col,
                       boolean asc,
                       boolean sel)
Description copied from interface: Select
Order by the given column. Optionally selects ordering data if not already selected.

Specified by:
orderBy in interface Select

orderBy

public boolean orderBy(Column col,
                       boolean asc,
                       Joins joins,
                       boolean sel)
Description copied from interface: Select
Order by the given column. Optionally selects ordering data if not already selected.

Specified by:
orderBy in interface Select

orderBy

boolean orderBy(Column col,
                boolean asc,
                Joins joins,
                boolean sel,
                boolean aliasOrder)
Allow unions to set aliases on order columns.


orderBy

public int orderBy(Column[] cols,
                   boolean asc,
                   boolean sel)
Description copied from interface: Select
Order by the given columns. Optionally selects ordering data if not already selected.

Specified by:
orderBy in interface Select

orderBy

public int orderBy(Column[] cols,
                   boolean asc,
                   Joins joins,
                   boolean sel)
Description copied from interface: Select
Order by the given columns. Optionally selects ordering data if not already selected.

Specified by:
orderBy in interface Select

orderBy

int orderBy(Column[] cols,
            boolean asc,
            Joins joins,
            boolean sel,
            boolean aliasOrder)
Allow unions to set aliases on order columns.


orderBy

public boolean orderBy(SQLBuffer sql,
                       boolean asc,
                       boolean sel,
                       Value selAs)
Description copied from interface: Select
Add an ORDER BY clause. Optionally selects ordering data if not already selected.

Specified by:
orderBy in interface Select

orderBy

public boolean orderBy(SQLBuffer sql,
                       boolean asc,
                       Joins joins,
                       boolean sel,
                       Value selAs)
Description copied from interface: Select
Add an ORDER BY clause. Optionally selects ordering data if not already selected.

Specified by:
orderBy in interface Select

orderBy

boolean orderBy(SQLBuffer sql,
                boolean asc,
                Joins joins,
                boolean sel,
                boolean aliasOrder,
                Value selAs)
Allow unions to set aliases on order columns.


orderBy

public boolean orderBy(String sql,
                       boolean asc,
                       boolean sel)
Description copied from interface: Select
Add an ORDER BY clause. Optionally selects ordering data if not already selected.

Specified by:
orderBy in interface Select

orderBy

public boolean orderBy(String sql,
                       boolean asc,
                       Joins joins,
                       boolean sel)
Description copied from interface: Select
Add an ORDER BY clause. Optionally selects ordering data if not already selected.

Specified by:
orderBy in interface Select

orderBy

boolean orderBy(String sql,
                boolean asc,
                Joins joins,
                boolean sel,
                boolean aliasOrder)
Allow unions to set aliases on order columns.


clearOrdering

public void clearOrdering()
Description copied from interface: Select
Clear odering conditions.

Specified by:
clearOrdering in interface Select

setRecordOrderedIndexes

void setRecordOrderedIndexes(boolean record)
Allow unions to record the select list indexes of items we order by.


getOrderedIndexes

List getOrderedIndexes()
Return the indexes in the select list of all items we're ordering by, or null if none. For use with unions.


wherePrimaryKey

public void wherePrimaryKey(Object oid,
                            ClassMapping mapping,
                            JDBCStore store)
Description copied from interface: Select
Add where conditions setting the mapping's primary key to the given oid values. If the given mapping does not use oid values for its primary key, we will recursively join to its superclass until we find an ancestor that does.

Specified by:
wherePrimaryKey in interface Select

whereForeignKey

public void whereForeignKey(ForeignKey fk,
                            Object oid,
                            ClassMapping mapping,
                            JDBCStore store)
Description copied from interface: Select
Add where conditions setting the given foreign key to the given oid values.

Specified by:
whereForeignKey in interface Select
See Also:
Select.wherePrimaryKey(java.lang.Object, org.apache.openjpa.jdbc.meta.ClassMapping, org.apache.openjpa.jdbc.kernel.JDBCStore)

where

public void where(Joins joins)
Description copied from interface: Select
Add the given where conditions.

Specified by:
where in interface Select

where

public void where(SQLBuffer sql)
Description copied from interface: Select
Add the given where conditions.

Specified by:
where in interface Select

where

public void where(SQLBuffer sql,
                  Joins joins)
Description copied from interface: Select
Add the given where conditions.

Specified by:
where in interface Select

where

public void where(String sql)
Description copied from interface: Select
Add the given where conditions.

Specified by:
where in interface Select

where

public void where(String sql,
                  Joins joins)
Description copied from interface: Select
Add the given where conditions.

Specified by:
where in interface Select

having

public void having(SQLBuffer sql)
Description copied from interface: Select
Add the given having conditions.

Specified by:
having in interface Select

having

public void having(SQLBuffer sql,
                   Joins joins)
Description copied from interface: Select
Add the given having conditions.

Specified by:
having in interface Select

having

public void having(String sql)
Description copied from interface: Select
Add the given having conditions.

Specified by:
having in interface Select

having

public void having(String sql,
                   Joins joins)
Description copied from interface: Select
Add the given having conditions.

Specified by:
having in interface Select

groupBy

public void groupBy(SQLBuffer sql)
Description copied from interface: Select
Add a GROUP BY clause.

Specified by:
groupBy in interface Select

groupBy

public void groupBy(SQLBuffer sql,
                    Joins joins)
Description copied from interface: Select
Add a GROUP BY clause.

Specified by:
groupBy in interface Select

groupBy

public void groupBy(String sql)
Description copied from interface: Select
Add a GROUP BY clause.

Specified by:
groupBy in interface Select

groupBy

public void groupBy(String sql,
                    Joins joins)
Description copied from interface: Select
Add a GROUP BY clause.

Specified by:
groupBy in interface Select

groupBy

public void groupBy(Column col)
Description copied from interface: Select
Group by the given column.

Specified by:
groupBy in interface Select

groupBy

public void groupBy(Column col,
                    Joins joins)
Description copied from interface: Select
Group by the given column.

Specified by:
groupBy in interface Select

groupBy

public void groupBy(Column[] cols)
Description copied from interface: Select
Group by the given columns.

Specified by:
groupBy in interface Select

groupBy

public void groupBy(Column[] cols,
                    Joins joins)
Description copied from interface: Select
Group by the given columns.

Specified by:
groupBy in interface Select

groupBy

public void groupBy(ClassMapping mapping,
                    int subclasses,
                    JDBCStore store,
                    JDBCFetchConfiguration fetch)
Description copied from interface: Select
Group by the columns of the given mapping, possibly including subclasses. Assumes EAGER_NONE.

Specified by:
groupBy in interface Select

groupBy

public void groupBy(ClassMapping mapping,
                    int subclasses,
                    JDBCStore store,
                    JDBCFetchConfiguration fetch,
                    Joins joins)
Description copied from interface: Select
Group by the columns of the given mapping, possibly including subclasses. Assumes EAGER_NONE.

Specified by:
groupBy in interface Select

whereClone

public SelectExecutor whereClone(int sels)
Description copied from interface: Select
Return a SELECT with the same joins and where conditions as this one.

Specified by:
whereClone in interface Select
Parameters:
sels - number of selects to UNION together; ignored if <= 1

fullClone

public SelectExecutor fullClone(int sels)
Description copied from interface: Select
Return a SELECT that is a complete clone of this one.

Specified by:
fullClone in interface Select
Parameters:
sels - number of selects to UNION together; ignored if <= 1

eagerClone

public SelectExecutor eagerClone(FieldMapping key,
                                 int eagerType,
                                 boolean toMany,
                                 int sels)
Description copied from interface: Select
Return a select that will be eagerly executed with this one, or null if the select cannot be created for the given key and join type. If the join type is inner or outer, then this select instance will be returned. Otherwise, the returned select will have a clone of this select's where conditions and joins but will be independent.

Specified by:
eagerClone in interface Select
Parameters:
key - the key for the eager select
eagerType - one of the EAGER_* constants
toMany - whether the eager join is to-many
sels - number of selects to UNION together; ignored if <= 1

getEagerMap

public Map getEagerMap()
Return view of eager selects. May be null.


logEagerRelations

public void logEagerRelations()
Description copied from interface: Select
Extended trace that logs eager relations

Specified by:
logEagerRelations in interface Select

getEager

public SelectExecutor getEager(FieldMapping key)
Description copied from interface: Select
Return the eager select for the given key.

Specified by:
getEager in interface Select

newJoins

public Joins newJoins()
Description copied from interface: Select
Return a new instance to use for joining.

Specified by:
newJoins in interface Select

newOuterJoins

public Joins newOuterJoins()
Description copied from interface: Select
Return a new instance to use for outer joining.

Specified by:
newOuterJoins in interface Select

append

public void append(SQLBuffer buf,
                   Joins joins)
Description copied from interface: Select
Append the given joins to the given buffer.

Specified by:
append in interface Select

and

public Joins and(Joins joins1,
                 Joins joins2)
Description copied from interface: Select
AND the given joins together. The given joins will be hollowed in the process.

Specified by:
and in interface Select

getSelect

public Select getSelect()
Description copied from interface: PathJoins
The select owner of this join

Specified by:
getSelect in interface PathJoins
Returns:

or

public Joins or(Joins joins1,
                Joins joins2)
Description copied from interface: Select
OR the given joins together. The common joins will be removed in the process.

Specified by:
or in interface Select

outer

public Joins outer(Joins joins)
Description copied from interface: Select
Return a join set making the given joins outer joins.

Specified by:
outer in interface Select

toString

public String toString()
Description copied from interface: Select
Implement toString to generate SQL string for profiling/debuggging.

Specified by:
toString in interface Select
Overrides:
toString in class Object

isOuter

public boolean isOuter()
Description copied from interface: Joins
Whether this joins path results in outer joins.

Specified by:
isOuter in interface Joins

setOuter

public PathJoins setOuter(boolean outer)
Description copied from interface: PathJoins
Mark this as an outer joins set.

Specified by:
setOuter in interface PathJoins

isDirty

public boolean isDirty()
Description copied from interface: PathJoins
Return true if this instance has a path, any joins, or a variable.

Specified by:
isDirty in interface PathJoins

path

public StringBuilder path()
Description copied from interface: PathJoins
Return the relation path traversed by these joins, or null if none.

Specified by:
path in interface PathJoins

getPathStr

public String getPathStr()
Specified by:
getPathStr in interface PathJoins

joins

public JoinSet joins()
Description copied from interface: PathJoins
Return the set of Join elements, or null if none.

Specified by:
joins in interface PathJoins

joinCount

public int joinCount()
Description copied from interface: PathJoins
Return the maximum number of joins contained in this instance at any time.

Specified by:
joinCount in interface PathJoins

nullJoins

public void nullJoins()
Description copied from interface: PathJoins
Null the set of Join elements.

Specified by:
nullJoins in interface PathJoins

isEmpty

public boolean isEmpty()
Description copied from interface: Joins
Whether we have any joins.

Specified by:
isEmpty in interface Joins

crossJoin

public Joins crossJoin(Table localTable,
                       Table foreignTable)
Description copied from interface: Joins
Perform a cross join on the given tables.

Specified by:
crossJoin in interface Joins

join

public Joins join(ForeignKey fk,
                  boolean inverse,
                  boolean toMany)
Description copied from interface: Joins
Join the columns of the given foreign key.

Specified by:
join in interface Joins

outerJoin

public Joins outerJoin(ForeignKey fk,
                       boolean inverse,
                       boolean toMany)
Description copied from interface: Joins
Join the columns of the given foreign key.

Specified by:
outerJoin in interface Joins

joinRelation

public Joins joinRelation(String name,
                          ForeignKey fk,
                          ClassMapping target,
                          int subs,
                          boolean inverse,
                          boolean toMany)
Description copied from interface: Joins
Join the columns of the given foreign key, which represents a relation via the given field name.

Specified by:
joinRelation in interface Joins

outerJoinRelation

public Joins outerJoinRelation(String name,
                               ForeignKey fk,
                               ClassMapping target,
                               int subs,
                               boolean inverse,
                               boolean toMany)
Description copied from interface: Joins
Join the columns of the given foreign key, which represents a relation via the given field name.

Specified by:
outerJoinRelation in interface Joins

setVariable

public Joins setVariable(String var)
Description copied from interface: Joins
Set the variable name being traversed into with the next join.

Specified by:
setVariable in interface Joins

setSubselect

public Joins setSubselect(String alias)
Description copied from interface: Joins
Set the subquery alias.

Specified by:
setSubselect in interface Joins

clone

public SelectImpl clone(Context ctx)

newSelects

protected SelectImpl.Selects newSelects()

getDictionary

public DBDictionary getDictionary()
Specified by:
getDictionary in interface Select

setCorrelatedVariable

public Joins setCorrelatedVariable(String var)
Description copied from interface: Joins
Set the correlated variable name being traversed into with the next join.

Specified by:
setCorrelatedVariable in interface Joins

setJoinContext

public Joins setJoinContext(Context ctx)
Description copied from interface: Joins
Set subquery context when traversing into the next join is in transition from parent context to subquery.

Specified by:
setJoinContext in interface Joins

getCorrelatedVariable

public String getCorrelatedVariable()
Description copied from interface: Joins
Return correlated variable name

Specified by:
getCorrelatedVariable in interface Joins
Returns:

moveJoinsToParent

public void moveJoinsToParent()
Description copied from interface: Joins
Move joins that belong to subquery's parent

Specified by:
moveJoinsToParent in interface Joins


Copyright © 2006-2012 Apache Software Foundation. All Rights Reserved.