Package org.teiid.api.exception.query

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


    @Test public void testSecondPassFunctionResolving1() {
      try {
        helpResolve("SELECT pm1.g1.e1 FROM pm1.g1 where 1/(e1 - 2) <> 4 "); //$NON-NLS-1$
        fail("expected exception");
      } catch (RuntimeException e) {
        QueryResolverException qre = (QueryResolverException)e.getCause();
        assertEquals("ERR.015.008.0040", qre.getCode());
      }
    }
View Full Code Here


                                      List values, CommandContext context, QueryMetadataInterface metadata) throws QueryResolverException, TeiidComponentException, QueryValidatorException {
    VariableContext result = new VariableContext();
      //the size of the values must be the same as that of the parameters
      if (params.size() != values.size()) {
          String msg = QueryPlugin.Util.getString("QueryUtil.wrong_number_of_values", new Object[] {new Integer(values.size()), new Integer(params.size())}); //$NON-NLS-1$
          throw new QueryResolverException(msg);
      }
 
      //the type must be the same, or the type of the value can be implicitly converted
      //to that of the reference
      for (int i = 0; i < params.size(); i++) {
          Reference param = params.get(i);
          Object value = values.get(i);
         
          //TODO: why is the list check in here
          if(value != null && !(value instanceof List)) {
                try {
                    String targetTypeName = DataTypeManager.getDataTypeName(param.getType());
                    Expression expr = ResolverUtil.convertExpression(new Constant(value), targetTypeName, metadata);
                    value = Evaluator.evaluate(expr);
        } catch (ExpressionEvaluationException e) {
                    String msg = QueryPlugin.Util.getString("QueryUtil.Error_executing_conversion_function_to_convert_value", new Integer(i + 1), value, DataTypeManager.getDataTypeName(param.getType())); //$NON-NLS-1$
                    throw new QueryResolverException(msg);
        } catch (QueryResolverException e) {
          String msg = QueryPlugin.Util.getString("QueryUtil.Error_executing_conversion_function_to_convert_value", new Integer(i + 1), value, DataTypeManager.getDataTypeName(param.getType())); //$NON-NLS-1$
                    throw new QueryResolverException(msg);
        }
          }
                   
          if (param.getConstraint() != null) {
            param.getConstraint().validate(value);
View Full Code Here

TOP

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

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.