Class JRSqlAbstractEqualClause
- java.lang.Object
-
- net.sf.jasperreports.engine.query.JRSqlAbstractEqualClause
-
- All Implemented Interfaces:
JRClauseFunction
- Direct Known Subclasses:
JRSqlEqualClause
,JRSqlNotEqualClause
public abstract class JRSqlAbstractEqualClause extends Object implements JRClauseFunction
Base (NOT) EQUAL clause function for SQL queries.The first token in the $X{...} syntax is the function ID token. Possible values for the (NOT) EQUAL clause function ID token are:
- EQUAL
- NOTEQUAL
- Author:
- Sanda Zaharia (shertage@users.sourceforge.net)
-
-
Field Summary
Fields Modifier and Type Field Description static String
EXCEPTION_MESSAGE_KEY_QUERY_EQUAL_CLAUSE_DB_COLUMN_TOKEN_MISSING
static String
EXCEPTION_MESSAGE_KEY_QUERY_EQUAL_CLAUSE_PARAMETER_TOKEN_MISSING
static int
POSITION_DB_COLUMN
static int
POSITION_PARAMETER
-
Constructor Summary
Constructors Modifier Constructor Description protected
JRSqlAbstractEqualClause()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
apply(JRClauseTokens clauseTokens, JRQueryClauseContext queryContext)
Creates a (NOT) EQUAL SQL clause.protected void
finalizeClause(StringBuffer sbuffer, String param, JRQueryClauseContext queryContext)
Finalizes the query stringprotected abstract void
handleEqualOperator(StringBuffer sBuffer, String param, JRQueryClauseContext queryContext)
-
-
-
Field Detail
-
EXCEPTION_MESSAGE_KEY_QUERY_EQUAL_CLAUSE_DB_COLUMN_TOKEN_MISSING
public static final String EXCEPTION_MESSAGE_KEY_QUERY_EQUAL_CLAUSE_DB_COLUMN_TOKEN_MISSING
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_QUERY_EQUAL_CLAUSE_PARAMETER_TOKEN_MISSING
public static final String EXCEPTION_MESSAGE_KEY_QUERY_EQUAL_CLAUSE_PARAMETER_TOKEN_MISSING
- See Also:
- Constant Field Values
-
POSITION_DB_COLUMN
public static final int POSITION_DB_COLUMN
- See Also:
- Constant Field Values
-
POSITION_PARAMETER
public static final int POSITION_PARAMETER
- See Also:
- Constant Field Values
-
-
Method Detail
-
apply
public void apply(JRClauseTokens clauseTokens, JRQueryClauseContext queryContext)
Creates a (NOT) EQUAL SQL clause.The method expects two clause tokens (after the ID token):
- The first token is the SQL column (or column combination) to be used in the clause.
- The second token is the name of the report parameter that contains the value to compare to.
The EQUAL function constructs either a
column = ?
or ancolumn IS NULL
clause, depending on the parameter's value.The NOTEQUAL function constructs either a
column <> ?
or ancolumn IS NOT NULL
clause, depending on the parameter's value.- Specified by:
apply
in interfaceJRClauseFunction
- Parameters:
clauseTokens
- the clause tokensqueryContext
- the query context
-
finalizeClause
protected void finalizeClause(StringBuffer sbuffer, String param, JRQueryClauseContext queryContext)
Finalizes the query string- Parameters:
sbuffer
-param
-queryContext
-
-
handleEqualOperator
protected abstract void handleEqualOperator(StringBuffer sBuffer, String param, JRQueryClauseContext queryContext)
-
-