|
SolarMetric Kodo JDO 3.3.5 generated on August 31 2005 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--kodo.jdbc.sql.Select
Abstraction of a SQL SELECT statement. Usage note: though this class
implements Joins
, it should not be used for joining directly.
Instead, use the return value of newJoins()
.
Field Summary | |
static int |
EAGER_INNER
Constant indicating to batch the select using an inner join. |
static int |
EAGER_OUTER
Constant indicating to batch the select using an outer join. |
static int |
EAGER_PARALLEL
Constant indicating to use a separate select executed in parallel. |
static String |
FROM_SELECT_ALIAS
The alias to use for the from select, if any. |
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. |
static int |
TYPE_JOINLESS
Constant indicating a select can be made without joins. |
static int |
TYPE_TWO_PART
Constant indicating a two-part select and load. |
Constructor Summary | |
Select(JDBCConfiguration conf)
Constructor. |
Method Summary | |
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. |
Joins |
crossJoin(Table localTable,
Table foreignTable)
Perform a cross join on the given tables. |
Select |
eagerClone(Object key,
int eagerType,
boolean toMany)
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(JDBCStoreManager store,
JDBCFetchConfiguration fetch)
Execute this select in the context of the given store manager. |
Result |
execute(JDBCStoreManager store,
JDBCFetchConfiguration fetch,
int lockLevel)
Execute this select in the context of the given store manager. |
Select |
fullClone()
Return a SELECT that is a complete clone of this one. |
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(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 configuration supplied on construction. |
Select |
getEager(Object key)
Return the eager select for the given key, or null if none. |
long |
getEndIndex()
The result end index. |
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. |
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. |
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 Join . |
SQLBuffer |
getOrdering()
Return the ordering SQL for this select. |
Select |
getParent()
Return the parent of this select, if it is a subselect. |
List |
getSelectAliases()
Return the aliases of all selected columns and all selected buffers, in the order they were selected. |
long |
getStartIndex()
The result start index. |
String |
getSubselectPath()
Return the subselect path for this select, if it is a subselect. |
Collection |
getTableAliases()
Return the set of all used table aliases. |
SQLBuffer |
getWhere()
Return the WHERE clause, minus any necessary end joins. |
void |
groupBy(Column col)
Add a GROUP BY clause. |
void |
groupBy(Column[] cols)
Add a GROUP BY clause. |
void |
groupBy(Column[] cols,
Joins joins)
Add a GROUP BY clause. |
void |
groupBy(Column col,
Joins joins)
Add a GROUP BY clause. |
void |
groupBy(SQLBuffer sql)
Add a GROUP BY clause. |
void |
groupBy(SQLBuffer 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. |
void |
having(SQLBuffer sql)
Add the given having conditions. |
void |
having(SQLBuffer sql,
Joins joins)
Add the given having conditions. |
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()
Return true if this is a SELECT DISTINCT. |
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()
Return whether this join set ended with an outer join. |
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,
boolean inverse,
boolean toMany)
Join the columns of the given foreign key, which represents a relation via the given field name. |
kodo.jdbc.sql.JoinSet |
joins()
Return the set of Join elements, or null if none. |
Joins |
newJoins()
Return a new instance to use for joining. |
void |
nullJoins()
Null the set of Join elements. |
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. |
void |
orderBy(SQLBuffer sql,
boolean ascending)
Add an ORDER BY clause. |
void |
orderBy(SQLBuffer sql,
boolean ascending,
Joins joins)
Add an ORDER BY clause. |
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,
boolean inverse,
boolean toMany)
Join the columns of the given foreign key, which represents a relation via the given field name. |
StringBuffer |
path()
Return the relation path traversed by these joins, or null if none. |
void |
select(ClassMapping mapping,
int subclasses,
JDBCStoreManager store,
JDBCFetchConfiguration fetch,
int eager)
Select the columns of the given mapping, possibly including subclasses. |
void |
select(ClassMapping mapping,
int subclasses,
JDBCStoreManager store,
JDBCFetchConfiguration fetch,
int eager,
Joins joins)
Select the columns of the given mapping, 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. |
void |
select(Column col,
Joins joins)
Select the given column. |
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 |
selectIdentifier(ClassMapping mapping,
int subclasses,
JDBCStoreManager store,
JDBCFetchConfiguration fetch,
int eager)
Select the columns of the given mapping, possibly including subclasses. |
void |
selectIdentifier(ClassMapping mapping,
int subclasses,
JDBCStoreManager store,
JDBCFetchConfiguration fetch,
int eager,
Joins joins)
Select the columns of the given mapping, possibly including subclasses. |
void |
selectIdentifier(Column col)
Select the given column as one that can be used to get a count of distinct matches. |
void |
selectIdentifier(Column[] cols)
Select the given columns as ones that can be used to get a count of distinct matches. |
void |
selectIdentifier(Column[] cols,
Joins joins)
Select the given columns as ones that can be used to get a count of distinct matches. |
void |
selectIdentifier(Column col,
Joins joins)
Select the given column as one that can be used to get a count of distinct matches. |
void |
selectPrimaryKey(ClassMapping mapping,
boolean order)
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 |
selectPrimaryKey(ClassMapping mapping,
boolean order,
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 |
setDistinct(boolean distinct)
Override the default DISTINCT setting of this select. |
void |
setFromSelect(Select sel)
Another select instance that creates a temporary table from which this select pulls data. |
void |
setJoinSyntax(int joinSyntax)
The join syntax for this select, as one of the syntax constants from Join . |
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. |
void |
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. |
Joins |
setSubselect(String alias)
Set the subquery alias. |
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. |
SQLBuffer |
toSelect(boolean forUpdate)
Return this select as a SQL statement formatted for the given dictionary. |
SQLBuffer |
toSelectCount()
Return this select as a COUNT SQL statement formatted for the given 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. |
Select |
whereClone()
Return a SELECT with the same joins and where conditions as this one. |
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int EAGER_INNER
public static final int EAGER_OUTER
public static final int EAGER_PARALLEL
public static final int TYPE_JOINLESS
public static final int TYPE_TWO_PART
public static final int SUBS_TRUE
public static final int SUBS_FALSE
public static final int SUBS_ANY
public static final int SUBS_EXACT
public static final String FROM_SELECT_ALIAS
Constructor Detail |
public Select(JDBCConfiguration conf)
Method Detail |
public JDBCConfiguration getConfiguration()
public SQLBuffer toSelect(boolean forUpdate)
public SQLBuffer toSelectCount()
public Select getFromSelect()
public void setFromSelect(Select sel)
public boolean isDistinct()
public void setDistinct(boolean distinct)
public boolean hasEagerJoin(boolean toMany)
public boolean hasJoin(boolean toMany)
public boolean isLRS()
public void setLRS(boolean lrs)
public boolean isSelected(Table table)
public Collection getTableAliases()
public List getSelectAliases()
SQLBuffer
.public List getIdentifierAliases()
public SQLBuffer getOrdering()
public SQLBuffer getGrouping()
public SQLBuffer getWhere()
public SQLBuffer getHaving()
public Joins getJoins()
public Iterator getJoinIterator()
Join
elements for this select.public int getJoinSyntax()
Join
.public void setJoinSyntax(int joinSyntax)
Join
.public long getStartIndex()
public long getEndIndex()
public void setRange(long start, long end)
public boolean supportsRandomAccess(boolean forUpdate)
public boolean supportsLocking()
public String getColumnAlias(Column col)
public String getColumnAlias(Column col, Joins joins)
public String getColumnAlias(String col, Table table)
public String getColumnAlias(String col, Table table, Joins joins)
public boolean isAggregate()
public void setAggregate(boolean agg)
public boolean isLob()
public void setLob(boolean lob)
public void select(SQLBuffer buf, Object id)
Result
.public void select(SQLBuffer buf, Object id, Joins joins)
Result
.public void select(Column col)
public void selectIdentifier(Column col)
count
.public void select(Column col, Joins joins)
public void selectIdentifier(Column col, Joins joins)
count
.public void select(Column[] cols)
public void selectIdentifier(Column[] cols)
count
.public void select(Column[] cols, Joins joins)
public void selectIdentifier(Column[] cols, Joins joins)
count
.public void select(ClassMapping mapping, int subclasses, JDBCStoreManager store, JDBCFetchConfiguration fetch, int eager)
public void selectIdentifier(ClassMapping mapping, int subclasses, JDBCStoreManager store, JDBCFetchConfiguration fetch, int eager)
count
.public void select(ClassMapping mapping, int subclasses, JDBCStoreManager store, JDBCFetchConfiguration fetch, int eager, Joins joins)
public void selectIdentifier(ClassMapping mapping, int subclasses, JDBCStoreManager store, JDBCFetchConfiguration fetch, int eager, Joins joins)
count
.public void selectPrimaryKey(ClassMapping mapping, boolean order)
public void selectPrimaryKey(ClassMapping mapping, boolean order, Joins joins)
public void wherePrimaryKey(Object oid, ClassMapping mapping)
public void wherePrimaryKey(Object oid, ClassMapping mapping, Joins joins)
public void whereForeignKey(ForeignKey fk, Object oid, ClassMapping mapping)
wherePrimaryKey(java.lang.Object, kodo.jdbc.meta.ClassMapping)
public void whereForeignKey(ForeignKey fk, Object oid, ClassMapping mapping, Joins joins)
wherePrimaryKey(java.lang.Object, kodo.jdbc.meta.ClassMapping)
public void where(Joins joins)
public void where(SQLBuffer sql)
public void where(SQLBuffer sql, Joins joins)
public void having(SQLBuffer sql)
public void having(SQLBuffer sql, Joins joins)
public void orderBy(SQLBuffer sql, boolean ascending)
public void orderBy(SQLBuffer sql, boolean ascending, Joins joins)
public void orderBy(Column col, boolean ascending)
public void orderBy(Column col, boolean ascending, Joins joins)
public void orderBy(Column[] cols, boolean ascending)
public void orderBy(Column[] cols, boolean ascending, Joins joins)
public void groupBy(SQLBuffer sql)
public void groupBy(SQLBuffer sql, Joins joins)
public void groupBy(Column col)
public void groupBy(Column col, Joins joins)
public void groupBy(Column[] cols)
public void groupBy(Column[] cols, Joins joins)
public Select getParent()
public String getSubselectPath()
public void setParent(Select parent, String path)
public Select whereClone()
public Select fullClone()
public Select getEager(Object key)
public Select eagerClone(Object key, int eagerType, boolean toMany)
key
- the key for the eager selecteagerType
- one of the EAGER_* constantstoMany
- whether the eager join is to-manypublic Result execute(JDBCStoreManager store, JDBCFetchConfiguration fetch) throws SQLException
public Result execute(JDBCStoreManager store, JDBCFetchConfiguration fetch, int lockLevel) throws SQLException
public Joins newJoins()
public void append(SQLBuffer buf, Joins joins)
public Joins and(Joins joins1, Joins joins2)
public Joins or(Joins joins1, Joins joins2)
public Joins outer(Joins joins)
public String toString()
toString
in class Object
public boolean isOuter()
kodo.jdbc.sql.PathJoins
isOuter
in interface kodo.jdbc.sql.PathJoins
public void setOuter(boolean outer)
kodo.jdbc.sql.PathJoins
setOuter
in interface kodo.jdbc.sql.PathJoins
public boolean isDirty()
kodo.jdbc.sql.PathJoins
isDirty
in interface kodo.jdbc.sql.PathJoins
public StringBuffer path()
kodo.jdbc.sql.PathJoins
path
in interface kodo.jdbc.sql.PathJoins
public kodo.jdbc.sql.JoinSet joins()
kodo.jdbc.sql.PathJoins
Join
elements, or null if none.joins
in interface kodo.jdbc.sql.PathJoins
public int joinCount()
kodo.jdbc.sql.PathJoins
joinCount
in interface kodo.jdbc.sql.PathJoins
public void nullJoins()
kodo.jdbc.sql.PathJoins
Join
elements.nullJoins
in interface kodo.jdbc.sql.PathJoins
public boolean isEmpty()
Joins
isEmpty
in interface Joins
public Joins crossJoin(Table localTable, Table foreignTable)
Joins
crossJoin
in interface Joins
public Joins join(ForeignKey fk, boolean inverse, boolean toMany)
Joins
join
in interface Joins
public Joins outerJoin(ForeignKey fk, boolean inverse, boolean toMany)
Joins
outerJoin
in interface Joins
public Joins joinRelation(String name, ForeignKey fk, boolean inverse, boolean toMany)
Joins
joinRelation
in interface Joins
public Joins outerJoinRelation(String name, ForeignKey fk, boolean inverse, boolean toMany)
Joins
outerJoinRelation
in interface Joins
public Joins setVariable(String var)
Joins
setVariable
in interface Joins
public Joins setSubselect(String alias)
Joins
setSubselect
in interface Joins
|
SolarMetric Kodo JDO 3.3.5 generated on August 31 2005 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |