java.lang.Object
org.eclipse.persistence.internal.expressions.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
  • Field Details

    • 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
  • Constructor Details

  • Method Details

    • getCall

      public SQLCall getCall()
      Return the call.
    • getPlatform

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

      protected AbstractSession getSession()
    • 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)
    • printField

      public void printField(DatabaseField field)
    • printField

      public void printField(DatabaseField field, DatabaseTable tableAlias)
    • printParameter

      public void printParameter(ParameterExpression expression)
    • printParameter

      public void printParameter(DatabaseField field)
    • printPrimitive

      public void printPrimitive(Object value, Boolean canBind)
    • printNull

      public void printNull(ConstantExpression nullValueExpression)
    • printString

      public void printString(String value)
    • printValuelist

      public void printValuelist(Collection<Object> values, Boolean canBind)
    • printList

      public void printList(Collection<Object> values, Boolean canBind)
    • 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.
    • setSession

      protected void setSession(AbstractSession theSession)
    • 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.