|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface QueryExpression
Defines the interface for a query expression. The query expression object is used to construct queries including parameters, conditions and joins, and generates the SQL statement for the underlying database.
A query experession object is created for each unique query, populated with the query parameters and the SQL statement is obtained from it at the proper time.
A query expression is generated from PersistenceFactory
,
see this interface for information on how to configure
it. The operators defined in this interface are part of
SQL 92 and the supported OQL syntax and are expected to
be supported by all query expressions.
Field Summary | |
---|---|
static java.lang.String |
OP_BETWEEN
Between operator. |
static java.lang.String |
OP_BETWEEN_AND
Between and operator. |
static java.lang.String |
OP_EQUALS
Equality operator. |
static java.lang.String |
OP_GREATER
Greater then operator. |
static java.lang.String |
OP_GREATER_EQUALS
Greater then or equals operator. |
static java.lang.String |
OP_LESS
Less then operator. |
static java.lang.String |
OP_LESS_EQUALS
Less then or equals operator. |
static java.lang.String |
OP_LIKE
Like operator. |
static java.lang.String |
OP_NOT_EQUALS
Inequality operator. |
static java.lang.String |
OP_NOT_LIKE
Not like operator. |
Method Summary | |
---|---|
void |
addColumn(java.lang.String tableName,
java.lang.String columnName)
Add a column used in the query. |
void |
addCondition(java.lang.String tableName,
java.lang.String columnName,
java.lang.String condOp,
java.lang.String value)
Add a condition. |
void |
addInnerJoin(java.lang.String leftTable,
java.lang.String[] leftColumn,
java.lang.String leftTableAlias,
java.lang.String rightTable,
java.lang.String[] rightColumn,
java.lang.String rightTableAlias)
Add an inner join with an aliases for the tables. |
void |
addLimitClause(java.lang.String limitClause)
Adds an limit clause. |
void |
addOffsetClause(java.lang.String offsetClause)
Adds an offset clause. |
void |
addOrderClause(java.lang.String orderClause)
Adds an order by clause. |
void |
addOuterJoin(java.lang.String leftTable,
java.lang.String[] leftColumn,
java.lang.String rightTable,
java.lang.String[] rightColumn,
java.lang.String rightTableAlias)
Add an outer join. |
void |
addParameter(java.lang.String tableName,
java.lang.String columnName,
java.lang.String condOp)
Add a query paramater. |
void |
addSelect(java.lang.String selectClause)
Add an entire select clause to the query with one call. |
void |
addTable(java.lang.String tableName,
java.lang.String tableAlias)
Add a table with an alias to the from clause. |
void |
addWhereClause(java.lang.String whereClause)
Adds a where clause. |
java.lang.Object |
clone()
Returns a clone of the query expression that can be further modified. |
java.lang.String |
encodeColumn(java.lang.String tableName,
java.lang.String columnName)
Encode a TableColumn for use in expressions. |
java.lang.String |
getStatement(boolean writeLock)
Return the query expression as an SQL statement. |
boolean |
isLimitClauseSupported()
Indicates whether a RDBMS supports LIMIT clauses. |
boolean |
isOffsetClauseSupported()
Indicates whether a RDBMS supports OFFSET clauses. |
void |
setDbMetaInfo(DbMetaInfo dbInfo)
Store database meta information. |
void |
setDistinct(boolean distinct)
Set the query to be distinct. |
Field Detail |
---|
static final java.lang.String OP_EQUALS
static final java.lang.String OP_NOT_EQUALS
static final java.lang.String OP_GREATER
static final java.lang.String OP_GREATER_EQUALS
static final java.lang.String OP_LESS
static final java.lang.String OP_LESS_EQUALS
static final java.lang.String OP_LIKE
static final java.lang.String OP_NOT_LIKE
static final java.lang.String OP_BETWEEN
static final java.lang.String OP_BETWEEN_AND
Method Detail |
---|
void addColumn(java.lang.String tableName, java.lang.String columnName)
tableName
- The table namecolumnName
- The column namevoid addSelect(java.lang.String selectClause)
selectClause
- The entire sql select clause without the word SELECTvoid setDistinct(boolean distinct)
distinct
- If the query should include DISTINCT in the SQL select.void addTable(java.lang.String tableName, java.lang.String tableAlias)
tableName
- The name of the table to add to the select clausetableAlias
- The name of the alias under which the where clauses will access itvoid addParameter(java.lang.String tableName, java.lang.String columnName, java.lang.String condOp)
tableName
- The table namecolumnName
- The column namecondOp
- The conditional operationvoid addCondition(java.lang.String tableName, java.lang.String columnName, java.lang.String condOp, java.lang.String value)
tableName
- The table namecolumnName
- The column namecondOp
- The conditional operationvalue
- The conditional valuejava.lang.String encodeColumn(java.lang.String tableName, java.lang.String columnName)
tableName
- The table name.columnName
- The column name.void addWhereClause(java.lang.String whereClause)
whereClause
- The WHERE clause to add (without the word WHERE).void addOrderClause(java.lang.String orderClause)
orderClause
- The ORDER BY clause to add (without the words ORDER BY).void addLimitClause(java.lang.String limitClause) throws SyntaxNotSupportedException
limitClause
- The LIMIT clause to add (without the word LIMIT).
SyntaxNotSupportedException
- If the LIMIT clause is not supported by the RDBMS.void addOffsetClause(java.lang.String offsetClause) throws SyntaxNotSupportedException
offsetClause
- The OFFSET clause to add (without the word OFFSET).
SyntaxNotSupportedException
- If the OFFSET clause is not supported by the RDBMS.void addInnerJoin(java.lang.String leftTable, java.lang.String[] leftColumn, java.lang.String leftTableAlias, java.lang.String rightTable, java.lang.String[] rightColumn, java.lang.String rightTableAlias)
leftTable
- The table name on the left sideleftColumn
- The column names on the left sideleftTableAlias
- The alias name to use for the table on the left siderightTable
- The table name on the right siderightColumn
- The column names on the right siderightTableAlias
- The alias name to use for the table on the right sidevoid addOuterJoin(java.lang.String leftTable, java.lang.String[] leftColumn, java.lang.String rightTable, java.lang.String[] rightColumn, java.lang.String rightTableAlias)
leftTable
- The table name on the left sideleftColumn
- The column name on the left siderightTable
- The table name on the right siderightColumn
- The column name on the right siderightTableAlias
- The alias name to use for the table on the right sidejava.lang.String getStatement(boolean writeLock) throws QueryException
writeLock
- True if a write lock is required
QueryException
- The query cannot be constructed for
this enginejava.lang.Object clone()
boolean isLimitClauseSupported()
boolean isOffsetClauseSupported()
void setDbMetaInfo(DbMetaInfo dbInfo)
dbInfo
- DbMetaInfo instance
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |