Search in sources :

Example 26 with DyadicExpression

use of org.datanucleus.query.expression.DyadicExpression in project datanucleus-api-jdo by datanucleus.

the class ExpressionImpl method eq.

/* (non-Javadoc)
     * @see org.datanucleus.query.typesafe.Expression#eq(org.datanucleus.query.typesafe.Expression)
     */
public BooleanExpression eq(Expression expr) {
    if (expr == null) {
        // Assume they meant to compare with NULL Literal
        return this.eq((T) null);
    }
    org.datanucleus.query.expression.Expression leftQueryExpr = queryExpr;
    org.datanucleus.query.expression.Expression rightQueryExpr = ((ExpressionImpl) expr).getQueryExpression();
    return new BooleanExpressionImpl(new DyadicExpression(leftQueryExpr, org.datanucleus.query.expression.Expression.OP_EQ, rightQueryExpr));
}
Also used : DyadicExpression(org.datanucleus.query.expression.DyadicExpression)

Example 27 with DyadicExpression

use of org.datanucleus.query.expression.DyadicExpression in project datanucleus-api-jdo by datanucleus.

the class BooleanExpressionImpl method not.

/* (non-Javadoc)
     * @see org.datanucleus.query.typesafe.BooleanExpression#not()
     */
public BooleanExpression not() {
    Expression rightQueryExpr = queryExpr;
    org.datanucleus.query.expression.Expression queryExpr = new DyadicExpression(org.datanucleus.query.expression.Expression.OP_NOT, rightQueryExpr);
    return new BooleanExpressionImpl(queryExpr);
}
Also used : DyadicExpression(org.datanucleus.query.expression.DyadicExpression) Expression(org.datanucleus.query.expression.Expression) PersistableExpression(javax.jdo.query.PersistableExpression) BooleanExpression(javax.jdo.query.BooleanExpression) Expression(org.datanucleus.query.expression.Expression) DyadicExpression(org.datanucleus.query.expression.DyadicExpression)

Example 28 with DyadicExpression

use of org.datanucleus.query.expression.DyadicExpression in project datanucleus-api-jdo by datanucleus.

the class ComparableExpressionImpl method gteq.

/* (non-Javadoc)
     * @see org.datanucleus.query.typesafe.Expression#gteq(java.lang.Object)
     */
public BooleanExpression gteq(T t) {
    Expression leftQueryExpr = queryExpr;
    Expression rightQueryExpr = new Literal(t);
    org.datanucleus.query.expression.Expression queryExpr = new DyadicExpression(leftQueryExpr, org.datanucleus.query.expression.Expression.OP_GTEQ, rightQueryExpr);
    return new BooleanExpressionImpl(queryExpr);
}
Also used : DyadicExpression(org.datanucleus.query.expression.DyadicExpression) NumericExpression(javax.jdo.query.NumericExpression) ComparableExpression(javax.jdo.query.ComparableExpression) Expression(org.datanucleus.query.expression.Expression) InvokeExpression(org.datanucleus.query.expression.InvokeExpression) OrderExpression(javax.jdo.query.OrderExpression) PersistableExpression(javax.jdo.query.PersistableExpression) BooleanExpression(javax.jdo.query.BooleanExpression) Literal(org.datanucleus.query.expression.Literal) Expression(org.datanucleus.query.expression.Expression) DyadicExpression(org.datanucleus.query.expression.DyadicExpression)

Example 29 with DyadicExpression

use of org.datanucleus.query.expression.DyadicExpression in project datanucleus-api-jdo by datanucleus.

the class ComparableExpressionImpl method lteq.

/* (non-Javadoc)
     * @see org.datanucleus.query.typesafe.Expression#lteq(org.datanucleus.query.typesafe.ComparableExpression)
     */
public BooleanExpression lteq(ComparableExpression expr) {
    Expression leftQueryExpr = queryExpr;
    Expression rightQueryExpr = ((ExpressionImpl) expr).getQueryExpression();
    org.datanucleus.query.expression.Expression queryExpr = new DyadicExpression(leftQueryExpr, org.datanucleus.query.expression.Expression.OP_LTEQ, rightQueryExpr);
    return new BooleanExpressionImpl(queryExpr);
}
Also used : DyadicExpression(org.datanucleus.query.expression.DyadicExpression) NumericExpression(javax.jdo.query.NumericExpression) ComparableExpression(javax.jdo.query.ComparableExpression) Expression(org.datanucleus.query.expression.Expression) InvokeExpression(org.datanucleus.query.expression.InvokeExpression) OrderExpression(javax.jdo.query.OrderExpression) PersistableExpression(javax.jdo.query.PersistableExpression) BooleanExpression(javax.jdo.query.BooleanExpression) Expression(org.datanucleus.query.expression.Expression) DyadicExpression(org.datanucleus.query.expression.DyadicExpression)

Example 30 with DyadicExpression

use of org.datanucleus.query.expression.DyadicExpression in project datanucleus-api-jdo by datanucleus.

the class ExpressionImpl method countDistinct.

/* (non-Javadoc)
     * @see org.datanucleus.query.typesafe.Expression#countDistinct()
     */
public NumericExpression<Long> countDistinct() {
    List<org.datanucleus.query.expression.Expression> args = new ArrayList();
    args.add(new DyadicExpression(org.datanucleus.query.expression.Expression.OP_DISTINCT, queryExpr));
    org.datanucleus.query.expression.Expression invokeExpr = new InvokeExpression(null, "count", args);
    return new NumericExpressionImpl<Long>(invokeExpr);
}
Also used : InvokeExpression(org.datanucleus.query.expression.InvokeExpression) DyadicExpression(org.datanucleus.query.expression.DyadicExpression) ParameterExpression(org.datanucleus.query.expression.ParameterExpression) InvokeExpression(org.datanucleus.query.expression.InvokeExpression) PersistableExpression(javax.jdo.query.PersistableExpression) BooleanExpression(javax.jdo.query.BooleanExpression) VariableExpression(org.datanucleus.query.expression.VariableExpression) NumericExpression(javax.jdo.query.NumericExpression) PrimaryExpression(org.datanucleus.query.expression.PrimaryExpression) Expression(javax.jdo.query.Expression) ArrayList(java.util.ArrayList) DyadicExpression(org.datanucleus.query.expression.DyadicExpression)

Aggregations

DyadicExpression (org.datanucleus.query.expression.DyadicExpression)51 InvokeExpression (org.datanucleus.query.expression.InvokeExpression)43 Expression (org.datanucleus.query.expression.Expression)42 PrimaryExpression (org.datanucleus.query.expression.PrimaryExpression)36 ParameterExpression (org.datanucleus.query.expression.ParameterExpression)34 Literal (org.datanucleus.query.expression.Literal)32 VariableExpression (org.datanucleus.query.expression.VariableExpression)30 NucleusException (org.datanucleus.exceptions.NucleusException)21 QueryCompilation (org.datanucleus.query.compiler.QueryCompilation)20 JavaQueryCompiler (org.datanucleus.query.compiler.JavaQueryCompiler)18 OrderExpression (org.datanucleus.query.expression.OrderExpression)13 BooleanExpression (javax.jdo.query.BooleanExpression)12 PersistableExpression (javax.jdo.query.PersistableExpression)12 JDOQLCompiler (org.datanucleus.query.compiler.JDOQLCompiler)12 Product (org.datanucleus.samples.store.Product)12 HashMap (java.util.HashMap)11 NumericExpression (javax.jdo.query.NumericExpression)9 ComparableExpression (javax.jdo.query.ComparableExpression)8 OrderExpression (javax.jdo.query.OrderExpression)8 NucleusUserException (org.datanucleus.exceptions.NucleusUserException)7