Package org.teiid.api.exception.query

Examples of org.teiid.api.exception.query.QueryValidatorException


        QueryResolver.resolveCommand(userCommand, metadata);
    ValidatorReport report = Validator.validate(userCommand, metadata);
       
        if (report.hasItems()) {
            ValidatorFailure firstFailure = report.getItems().iterator().next();
            throw new QueryValidatorException(firstFailure.getMessage());
        }
        userCommand = QueryRewriter.rewrite(userCommand, metadata, null);
       
        AnalysisRecord analysisRecord = new AnalysisRecord(false, DEBUG);
       
View Full Code Here


        QueryResolver.resolveCommand(userCommand, metadata);
        ValidatorReport report = Validator.validate(userCommand, metadata);
       
        if (report.hasItems()) {
            ValidatorFailure firstFailure = report.getItems().iterator().next();
            throw new QueryValidatorException(firstFailure.getMessage());
        }
        QueryRewriter.rewrite(userCommand, metadata, new CommandContext());

        AnalysisRecord analysisRecord = new AnalysisRecord(false, DEBUG);
        try {
View Full Code Here

  public static void validateProjectedSymbols(GroupSymbol virtualGroup,
      List<ElementSymbol> symbols,
      List<SingleElementSymbol> projectedSymbols)
      throws QueryValidatorException {
    if (symbols.size() != projectedSymbols.size()) {
      throw new QueryValidatorException(QueryPlugin.Util.getString("QueryResolver.wrong_view_symbols", virtualGroup, symbols.size(), projectedSymbols.size())); //$NON-NLS-1$
    }
    for (int i = 0; i < projectedSymbols.size(); i++) {
      SingleElementSymbol projectedSymbol = projectedSymbols.get(i);
     
      ResolverUtil.setTypeIfNull(projectedSymbol, symbols.get(i).getType());
     
      if (projectedSymbol.getType() != symbols.get(i).getType()) {
        throw new QueryValidatorException(QueryPlugin.Util.getString("QueryResolver.wrong_view_symbol_type", virtualGroup, i+1//$NON-NLS-1$
            DataTypeManager.getDataTypeName(symbols.get(i).getType()), DataTypeManager.getDataTypeName(projectedSymbol.getType())));
      }
    }
  }
View Full Code Here

                Criteria crit = whileStatement.getCondition();
                crit = rewriteCriteria(crit);
               
                whileStatement.setCondition(crit);
                if(crit.equals(TRUE_CRITERIA)) {
                    throw new QueryValidatorException(QueryPlugin.Util.getString("QueryRewriter.infinite_while")); //$NON-NLS-1$
                } else if(crit.equals(FALSE_CRITERIA) || crit.equals(UNKNOWN_CRITERIA)) {
                    return null;
                }
                whileStatement.setBlock(rewriteBlock(whileStatement.getBlock()));
               
View Full Code Here

    // apply any implicit conversions
    try {
            ResolverVisitor.resolveLanguageObject(translatedCriteria, metadata);
    } catch(TeiidException ex) {
            throw new QueryValidatorException(ex, "ERR.015.009.0002", QueryPlugin.Util.getString("ERR.015.009.0002", translatedCriteria)); //$NON-NLS-1$ //$NON-NLS-2$
    }

    return translatedCriteria;
  }
View Full Code Here

            Insert insert = new Insert(into.getGroup(), allIntoElements, Collections.emptyList());
            query.setInto(null);
            insert.setQueryExpression(query);
            return rewriteInsert(correctDatatypes(insert));
        } catch (QueryMetadataException err) {
            throw new QueryValidatorException(err, err.getMessage());
        } catch (TeiidComponentException err) {
            throw new QueryValidatorException(err, err.getMessage());
    }
    }
View Full Code Here

              Boolean eval = evaluator.evaluateTVL(crit, Collections.emptyList());
               
                return getCriteria(eval);               
               
            } catch(ExpressionEvaluationException e) {
                throw new QueryValidatorException(e, "ERR.015.009.0001", QueryPlugin.Util.getString("ERR.015.009.0001", crit)); //$NON-NLS-1$ //$NON-NLS-2$
            }
        }
       
        return crit;
    }
View Full Code Here

            Constant const2 = (Constant)rightExpr;
            try {
                Object result = descriptor.invokeFunction(new Object[] { const2.getValue(), const1.getValue() } );
                combinedConst = new Constant(result, descriptor.getReturnType());
            } catch(FunctionExecutionException e) {
              throw new QueryValidatorException(e, "ERR.015.009.0003", QueryPlugin.Util.getString("ERR.015.009.0003", e.getMessage())); //$NON-NLS-1$ //$NON-NLS-2$
          }
        } else {
            Function conversion = new Function(descriptor.getName(), new Expression[] { rightExpr, const1 });
            conversion.setType(leftExpr.getType());
            conversion.setFunctionDescriptor(descriptor);
View Full Code Here

                    return value;
                  }
                  try {
            return new Constant(FunctionMethods.convert(((Constant)value).getValue(), DataTypeManager.getDataTypeName(type)), es.getType());
          } catch (FunctionExecutionException e) {
            throw new QueryValidatorException(e, e.getMessage());
          }
                }
                return new Reference(es);
            }
            return expression;
View Full Code Here

    UpdateInfo info = insert.getUpdateInfo();
    if (info != null && info.isInherentInsert()) {
      //TODO: update error messages
      UpdateMapping mapping = info.findInsertUpdateMapping(insert, true);
      if (mapping == null) {
        throw new QueryValidatorException(QueryPlugin.Util.getString("ValidationVisitor.nonUpdatable", insert.getVariables())); //$NON-NLS-1$
      }
      Map<ElementSymbol, ElementSymbol> symbolMap = mapping.getUpdatableViewSymbols();
      List<ElementSymbol> mappedSymbols = new ArrayList<ElementSymbol>(insert.getVariables().size());
      for (ElementSymbol symbol : insert.getVariables()) {
        mappedSymbols.add(symbolMap.get(symbol));
View Full Code Here

TOP

Related Classes of org.teiid.api.exception.query.QueryValidatorException

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.