public void visit(StoredProcedure obj) { for (Iterator<SPParameter> paramIter = obj.getInputParameters().iterator(); paramIter.hasNext();) { SPParameter param = paramIter.next(); Expression expr = param.getExpression(); param.setExpression(replaceExpression(expr)); } }
/** * Constructor used when constructing a parameter during execution. In this case we * know what the parameter is being filled with but no metadata about the parameter. * * @param index the positional index of this parameter * @param value the Value of this parameter */ public SPParameter(int index, Expression expression){ setIndex(index); setExpression(expression); this.parameterSymbol = new ElementSymbol(""); //$NON-NLS-1$ }
public void visit(StoredProcedure obj) { for (Iterator<SPParameter> paramIter = obj.getInputParameters().iterator(); paramIter.hasNext();) { SPParameter param = paramIter.next(); Expression expr = param.getExpression(); param.setExpression(replaceExpression(expr)); } }
public void visit(StoredProcedure obj) { for (Iterator<SPParameter> paramIter = obj.getInputParameters().iterator(); paramIter.hasNext();) { SPParameter param = paramIter.next(); Expression expr = param.getExpression(); param.setExpression(replaceExpression(expr)); } }
/** * Constructor used when constructing a parameter during execution. In this case we * know what the parameter is being filled with but no metadata about the parameter. * * @param index the positional index of this parameter * @param value the Value of this parameter */ public SPParameter(int index, Expression expression){ setIndex(index); setExpression(expression); this.parameterSymbol = new ElementSymbol(""); //$NON-NLS-1$ }
/** * Constructor used when constructing a parameter during execution. In this case we * know what the parameter is being filled with but no metadata about the parameter. * * @param index the positional index of this parameter * @param value the Value of this parameter */ public SPParameter(int index, Expression expression){ setIndex(index); setExpression(expression); this.parameterSymbol = new ElementSymbol(""); //$NON-NLS-1$ }
/** * @see java.lang.Object#clone() */ public Object clone() { SPParameter copy = new SPParameter(); copy.index = this.index; copy.parameterType = this.parameterType; copy.parameterSymbol = this.parameterSymbol.clone(); if(this.expression != null) { copy.setExpression((Expression)this.expression.clone()); } if(this.resultSetColumns != null) { Iterator<ElementSymbol> iter = this.resultSetColumns.iterator(); Iterator<Object> idIter = this.resultSetIDs.iterator(); while(iter.hasNext()) { ElementSymbol column = iter.next(); copy.addResultSetColumn(column.getName(), column.getType(), idIter.next()); } } copy.setUsingDefault(this.usingDefault); copy.varArg = this.varArg; return copy; }
/** * @see java.lang.Object#clone() */ public Object clone() { SPParameter copy = new SPParameter(); copy.index = this.index; copy.parameterType = this.parameterType; copy.parameterSymbol = this.parameterSymbol.clone(); if(this.expression != null) { copy.setExpression((Expression)this.expression.clone()); } if(this.resultSetColumns != null) { Iterator<ElementSymbol> iter = this.resultSetColumns.iterator(); Iterator<Object> idIter = this.resultSetIDs.iterator(); while(iter.hasNext()) { ElementSymbol column = iter.next(); copy.addResultSetColumn(column.getName(), column.getType(), idIter.next()); } } copy.setUsingDefault(this.usingDefault); copy.varArg = this.varArg; return copy; }
/** * @see java.lang.Object#clone() */ public Object clone() { SPParameter copy = new SPParameter(); copy.index = this.index; copy.parameterType = this.parameterType; copy.parameterSymbol = this.parameterSymbol.clone(); if(this.expression != null) { copy.setExpression((Expression)this.expression.clone()); } if(this.resultSetColumns != null) { Iterator<ElementSymbol> iter = this.resultSetColumns.iterator(); Iterator<Object> idIter = this.resultSetIDs.iterator(); while(iter.hasNext()) { ElementSymbol column = iter.next(); copy.addResultSetColumn(column.getName(), column.getType(), idIter.next()); } } copy.setUsingDefault(this.usingDefault); copy.varArg = this.varArg; return copy; }
/** * The param resolving always constructs an array, which is * not appropriate if passing an array directly * @return */ private boolean checkForArray(SPParameter param, Expression expr) { if (!param.isVarArg() || !(expr instanceof Array)) { return false; } Array array = (Array)expr; if (array.getExpressions().size() == 1) { Expression first = array.getExpressions().get(0); if (first.getType() != null && first.getType() == array.getType()) { param.setExpression(first); return true; } } return false; }
/** * The param resolving always constructs an array, which is * not appropriate if passing an array directly * @return */ private boolean checkForArray(SPParameter param, Expression expr) { if (!param.isVarArg() || !(expr instanceof Array)) { return false; } Array array = (Array)expr; if (array.getExpressions().size() == 1) { Expression first = array.getExpressions().get(0); if (first.getType() != null && first.getType() == array.getType()) { param.setExpression(first); return true; } } return false; }
/** * The param resolving always constructs an array, which is * not appropriate if passing an array directly * @return */ private boolean checkForArray(SPParameter param, Expression expr) { if (!param.isVarArg() || !(expr instanceof Array)) { return false; } Array array = (Array)expr; if (array.getExpressions().size() == 1) { Expression first = array.getExpressions().get(0); if (first.getType() != null && first.getType() == array.getType()) { param.setExpression(first); return true; } } return false; }
private Command rewriteExec(StoredProcedure storedProcedure) throws TeiidComponentException, TeiidProcessingException{ //After this method, no longer need to display named parameters storedProcedure.setDisplayNamedParameters(false); for (SPParameter param : storedProcedure.getInputParameters()) { if (!processing || storedProcedure.isPushedInQuery()) { param.setExpression(rewriteExpressionDirect(param.getExpression())); } else if (!(param.getExpression() instanceof Constant)) { boolean isBindEligible = !isConstantConvert(param.getExpression()); param.setExpression(evaluate(param.getExpression(), isBindEligible)); } } return storedProcedure; }
private Command rewriteExec(StoredProcedure storedProcedure) throws TeiidComponentException, TeiidProcessingException{ //After this method, no longer need to display named parameters storedProcedure.setDisplayNamedParameters(false); for (SPParameter param : storedProcedure.getInputParameters()) { if (!processing || storedProcedure.isPushedInQuery()) { param.setExpression(rewriteExpressionDirect(param.getExpression())); } else if (!(param.getExpression() instanceof Constant)) { boolean isBindEligible = !isConstantConvert(param.getExpression()); param.setExpression(evaluate(param.getExpression(), isBindEligible)); } } return storedProcedure; }
private Command rewriteExec(StoredProcedure storedProcedure) throws TeiidComponentException, TeiidProcessingException{ //After this method, no longer need to display named parameters storedProcedure.setDisplayNamedParameters(false); for (SPParameter param : storedProcedure.getInputParameters()) { if (!processing || storedProcedure.isPushedInQuery()) { param.setExpression(rewriteExpressionDirect(param.getExpression())); } else if (!(param.getExpression() instanceof Constant)) { boolean isBindEligible = !isConstantConvert(param.getExpression()); param.setExpression(evaluate(param.getExpression(), isBindEligible)); } } return storedProcedure; }
@Test public void testProcedureBatching() throws Exception { ProcedureExecution exec = new FakeProcedureExecution(2, 1); // this has two result set columns and 1 out parameter int total_columns = 3; StoredProcedure command = (StoredProcedure)helpGetCommand("{call pm2.spTest8(?)}", EXAMPLE_BQT); //$NON-NLS-1$ command.getInputParameters().get(0).setExpression(new Constant(1)); Call proc = new LanguageBridgeFactory(EXAMPLE_BQT).translate(command); ProcedureBatchHandler pbh = new ProcedureBatchHandler(proc, exec); assertEquals(total_columns, pbh.padRow(Arrays.asList(null, null)).size()); List params = pbh.getParameterRow(); assertEquals(total_columns, params.size()); // check the parameter value assertEquals(Integer.valueOf(0), params.get(2)); try { pbh.padRow(Arrays.asList(1)); fail("Expected exception from resultset mismatch"); //$NON-NLS-1$ } catch (TranslatorException err) { assertEquals( "TEIID30479 Could not process stored procedure results for EXEC spTest8(1). Expected 2 result set columns, but was 1. Please update your models to allow for stored procedure results batching.", err.getMessage()); //$NON-NLS-1$ } }
int i = 0; for (SPParameter param : cloneProc.getInputParameters()) { param.setExpression(new Reference(i++));
throw new QueryResolverException(QueryPlugin.Event.TEIID30145, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30145, new Object[] { param.getParameterSymbol(), srcType, tgtType})); param.setExpression(result);
throw new QueryResolverException(QueryPlugin.Event.TEIID30145, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30145, new Object[] { param.getParameterSymbol(), srcType, tgtType})); param.setExpression(result);
throw new QueryResolverException(QueryPlugin.Event.TEIID30145, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30145, new Object[] { param.getParameterSymbol(), srcType, tgtType})); param.setExpression(result);