Package org.jpox.store.mapped.expression

Examples of org.jpox.store.mapped.expression.BooleanExpression


         * creates a query like WHERE ... AND (CANDIDATE_ID = ?1 OR CANDIDATE_ID =
         * ?2) or for classes with composite primary keys WHERE ... AND (
         * (CANDIDATE_IDa = ?1a AND CANDIDATE_IDb = ?1b) OR (CANDIDATE_IDa = ?2a
         * AND CANDIDATE_IDb = ?2b) )
         */
        BooleanExpression elementsExpr = null;
        for (Iterator it = userCandidates.iterator(); it.hasNext();)
        {
            Object candidateValue = it.next();
            ScalarExpression expr = m.newScalarExpression(stmt, stmt.getMainTableExpression());
            BooleanExpression keyExpr = expr.eq(m.newLiteral(stmt, candidateValue));
            if (elementsExpr == null)
            {
                elementsExpr = keyExpr;
            }
            else
View Full Code Here


        DatastoreMapping data_mapping = getDataStoreMapping(0);
        if (data_mapping.isBitBased() || data_mapping.isIntegerBased())
        {
            if (dba.isBitReallyBoolean())
            {
                expr = new BooleanExpression(qs, this, te);
            }
            else
            {
                expr = new BooleanBitColumnExpression(qs, this, te);
            }
        }
        else if (data_mapping.isBooleanBased())
        {
            expr = new BooleanExpression(qs, this, te);
        }
        else if (data_mapping.isStringBased())
        {
            expr = new BooleanCharColumnExpression(qs, this, te);
        }
        else
        {
            expr = new BooleanExpression(qs, this, te);
        }

        return expr;
    }
View Full Code Here

        args.add(source);
        args.add(str);
        ScalarExpression literal = getMapping(BigInteger.class, source).newLiteral(source.getQueryExpression(), BigInteger.ZERO);
        args.add(literal);
        //JPOX_STRPOS( SearchString, stringSearched, [StartPosition] )
        return new BooleanExpression(new StringExpression("JPOX_STRPOS", args),ScalarExpression.OP_EQ,integerLiteral);
    }
View Full Code Here

        args.add(leftOperand);
        args.add(rightOperand);
        ScalarExpression literal = getMapping(BigInteger.class, leftOperand).newLiteral(leftOperand.getQueryExpression(), BigInteger.ZERO);
        args.add(literal);
        //JPOX_STRPOS( SearchString, stringSearched, [StartPosition] )
        return new BooleanExpression(new StringExpression("JPOX_STRPOS", args),ScalarExpression.OP_EQ,lengthMethod((StringExpression)leftOperand).sub(lengthMethod((StringExpression)rightOperand)).add(integerLiteral).encloseWithInParentheses());
    }
View Full Code Here

             * creates a query like WHERE ... AND (CANDIDATE_ID = ?1 OR CANDIDATE_ID =
             * ?2) or for classes with composite primary keys WHERE ... AND (
             * (CANDIDATE_IDa = ?1a AND CANDIDATE_IDb = ?1b) OR (CANDIDATE_IDa = ?2a
             * AND CANDIDATE_IDb = ?2b) )
             */
            BooleanExpression elementsExpr = null;
            for (Iterator it = userCandidates.iterator(); it.hasNext();)
            {
                Object candidateValue = it.next();
                ScalarExpression expr = m.newScalarExpression(stmt, stmt.getMainTableExpression());
                BooleanExpression keyExpr = expr.eq(m.newLiteral(stmt, candidateValue));
                if (elementsExpr == null)
                {
                    elementsExpr = keyExpr;
                }
                else
View Full Code Here

       
        ScalarExpression integerLiteral = getMapping(BigInteger.class, source).newLiteral(source.getQueryExpression(), BigInteger.ONE);
        ArrayList args = new ArrayList();
        args.add(str);
        args.add(source);
        return new BooleanExpression(new StringExpression("LOCATE", args),ScalarExpression.OP_EQ,integerLiteral);
    }
View Full Code Here

        {
            throw new IllegalArgumentTypeException(rightOperand);
        }
       
        StringLiteral pct = new StringLiteral(leftOperand.getQueryExpression(), leftOperand.getMapping(), '%');
        return new BooleanExpression(leftOperand, ScalarExpression.OP_LIKE, pct.add(leftOperand.getQueryExpression().getStoreManager().getDatastoreAdapter().getEscapedPatternExpression(rightOperand)));
    }
View Full Code Here

     * @param pattern The literal expression with the pattern.
     * @return the match expression.
     */
    public BooleanExpression matchesMethod(StringExpression text, StringExpression pattern)
    {
        return new BooleanExpression(text, ScalarExpression.OP_LIKE, pattern);
    }
View Full Code Here

     **/
    public BooleanExpression startsWithMethod(ScalarExpression source, ScalarExpression str)
    {
        ScalarExpression pct = getMapping(String.class, source).newLiteral(source.getQueryExpression(), "%");

        return new BooleanExpression(source, ScalarExpression.OP_LIKE, getEscapedPatternExpression(str).add(pct));
    }
View Full Code Here

    {
        ScalarExpression integerLiteral = getMapping(BigInteger.class, source).newLiteral(source.getQueryExpression(), BigInteger.ONE);
        ArrayList args = new ArrayList();
        args.add(str);
        args.add(source);
        return new BooleanExpression(new StringExpression("CHARINDEX", args),ScalarExpression.OP_EQ,integerLiteral);
    }
View Full Code Here

TOP

Related Classes of org.jpox.store.mapped.expression.BooleanExpression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.