Class DefaultQueryVisitor
java.lang.Object
org.castor.cpa.persistence.sql.query.visitor.DefaultQueryVisitor
- All Implemented Interfaces:
Visitor
- Direct Known Subclasses:
DefaultDoubleQuoteNameQueryVisitor,SapDbQueryVisitor
Class representing a alias of a specific table or a database.
- Version:
- $Revision: 8469 $ $Date: 2006-04-25 15:08:23 -0600 (Tue, 25 Apr 2006) $
- Author:
- Dennis Butterstein, Ralf Joachim
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final StringBuilderStringBuilder used to append query string.protected static final org.apache.commons.logging.LogThe Jakarta Commons Logging instance used for all logging. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddTableNames(Qualifier qualifier) Method adding table-names in case of joins.protected StringgetSequenceNextValString(String seqName) Returns the database engine specific string to fetch sequence next value.protected final voidhandleJoinConstruction(Qualifier qualifier) Method handling construction of joins.protected voidhandleLock(Select select) Method appending lock clauses as "FOR UPDATE" when needed.protected StringMethod returning prepared string to match requirements of specific databases if needed.toString()Method returning constructed String.voidvisit(Assignment assignment) Visit method to handleAssignmentelements.voidvisit(AndCondition andCondition) Visit method to handleAndConditionelements.voidVisit method to handleCompareelements.voidvisit(IsNullPredicate isNullPredicate) Visit method to handleIsNullPredicateelements.voidvisit(OrCondition orCondition) Visit method to handleOrConditionelements.voidVisit method to handleDeleteelements.voidVisit method to handleColumnelements.voidVisit method to handleNextValelements.voidVisit method to handleParameterelements.voidVisit method to handleInsertelements.voidVisit method to handleJoinelements.voidVisit method to handle select elements.voidVisit method to handleTableelements.voidvisit(TableAlias tableAlias) Visit method to handleTableAliaselements.voidVisit method to handle update elements.
-
Field Details
-
_queryString
StringBuilder used to append query string. -
LOG
protected static final org.apache.commons.logging.Log LOGThe Jakarta Commons Logging instance used for all logging.
-
-
Constructor Details
-
DefaultQueryVisitor
public DefaultQueryVisitor()
-
-
Method Details
-
visit
Visit method to handleAssignmentelements. -
visit
Visit method to handleDeleteelements. -
visit
Visit method to handleInsertelements. -
visit
Visit method to handleJoinelements. -
visit
Visit method to handle select elements. -
handleJoinConstruction
Method handling construction of joins. If Processing of joins is delegated to visit(Table) and visit(TableAlias) method we get the problem that they are processed by every class holding qualifier as well (e. g. compare). This behavior can result in an infinite loop.- Parameters:
qualifier- Qualifier to process joins from.
-
addTableNames
Method adding table-names in case of joins. Normal table => Adding table name only, Aliased table => adding table name SPACE table alias.- Parameters:
qualifier- Qualifier to add names from
-
visit
Visit method to handleTableelements. -
visit
Visit method to handleTableAliaselements. -
visit
Visit method to handle update elements. -
visit
Visit method to handleAndConditionelements. -
visit
Visit method to handleCompareelements. -
visit
Visit method to handleIsNullPredicateelements. -
visit
Visit method to handleOrConditionelements. -
visit
Visit method to handleColumnelements. -
visit
Visit method to handleNextValelements. -
visit
Visit method to handleParameterelements. -
quoteName
Method returning prepared string to match requirements of specific databases if needed.- Parameters:
name- String to be prepared.- Returns:
- Prepared string.
-
getSequenceNextValString
Returns the database engine specific string to fetch sequence next value.- Parameters:
seqName- Name of the sequence.- Returns:
- String to fetch sequence next value.
-
handleLock
Method appending lock clauses as "FOR UPDATE" when needed.- Parameters:
select- Select to check if locking-clauses have to be appended or not.
-
toString
Method returning constructed String.
-