Class DefaultQueryVisitor

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.StringBuilder _queryString
      StringBuilder used to append query string.
      protected static org.apache.commons.logging.Log LOG
      The Jakarta Commons Logging instance used for all logging.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addTableNames​(Qualifier qualifier)
      Method adding table-names in case of joins.
      protected java.lang.String getSequenceNextValString​(java.lang.String seqName)
      Returns the database engine specific string to fetch sequence next value.
      protected void handleJoinConstruction​(Qualifier qualifier)
      Method handling construction of joins.
      protected void handleLock​(Select select)
      Method appending lock clauses as "FOR UPDATE" when needed.
      protected java.lang.String quoteName​(java.lang.String name)
      Method returning prepared string to match requirements of specific databases if needed.
      java.lang.String toString()
      Method returning constructed String.
      void visit​(Assignment assignment)
      Visit method to handle Assignment elements.
      void visit​(AndCondition andCondition)
      Visit method to handle AndCondition elements.
      void visit​(Compare compare)
      Visit method to handle Compare elements.
      void visit​(IsNullPredicate isNullPredicate)
      Visit method to handle IsNullPredicate elements.
      void visit​(OrCondition orCondition)
      Visit method to handle OrCondition elements.
      void visit​(Delete delete)
      Visit method to handle Delete elements.
      void visit​(Column column)
      Visit method to handle Column elements.
      void visit​(NextVal nextVal)
      Visit method to handle NextVal elements.
      void visit​(Parameter parameter)
      Visit method to handle Parameter elements.
      void visit​(Insert insert)
      Visit method to handle Insert elements.
      void visit​(Join join)
      Visit method to handle Join elements.
      void visit​(Select select)
      Visit method to handle select elements.
      void visit​(Table table)
      Visit method to handle Table elements.
      void visit​(TableAlias tableAlias)
      Visit method to handle TableAlias elements.
      void visit​(Update update)
      Visit method to handle update elements.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • _queryString

        protected final java.lang.StringBuilder _queryString
        StringBuilder used to append query string.
      • LOG

        protected static final org.apache.commons.logging.Log LOG
        The Jakarta Commons Logging instance used for all logging.
    • Constructor Detail

      • DefaultQueryVisitor

        public DefaultQueryVisitor()
    • Method Detail

      • visit

        public void visit​(Assignment assignment)
        Visit method to handle Assignment elements.
        Specified by:
        visit in interface Visitor
        Parameters:
        assignment - Assignment object to be handled.
      • visit

        public void visit​(Delete delete)
        Visit method to handle Delete elements.
        Specified by:
        visit in interface Visitor
        Parameters:
        delete - Delete object to be handled.
      • visit

        public void visit​(Insert insert)
        Visit method to handle Insert elements.
        Specified by:
        visit in interface Visitor
        Parameters:
        insert - Insert object to be handled.
      • visit

        public void visit​(Join join)
        Visit method to handle Join elements.
        Specified by:
        visit in interface Visitor
        Parameters:
        join - Join object to be handled
      • visit

        public void visit​(Select select)
        Visit method to handle select elements.
        Specified by:
        visit in interface Visitor
        Parameters:
        select - Select object to be handled.
      • handleJoinConstruction

        protected final void handleJoinConstruction​(Qualifier qualifier)
        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

        protected void addTableNames​(Qualifier qualifier)
        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

        public void visit​(Table table)
        Visit method to handle Table elements.
        Specified by:
        visit in interface Visitor
        Parameters:
        table - Table object to be handled.
      • visit

        public void visit​(TableAlias tableAlias)
        Visit method to handle TableAlias elements.
        Specified by:
        visit in interface Visitor
        Parameters:
        tableAlias - TableAlias object to be handled.
      • visit

        public void visit​(Update update)
        Visit method to handle update elements.
        Specified by:
        visit in interface Visitor
        Parameters:
        update - Update object to be handled.
      • visit

        public void visit​(AndCondition andCondition)
        Visit method to handle AndCondition elements.
        Specified by:
        visit in interface Visitor
        Parameters:
        andCondition - AndCondition object to be handled.
      • visit

        public void visit​(Compare compare)
        Visit method to handle Compare elements.
        Specified by:
        visit in interface Visitor
        Parameters:
        compare - Compare object to be handled.
      • visit

        public void visit​(IsNullPredicate isNullPredicate)
        Visit method to handle IsNullPredicate elements.
        Specified by:
        visit in interface Visitor
        Parameters:
        isNullPredicate - IsNullPredicate object to be handled.
      • visit

        public void visit​(OrCondition orCondition)
        Visit method to handle OrCondition elements.
        Specified by:
        visit in interface Visitor
        Parameters:
        orCondition - OrCondition object to be handled.
      • visit

        public void visit​(Column column)
        Visit method to handle Column elements.
        Specified by:
        visit in interface Visitor
        Parameters:
        column - Column object to be handled.
      • visit

        public void visit​(NextVal nextVal)
        Visit method to handle NextVal elements.
        Specified by:
        visit in interface Visitor
        Parameters:
        nextVal - NextVal object to be handled.
      • visit

        public void visit​(Parameter parameter)
        Visit method to handle Parameter elements.
        Specified by:
        visit in interface Visitor
        Parameters:
        parameter - Parameter object to be handled.
      • quoteName

        protected java.lang.String quoteName​(java.lang.String name)
        Method returning prepared string to match requirements of specific databases if needed.
        Parameters:
        name - String to be prepared.
        Returns:
        Prepared string.
      • getSequenceNextValString

        protected java.lang.String getSequenceNextValString​(java.lang.String seqName)
        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

        protected void handleLock​(Select select)
        Method appending lock clauses as "FOR UPDATE" when needed.
        Parameters:
        select - Select to check if locking-clauses have to be appended or not.
      • toString

        public java.lang.String toString()
        Method returning constructed String.
        Specified by:
        toString in interface Visitor
        Overrides:
        toString in class java.lang.Object
        Returns:
        Constructed query string.