Examples of ParameterExpression


Examples of org.datanucleus.query.expression.ParameterExpression

            PrimaryExpression primExpr = (PrimaryExpression)param;
            argObj = eval.getValueForPrimaryExpression(primExpr);
        }
        else if (param instanceof ParameterExpression)
        {
            ParameterExpression paramExpr = (ParameterExpression)param;
            argObj = QueryUtils.getValueForParameterExpression(eval.getParameterValues(), paramExpr);
        }
        else if (param instanceof Literal)
        {
            argObj = ((Literal)param).getLiteral();
View Full Code Here

Examples of org.datanucleus.query.expression.ParameterExpression

        return exprOrdering;
    }

    public ParameterExpression getParameterExpressionForPosition(int pos)
    {
        ParameterExpression paramExpr = null;
        if (exprResult != null)
        {
            for (int i=0;i<exprResult.length;i++)
            {
                paramExpr = QueryUtils.getParameterExpressionForPosition(exprResult[i], pos);
View Full Code Here

Examples of org.datanucleus.query.expression.ParameterExpression

    public static String getStringValueForExpression(Expression expr, Map parameters)
    {
        String paramValue = null;
        if (expr instanceof ParameterExpression)
        {
            ParameterExpression paramExpr = (ParameterExpression) expr;
            Object obj = getValueForParameterExpression(parameters, paramExpr);
            paramValue = getStringValue(obj);
        }
        else if (expr instanceof Literal)
        {
View Full Code Here

Examples of org.datanucleus.query.expression.ParameterExpression

            return (ParameterExpression)rootExpr;
        }

        if (rootExpr.getLeft() != null)
        {
            ParameterExpression paramExpr = getParameterExpressionForPosition(rootExpr.getLeft(), pos);
            if (paramExpr != null)
            {
                return paramExpr;
            }
        }
        if (rootExpr.getRight() != null)
        {
            ParameterExpression paramExpr = getParameterExpressionForPosition(rootExpr.getRight(), pos);
            if (paramExpr != null)
            {
                return paramExpr;
            }
        }
        if (rootExpr instanceof InvokeExpression)
        {
            InvokeExpression invokeExpr = (InvokeExpression)rootExpr;
            List<Expression> args = invokeExpr.getArguments();
            if (args != null)
            {
                Iterator<Expression> argIter = args.iterator();
                while (argIter.hasNext())
                {
                    ParameterExpression paramExpr = getParameterExpressionForPosition(argIter.next(), pos);
                    if (paramExpr != null)
                    {
                        return paramExpr;
                    }
                }
View Full Code Here

Examples of org.datanucleus.query.expression.ParameterExpression

    private Symbol getSymbolForParameterInCompilation(QueryCompilation compilation, Object paramKey)
    {
        Symbol sym = null;
        if (paramKey instanceof Integer)
        {
            ParameterExpression expr = compilation.getParameterExpressionForPosition((Integer)paramKey);
            if (expr != null)
            {
                sym = expr.getSymbol();
            }
        }
        else
        {
            String paramName = (String)paramKey;
View Full Code Here

Examples of org.datanucleus.query.expression.ParameterExpression

            }
            return primExpr.getId();
        }
        else if (expr instanceof ParameterExpression)
        {
            ParameterExpression paramExpr = (ParameterExpression)expr;
            if (paramExpr.getId() != null)
            {
                return ":" + paramExpr.getId();
            }
            else
            {
                return "?" + paramExpr.getPosition();
            }
        }
        else if (expr instanceof VariableExpression)
        {
            VariableExpression varExpr = (VariableExpression)expr;
View Full Code Here

Examples of org.datanucleus.query.expression.ParameterExpression

     */
    public TypesafeQuery<T> setParameter(Expression paramExpr, Object value)
    {
        discardCompiled();

        ParameterExpression internalParamExpr = (ParameterExpression) ((ExpressionImpl)paramExpr).getQueryExpression();
        if (parameterExprByName == null ||
                (parameterExprByName != null && !parameterExprByName.containsKey(internalParamExpr.getAlias())))
        {
            throw new JDOUserException("Parameter with name " + internalParamExpr.getAlias() + " doesnt exist for this query");
        }

        if (parameterValuesByName == null)
        {
            parameterValuesByName = new HashMap<String, Object>();
        }
        parameterValuesByName.put(internalParamExpr.getAlias(), value);
        return this;
    }
View Full Code Here

Examples of org.datanucleus.query.expression.ParameterExpression

      if (param instanceof Literal) {
        String matchesExpr = getPrefixFromMatchesExpression(((Literal) param).getLiteral());
        addPrefix(leftExpr, new Literal(matchesExpr), matchesExpr, qd);
        return;
      } else if (param instanceof ParameterExpression) {
        ParameterExpression parameterExpression = (ParameterExpression) param;
        Object parameterValue = getParameterValue(qd.parameters, parameterExpression);
        String matchesExpr = getPrefixFromMatchesExpression(parameterValue);
        addPrefix(leftExpr, new Literal(matchesExpr), matchesExpr, qd);
        return;
      }
View Full Code Here

Examples of org.datanucleus.query.expression.ParameterExpression

      }

      // treat contains as equality since that's how the low-level api does checks on multi-value properties.
      addLeftPrimaryExpression(left, Expression.OP_EQ, param, qd);
    } else if (invokeExpr.getLeft() instanceof ParameterExpression && param instanceof PrimaryExpression) {
      ParameterExpression pe = (ParameterExpression) invokeExpr.getLeft();
      addLeftPrimaryExpression((PrimaryExpression) param, Expression.OP_EQ, pe, qd);
    } else {
      throw newUnsupportedQueryMethodException(invokeExpr);
    }
  }
View Full Code Here

Examples of org.datanucleus.query.expression.ParameterExpression

    if (expr.getLeft() instanceof PrimaryExpression && param instanceof Literal) {
      String matchesExpr = getPrefixFromMatchesExpression(((Literal) param).getLiteral());
      addPrefix((PrimaryExpression) expr.getLeft(), new Literal(matchesExpr), matchesExpr, qd);
    } else if (expr.getLeft() instanceof PrimaryExpression &&
               param instanceof ParameterExpression) {
      ParameterExpression parameterExpression = (ParameterExpression) param;
      Object parameterValue = getParameterValue(qd, parameterExpression);
      String matchesExpr = getPrefixFromMatchesExpression(parameterValue);
      addPrefix((PrimaryExpression) expr.getLeft(), new Literal(matchesExpr), matchesExpr, qd);
    } else {
      // We don't know what this is.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.