Class ExpressionSQLPrinter
- java.lang.Object
-
- org.eclipse.persistence.internal.expressions.ExpressionSQLPrinter
-
public class ExpressionSQLPrinter extends java.lang.ObjectPurpose: 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 SQLCallcallStores the call being created.protected booleanisFirstElementPrintedprotected DatabasePlatformplatformStores the current platform to access platform specific functions.protected booleanrequiresDistinctUsed for distincts in functions.protected AbstractSessionsessionStores the current session.protected booleanshouldPrintQualifiedNamesIndicates whether fully qualified field names (owner + table) should be used or not.protected AbstractRecordtranslationRowStores the row.protected java.io.Writerwriter
-
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 SQLCallgetCall()Return the call.DatabasePlatformgetPlatform()INTERNAL: Return the database platform specific information.protected AbstractSessiongetSession()protected AbstractRecordgetTranslationRow()INTERNAL: Return the row for translationjava.io.WritergetWriter()booleanisFirstElementPrinted()INTERNAL: Used in figuring out when to print a comma in the select clausevoidprintExpression(Expression expression)voidprintField(DatabaseField field)voidprintField(DatabaseField field, DatabaseTable tableAlias)voidprintList(java.util.Collection values, java.lang.Boolean canBind)voidprintNull(ConstantExpression nullValueExpression)voidprintParameter(ParameterExpression expression)voidprintParameter(DatabaseField field)voidprintPrimitive(java.lang.Object value, java.lang.Boolean canBind)voidprintString(java.lang.String value)voidprintValuelist(java.util.Collection values, java.lang.Boolean canBind)booleanrequiresDistinct()If a distinct has been set the DISTINCT clause will be printed.protected voidsetCall(SQLCall call)voidsetIsFirstElementPrinted(boolean isFirstElementPrinted)INTERNAL: Used in figuring out when to print a comma in the select clausevoidsetRequiresDistinct(boolean requiresDistinct)If a distinct has been set the DISTINCT clause will be printed.protected voidsetSession(AbstractSession theSession)protected voidsetShouldPrintQualifiedNames(boolean shouldPrintQualifiedNames)protected voidsetTranslationRow(AbstractRecord theRow)INTERNAL: Set the row for translationvoidsetWriter(java.io.Writer writer)booleanshouldPrintParameterValues()protected booleanshouldPrintQualifiedNames()protected voidtranslateExpression(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 java.io.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 java.io.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(java.lang.Object value, java.lang.Boolean canBind)
-
printNull
public void printNull(ConstantExpression nullValueExpression)
-
printString
public void printString(java.lang.String value)
-
printValuelist
public void printValuelist(java.util.Collection values, java.lang.Boolean canBind)
-
printList
public void printList(java.util.Collection values, java.lang.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(java.io.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.
-
-