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 StringBuilder
StringBuilder used to append query string.protected static final org.apache.commons.logging.Log
The Jakarta Commons Logging instance used for all logging. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addTableNames
(Qualifier qualifier) Method adding table-names in case of joins.protected String
getSequenceNextValString
(String seqName) Returns the database engine specific string to fetch sequence next value.protected final void
handleJoinConstruction
(Qualifier qualifier) Method handling construction of joins.protected void
handleLock
(Select select) Method appending lock clauses as "FOR UPDATE" when needed.protected String
Method returning prepared string to match requirements of specific databases if needed.toString()
Method returning constructed String.void
visit
(Assignment assignment) Visit method to handleAssignment
elements.void
visit
(AndCondition andCondition) Visit method to handleAndCondition
elements.void
Visit method to handleCompare
elements.void
visit
(IsNullPredicate isNullPredicate) Visit method to handleIsNullPredicate
elements.void
visit
(OrCondition orCondition) Visit method to handleOrCondition
elements.void
Visit method to handleDelete
elements.void
Visit method to handleColumn
elements.void
Visit method to handleNextVal
elements.void
Visit method to handleParameter
elements.void
Visit method to handleInsert
elements.void
Visit method to handleJoin
elements.void
Visit method to handle select elements.void
Visit method to handleTable
elements.void
visit
(TableAlias tableAlias) Visit method to handleTableAlias
elements.void
Visit 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 handleAssignment
elements. -
visit
Visit method to handleDelete
elements. -
visit
Visit method to handleInsert
elements. -
visit
Visit method to handleJoin
elements. -
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 handleTable
elements. -
visit
Visit method to handleTableAlias
elements. -
visit
Visit method to handle update elements. -
visit
Visit method to handleAndCondition
elements. -
visit
Visit method to handleCompare
elements. -
visit
Visit method to handleIsNullPredicate
elements. -
visit
Visit method to handleOrCondition
elements. -
visit
Visit method to handleColumn
elements. -
visit
Visit method to handleNextVal
elements. -
visit
Visit method to handleParameter
elements. -
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.
-