Top Description Fields Constructors Methods
org.eclipse.persistence.internal.expressions

public Class ExpressionSQLPrinter

extends Object
Class Inheritance
Imports
java.io.*, java.util.*, org.eclipse.persistence.internal.helper.*, org.eclipse.persistence.internal.sessions.AbstractSession, .AbstractRecord, org.eclipse.persistence.queries.*, org.eclipse.persistence.exceptions.*, org.eclipse.persistence.expressions.*, org.eclipse.persistence.internal.databaseaccess.*

Purpose: Expression SQL printer.

Responsibilities:

Author
Dorin Sandu
Since
TOPLink/Java 1.0

Field Summary

Modifier and TypeField and Description
protected SQLCall
call

Stores the call being created.

protected boolean
private static final String
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

Constructor Summary

AccessConstructor and Description
public
ExpressionSQLPrinter(AbstractSession session, AbstractRecord translationRow, SQLCall call, boolean printQualifiedNames, ExpressionBuilder builder)

Method Summary

Modifier and TypeMethod and Description
public SQLCall
getCall()

Return the call.

public DatabasePlatform
getPlatform()

INTERNAL: Return the database platform specific information.

protected AbstractSession
protected AbstractRecord
getTranslationRow()

INTERNAL: Return the row for translation

public Writer
public boolean
isFirstElementPrinted()

INTERNAL: Used in figuring out when to print a comma in the select clause

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

public void
printNull(ConstantExpression nullValueExpression)

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

public void
public void
public boolean
requiresDistinct()

If a distinct has been set the DISTINCT clause will be printed.

protected void
public void
setIsFirstElementPrinted(boolean isFirstElementPrinted)

INTERNAL: Used in figuring out when to print a comma in the select clause

public void
setRequiresDistinct(boolean requiresDistinct)

If a distinct has been set the DISTINCT clause will be printed.

protected void
protected void
setShouldPrintQualifiedNames(boolean shouldPrintQualifiedNames)

protected void
setTranslationRow(AbstractRecord theRow)

INTERNAL: Set the row for translation

public void
setWriter(Writer writer)

public boolean
protected boolean
protected void
translateExpression(Expression theExpression)

Translate an expression i.e. call the appropriate translation method for the expression based on its type.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

callback to summary
protected SQLCall call

Stores the call being created.

isFirstElementPrintedback to summary
protected boolean isFirstElementPrinted
NULL_STRINGback to summary
private static final String NULL_STRING
platformback to summary
protected DatabasePlatform platform

Stores the current platform to access platform specific functions.

requiresDistinctback to summary
protected boolean requiresDistinct

Used for distincts in functions.

sessionback to summary
protected AbstractSession session

Stores the current session. The session accessor is used to print all the primitive types.

shouldPrintQualifiedNamesback to summary
protected boolean shouldPrintQualifiedNames

Indicates whether fully qualified field names (owner + table) should be used or not.

translationRowback to summary
protected AbstractRecord translationRow

Stores the row. Used to print PARAMETER nodes.

writerback to summary
protected Writer writer

Constructor Detail

ExpressionSQLPrinterback to summary
public ExpressionSQLPrinter(AbstractSession session, AbstractRecord translationRow, SQLCall call, boolean printQualifiedNames, ExpressionBuilder builder)

Method Detail

getCallback to summary
public SQLCall getCall()

Return the call.

getPlatformback to summary
public DatabasePlatform getPlatform()

INTERNAL: Return the database platform specific information.

getSessionback to summary
protected AbstractSession getSession()
getTranslationRowback to summary
protected AbstractRecord getTranslationRow()

INTERNAL: Return the row for translation

getWriterback to summary
public Writer getWriter()
isFirstElementPrintedback to summary
public boolean isFirstElementPrinted()

INTERNAL: Used in figuring out when to print a comma in the select clause

printExpressionback to summary
public void printExpression(Expression expression)
printFieldback to summary
public void printField(DatabaseField field)
printFieldback to summary
public void printField(DatabaseField field, DatabaseTable tableAlias)
printListback to summary
public void printList(Collection<Object> values, Boolean canBind)
printNullback to summary
public void printNull(ConstantExpression nullValueExpression)
printParameterback to summary
public void printParameter(ParameterExpression expression)
printParameterback to summary
public void printParameter(DatabaseField field)
printPrimitiveback to summary
public void printPrimitive(Object value, Boolean canBind)
printStringback to summary
public void printString(String value)
printValuelistback to summary
public void printValuelist(Collection<Object> values, Boolean canBind)
requiresDistinctback to summary
public boolean requiresDistinct()

If a distinct has been set the DISTINCT clause will be printed. This is required for batch reading.

setCallback to summary
protected void setCall(SQLCall call)
setIsFirstElementPrintedback to summary
public void setIsFirstElementPrinted(boolean isFirstElementPrinted)

INTERNAL: Used in figuring out when to print a comma in the select clause

setRequiresDistinctback to summary
public void setRequiresDistinct(boolean requiresDistinct)

If a distinct has been set the DISTINCT clause will be printed. This is required for batch reading.

setSessionback to summary
protected void setSession(AbstractSession theSession)
setShouldPrintQualifiedNamesback to summary
protected void setShouldPrintQualifiedNames(boolean shouldPrintQualifiedNames)
setTranslationRowback to summary
protected void setTranslationRow(AbstractRecord theRow)

INTERNAL: Set the row for translation

setWriterback to summary
public void setWriter(Writer writer)
shouldPrintParameterValuesback to summary
public boolean shouldPrintParameterValues()
shouldPrintQualifiedNamesback to summary
protected boolean shouldPrintQualifiedNames()
translateExpressionback to summary
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.