SolarMetric Kodo JDO 3.0.3 generated on February 20 2004

kodo.jdbc.sql
Interface Select


public interface Select

Abstraction of a SQL SELECT statement.


Field Summary
static int BATCH_INNER
          Constant indicating to batch the select using an inner join.
static int BATCH_OUTER
          Constant indicating to batch the select using an outer join.
static int BATCH_SELECT
          Constant indicating to batch the select using a separate select.
static int SUBS_ANY
          Constant indicating to select subclasses but without adding any class conditions to the select.
static int SUBS_EXACT
          Constant indicating to select this class but without adding any class conditions to the select.
static int SUBS_FALSE
          Constant indicating to add conditions to the select to select this class only.
static int SUBS_TRUE
          Constant indicating to add conditions to the selcet to select this class and subclasses only.
 
Method Summary
 void addBatchedType(ClassMapping type)
          Record that this select is for vrow columns of the given type.
 void addJoins(SQLBuffer buf, Joins joins)
          Add SQL for the given joins to the given buffer.
 Joins and(Joins joins1, Joins joins2)
          AND the given joins together.
 Select batchSelect(Object key, ClassMapping mapping, int batchType)
          Return SELECT that will be batched with this one, or null if the select cannot be batched for the given mapping and join type.
 void clearSelects()
          Clears any selected columns or aggregates.
 Collection getBatchedKeys()
          Return the set of batched select keys.
 Select getBatchedSelect(Object key)
          Return the batched select for the given key, or null if none.
 Joins getJoins()
          Return the joins on this select.
 int getJoinSyntax()
          The join syntax for this select, as one of the syntax constants from Join.
 List getOrderings()
          Return a collection of orderings on this statement.
 int getResultSetConcurrency()
          The result set concurrency, such as ResultSet.CONCUR_READ_ONLY, or -1 for the default.
 int getResultSetType()
          The result set type, such as ResultSet.TYPE_FORWARD_ONLY, or -1 for the default.
 List getSelectAliases()
          Return the aliases of all selected columns and all selected buffers, in the order they were selected.
 Collection getSelectedTableAliases()
          Return the set of selected table aliases.
 Collection getSelectedTables()
          Return the set of selected tables.
 List getSelects()
          Return all selected columns and buffer ids, in the order they were selected.
 SQLBuffer getWhere()
          Return the WHERE clause, minus any necessary end joins.
 boolean isDistinct()
          Return true if this is a SELECT DISTINCT.
 boolean isForUpdate()
          Return true if this is a FOR UPDATE select.
 boolean isSelectCount()
          Return true if this is a SELECT COUNT.
 Select joinsSelect()
          Return a SELECT with the same aliases as this one.
 Joins newJoins()
          Return a new instance to use for joining.
 Joins or(Joins joins1, Joins joins2)
          OR the given joins together.
 void orderBy(Column[] cols, boolean ascending)
          Add an ORDER BY clause.
 void orderBy(Column[] cols, boolean ascending, Joins joins)
          Add an ORDER BY clause.
 void orderBy(Column col, boolean ascending)
          Add an ORDER BY clause.
 void orderBy(Column col, boolean ascending, Joins joins)
          Add an ORDER BY clause.
 Joins orderBy(Joins joins1, Joins joins2)
          Combine the given joins.
 void orderBy(SQLBuffer sql, boolean ascending)
          Add an ORDER BY clause.
 void orderBy(SQLBuffer sql, boolean ascending, Joins joins)
          Add an ORDER BY clause.
 String reserveTableAlias(Table table)
          Reserve the next alias for the given table.
 void select(ClassMapping mapping, int subclasses, JDBCFetchConfiguration fetch, int batch)
          Select the columns of the given mapping, possibly including subclasses.
 void select(ClassMapping mapping, int subclasses, JDBCFetchConfiguration fetch, int batch, Joins joins)
          Select the columns of the given mapping aftering joining to it, possibly including subclasses.
 void select(Column col)
          Select the given column.
 void select(Column[] cols)
          Select the given columns.
 void select(Column[] cols, Joins joins)
          Select the given columns after making the given joins.
 void select(Column col, Joins joins)
          Select the given column after making the given joins.
 void select(SQLBuffer buf, Object id)
          Select the given buffer; the given id object is an identifier to use when retrieving the corresponding value from a Result.
 void select(SQLBuffer buf, Object id, Joins joins)
          Select the given buffer; the given id object is an identifier to use when retrieving the corresponding value from a Result.
 void 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.
 void setForUpdate(boolean forUpdate)
          Whether this is a FOR UPDATE select.
 void setJoinSyntax(int joinSyntax)
          The join syntax for this select, as one of the syntax constants from Join.
 void setResultSetConcurrency(int concur)
          The result set concurrency, such as ResultSet.CONCUR_READ_ONLY, or -1 for the default.
 void setResultSetType(int type)
          The result set type, such as ResultSet.TYPE_FORWARD_ONLY, or -1 for the default.
 void setSelectCount(boolean count)
          Select 'COUNT(*)'; the count overrides all other selects.
 Select subSelect(Joins parentJoins)
          Return a subselect of this one.
 SQLBuffer toSelect()
          Return this select as a SQL statement formatted for the given dictionary.
 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 whereForeignKey(ForeignKey fk, Object oid, ClassMapping mapping)
          Add where conditions setting the given foreign key to the given oid values.
 void whereForeignKey(ForeignKey fk, Object oid, ClassMapping mapping, Joins joins)
          Add where conditions setting the given foreign key to the given oid values.
 void wherePrimaryKey(Object oid, ClassMapping mapping)
          Add where conditions setting the mapping's primary key to the given oid values.
 void wherePrimaryKey(Object oid, ClassMapping mapping, Joins joins)
          Add where conditions setting the mapping's primary key to the given oid values.
 

Field Detail

BATCH_INNER

public static final int BATCH_INNER
Constant indicating to batch the select using an inner join.

BATCH_OUTER

public static final int BATCH_OUTER
Constant indicating to batch the select using an outer join.

BATCH_SELECT

public static final int BATCH_SELECT
Constant indicating to batch the select using a separate select.

SUBS_TRUE

public static final int SUBS_TRUE
Constant indicating to add conditions to the selcet to select this class and subclasses only.

SUBS_FALSE

public static final int SUBS_FALSE
Constant indicating to add conditions to the select to select this class only.

SUBS_ANY

public static final int SUBS_ANY
Constant indicating to select subclasses but without adding any class conditions to the select.

SUBS_EXACT

public static final int SUBS_EXACT
Constant indicating to select this class but without adding any class conditions to the select.
Method Detail

toSelect

public SQLBuffer toSelect()
Return this select as a SQL statement formatted for the given dictionary.

isDistinct

public boolean isDistinct()
Return true if this is a SELECT DISTINCT.

isForUpdate

public boolean isForUpdate()
Return true if this is a FOR UPDATE select.

setForUpdate

public void setForUpdate(boolean forUpdate)
Whether this is a FOR UPDATE select.

getSelectedTables

public Collection getSelectedTables()
Return the set of selected tables.

getSelectedTableAliases

public Collection getSelectedTableAliases()
Return the set of selected table aliases.

getSelects

public List getSelects()
Return all selected columns and buffer ids, in the order they were selected.

getSelectAliases

public List getSelectAliases()
Return the aliases of all selected columns and all selected buffers, in the order they were selected.

getOrderings

public List getOrderings()
Return a collection of orderings on this statement. Orderings always come in pairs: a SQLBuffer for the ordering criteria, and then a string for the order - "ASC" or "DESC".

getWhere

public SQLBuffer getWhere()
Return the WHERE clause, minus any necessary end joins.

getJoins

public Joins getJoins()
Return the joins on this select.

getResultSetType

public int getResultSetType()
The result set type, such as ResultSet.TYPE_FORWARD_ONLY, or -1 for the default.

setResultSetType

public void setResultSetType(int type)
The result set type, such as ResultSet.TYPE_FORWARD_ONLY, or -1 for the default.

getResultSetConcurrency

public int getResultSetConcurrency()
The result set concurrency, such as ResultSet.CONCUR_READ_ONLY, or -1 for the default.

setResultSetConcurrency

public void setResultSetConcurrency(int concur)
The result set concurrency, such as ResultSet.CONCUR_READ_ONLY, or -1 for the default.

getJoinSyntax

public int getJoinSyntax()
The join syntax for this select, as one of the syntax constants from Join.

setJoinSyntax

public void setJoinSyntax(int joinSyntax)
The join syntax for this select, as one of the syntax constants from Join.

reserveTableAlias

public String reserveTableAlias(Table table)
Reserve the next alias for the given table. The table is not added to the table list, but the returned alias is reserved for it should any column of the table be selected later.

isSelectCount

public boolean isSelectCount()
Return true if this is a SELECT COUNT.

setSelectCount

public void setSelectCount(boolean count)
Select 'COUNT(*)'; the count overrides all other selects.

select

public void select(SQLBuffer buf,
                   Object id)
Select the given buffer; the given id object is an identifier to use when retrieving the corresponding value from a Result.

select

public void select(SQLBuffer buf,
                   Object id,
                   Joins joins)
Select the given buffer; the given id object is an identifier to use when retrieving the corresponding value from a Result.

select

public void select(Column col)
Select the given column.

select

public void select(Column col,
                   Joins joins)
Select the given column after making the given joins.

select

public void select(Column[] cols)
Select the given columns.

select

public void select(Column[] cols,
                   Joins joins)
Select the given columns after making the given joins.

select

public void select(ClassMapping mapping,
                   int subclasses,
                   JDBCFetchConfiguration fetch,
                   int batch)
Select the columns of the given mapping, possibly including subclasses. Specifying whether this select is expected to return multiple results helps some mappings optimize their behavior. This method should be called after all where conditions are added in case the given mapping batches other selects.

select

public void select(ClassMapping mapping,
                   int subclasses,
                   JDBCFetchConfiguration fetch,
                   int batch,
                   Joins joins)
Select the columns of the given mapping aftering joining to it, possibly including subclasses. This method should be called after all where conditions are added in case the given mapping batches other selects.

clearSelects

public void clearSelects()
Clears any selected columns or aggregates. Does not modify WHERE clauses etc.

selectPrimaryKey

public void 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.

where

public void where(Joins joins)
Add the given where conditions.

where

public void where(SQLBuffer sql)
Add the given where conditions.

where

public void where(SQLBuffer sql,
                  Joins joins)
Add the given where conditions.

wherePrimaryKey

public void wherePrimaryKey(Object oid,
                            ClassMapping mapping)
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.

wherePrimaryKey

public void wherePrimaryKey(Object oid,
                            ClassMapping mapping,
                            Joins joins)
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.

whereForeignKey

public void whereForeignKey(ForeignKey fk,
                            Object oid,
                            ClassMapping mapping)
Add where conditions setting the given foreign key to the given oid values.
See Also:
wherePrimaryKey(java.lang.Object, kodo.jdbc.meta.ClassMapping)

whereForeignKey

public void whereForeignKey(ForeignKey fk,
                            Object oid,
                            ClassMapping mapping,
                            Joins joins)
Add where conditions setting the given foreign key to the given oid values.
See Also:
wherePrimaryKey(java.lang.Object, kodo.jdbc.meta.ClassMapping)

orderBy

public void orderBy(SQLBuffer sql,
                    boolean ascending)
Add an ORDER BY clause.

orderBy

public void orderBy(SQLBuffer sql,
                    boolean ascending,
                    Joins joins)
Add an ORDER BY clause.

orderBy

public void orderBy(Column col,
                    boolean ascending)
Add an ORDER BY clause.

orderBy

public void orderBy(Column col,
                    boolean ascending,
                    Joins joins)
Add an ORDER BY clause.

orderBy

public void orderBy(Column[] cols,
                    boolean ascending)
Add an ORDER BY clause.

orderBy

public void orderBy(Column[] cols,
                    boolean ascending,
                    Joins joins)
Add an ORDER BY clause.

joinsSelect

public Select joinsSelect()
Return a SELECT with the same aliases as this one.

subSelect

public Select subSelect(Joins parentJoins)
Return a subselect of this one.

getBatchedSelect

public Select getBatchedSelect(Object key)
Return the batched select for the given key, or null if none.

getBatchedKeys

public Collection getBatchedKeys()
Return the set of batched select keys.

batchSelect

public Select batchSelect(Object key,
                          ClassMapping mapping,
                          int batchType)
Return SELECT that will be batched with this one, or null if the select cannot be batched for the given mapping 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.
Parameters:
key - the key for the batched select
mapping - the type the select is batching
batchType - BATCH_INNER, BATCH_OUTER, or BATCH_SELECT

addBatchedType

public void addBatchedType(ClassMapping type)
Record that this select is for vrow columns of the given type.

newJoins

public Joins newJoins()
Return a new instance to use for joining.

addJoins

public void addJoins(SQLBuffer buf,
                     Joins joins)
Add SQL for the given joins to the given buffer.

and

public Joins and(Joins joins1,
                 Joins joins2)
AND the given joins together. The given joins will be hollowed in the process.

or

public Joins or(Joins joins1,
                Joins joins2)
OR the given joins together. The common joins will be removed in the process.

orderBy

public Joins orderBy(Joins joins1,
                     Joins joins2)
Combine the given joins.
Parameters:
joins1 - joins from the main expression
joins2 - joins from the ordering value

SolarMetric Kodo JDO 3.0.3 generated on February 20 2004

Copyright 2001,2002 SolarMetric, Inc. All Rights Reserved.