QueryExpression
DB2QueryExpression
, DerbyQueryExpression
, HsqlQueryExpression
, InformixQueryExpression
, InstantDBQueryExpression
, InterbaseQueryExpression
, MySQLQueryExpression
, OracleQueryExpression
, PointbaseQueryExpression
, PostgreSQLQueryExpression
, ProgressQueryExpression
, SapDbQueryExpression
, SQLServerQueryExpression
, SybaseQueryExpression
public class JDBCQueryExpression extends java.lang.Object implements QueryExpression
Modifier and Type | Class | Description |
---|---|---|
(package private) static class |
JDBCQueryExpression.Join |
Modifier and Type | Field | Description |
---|---|---|
protected DbMetaInfo |
_dbInfo |
MetaInfo as acquired from the RDBMS.
|
protected boolean |
_distinct |
|
protected PersistenceFactory |
_factory |
|
protected java.util.Vector<JDBCQueryExpression.Join> |
_joins |
|
protected java.lang.String |
_limit |
|
protected java.lang.String |
_offset |
|
protected java.lang.String |
_order |
|
protected java.lang.String |
_select |
|
protected java.util.Hashtable<java.lang.String,java.lang.String> |
_tables |
OP_BETWEEN, OP_BETWEEN_AND, OP_EQUALS, OP_GREATER, OP_GREATER_EQUALS, OP_LESS, OP_LESS_EQUALS, OP_LIKE, OP_NOT_EQUALS, OP_NOT_LIKE
Constructor | Description |
---|---|
JDBCQueryExpression(PersistenceFactory factory) |
Modifier and Type | Method | Description |
---|---|---|
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 limit) |
Adds an limit clause.
|
void |
addOffsetClause(java.lang.String offset) |
Adds an offset clause.
|
void |
addOrderClause(java.lang.String order) |
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 where) |
Adds a where clause.
|
protected boolean |
addWhereClause(java.lang.StringBuffer sql,
boolean first) |
|
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.
|
protected java.lang.String |
getColumnList() |
|
protected java.lang.StringBuffer |
getStandardStatement(boolean lock,
boolean oj) |
Helper method.
|
java.lang.String |
getStatement(boolean lock) |
Creates a SQL statement.
|
boolean |
isLimitClauseSupported() |
Provides a default implementation of
QueryExpression.isLimitClauseSupported() . |
boolean |
isOffsetClauseSupported() |
Provides a default implementation of
QueryExpression.isOffsetClauseSupported() . |
void |
setDbMetaInfo(DbMetaInfo dbInfo) |
Store database meta information.
|
void |
setDistinct(boolean distinct) |
Set the query to be distinct.
|
java.lang.String |
toString() |
protected java.util.Hashtable<java.lang.String,java.lang.String> _tables
protected java.util.Vector<JDBCQueryExpression.Join> _joins
protected java.lang.String _select
protected java.lang.String _order
protected java.lang.String _limit
protected java.lang.String _offset
protected boolean _distinct
protected PersistenceFactory _factory
protected DbMetaInfo _dbInfo
public JDBCQueryExpression(PersistenceFactory factory)
public final void setDbMetaInfo(DbMetaInfo dbInfo)
setDbMetaInfo
in interface QueryExpression
dbInfo
- DbMetaInfo instance.public final void setDistinct(boolean distinct)
QueryExpression
setDistinct
in interface QueryExpression
distinct
- If the query should include DISTINCT in the SQL select.public final void addColumn(java.lang.String tableName, java.lang.String columnName)
QueryExpression
addColumn
in interface QueryExpression
tableName
- The table namecolumnName
- The column namepublic final void addTable(java.lang.String tableName, java.lang.String tableAlias)
QueryExpression
addTable
in interface QueryExpression
tableName
- The name of the table to add to the select clausetableAlias
- The name of the alias under which the where clauses will access itpublic final void addParameter(java.lang.String tableName, java.lang.String columnName, java.lang.String condOp)
QueryExpression
addParameter
in interface QueryExpression
tableName
- The table namecolumnName
- The column namecondOp
- The conditional operationpublic final void addCondition(java.lang.String tableName, java.lang.String columnName, java.lang.String condOp, java.lang.String value)
QueryExpression
addCondition
in interface QueryExpression
tableName
- The table namecolumnName
- The column namecondOp
- The conditional operationvalue
- The conditional valuepublic final java.lang.String encodeColumn(java.lang.String tableName, java.lang.String columnName)
QueryExpression
encodeColumn
in interface QueryExpression
tableName
- The table name.columnName
- The column name.public final 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)
QueryExpression
addInnerJoin
in interface QueryExpression
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 sidepublic final void addOuterJoin(java.lang.String leftTable, java.lang.String[] leftColumn, java.lang.String rightTable, java.lang.String[] rightColumn, java.lang.String rightTableAlias)
QueryExpression
addOuterJoin
in interface QueryExpression
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 sidepublic final void addSelect(java.lang.String selectClause)
QueryExpression
addSelect
in interface QueryExpression
selectClause
- The entire sql select clause without the word SELECTpublic final void addWhereClause(java.lang.String where)
QueryExpression
addWhereClause
in interface QueryExpression
where
- The WHERE clause to add (without the word WHERE).public final void addOrderClause(java.lang.String order)
QueryExpression
addOrderClause
in interface QueryExpression
order
- The ORDER BY clause to add (without the words ORDER BY).public final void addLimitClause(java.lang.String limit) throws SyntaxNotSupportedException
QueryExpression
addLimitClause
in interface QueryExpression
limit
- The LIMIT clause to add (without the word LIMIT).SyntaxNotSupportedException
- If the LIMIT clause is not supported by the RDBMS.public final void addOffsetClause(java.lang.String offset) throws SyntaxNotSupportedException
QueryExpression
addOffsetClause
in interface QueryExpression
offset
- The OFFSET clause to add (without the word OFFSET).SyntaxNotSupportedException
- If the OFFSET clause is not supported by the RDBMS.protected final java.lang.String getColumnList()
protected final boolean addWhereClause(java.lang.StringBuffer sql, boolean first)
public java.lang.String getStatement(boolean lock) throws SyntaxNotSupportedException
SyntaxNotSupportedException
.getStatement
in interface QueryExpression
lock
- True if a write lock is requiredSyntaxNotSupportedException
- If the RDBMS does not support a particular feature.protected final java.lang.StringBuffer getStandardStatement(boolean lock, boolean oj)
lock
- whether to lock selected tablesoj
- true in the first case above, false in the second case.public final java.lang.String toString()
toString
in class java.lang.Object
public final java.lang.Object clone()
QueryExpression
clone
in interface QueryExpression
clone
in class java.lang.Object
public boolean isLimitClauseSupported()
QueryExpression.isLimitClauseSupported()
.isLimitClauseSupported
in interface QueryExpression
QueryExpression.isLimitClauseSupported()
public boolean isOffsetClauseSupported()
QueryExpression.isOffsetClauseSupported()
.isOffsetClauseSupported
in interface QueryExpression
QueryExpression.isOffsetClauseSupported()
Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com