public Object evaluate(Expression expression, List<?> tuple) throws ExpressionEvaluationException, BlockedException, TeiidComponentException { try { return internalEvaluate(expression, tuple); } catch (ExpressionEvaluationException e) { throw new ExpressionEvaluationException(QueryPlugin.Event.TEIID30328, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30328, new Object[] {expression, e.getMessage()})); } }
public Object evaluate(Expression expression, List<?> tuple) throws ExpressionEvaluationException, BlockedException, TeiidComponentException { try { return internalEvaluate(expression, tuple); } catch (ExpressionEvaluationException e) { throw new ExpressionEvaluationException(QueryPlugin.Event.TEIID30328, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30328, new Object[] {expression, e.getMessage()})); } }
public Object evaluate(Expression expression, List<?> tuple) throws ExpressionEvaluationException, BlockedException, TeiidComponentException { try { return internalEvaluate(expression, tuple); } catch (ExpressionEvaluationException e) { throw new ExpressionEvaluationException(QueryPlugin.Event.TEIID30328, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30328, new Object[] {expression, e.getMessage()})); } }
/** * * @param tuple * @param xmlQuery * @param exists - check only for the existence of a non-empty result * @return Boolean if exists is true, otherwise an XMLType value * @throws BlockedException * @throws TeiidComponentException * @throws FunctionExecutionException */ private Object evaluateXMLQuery(List<?> tuple, XMLQuery xmlQuery, boolean exists) throws BlockedException, TeiidComponentException, FunctionExecutionException { Map<String, Object> parameters = new HashMap<String, Object>(); try { evaluateParameters(xmlQuery.getPassing(), tuple, parameters); } catch (ExpressionEvaluationException e) { throw new FunctionExecutionException(QueryPlugin.Event.TEIID30333, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30333, e.getMessage())); } return XQueryEvaluator.evaluateXMLQuery(tuple, xmlQuery, exists, parameters, context); }
/** * * @param tuple * @param xmlQuery * @param exists - check only for the existence of a non-empty result * @return Boolean if exists is true, otherwise an XMLType value * @throws BlockedException * @throws TeiidComponentException * @throws FunctionExecutionException */ private Object evaluateXMLQuery(List<?> tuple, XMLQuery xmlQuery, boolean exists) throws BlockedException, TeiidComponentException, FunctionExecutionException { Map<String, Object> parameters = new HashMap<String, Object>(); try { evaluateParameters(xmlQuery.getPassing(), tuple, parameters); } catch (ExpressionEvaluationException e) { throw new FunctionExecutionException(QueryPlugin.Event.TEIID30333, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30333, e.getMessage())); } return XQueryEvaluator.evaluateXMLQuery(tuple, xmlQuery, exists, parameters, context); }
@Test public void testMatch49() throws Exception { try { helpTestMatch("abc", "a", 'a', true); //$NON-NLS-1$ //$NON-NLS-2$ } catch (ExpressionEvaluationException cee) { assertEquals("TEIID30449 Invalid escape sequence \"a\" with escape character \"a\"", cee.getMessage()); //$NON-NLS-1$ } }
@Test public void testMatch50() throws Exception { try { helpTestMatch("abc", "ab", 'a', true); //$NON-NLS-1$ //$NON-NLS-2$ } catch (ExpressionEvaluationException cee) { assertEquals("TEIID30449 Invalid escape sequence \"ab\" with escape character \"a\"", cee.getMessage()); //$NON-NLS-1$ } }
@Test public void testScalarSubqueryFails() throws Exception{ ScalarSubquery expr = new ScalarSubquery((QueryCommand) QueryParser.getQueryParser().parseCommand("select x from y")); ArrayList values = new ArrayList(2); values.add("a"); //$NON-NLS-1$ values.add("b"); //$NON-NLS-1$ try { helpTestWithValueIterator(expr, values, null); fail("Expected ExpressionEvaluationException but got none"); //$NON-NLS-1$ } catch (ExpressionEvaluationException e) { assertEquals("TEIID30328 Unable to evaluate (SELECT x FROM y): TEIID30345 The command of this scalar subquery returned more than one value: SELECT x FROM y", e.getMessage()); //$NON-NLS-1$ } }
public void helpTestProjectFails(List elements, List[] data, List childElements, String expectedError) throws TeiidComponentException, TeiidProcessingException { ProjectNode projectNode = helpSetupProject(elements, data, childElements, null); try { projectNode.open(); while(true) { TupleBatch batch = projectNode.nextBatch(); if(batch.getTerminationFlag()) { break; } } fail("Expected error but test succeeded"); //$NON-NLS-1$ } catch(ExpressionEvaluationException e) { //note that this should not be a component exception, which would indicate that something abnormal happened assertEquals("Got unexpected exception", expectedError.toUpperCase(), e.getMessage().toUpperCase()); //$NON-NLS-1$ } }
fail(); } catch (ExpressionEvaluationException e) { assertTrue(e.getMessage().contains("TEIID31293"));
throw new TeiidComponentException(e, e.getMessage()); throw new TeiidComponentException(e, e.getMessage());