org.exolab.castor.jdo.drivers

Class JDBCQueryExpression

public class JDBCQueryExpression extends Object implements QueryExpression

Version: $Revision: 1.10 $ $Date: 2004/10/01 19:44:37 $

Author: Assaf Arkin

Nested Class Summary
static classJDBCQueryExpression.Join
Field Summary
protected Vector_cols
protected Vector_conds
protected DbMetaInfo_dbInfo
MetaInfo as acquired from the RDBMS
protected boolean_distinct
protected PersistenceFactory_factory
protected Vector_joins
protected String_limit
protected String_offset
protected String_order
protected String_select
protected Hashtable_tables
protected String_where
Constructor Summary
JDBCQueryExpression(PersistenceFactory factory)
Method Summary
voidaddColumn(String tableName, String columnName)
voidaddCondition(String tableName, String columnName, String condOp, String value)
voidaddInnerJoin(String leftTable, String leftColumn, String rightTable, String rightColumn)
voidaddInnerJoin(String leftTable, String leftColumn, String leftTableAlias, String rightTable, String rightColumn, String rightTableAlias)
voidaddInnerJoin(String leftTable, String[] leftColumn, String rightTable, String[] rightColumn)
voidaddInnerJoin(String leftTable, String[] leftColumn, String leftTableAlias, String rightTable, String[] rightColumn, String rightTableAlias)
voidaddLimitClause(String limit)
voidaddOffsetClause(String offset)
voidaddOrderClause(String order)
voidaddOuterJoin(String leftTable, String leftColumn, String rightTable, String rightColumn)
voidaddOuterJoin(String leftTable, String leftColumn, String rightTable, String rightColumn, String rightTableAlias)
voidaddOuterJoin(String leftTable, String[] leftColumn, String rightTable, String[] rightColumn)
voidaddOuterJoin(String leftTable, String[] leftColumn, String rightTable, String[] rightColumn, String rightTableAlias)
voidaddParameter(String tableName, String columnName, String condOp)
voidaddSelect(String selectClause)
voidaddTable(String tableName)
voidaddTable(String tableName, String tableAlias)
voidaddWhereClause(String where)
protected booleanaddWhereClause(StringBuffer sql, boolean first)
Objectclone()
StringencodeColumn(String tableName, String columnName)
protected StringgetColumnList()
protected StringBuffergetStandardStatement(boolean lock, boolean oj)
Helper method.
StringgetStatement(boolean lock)
Creates a SQL statement.
booleanisLimitClauseSupported()
Provides a default implementation of isLimitClauseSupported.
booleanisOffsetClauseSupported()
Provides a default implementation of isOffsetClauseSupported.
voidsetDbMetaInfo(DbMetaInfo dbInfo)
Store database meta information
voidsetDistinct(boolean distinct)
StringtoString()

Field Detail

_cols

protected Vector _cols

_conds

protected Vector _conds

_dbInfo

protected DbMetaInfo _dbInfo
MetaInfo as acquired from the RDBMS

_distinct

protected boolean _distinct

_factory

protected PersistenceFactory _factory

_joins

protected Vector _joins

_limit

protected String _limit

_offset

protected String _offset

_order

protected String _order

_select

protected String _select

_tables

protected Hashtable _tables

_where

protected String _where

Constructor Detail

JDBCQueryExpression

public JDBCQueryExpression(PersistenceFactory factory)

Method Detail

addColumn

public void addColumn(String tableName, String columnName)

addCondition

public void addCondition(String tableName, String columnName, String condOp, String value)

addInnerJoin

public void addInnerJoin(String leftTable, String leftColumn, String rightTable, String rightColumn)

addInnerJoin

public void addInnerJoin(String leftTable, String leftColumn, String leftTableAlias, String rightTable, String rightColumn, String rightTableAlias)

addInnerJoin

public void addInnerJoin(String leftTable, String[] leftColumn, String rightTable, String[] rightColumn)

addInnerJoin

public void addInnerJoin(String leftTable, String[] leftColumn, String leftTableAlias, String rightTable, String[] rightColumn, String rightTableAlias)

addLimitClause

public void addLimitClause(String limit)

addOffsetClause

public void addOffsetClause(String offset)

addOrderClause

public void addOrderClause(String order)

addOuterJoin

public void addOuterJoin(String leftTable, String leftColumn, String rightTable, String rightColumn)

addOuterJoin

public void addOuterJoin(String leftTable, String leftColumn, String rightTable, String rightColumn, String rightTableAlias)

addOuterJoin

public void addOuterJoin(String leftTable, String[] leftColumn, String rightTable, String[] rightColumn)

addOuterJoin

public void addOuterJoin(String leftTable, String[] leftColumn, String rightTable, String[] rightColumn, String rightTableAlias)

addParameter

public void addParameter(String tableName, String columnName, String condOp)

addSelect

public void addSelect(String selectClause)

addTable

public void addTable(String tableName)

addTable

public void addTable(String tableName, String tableAlias)

addWhereClause

public void addWhereClause(String where)

addWhereClause

protected boolean addWhereClause(StringBuffer sql, boolean first)

clone

public Object clone()

encodeColumn

public String encodeColumn(String tableName, String columnName)

getColumnList

protected String getColumnList()

getStandardStatement

protected StringBuffer getStandardStatement(boolean lock, boolean oj)
Helper method. Can be used in two cases: 1) for JDBC drivers which support "{oj ...OUTER JOIN ...}" notation (in accordance with JDBC specification); 2) for the databases which support "... OUTER JOIN ..." notation (in accordance with SQL-92 standard); .

Parameters: lock whether to lock selected tables oj true in the first case above, false in the second case.

getStatement

public String getStatement(boolean lock)
Creates a SQL statement. In general, for a RDBMS/JDBC driver with a full support of the SQL standard/JDBC specification, this will return a valid SQL statement. For some features, a particular RDBMS might indicate that it does not support this feature by throwing a {@linik SyntaxNotSupportedException}.

Throws: SyntaxNotSupportedException If the RDBMS does not support a particular feature.

isLimitClauseSupported

public boolean isLimitClauseSupported()
Provides a default implementation of isLimitClauseSupported.

Returns: false to indicate that this feature is not supported by default.

See Also: isLimitClauseSupported

isOffsetClauseSupported

public boolean isOffsetClauseSupported()
Provides a default implementation of isOffsetClauseSupported.

Returns: false to indicate that this feature is not supported by default.

See Also: isOffsetClauseSupported

setDbMetaInfo

public void setDbMetaInfo(DbMetaInfo dbInfo)
Store database meta information

Parameters: dbInfo DbMetaInfo instance

setDistinct

public void setDistinct(boolean distinct)

toString

public String toString()
Intalio Inc. (C) 1999-2004. All rights reserved http://www.intalio.com