Package org.teiid.api.exception.query

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


      throws QueryValidatorException, QueryMetadataException,
      TeiidComponentException, QueryResolverException,
      TeiidProcessingException {
    UpdateMapping mapping = info.findUpdateMapping(update.getChangeList().getClauseMap().keySet(), false);
    if (mapping == null) {
      throw new QueryValidatorException(QueryPlugin.Util.getString("ValidationVisitor.nonUpdatable", update.getChangeList().getClauseMap().keySet())); //$NON-NLS-1$
    }
    Map<ElementSymbol, ElementSymbol> symbolMap = mapping.getUpdatableViewSymbols();
    if (info.isSimple()) {
      update.setGroup(mapping.getGroup().clone());
      for (SetClause clause : update.getChangeList().getClauses()) {
View Full Code Here


                Boolean changingValue = (Boolean)((Constant)variables.get(var)).getValue();
               
                if (result == null) {
                    result = changingValue;
                } else if (!result.equals(changingValue)) {
                  throw new QueryValidatorException(QueryPlugin.Util.getString("VariableSubstitutionVisitor.Input_vars_should_have_same_changing_state", expr)); //$NON-NLS-1$
                }
            }
        }
       
        if (result != null) {
View Full Code Here

    }
     
    @Override
    public void validate(Object value) throws QueryValidatorException {
      if (((Integer)value).intValue() < 0) {
        throw new QueryValidatorException(QueryPlugin.Util.getString(msgKey));
      }
    }
View Full Code Here

      if (getUnionBranches().isEmpty()) {
        return findUpdateMapping(insert.getVariables(), true)
      }
      if (insert.getQueryExpression() != null) {
        //TODO: this could be done in a loop, see about adding a validation
        throw new QueryValidatorException(QueryPlugin.Util.getString("ValidationVisitor.insert_qe_partition", insert.getGroup())); //$NON-NLS-1$
      }
      int partition = -1;
      List<ElementSymbol> filteredColumns = new LinkedList<ElementSymbol>();
      for (Map.Entry<ElementSymbol, List<Set<Constant>>> entry : partitionInfo.entrySet()) {
        int index = insert.getVariables().indexOf(entry.getKey());
        if (index == -1) {
          continue;
        }
        Expression value = (Expression)insert.getValues().get(index);
        if (!(value instanceof Constant)) {
          continue;
        }
        for (int i = 0; i < entry.getValue().size(); i++) {
          if (entry.getValue().get(i).contains(value)) {
            if (entry.getValue().get(i).size() == 1) {
              filteredColumns.add(entry.getKey());
            }
            if (partition == -1) {
              partition = i;
            } else if (partition != i) {
              throw new QueryValidatorException(QueryPlugin.Util.getString("ValidationVisitor.insert_no_partition", insert.getGroup(), insert.getVariables())); //$NON-NLS-1$
            }
          }
        }
      }
      if (partition == -1) {
        throw new QueryValidatorException(QueryPlugin.Util.getString("ValidationVisitor.insert_no_partition", insert.getGroup(), insert.getVariables())); //$NON-NLS-1$
      }
      UpdateInfo info = this;
      if (partition > 0) {
        info = info.getUnionBranches().get(partition - 1);
      }
View Full Code Here

  private void checkNotNull(ElementSymbol param, Object value)
      throws TeiidComponentException, QueryMetadataException,
      QueryValidatorException {
    if (value == null && !metadata.elementSupports(param.getMetadataID(), SupportConstants.Element.NULL)) {
        throw new QueryValidatorException(QueryPlugin.Util.getString("ProcedurePlan.nonNullableParam", param)); //$NON-NLS-1$
    }
  }
View Full Code Here

    protected void createCommandContext() throws QueryValidatorException {
      boolean returnsResultSet = userCommand.returnsResultSet();
      this.returnsUpdateCount = !(userCommand instanceof StoredProcedure) && !returnsResultSet;
      if ((this.requestMsg.getResultsMode() == ResultsMode.UPDATECOUNT && !returnsUpdateCount)
          || (this.requestMsg.getResultsMode() == ResultsMode.RESULTSET && !returnsResultSet)) {
          throw new QueryValidatorException(QueryPlugin.Util.getString(this.requestMsg.getResultsMode()==ResultsMode.RESULTSET?"Request.no_result_set":"Request.result_set")); //$NON-NLS-1$ //$NON-NLS-2$
      }

      // Create command context, used in rewriting, planning, and processing
        // Identifies a "group" of requests on a per-connection basis to allow later
        // cleanup of all resources in the group on connection shutdown
View Full Code Here

      referenceCheck(references);
    }
   
    static void referenceCheck(List<Reference> references) throws QueryValidatorException {
      if (references != null && !references.isEmpty()) {
        throw new QueryValidatorException(QueryPlugin.Util.getString("Request.Invalid_character_in_query")); //$NON-NLS-1$
      }
    }
View Full Code Here

        // Validate with visitor
        ValidatorReport report = Validator.validate(command, metadata, visitor);
        if (report.hasItems()) {
            ValidatorFailure firstFailure = report.getItems().iterator().next();
            throw new QueryValidatorException(firstFailure.getMessage());
        }
    }
View Full Code Here

     */
  private void handlePreparedBatchUpdate() throws QueryMetadataException,
      TeiidComponentException, QueryResolverException, QueryPlannerException, QueryValidatorException {
    List<List<?>> paramValues = (List<List<?>>) requestMsg.getParameterValues();
    if (paramValues.isEmpty()) {
      throw new QueryValidatorException("No batch values sent for prepared batch update"); //$NON-NLS-1$
    }
    boolean supportPreparedBatchUpdate = false;
    Command command = null;
    if (this.processPlan instanceof RelationalPlan) {
      RelationalPlan rPlan = (RelationalPlan)this.processPlan;
View Full Code Here

   
    Command proc = QueryResolver.expandCommand(command, metadata, AnalysisRecord.createNonRecordingRecord());
   
    ValidatorReport report = Validator.validate(proc, metadata);
    if(report.hasItems()) {
        throw new QueryValidatorException(report.getFailureMessage());
    }

    report = Validator.validate(command, metadata);
    if(report.hasItems()) {
        throw new QueryValidatorException(report.getFailureMessage());
    }
  }
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.