/** * Accessor for parameter value for the provided parameter expression. * @param qd QueryData * @param pe Expression for the parameter * @return The value of this parameter */ private static Object getParameterValue(Map paramValues, ParameterExpression pe) { Object key = null; if (paramValues.containsKey(pe.getId())) { key = pe.getId(); } else { try { Integer intVal = Integer.valueOf(pe.getId()); if (paramValues.containsKey(intVal)) { key = intVal; } } catch (NumberFormatException nfe) {} if (key == null) { key = pe.getPosition(); } } return paramValues.get(key); }
private Object getParameterValue(ExpressionBuilderHelper h, ParameterExpression expr, ExecutionContext executionContext) { Object paramValue = parameters.get(expr.getId()); if (paramValue != null) return getTransformedValueFromParamValue(paramValue, executionContext); // Check if a positional param is set try { paramValue = parameters.get(Integer.parseInt(expr.getId())); if (paramValue != null) { return getTransformedValueFromParamValue(paramValue, executionContext); } return paramValue; } catch (NumberFormatException e) { // we are going to settle for null here } return new NucleusException("Cannot find parameter expression: " + expr.toString()); }
private Object getParameterValue(ExpressionBuilderHelper h, ParameterExpression expr, ExecutionContext executionContext) { Object paramValue = parameters.get(expr.getId()); if (paramValue != null) return getTransformedValueFromParamValue(paramValue, executionContext); // Check if a positional param is set try { paramValue = parameters.get(Integer.parseInt(expr.getId())); if (paramValue != null) { return getTransformedValueFromParamValue(paramValue, executionContext); } return paramValue; } catch (NumberFormatException e) { // we are going to settle for null here } return new NucleusException("Cannot find parameter expression: " + expr.toString()); }
paramNameByPosition.put(Integer.valueOf(expr.getPosition()), expr.getId()); if (parameters.containsKey(expr.getId())) paramValue = parameters.get(expr.getId()); paramValueSet = true; else if (parameterValueByName != null && parameterValueByName.containsKey(expr.getId())) paramValue = parameterValueByName.get(expr.getId()); paramValueSet = true; parameterValueByName.put(expr.getId(), paramValue);
if (namedParams == null) if (paramExpr.getId() != null) if ((namedParams == Boolean.TRUE && paramExpr.getId() == null) || (namedParams == Boolean.FALSE && paramExpr.getId() != null)) ParameterExpressionImpl param = new ParameterExpressionImpl(paramExpr.getType(), paramExpr.getId()); params.add(param);
paramNameByPosition.put(Integer.valueOf(expr.getPosition()), expr.getId()); if (parameters.containsKey(expr.getId())) paramValue = parameters.get(expr.getId()); paramValueSet = true; else if (parameterValueByName != null && parameterValueByName.containsKey(expr.getId())) paramValue = parameterValueByName.get(expr.getId()); paramValueSet = true; parameterValueByName.put(expr.getId(), paramValue); JavaTypeMapping m = paramMappingForName.get(expr.getId()); if (m == null) throw new QueryCompilerSyntaxException(Localiser.msg("021118", expr.getId(), expr.getSymbol().getValueType().getName(), paramValue.getClass().getName())); sqlExpr = exprFactory.newLiteralParameter(stmt, m, paramValue, expr.getId()); if (sqlExpr instanceof ParameterLiteral) ((ParameterLiteral)sqlExpr).setName(expr.getId()); expressionForParameter.put(expr.getId(), sqlExpr); paramMappingForName.put(expr.getId(), m);
paramMappingForName.put(paramExpr.getId(), leftSqlExpr.getJavaTypeMapping()); processParameterExpression(paramExpr); rightSqlExpr = stack.pop();
Symbol paramSym = compilation.getSymbolTable().getSymbol(paramExpr.getId()); if (paramSym.getValueType() != null && paramSym.getValueType().isArray())