|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.jasperreports.engine.query.JRSqlBetweenClause
public class JRSqlBetweenClause
Base BETWEEN clause function for SQL queries.
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]
| Field Summary | |
|---|---|
protected static 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
|
protected static JRSqlBetweenClause |
singleton
|
| Constructor Summary | |
|---|---|
JRSqlBetweenClause()
|
|
| Method Summary | |
|---|---|
void |
apply(JRClauseTokens clauseTokens,
JRQueryClauseContext queryContext)
Creates a BETWEEN-like SQL clause, depending on the clause ID. |
protected String |
getGreaterOperator(String clauseId)
|
protected String |
getLessOperator(String clauseId)
|
protected void |
handleGreaterClause(StringBuffer sbuffer,
String clauseId,
String col,
String leftParam,
JRQueryClauseContext queryContext)
Generates either a ' column > ? |
protected void |
handleLessClause(StringBuffer sbuffer,
String clauseId,
String col,
String rightParam,
JRQueryClauseContext queryContext)
Generates either a ' column < ? |
static JRSqlBetweenClause |
instance()
Returns the singleton function instance. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
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 String CLAUSE_TRUISM
protected static final JRSqlBetweenClause singleton
| Constructor Detail |
|---|
public JRSqlBetweenClause()
| Method Detail |
|---|
public static JRSqlBetweenClause instance()
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 String getGreaterOperator(String clauseId)
clauseId - the clause ID
>' or '>=' signprotected String getLessOperator(String clauseId)
clauseId - the clause ID
<' or '<=' sign
protected void handleGreaterClause(StringBuffer sbuffer,
String clauseId,
String col,
String leftParam,
JRQueryClauseContext queryContext)
column > ?' or a 'column >= ?' clause
sbuffer - the StringBuffer that contains the generated queryclauseId - the clause IDcol - the name of the column, or a column names combinationleftParam - the name of the parameter that contains the left member valuequeryContext - the query context
protected void handleLessClause(StringBuffer sbuffer,
String clauseId,
String col,
String rightParam,
JRQueryClauseContext queryContext)
column < ?' or a 'column <= ?' clause
sbuffer - the StringBuffer that contains the generated queryclauseId - the clause IDcol - the name of the column, or a column names combinationrightParam - the name of the parameter that contains the right member valuequeryContext - the query context
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||