public class QualifierTranslator extends QueryAssemblerHelper implements TraversalHandler
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
caseInsensitive |
protected boolean |
matchingObject |
protected DataObjectMatchTranslator |
objectMatchTranslator |
protected Expression |
qualifier |
protected boolean |
useAliasForExpressions |
protected Expression |
waitingForEndNode |
out, queryAssembler, strategy| Constructor and Description |
|---|
QualifierTranslator(QueryAssembler queryAssembler) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
appendExtractFunction(ASTExtract functionExpression)
Special case for extract date/time parts functions as they have many variants
|
protected void |
appendFunction(ASTFunctionCall functionExpression)
Append function name to result SQL
Override this method to rename or skip function if generic name isn't supported on target DB.
|
protected void |
appendFunctionArg(Object value,
ASTFunctionCall functionExpression)
Append scalar argument of a function call
Used only for values stored in ASTScalar other
expressions appended in objectNode() method
|
protected void |
appendFunctionArgDivider(ASTFunctionCall functionExpression)
Append divider between function arguments.
|
protected void |
appendLiteral(Object val,
DbAttribute attr,
Expression parentExpression)
Appends SQL code to the query buffer to handle
val as a
parameter to the PreparedStatement being built. |
protected void |
appendObjectMatch() |
protected void |
clearLastFunctionArgDivider(ASTFunctionCall functionExpression)
Clear last divider as we currently don't now position of argument until parent element is ended.
|
protected void |
detectObjectMatch(Expression exp)
Called before processing an expression to initialize
objectMatchTranslator if needed.
|
protected void |
doAppendPart()
Translates query qualifier to SQL WHERE clause.
|
protected void |
doAppendPart(Expression rootNode)
Translates query qualifier to SQL WHERE clause.
|
void |
endNode(Expression node,
Expression parentNode)
Called during the traversal after an expression node children
processing is finished.
|
protected Expression |
extractQualifier() |
void |
finishedChild(Expression node,
int childIndex,
boolean hasMoreChildren)
Called during traversal after a child of expression
has been visited.
|
void |
objectNode(Object leaf,
Expression parentNode)
Called during the traversal when a leaf non-expression node
is encountered.
|
protected String |
operandForBitwiseAnd() |
protected String |
operandForBitwiseLeftShift() |
protected String |
operandForBitwiseNot() |
protected String |
operandForBitwiseOr() |
protected String |
operandForBitwiseRightShift() |
protected String |
operandForBitwiseXor() |
protected boolean |
parenthesisNeeded(Expression node,
Expression parentNode) |
protected void |
processRelTermination(DbRelationship rel,
JoinType joinType,
String joinSplitAlias)
Handles case when a DB_NAME expression ends with relationship.
|
void |
setCaseInsensitive(boolean caseInsensitive) |
void |
setQualifier(Expression qualifier)
Explicitly set qualifier.
|
void |
setUseAliasForExpressions(boolean useAliasForExpressions) |
void |
startNode(Expression node,
Expression parentNode)
Called during the traversal before an expression node children
processing is started.
|
appendDbPath, appendLikeEscapeCharacter, appendLiteralDirect, appendObjPath, appendPart, getDbEntity, getObjEntity, paramsDbType, processColumn, processColumnWithQuoteSqlIdentifiers, processRelTermination, setForceJoinForRelationsprotected DataObjectMatchTranslator objectMatchTranslator
protected boolean matchingObject
protected boolean caseInsensitive
protected boolean useAliasForExpressions
protected Expression waitingForEndNode
protected Expression qualifier
public QualifierTranslator(QueryAssembler queryAssembler)
protected void doAppendPart()
doAppendPart in class QueryAssemblerHelperpublic void setCaseInsensitive(boolean caseInsensitive)
public void setQualifier(Expression qualifier)
public void setUseAliasForExpressions(boolean useAliasForExpressions)
protected void doAppendPart(Expression rootNode)
protected Expression extractQualifier()
protected void detectObjectMatch(Expression exp)
protected void appendObjectMatch()
throws IOException
IOExceptionpublic void finishedChild(Expression node, int childIndex, boolean hasMoreChildren)
TraversalHandlerfinishedChild in interface TraversalHandlerprotected String operandForBitwiseNot()
protected String operandForBitwiseOr()
protected String operandForBitwiseAnd()
protected String operandForBitwiseXor()
protected String operandForBitwiseLeftShift()
protected String operandForBitwiseRightShift()
public void startNode(Expression node, Expression parentNode)
TraversalHandlerstartNode in interface TraversalHandlerpublic void endNode(Expression node, Expression parentNode)
TraversalHandlerendNode in interface TraversalHandlerpublic void objectNode(Object leaf, Expression parentNode)
TraversalHandlerobjectNode in interface TraversalHandlerprotected boolean parenthesisNeeded(Expression node, Expression parentNode)
protected void appendLiteral(Object val, DbAttribute attr, Expression parentExpression) throws IOException
QueryAssemblerHelperval as a
parameter to the PreparedStatement being built. Adds val
into QueryAssembler parameter list.
If val is null, "NULL" is appended to the query.
If val is a DataObject, its primary key value is used as a
parameter. Only objects with a single column primary key can be
used.
appendLiteral in class QueryAssemblerHelperval - object that should be appended as a literal to the query. Must
be of one of "standard JDBC" types, null or a DataObject.attr - DbAttribute that has information on what type of parameter is
being appended.IOExceptionprotected void processRelTermination(DbRelationship rel, JoinType joinType, String joinSplitAlias)
QueryAssemblerHelperprocessRelTermination in class QueryAssemblerHelperprotected void appendFunction(ASTFunctionCall functionExpression)
protected void appendExtractFunction(ASTExtract functionExpression)
protected void appendFunctionArg(Object value, ASTFunctionCall functionExpression) throws IOException
IOExceptionprotected void appendFunctionArgDivider(ASTFunctionCall functionExpression)
protected void clearLastFunctionArgDivider(ASTFunctionCall functionExpression)
Copyright © 2001–2023 Apache Cayenne. All rights reserved.