void receiveResults(AtomicResultsMessage response, boolean partial) { this.arm = response; this.scope = response.getScope(); if (this.scope != null) { this.aqr.getCommandContext().setDeterminismLevel(CachingTupleSource.getDeterminismLevel(this.scope)); } explicitClose |= !arm.supportsImplicitClose(); rowsProcessed += response.getResults().length; index = 0; if (response.getWarnings() != null) { for (Exception warning : response.getWarnings()) { SourceWarning sourceFailure = new SourceWarning(this.aqr.getModelName(), aqr.getConnectorName(), warning, partial); this.aqr.getCommandContext().addWarning(sourceFailure); } } if (response.getFinalRow() >= 0) { done = true; } }
AtomicResultsMessage exceptionOccurred(TranslatorException exception) throws TeiidComponentException, TeiidProcessingException { if(workItem.requestMsg.supportsPartialResults()) { AtomicResultsMessage emptyResults = new AtomicResultsMessage(new List[0]); emptyResults.setWarnings(Arrays.asList((Exception)exception)); emptyResults.setFinalRow(this.rowsProcessed); return emptyResults; } fullyCloseSource(); if (exception.getCause() instanceof TeiidComponentException) { throw (TeiidComponentException)exception.getCause(); } if (exception.getCause() instanceof TeiidProcessingException) { throw (TeiidProcessingException)exception.getCause(); } throw new TeiidProcessingException(QueryPlugin.Event.TEIID30504, exception, this.getConnectorName() + ": " + exception.getMessage()); //$NON-NLS-1$ }
response.setSupportsImplicitClose(!this.securityContext.keepExecutionAlive() && !explicitClose); response.setWarnings(this.securityContext.getWarnings()); if (this.securityContext.getCacheDirective() != null) { response.setScope(this.securityContext.getCacheDirective().getScope()); (response.getScope() == null || response.getScope().compareTo(this.securityContext.getScope()) > 0)) { response.setScope(this.securityContext.getScope()); response.setFinalRow(rowCount);
@Test public void testBatchUpdateExecution() throws Throwable { AtomicResultsMessage results = helpExecuteUpdate(true, false); assertEquals(2, results.getResults().length); assertEquals(Integer.valueOf(1), results.getResults()[0].get(0)); assertEquals(1, results.getResults()[1].get(0)); }
cwi.execute(); AtomicResultsMessage message = cwi.more(); List[] results = message.getResults(); assertEquals(1, results.length); List<?> tuple = results[0]; assertEquals(1, tuple.get(0)); assertEquals(1, message.getFinalRow());
cwi.execute(); AtomicResultsMessage message = cwi.more(); List[] resutls = message.getResults(); assertTrue(message.supportsImplicitClose()); cwi.execute(); message = cwi.more(); resutls = message.getResults(); assertFalse(message.supportsImplicitClose()); cwi.execute(); message = cwi.more(); resutls = message.getResults(); assertFalse(message.supportsImplicitClose());
try { results = currentResults.get(); if (results.getFinalRow() < 0) { addWork();
@Override public AtomicResultsMessage more() throws TranslatorException { if (dataNotAvailable != null) { int delay = dataNotAvailable; dataNotAvailable = null; DataNotAvailableException dnae = new DataNotAvailableException(delay); dnae.setStrict(strict); throw dnae; } if (addWarning) { msg.setWarnings(Arrays.asList(new Exception())); } if (!returnedInitial) { returnedInitial = true; return msg; } throw new RuntimeException("Should not be called"); //$NON-NLS-1$ }
@Test public void testExecutionWarning() throws Throwable { AtomicResultsMessage results = helpExecuteUpdate(false, false); assertEquals(1, results.getWarnings().size()); }
public static AtomicResultsMessage createResultsMessage(List<?>[] batch) { return new AtomicResultsMessage(batch); }
msg.setFinalRow(rows); return new ConnectorWork() {
response.setSupportsImplicitClose(!this.securityContext.keepExecutionAlive() && !explicitClose); response.setWarnings(this.securityContext.getWarnings()); if (this.securityContext.getCacheDirective() != null) { response.setScope(this.securityContext.getCacheDirective().getScope()); (response.getScope() == null || response.getScope().compareTo(this.securityContext.getScope()) > 0)) { response.setScope(this.securityContext.getScope()); response.setFinalRow(rowCount);
@Test public void testBatchUpdateExecutionSingleResult() throws Throwable { AtomicResultsMessage results = helpExecuteUpdate(true, true); assertEquals(2, results.getResults().length); assertEquals(Integer.valueOf(1), results.getResults()[0].get(0)); assertEquals(1, results.getResults()[1].get(0)); }
cwi.execute(); AtomicResultsMessage message = cwi.more(); List[] results = message.getResults(); assertEquals(1, results.length); List<?> tuple = results[0]; assertEquals(1, tuple.get(0)); assertEquals(-1, message.getFinalRow()); try { cwi.more();
try { results = currentResults.get(); if (results.getFinalRow() < 0) { addWork();
public static AtomicResultsMessage createResultsMessage(List<?>[] batch) { return new AtomicResultsMessage(batch); }
void receiveResults(AtomicResultsMessage response, boolean partial) { this.arm = response; this.scope = response.getScope(); if (this.scope != null) { this.aqr.getCommandContext().setDeterminismLevel(CachingTupleSource.getDeterminismLevel(this.scope)); } explicitClose |= !arm.supportsImplicitClose(); rowsProcessed += response.getResults().length; index = 0; if (response.getWarnings() != null) { for (Exception warning : response.getWarnings()) { SourceWarning sourceFailure = new SourceWarning(this.aqr.getModelName(), aqr.getConnectorName(), warning, partial); this.aqr.getCommandContext().addWarning(sourceFailure); } } if (response.getFinalRow() >= 0) { done = true; } }
response.setSupportsImplicitClose(!this.securityContext.keepExecutionAlive() && !explicitClose); response.setWarnings(this.securityContext.getWarnings()); if (this.securityContext.getCacheDirective() != null) { response.setScope(this.securityContext.getCacheDirective().getScope()); (response.getScope() == null || response.getScope().compareTo(this.securityContext.getScope()) > 0)) { response.setScope(this.securityContext.getScope()); response.setFinalRow(rowCount);
AtomicResultsMessage exceptionOccurred(TranslatorException exception) throws TeiidComponentException, TeiidProcessingException { if(workItem.requestMsg.supportsPartialResults()) { AtomicResultsMessage emptyResults = new AtomicResultsMessage(new List[0]); emptyResults.setWarnings(Arrays.asList((Exception)exception)); emptyResults.setFinalRow(this.rowsProcessed); return emptyResults; } fullyCloseSource(); if (exception.getCause() instanceof TeiidComponentException) { throw (TeiidComponentException)exception.getCause(); } if (exception.getCause() instanceof TeiidProcessingException) { throw (TeiidProcessingException)exception.getCause(); } throw new TeiidProcessingException(QueryPlugin.Event.TEIID30504, exception, this.getConnectorName() + ": " + exception.getMessage()); //$NON-NLS-1$ }
@Test public void testUpdateExecution() throws Throwable { AtomicResultsMessage results = helpExecuteUpdate(false, true); assertEquals(Integer.valueOf(1), results.getResults()[0].get(0)); }