Class SQLLessOrGreaterBaseClause

    • Field Detail

      • EXCEPTION_MESSAGE_KEY_QUERY_LESS_GREATER_CLAUSE_DB_COLUMN_TOKEN_MISSING

        public static final java.lang.String EXCEPTION_MESSAGE_KEY_QUERY_LESS_GREATER_CLAUSE_DB_COLUMN_TOKEN_MISSING
        See Also:
        Constant Field Values
      • EXCEPTION_MESSAGE_KEY_QUERY_LESS_GREATER_CLAUSE_NAME_TOKEN_MISSING

        public static final java.lang.String EXCEPTION_MESSAGE_KEY_QUERY_LESS_GREATER_CLAUSE_NAME_TOKEN_MISSING
        See Also:
        Constant Field Values
      • EXCEPTION_MESSAGE_KEY_QUERY_LESS_GREATER_CLAUSE_PARAMETER_TOKEN_MISSING

        public static final java.lang.String EXCEPTION_MESSAGE_KEY_QUERY_LESS_GREATER_CLAUSE_PARAMETER_TOKEN_MISSING
        See Also:
        Constant Field Values
      • OPERATOR_LESS_OR_EQUAL

        protected static final java.lang.String OPERATOR_LESS_OR_EQUAL
        See Also:
        Constant Field Values
      • OPERATOR_GREATER

        protected static final java.lang.String OPERATOR_GREATER
        See Also:
        Constant Field Values
      • OPERATOR_GREATER_OR_EQUAL

        protected static final java.lang.String OPERATOR_GREATER_OR_EQUAL
        See Also:
        Constant Field Values
    • Constructor Detail

      • SQLLessOrGreaterBaseClause

        protected SQLLessOrGreaterBaseClause()
    • Method Detail

      • apply

        public void apply​(JRClauseTokens clauseTokens,
                          JRQueryClauseContext queryContext)
        Creates either a LESS or a GREATER SQL clause, depending on the clause ID.

        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 method constructs one of the following clauses:

        • column < ? if the clause ID is LESS
        • column <= ? if the clause ID is LESS]
        • column >= ? if the clause ID is GREATER
        • column > ? if the clause ID is [GREATER
        If the value to compare to is null, the method generates a SQL clause that will always evaluate to true (e.g. 0 = 0).

        Specified by:
        apply in interface JRClauseFunction
        Parameters:
        clauseTokens - the clause tokens
        queryContext - the query context
      • handleLessOrGreaterOperator

        protected void handleLessOrGreaterOperator​(java.lang.StringBuffer sBuffer,
                                                   java.lang.String clauseId)
        Appends the appropriate inequality sign to the query string, depending on the clause ID value
        Parameters:
        sBuffer - the StringBuffer that contains the generated query
        clauseId - the clause ID