@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$ } }
row = this.procedureBatchHandler.padRow(row); List<?> row = this.procedureBatchHandler.getParameterRow(); if (row != null) { try {
StoredProcedure proc = (StoredProcedure)command; if (proc.returnParameters()) { this.procedureBatchHandler = new ProcedureBatchHandler((Call)translatedCommand, (ProcedureExecution)exec);
row = this.procedureBatchHandler.padRow(row); List<?> row = this.procedureBatchHandler.getParameterRow(); if (row != null) { try {
StoredProcedure proc = (StoredProcedure)command; if (proc.returnParameters()) { this.procedureBatchHandler = new ProcedureBatchHandler((Call)translatedCommand, (ProcedureExecution)exec);
row = this.procedureBatchHandler.padRow(row); List<?> row = this.procedureBatchHandler.getParameterRow(); if (row != null) { try {
StoredProcedure proc = (StoredProcedure)command; if (proc.returnParameters()) { this.procedureBatchHandler = new ProcedureBatchHandler((Call)translatedCommand, (ProcedureExecution)exec);