|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.castor.cpa.persistence.sql.driver.JDBCQueryExpression
public class JDBCQueryExpression
| Field Summary | |
|---|---|
protected DbMetaInfo |
_dbInfo
MetaInfo as acquired from the RDBMS. |
protected boolean |
_distinct
|
protected PersistenceFactory |
_factory
|
protected Vector<org.castor.cpa.persistence.sql.driver.JDBCQueryExpression.Join> |
_joins
|
protected String |
_limit
|
protected String |
_offset
|
protected String |
_order
|
protected String |
_select
|
protected Hashtable<String,String> |
_tables
|
| Fields inherited from interface org.exolab.castor.persist.spi.QueryExpression |
|---|
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 Summary | |
|---|---|
JDBCQueryExpression(PersistenceFactory factory)
|
|
| Method Summary | |
|---|---|
void |
addColumn(String tableName,
String columnName)
Add a column used in the query. |
void |
addCondition(String tableName,
String columnName,
String condOp,
String value)
Add a condition. |
void |
addInnerJoin(String leftTable,
String[] leftColumn,
String leftTableAlias,
String rightTable,
String[] rightColumn,
String rightTableAlias)
Add an inner join with an aliases for the tables. |
void |
addLimitClause(String limit)
Adds an limit clause. |
void |
addOffsetClause(String offset)
Adds an offset clause. |
void |
addOrderClause(String order)
Adds an order by clause. |
void |
addOuterJoin(String leftTable,
String[] leftColumn,
String rightTable,
String[] rightColumn,
String rightTableAlias)
Add an outer join. |
void |
addParameter(String tableName,
String columnName,
String condOp)
Add a query paramater. |
void |
addSelect(String selectClause)
Add an entire select clause to the query with one call. |
void |
addTable(String tableName,
String tableAlias)
Add a table with an alias to the from clause. |
void |
addWhereClause(String where)
Adds a where clause. |
protected boolean |
addWhereClause(StringBuffer sql,
boolean first)
|
Object |
clone()
Returns a clone of the query expression that can be further modified. |
String |
encodeColumn(String tableName,
String columnName)
Encode a TableColumn for use in expressions. |
protected String |
getColumnList()
|
protected StringBuffer |
getStandardStatement(boolean lock,
boolean oj)
Helper method. |
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. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Hashtable<String,String> _tables
protected Vector<org.castor.cpa.persistence.sql.driver.JDBCQueryExpression.Join> _joins
protected String _select
protected String _order
protected String _limit
protected String _offset
protected boolean _distinct
protected PersistenceFactory _factory
protected DbMetaInfo _dbInfo
| Constructor Detail |
|---|
public JDBCQueryExpression(PersistenceFactory factory)
| Method Detail |
|---|
public final void setDbMetaInfo(DbMetaInfo dbInfo)
setDbMetaInfo in interface QueryExpressiondbInfo - DbMetaInfo instance.public final void setDistinct(boolean distinct)
QueryExpression
setDistinct in interface QueryExpressiondistinct - If the query should include DISTINCT in the SQL select.
public final void addColumn(String tableName,
String columnName)
QueryExpression
addColumn in interface QueryExpressiontableName - The table namecolumnName - The column name
public final void addTable(String tableName,
String tableAlias)
QueryExpression
addTable in interface QueryExpressiontableName - The name of the table to add to the select clausetableAlias - The name of the alias under which the where clauses will access it
public final void addParameter(String tableName,
String columnName,
String condOp)
QueryExpression
addParameter in interface QueryExpressiontableName - The table namecolumnName - The column namecondOp - The conditional operation
public final void addCondition(String tableName,
String columnName,
String condOp,
String value)
QueryExpression
addCondition in interface QueryExpressiontableName - The table namecolumnName - The column namecondOp - The conditional operationvalue - The conditional value
public final String encodeColumn(String tableName,
String columnName)
QueryExpression
encodeColumn in interface QueryExpressiontableName - The table name.columnName - The column name.
public final void addInnerJoin(String leftTable,
String[] leftColumn,
String leftTableAlias,
String rightTable,
String[] rightColumn,
String rightTableAlias)
QueryExpression
addInnerJoin in interface QueryExpressionleftTable - 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 side
public final void addOuterJoin(String leftTable,
String[] leftColumn,
String rightTable,
String[] rightColumn,
String rightTableAlias)
QueryExpression
addOuterJoin in interface QueryExpressionleftTable - 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(String selectClause)
QueryExpression
addSelect in interface QueryExpressionselectClause - The entire sql select clause without the word SELECTpublic final void addWhereClause(String where)
QueryExpression
addWhereClause in interface QueryExpressionwhere - The WHERE clause to add (without the word WHERE).public final void addOrderClause(String order)
QueryExpression
addOrderClause in interface QueryExpressionorder - The ORDER BY clause to add (without the words ORDER BY).
public final void addLimitClause(String limit)
throws SyntaxNotSupportedException
QueryExpression
addLimitClause in interface QueryExpressionlimit - The LIMIT clause to add (without the word LIMIT).
SyntaxNotSupportedException - If the LIMIT clause is not supported by the RDBMS.
public final void addOffsetClause(String offset)
throws SyntaxNotSupportedException
QueryExpression
addOffsetClause in interface QueryExpressionoffset - The OFFSET clause to add (without the word OFFSET).
SyntaxNotSupportedException - If the OFFSET clause is not supported by the RDBMS.protected final String getColumnList()
protected final boolean addWhereClause(StringBuffer sql,
boolean first)
public String getStatement(boolean lock)
throws SyntaxNotSupportedException
SyntaxNotSupportedException.
getStatement in interface QueryExpressionlock - True if a write lock is required
SyntaxNotSupportedException - If the RDBMS does not support a particular feature.
protected final 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 String toString()
toString in class Objectpublic final Object clone()
QueryExpression
clone in interface QueryExpressionclone in class Objectpublic boolean isLimitClauseSupported()
QueryExpression.isLimitClauseSupported().
isLimitClauseSupported in interface QueryExpressionQueryExpression.isLimitClauseSupported()public boolean isOffsetClauseSupported()
QueryExpression.isOffsetClauseSupported().
isOffsetClauseSupported in interface QueryExpressionQueryExpression.isOffsetClauseSupported()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||