public abstract class SQLBetweenBaseClause extends java.lang.Object implements JRClauseFunction
The purpose of this clause function is to find that a given value can be found in a given A...B interval.
The first token in the $X{...} syntax is the function ID token. Possible values for the BETWEEN clause function ID token are:
BETWEEN - in this case the A...B interval will be considered open: (A,B)[BETWEEN - in this case the A...B interval will be considered right-open: [A,B)BETWEEN] - in this case the A...B interval will be considered left-open: (A,B][BETWEEN] - in this case the A...B interval will be considered closed: [A,B]| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
CLAUSE_TRUISM |
protected static int |
POSITION_CLAUSE_ID |
protected static int |
POSITION_DB_COLUMN |
protected static int |
POSITION_LEFT_PARAMETER |
protected static int |
POSITION_RIGHT_PARAMETER |
| Constructor and Description |
|---|
SQLBetweenBaseClause() |
| Modifier and Type | Method and Description |
|---|---|
void |
apply(JRClauseTokens clauseTokens,
JRQueryClauseContext queryContext)
Creates a BETWEEN-like SQL clause, depending on the clause ID.
|
protected abstract ClauseFunctionParameterHandler |
createParameterHandler(JRQueryClauseContext queryContext,
java.lang.String clauseId,
java.lang.String parameterName,
boolean left) |
protected java.lang.String |
getGreaterOperator(java.lang.String clauseId) |
protected java.lang.String |
getLessOperator(java.lang.String clauseId) |
protected void |
handleGreaterClause(java.lang.StringBuffer sbuffer,
java.lang.String clauseId,
java.lang.String col,
ClauseFunctionParameterHandler leftParamHandler,
JRQueryClauseContext queryContext)
Generates either a '
column > ? |
protected void |
handleLessClause(java.lang.StringBuffer sbuffer,
java.lang.String clauseId,
java.lang.String col,
ClauseFunctionParameterHandler rightParamHandler,
JRQueryClauseContext queryContext)
Generates either a '
column < ? |
protected boolean |
isLeftClosed(java.lang.String clauseId) |
protected boolean |
isRightClosed(java.lang.String clauseId) |
protected static final int POSITION_CLAUSE_ID
protected static final int POSITION_DB_COLUMN
protected static final int POSITION_LEFT_PARAMETER
protected static final int POSITION_RIGHT_PARAMETER
protected static final java.lang.String CLAUSE_TRUISM
public void apply(JRClauseTokens clauseTokens, JRQueryClauseContext queryContext)
The method expects three clause tokens (after the ID token):
The method constructs one of the following clauses:
(column > ? AND column < ?) if the clause ID is BETWEEN(column >= ? AND column < ?) if the clause ID is [BETWEEN(column > ? AND column <= ?) if the clause ID is BETWEEN](column >= ? AND column <= ?) if the clause ID is [BETWEEN]column < ? if the clause ID is BETWEEN or BETWEENcolumn <= ? if the clause ID is BETWEEN] or [BETWEEN]column > ? if the clause ID is BETWEEN or BETWEEN]column >= ? if the clause ID is [BETWEEN or [BETWEEN]0 = 0).
apply in interface JRClauseFunctionclauseTokens - queryContext - protected abstract ClauseFunctionParameterHandler createParameterHandler(JRQueryClauseContext queryContext, java.lang.String clauseId, java.lang.String parameterName, boolean left)
protected java.lang.String getGreaterOperator(java.lang.String clauseId)
clauseId - the clause ID>' or '>=' signprotected boolean isLeftClosed(java.lang.String clauseId)
protected java.lang.String getLessOperator(java.lang.String clauseId)
clauseId - the clause ID<' or '<=' signprotected boolean isRightClosed(java.lang.String clauseId)
protected void handleGreaterClause(java.lang.StringBuffer sbuffer,
java.lang.String clauseId,
java.lang.String col,
ClauseFunctionParameterHandler leftParamHandler,
JRQueryClauseContext queryContext)
column > ?' or a 'column >= ?' clausesbuffer - the StringBuffer that contains the generated queryclauseId - the clause IDcol - the name of the column, or a column names combinationleftParamHandler - the parameter handler that contains the left member valuequeryContext - the query contextprotected void handleLessClause(java.lang.StringBuffer sbuffer,
java.lang.String clauseId,
java.lang.String col,
ClauseFunctionParameterHandler rightParamHandler,
JRQueryClauseContext queryContext)
column < ?' or a 'column <= ?' clausesbuffer - the StringBuffer that contains the generated queryclauseId - the clause IDcol - the name of the column, or a column names combinationrightParamHandler - queryContext - the query context© 2001-2010 Jaspersoft Corporation www.jaspersoft.com