Package org.datanucleus.query.expression

Examples of org.datanucleus.query.expression.Literal


                // Evaluate the cast
                expr.getLeft().evaluate(this);
                sqlExpr = stack.pop();

                // Add the cast expression to the table mapping
                Literal castLitExpr = (Literal)expr.getLeft().getRight();
                AbstractClassMetaData castCmd =
                    ec.getMetaDataManager().getMetaDataForClass(resolveClass((String)castLitExpr.getLiteral()), clr);
                String exprCastName = null;
                if (expr.getLeft().getLeft() instanceof PrimaryExpression)
                {
                    exprCastName = "CAST_" + ((PrimaryExpression)expr.getLeft().getLeft()).getId();
                }
View Full Code Here


        {
            param = expr.getArguments().get(1);
            int arg2 = -1;
            if (param instanceof Literal)
            {
                Literal param2 = (Literal)expr.getArguments().get(1);
                if (param2.getLiteral() instanceof Number)
                {
                    arg2 = ((Number)param2.getLiteral()).intValue();
                }
                else
                {
                    throw new NucleusException(method + "(param1, param2) : param2 must be numeric!");
                }
View Full Code Here

        {
            throw new NucleusException(LOCALISER.msg("021011", method, invokedValue.getClass().getName()));
        }

        int arg1 = -1;
        Literal param1 = (Literal)expr.getArguments().get(0);
        if (param1.getLiteral() instanceof Number)
        {
            arg1 = ((Number)param1.getLiteral()).intValue();
        }

        String result = null;
        if (expr.getArguments().size() == 2)
        {
            Literal param2 = (Literal)expr.getArguments().get(1);
            int arg2 = -1;
            if (param2.getLiteral() instanceof Number)
            {
                arg2 = ((Number)param2.getLiteral()).intValue();
            }
            if (((String)invokedValue).length() < arg2)
            {
                if (((String)invokedValue).length() < arg1)
                {
View Full Code Here

                Field fld = peil.getLiteralField();
                try
                {
                    // Get the value of the static field
                    Object value = fld.get(null);
                    expr[i] = new Literal(value);
                    expr[i].bind(symtbl);
                }
                catch (Exception e)
                {
                    throw new NucleusUserException("Error processing static field " + fld.getName(), e);
View Full Code Here

            Object obj = getValueForParameterExpression(parameters, paramExpr);
            paramValue = getStringValue(obj);
        }
        else if (expr instanceof Literal)
        {
            Literal literal = (Literal) expr;
            paramValue = getStringValue(literal.getLiteral());
        }
        else
        {
            throw new NucleusException(
                    "getStringValueForExpression(expr) where expr is instanceof " + expr.getClass().getName() + " not supported");
View Full Code Here

            str.append(")");
            return str.toString();
        }
        else if (expr instanceof Literal)
        {
            Literal litExpr = (Literal)expr;
            Object value = litExpr.getLiteral();
            if (value instanceof String || value instanceof Character)
            {
                return "'" + value.toString() + "'";
            }
            else if (value instanceof Boolean)
            {
                return ((Boolean)value ? "TRUE" : "FALSE");
            }
            else
            {
                if (litExpr.getLiteral() == null)
                {
                    return "null";
                }
                else
                {
                    return litExpr.getLiteral().toString();
                }
            }
        }
        else if (expr instanceof VariableExpression)
        {
View Full Code Here

     * @see org.datanucleus.query.typesafe.TypesafeQuery#range(long, long)
     */
    public TypesafeQuery<T> range(long lowerIncl, long upperExcl)
    {
        discardCompiled();
        this.rangeLowerExpr = new NumericExpressionImpl<T>(new Literal(lowerIncl));
        this.rangeUpperExpr = new NumericExpressionImpl<T>(new Literal(upperExcl));
        return this;
    }
View Full Code Here

            updateExprs = new ArrayList<ExpressionImpl>();
            updateVals = new ArrayList<ExpressionImpl>();
        }

        ExpressionImpl valExpr = null;
        org.datanucleus.query.expression.Expression literalExpr = new Literal(val);
        if (val instanceof String)
        {
            valExpr = new StringExpressionImpl(literalExpr);
        }
        else if (val instanceof Number)
View Full Code Here

        while (iter.hasNext())
        {
            PredicateImpl predSub = new PredicateImpl();
            Object obj = iter.next();
            predSub.queryExpr = new DyadicExpression(((ExpressionImpl)this).getQueryExpression(),
                org.datanucleus.query.expression.Expression.OP_EQ, new Literal(obj));
            pred.append(predSub);
        }
        return pred;
    }
View Full Code Here

        pred.queryExpr = queryExpr;
        for (int i=0;i<expr.length;i++)
        {
            PredicateImpl predSub = new PredicateImpl();
            predSub.queryExpr = new DyadicExpression(((ExpressionImpl)this).getQueryExpression(),
                org.datanucleus.query.expression.Expression.OP_EQ, new Literal(expr[i]));
            pred.append(predSub);
        }
        return pred;
    }
View Full Code Here

TOP

Related Classes of org.datanucleus.query.expression.Literal

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.