Class ExpressionSQLPrinter


  • public class ExpressionSQLPrinter
    extends Object

    Purpose: Expression SQL printer.

    Responsibilities:

    • Print an expression in SQL format.
    • Replaces FIELD types with field names from the descriptor.
    • Replaces PARAMETER types with row or object values.
    • Calls accessor to print primitive types.
    Since:
    TOPLink/Java 1.0
    Author:
    Dorin Sandu
    • Field Detail

      • session

        protected AbstractSession session
        Stores the current session. The session accessor is used to print all the primitive types.
      • platform

        protected DatabasePlatform platform
        Stores the current platform to access platform specific functions.
      • call

        protected SQLCall call
        Stores the call being created.
      • translationRow

        protected AbstractRecord translationRow
        Stores the row. Used to print PARAMETER nodes.
      • shouldPrintQualifiedNames

        protected boolean shouldPrintQualifiedNames
        Indicates whether fully qualified field names (owner + table) should be used or not.
      • writer

        protected Writer writer
      • requiresDistinct

        protected boolean requiresDistinct
        Used for distincts in functions.
      • isFirstElementPrinted

        protected boolean isFirstElementPrinted
    • Method Detail

      • getCall

        public SQLCall getCall()
        Return the call.
      • getPlatform

        public DatabasePlatform getPlatform()
        INTERNAL: Return the database platform specific information.
      • getTranslationRow

        protected AbstractRecord getTranslationRow()
        INTERNAL: Return the row for translation
      • getWriter

        public Writer getWriter()
      • isFirstElementPrinted

        public boolean isFirstElementPrinted()
        INTERNAL: Used in figuring out when to print a comma in the select clause
      • printExpression

        public void printExpression​(Expression expression)
      • printParameter

        public void printParameter​(DatabaseField field)
      • printPrimitive

        public void printPrimitive​(Object value)
      • printString

        public void printString​(String value)
      • printValuelist

        public void printValuelist​(Collection values)
      • printList

        public void printList​(Collection values)
      • requiresDistinct

        public boolean requiresDistinct()
        If a distinct has been set the DISTINCT clause will be printed. This is required for batch reading.
      • setCall

        protected void setCall​(SQLCall call)
      • setIsFirstElementPrinted

        public void setIsFirstElementPrinted​(boolean isFirstElementPrinted)
        INTERNAL: Used in figuring out when to print a comma in the select clause
      • setRequiresDistinct

        public void setRequiresDistinct​(boolean requiresDistinct)
        If a distinct has been set the DISTINCT clause will be printed. This is required for batch reading.
      • setShouldPrintQualifiedNames

        protected void setShouldPrintQualifiedNames​(boolean shouldPrintQualifiedNames)
      • setTranslationRow

        protected void setTranslationRow​(AbstractRecord theRow)
        INTERNAL: Set the row for translation
      • setWriter

        public void setWriter​(Writer writer)
      • shouldPrintParameterValues

        public boolean shouldPrintParameterValues()
      • shouldPrintQualifiedNames

        protected boolean shouldPrintQualifiedNames()
      • translateExpression

        protected void translateExpression​(Expression theExpression)
        Translate an expression i.e. call the appropriate translation method for the expression based on its type. The translation method is then responsible for translating the subexpressions.