private Criteria evaluateCriteria(Criteria crit) throws TeiidComponentException, TeiidProcessingException{ if(EvaluatableVisitor.isFullyEvaluatable(crit, !processing)) { try { Boolean eval = evaluator.evaluateTVL(crit, Collections.emptyList()); return getCriteria(eval); } catch(ExpressionEvaluationException e) { throw new QueryValidatorException(QueryPlugin.Event.TEIID30372, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30372, crit)); } } return crit; }
private Criteria evaluateCriteria(Criteria crit) throws TeiidComponentException, TeiidProcessingException{ if(EvaluatableVisitor.isFullyEvaluatable(crit, !processing)) { try { Boolean eval = evaluator.evaluateTVL(crit, Collections.emptyList()); return getCriteria(eval); } catch(ExpressionEvaluationException e) { throw new QueryValidatorException(QueryPlugin.Event.TEIID30372, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30372, crit)); } } return crit; }
private Criteria evaluateCriteria(Criteria crit) throws TeiidComponentException, TeiidProcessingException{ if(EvaluatableVisitor.isFullyEvaluatable(crit, !processing)) { try { Boolean eval = evaluator.evaluateTVL(crit, Collections.emptyList()); return getCriteria(eval); } catch(ExpressionEvaluationException e) { throw new QueryValidatorException(QueryPlugin.Event.TEIID30372, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30372, crit)); } } return crit; }
private static boolean shouldEvaluate(boolean simplifyCriteria, boolean duringPlanning, Criteria criteria, Query query, boolean having) throws ExpressionEvaluationException, BlockedException, TeiidComponentException { if(criteria == null) { return true; } else if(!EvaluatableVisitor.isFullyEvaluatable(criteria, duringPlanning)) { // If there are elements present in the criteria, // then we don't know the result, so assume we need to execute return true; } else if(Evaluator.evaluate(criteria)) { if (simplifyCriteria) { if (having) { query.setHaving(null); } else { query.setCriteria(null); } } return true; } return false; }
private static boolean shouldEvaluate(boolean simplifyCriteria, boolean duringPlanning, Criteria criteria, Query query, boolean having) throws ExpressionEvaluationException, BlockedException, TeiidComponentException { if(criteria == null) { return true; } else if(!EvaluatableVisitor.isFullyEvaluatable(criteria, duringPlanning)) { // If there are elements present in the criteria, // then we don't know the result, so assume we need to execute return true; } else if(Evaluator.evaluate(criteria)) { if (simplifyCriteria) { if (having) { query.setHaving(null); } else { query.setCriteria(null); } } return true; } return false; }
private static Expression evaluateIfPossible(Expression newExpr) { if (EvaluatableVisitor.isFullyEvaluatable(newExpr, true)) { try { return new Constant(Evaluator.evaluate(newExpr), newExpr.getType()); } catch (TeiidException e) { throw new TeiidRuntimeException(QueryPlugin.Event.TEIID30269, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30269)); } } return newExpr; }
private static Expression evaluateIfPossible(Expression newExpr) { if (EvaluatableVisitor.isFullyEvaluatable(newExpr, true)) { try { return new Constant(Evaluator.evaluate(newExpr), newExpr.getType()); } catch (TeiidException e) { throw new TeiidRuntimeException(QueryPlugin.Event.TEIID30269, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30269)); } } return newExpr; }
private static Expression evaluateIfPossible(Expression newExpr) { if (EvaluatableVisitor.isFullyEvaluatable(newExpr, true)) { try { return new Constant(Evaluator.evaluate(newExpr), newExpr.getType()); } catch (TeiidException e) { throw new TeiidRuntimeException(QueryPlugin.Event.TEIID30269, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30269)); } } return newExpr; }
if (!EvaluatableVisitor.isFullyEvaluatable(crit, true)) { return false;
if (!EvaluatableVisitor.isFullyEvaluatable(crit, true)) { return false;
if (!EvaluatableVisitor.isFullyEvaluatable(crit, true)) { return false;
@Override public void visit(XMLTable obj) { List<DerivedColumn> passing = obj.getPassing(); validatePassing(obj, obj.getXQueryExpression(), passing); boolean hasOrdinal = false; for (XMLColumn xc : obj.getColumns()) { if (!xc.isOrdinal()) { if (xc.getDefaultExpression() != null && !EvaluatableVisitor.isFullyEvaluatable(xc.getDefaultExpression(), false)) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.invalid_default", xc.getDefaultExpression()), obj); //$NON-NLS-1$ } continue; } if (hasOrdinal) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.one_ordinal"), obj); //$NON-NLS-1$ break; } hasOrdinal = true; } }
@Override public void visit(XMLTable obj) { List<DerivedColumn> passing = obj.getPassing(); validatePassing(obj, obj.getXQueryExpression(), passing); boolean hasOrdinal = false; for (XMLColumn xc : obj.getColumns()) { if (!xc.isOrdinal()) { if (xc.getDefaultExpression() != null && !EvaluatableVisitor.isFullyEvaluatable(xc.getDefaultExpression(), false)) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.invalid_default", xc.getDefaultExpression()), obj); //$NON-NLS-1$ } continue; } if (hasOrdinal) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.one_ordinal"), obj); //$NON-NLS-1$ break; } hasOrdinal = true; } }
@Override public void visit(XMLTable obj) { List<DerivedColumn> passing = obj.getPassing(); validatePassing(obj, obj.getXQueryExpression(), passing); boolean hasOrdinal = false; for (XMLColumn xc : obj.getColumns()) { if (!xc.isOrdinal()) { if (xc.getDefaultExpression() != null && !EvaluatableVisitor.isFullyEvaluatable(xc.getDefaultExpression(), false)) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.invalid_default", xc.getDefaultExpression()), obj); //$NON-NLS-1$ } continue; } if (hasOrdinal) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.one_ordinal"), obj); //$NON-NLS-1$ break; } hasOrdinal = true; } }
if (xc.getDefaultExpression() != null && !EvaluatableVisitor.isFullyEvaluatable(xc.getDefaultExpression(), false)) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.invalid_default", xc.getDefaultExpression()), obj); //$NON-NLS-1$
if (xc.getDefaultExpression() != null && !EvaluatableVisitor.isFullyEvaluatable(xc.getDefaultExpression(), false)) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.invalid_default", xc.getDefaultExpression()), obj); //$NON-NLS-1$
if (xc.getDefaultExpression() != null && !EvaluatableVisitor.isFullyEvaluatable(xc.getDefaultExpression(), false)) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.invalid_default", xc.getDefaultExpression()), obj); //$NON-NLS-1$
@Override public void visit(StoredProcedure obj) { for (SPParameter param : obj.getInputParameters()) { try { if (!getMetadata().elementSupports(param.getMetadataID(), SupportConstants.Element.NULL) && EvaluatableVisitor.isFullyEvaluatable(param.getExpression(), true)) { try { // If nextValue is an expression, evaluate it before checking for null Object evaluatedValue = Evaluator.evaluate(param.getExpression()); if(evaluatedValue == null) { handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0055", param.getParameterSymbol()), param.getParameterSymbol()); //$NON-NLS-1$ } else if (evaluatedValue instanceof ArrayImpl && getMetadata().isVariadic(param.getMetadataID())) { ArrayImpl av = (ArrayImpl)evaluatedValue; for (Object o : av.getValues()) { if (o == null) { handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0055", param.getParameterSymbol()), param.getParameterSymbol()); //$NON-NLS-1$ } } } } catch(ExpressionEvaluationException e) { //ignore for now, we don't have the context which could be the problem } } } catch (TeiidComponentException e) { handleException(e); } } }
@Override public void visit(StoredProcedure obj) { for (SPParameter param : obj.getInputParameters()) { try { if (!param.isUsingDefault() && !getMetadata().elementSupports(param.getMetadataID(), SupportConstants.Element.NULL) && EvaluatableVisitor.isFullyEvaluatable(param.getExpression(), true)) { try { // If nextValue is an expression, evaluate it before checking for null Object evaluatedValue = Evaluator.evaluate(param.getExpression()); if(evaluatedValue == null) { handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0055", param.getParameterSymbol()), param.getParameterSymbol()); //$NON-NLS-1$ } else if (evaluatedValue instanceof ArrayImpl && getMetadata().isVariadic(param.getMetadataID())) { ArrayImpl av = (ArrayImpl)evaluatedValue; for (Object o : av.getValues()) { if (o == null) { handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0055", param.getParameterSymbol()), param.getParameterSymbol()); //$NON-NLS-1$ } } } } catch(Exception e) { //ignore for now, we don't have the context which could be the problem } } } catch (TeiidComponentException e) { handleException(e); } } }
@Override public void visit(StoredProcedure obj) { for (SPParameter param : obj.getInputParameters()) { try { if (!param.isUsingDefault() && !getMetadata().elementSupports(param.getMetadataID(), SupportConstants.Element.NULL) && EvaluatableVisitor.isFullyEvaluatable(param.getExpression(), true)) { try { // If nextValue is an expression, evaluate it before checking for null Object evaluatedValue = Evaluator.evaluate(param.getExpression()); if(evaluatedValue == null) { handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0055", param.getParameterSymbol()), param.getParameterSymbol()); //$NON-NLS-1$ } else if (evaluatedValue instanceof ArrayImpl && getMetadata().isVariadic(param.getMetadataID())) { ArrayImpl av = (ArrayImpl)evaluatedValue; for (Object o : av.getValues()) { if (o == null) { handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0055", param.getParameterSymbol()), param.getParameterSymbol()); //$NON-NLS-1$ } } } } catch(Exception e) { //ignore for now, we don't have the context which could be the problem } } } catch (TeiidComponentException e) { handleException(e); } } }