|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jpox.store.rdbms.RDBMSFetchStatement
Representation of a Fetch statement for RDBMS datastores.
Provides a simplification over QueryStatement which is totally general. Fetch statements only provide select of columns, (inner) joins to superclass tables, and (left outer) joins to related table columns.
Takes the traditional SQL form of "SELECT .... FROM ... WHERE ... " and can have an optional locking on the selected rows where required. Can operate using ANSI92 SQL JOIN syntax, or custom JOIN syntax where the DatabaseAdapter doesnt support ANSI (e.g Oracle 8).
Field Summary | |
protected java.lang.StringBuffer |
conditionList
Any WHERE conditions specified. |
protected java.util.Map |
innerTableMappings
Map of mappings to inner join to (from the id of the main table), keyed by the table alias |
protected static Localiser |
LOCALISER
Localiser of messages. |
protected DatastoreContainerObject |
mainTable
The primary table, which will have an alias of "THIS". |
protected java.util.Map |
outerTableMappings
Map of mappings to left outer join to (from the id of the main table), keyed by the table alias |
protected java.util.ArrayList |
selected
The selected columns. |
Constructor Summary | |
RDBMSFetchStatement(DatastoreContainerObject mainTable)
Constructor. |
Method Summary | |
void |
andCondition(java.lang.String condition)
Method to add an extra condition to the WHERE clause. |
java.lang.String |
referenceDatastoreField(DatastoreField col)
Method to specify a column to be referenced. |
int |
select(DatastoreField col)
Add a column to the SELECT clause. |
int |
select(java.lang.String expr)
Adds an expression to the SELECT clause. |
int[] |
selectOuterJoin(JavaTypeMapping refMapping,
JavaTypeMapping selectMapping,
JavaTypeMapping refTypeMapping)
Add column(s) to the SELECT clause using a LEFT OUTER JOIN to join to a related table. |
int[] |
selectOuterJoin(JavaTypeMapping refMapping,
JavaTypeMapping selectMapping,
JavaTypeMapping refDiscrimMapping,
java.lang.Object[] discrimValues)
Add column(s) to the SELECT clause using a LEFT OUTER JOIN to join to a related table. |
java.lang.String |
toString()
Method to return the statement assuming no locking of rows. |
java.lang.String |
toString(boolean lock)
Method to return the statement. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected static final Localiser LOCALISER
protected final DatastoreContainerObject mainTable
protected final java.util.ArrayList selected
protected java.lang.StringBuffer conditionList
protected final java.util.Map innerTableMappings
protected final java.util.Map outerTableMappings
Constructor Detail |
public RDBMSFetchStatement(DatastoreContainerObject mainTable)
mainTable
- The table to select fromMethod Detail |
public int[] selectOuterJoin(JavaTypeMapping refMapping, JavaTypeMapping selectMapping, JavaTypeMapping refDiscrimMapping, java.lang.Object[] discrimValues)
selectOuterJoin
in interface FetchStatement
refMapping
- The reference mapping in the other table that we join to our idselectMapping
- The mapping of the field in the referenced table to select in the fetchrefDiscrimMapping
- Mapping for discriminator in the related tablediscrimValues
- Possible values to accept for the discriminator in the related table
public int[] selectOuterJoin(JavaTypeMapping refMapping, JavaTypeMapping selectMapping, JavaTypeMapping refTypeMapping)
selectOuterJoin
in interface FetchStatement
refMapping
- The reference mapping in the other table that we join to our idselectMapping
- The mapping of the field to select in the fetchrefTypeMapping
- Mapping to the type of the referenced table (subclass table)
public int select(DatastoreField col)
select
in interface FetchStatement
col
- The column to add
public int select(java.lang.String expr)
select
in interface FetchStatement
expr
- the expr to add to the select clause
public java.lang.String referenceDatastoreField(DatastoreField col)
referenceDatastoreField
in interface FetchStatement
col
- The column
public void andCondition(java.lang.String condition)
andCondition
in interface FetchStatement
condition
- The conditionpublic java.lang.String toString()
toString
in interface FetchStatement
public java.lang.String toString(boolean lock)
toString
in interface FetchStatement
lock
- Whether to lock the rows found by this SELECT
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |