Module org.eclipse.persistence.core
Class ExpressionSQLPrinter
java.lang.Object
org.eclipse.persistence.internal.expressions.ExpressionSQLPrinter
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 Summary
FieldsModifier and TypeFieldDescriptionprotected SQLCall
Stores the call being created.protected boolean
protected DatabasePlatform
Stores the current platform to access platform specific functions.protected boolean
Used for distincts in functions.protected AbstractSession
Stores the current session.protected boolean
Indicates whether fully qualified field names (owner + table) should be used or not.protected AbstractRecord
Stores the row.protected Writer
-
Constructor Summary
ConstructorsConstructorDescriptionExpressionSQLPrinter
(AbstractSession session, AbstractRecord translationRow, SQLCall call, boolean printQualifiedNames, ExpressionBuilder builder) -
Method Summary
Modifier and TypeMethodDescriptiongetCall()
Return the call.INTERNAL: Return the database platform specific information.protected AbstractSession
protected AbstractRecord
INTERNAL: Return the row for translationboolean
INTERNAL: Used in figuring out when to print a comma in the select clausevoid
printExpression
(Expression expression) void
printField
(DatabaseField field) void
printField
(DatabaseField field, DatabaseTable tableAlias) void
printList
(Collection<Object> values, Boolean canBind) void
printNull
(ConstantExpression nullValueExpression) void
printParameter
(ParameterExpression expression) void
printParameter
(DatabaseField field) void
printPrimitive
(Object value, Boolean canBind) void
printString
(String value) void
printValuelist
(Collection<Object> values, Boolean canBind) boolean
If a distinct has been set the DISTINCT clause will be printed.protected void
void
setIsFirstElementPrinted
(boolean isFirstElementPrinted) INTERNAL: Used in figuring out when to print a comma in the select clausevoid
setRequiresDistinct
(boolean requiresDistinct) If a distinct has been set the DISTINCT clause will be printed.protected void
setSession
(AbstractSession theSession) protected void
setShouldPrintQualifiedNames
(boolean shouldPrintQualifiedNames) protected void
setTranslationRow
(AbstractRecord theRow) INTERNAL: Set the row for translationvoid
boolean
protected boolean
protected void
translateExpression
(Expression theExpression) Translate an expression i.e.
-
Field Details
-
session
Stores the current session. The session accessor is used to print all the primitive types. -
platform
Stores the current platform to access platform specific functions. -
call
Stores the call being created. -
translationRow
Stores the row. Used to print PARAMETER nodes. -
shouldPrintQualifiedNames
protected boolean shouldPrintQualifiedNamesIndicates whether fully qualified field names (owner + table) should be used or not. -
writer
-
requiresDistinct
protected boolean requiresDistinctUsed for distincts in functions. -
isFirstElementPrinted
protected boolean isFirstElementPrinted
-
-
Constructor Details
-
ExpressionSQLPrinter
public ExpressionSQLPrinter(AbstractSession session, AbstractRecord translationRow, SQLCall call, boolean printQualifiedNames, ExpressionBuilder builder)
-
-
Method Details
-
getCall
Return the call. -
getPlatform
INTERNAL: Return the database platform specific information. -
getSession
-
getTranslationRow
INTERNAL: Return the row for translation -
getWriter
-
isFirstElementPrinted
public boolean isFirstElementPrinted()INTERNAL: Used in figuring out when to print a comma in the select clause -
printExpression
-
printField
-
printField
-
printParameter
-
printParameter
-
printPrimitive
-
printNull
-
printString
-
printValuelist
-
printList
-
requiresDistinct
public boolean requiresDistinct()If a distinct has been set the DISTINCT clause will be printed. This is required for batch reading. -
setCall
-
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
-
setShouldPrintQualifiedNames
protected void setShouldPrintQualifiedNames(boolean shouldPrintQualifiedNames) -
setTranslationRow
INTERNAL: Set the row for translation -
setWriter
-
shouldPrintParameterValues
public boolean shouldPrintParameterValues() -
shouldPrintQualifiedNames
protected boolean shouldPrintQualifiedNames() -
translateExpression
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.
-