Class ExpressionSQLPrinter
- 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
- Author:
- Dorin Sandu
-
-
Field Summary
Fields Modifier and Type Field Description protected SQLCall
call
Stores the call being created.protected boolean
isFirstElementPrinted
protected DatabasePlatform
platform
Stores the current platform to access platform specific functions.protected boolean
requiresDistinct
Used for distincts in functions.protected AbstractSession
session
Stores the current session.protected boolean
shouldPrintQualifiedNames
Indicates whether fully qualified field names (owner + table) should be used or not.protected AbstractRecord
translationRow
Stores the row.protected Writer
writer
-
Constructor Summary
Constructors Constructor Description ExpressionSQLPrinter(AbstractSession session, AbstractRecord translationRow, SQLCall call, boolean printQualifiedNames, ExpressionBuilder builder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SQLCall
getCall()
Return the call.DatabasePlatform
getPlatform()
INTERNAL: Return the database platform specific information.protected AbstractSession
getSession()
protected AbstractRecord
getTranslationRow()
INTERNAL: Return the row for translationWriter
getWriter()
boolean
isFirstElementPrinted()
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 values)
void
printNull(ConstantExpression nullValueExpression)
void
printParameter(ParameterExpression expression)
void
printParameter(DatabaseField field)
void
printPrimitive(Object value)
void
printString(String value)
void
printValuelist(Collection values)
boolean
requiresDistinct()
If a distinct has been set the DISTINCT clause will be printed.protected void
setCall(SQLCall call)
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
setWriter(Writer writer)
boolean
shouldPrintParameterValues()
protected boolean
shouldPrintQualifiedNames()
protected void
translateExpression(Expression theExpression)
Translate an expression i.e.
-
-
-
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
-
-
Constructor Detail
-
ExpressionSQLPrinter
public ExpressionSQLPrinter(AbstractSession session, AbstractRecord translationRow, SQLCall call, boolean printQualifiedNames, ExpressionBuilder builder)
-
-
Method Detail
-
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)
-
printNull
public void printNull(ConstantExpression nullValueExpression)
-
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.
-
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.
-
-