use of org.teiid.client.RequestMessage in project teiid by teiid.
the class TestRequest method testCommandContext.
@Test
public void testCommandContext() throws Exception {
QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
// Try before plan is cached.
// If this doesn't throw an exception, assume it was successful.
RequestMessage message = new RequestMessage(QUERY);
DQPWorkContext workContext = RealMetadataFactory.buildWorkContext(metadata, RealMetadataFactory.example1VDB());
Request request = helpProcessMessage(message, null, workContext);
// $NON-NLS-1$
assertEquals("1", request.context.getConnectionId());
assertNotNull(request.context.getTransactionContext());
}
use of org.teiid.client.RequestMessage in project teiid by teiid.
the class StatementImpl method createRequestMessage.
protected RequestMessage createRequestMessage(String[] commands, boolean isBatchedCommand, ResultsMode resultsMode) {
RequestMessage reqMessage = new RequestMessage();
reqMessage.setCommands(commands);
reqMessage.setBatchedUpdate(isBatchedCommand);
reqMessage.setResultsMode(resultsMode);
return reqMessage;
}
use of org.teiid.client.RequestMessage in project teiid by teiid.
the class TestAllResultsImpl method exampleMessage.
private ResultsMessage exampleMessage(List<Object>[] results, String[] columnNames, String[] datatypes) {
RequestMessage request = new RequestMessage();
request.setExecutionId(REQUEST_ID);
ResultsMessage resultsMsg = new ResultsMessage();
resultsMsg.setResults(results);
resultsMsg.setColumnNames(columnNames);
resultsMsg.setDataTypes(datatypes);
resultsMsg.setFinalRow(results.length);
resultsMsg.setLastRow(results.length);
resultsMsg.setFirstRow(1);
return resultsMsg;
}
use of org.teiid.client.RequestMessage in project teiid by teiid.
the class TestCallableStatement method testGetOutputParameter.
@Test
public void testGetOutputParameter() throws Exception {
CallableStatementImpl mmcs = getCallableStatement();
RequestMessage request = new RequestMessage();
request.setExecutionId(1);
ResultsMessage resultsMsg = new ResultsMessage();
List<?>[] results = new List[] { Arrays.asList(null, null, null), Arrays.asList(null, 1, 2) };
resultsMsg.setResults(results);
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
resultsMsg.setColumnNames(new String[] { "IntNum", "Out1", "Out2" });
resultsMsg.setDataTypes(new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER });
resultsMsg.setFinalRow(results.length);
resultsMsg.setLastRow(results.length);
resultsMsg.setFirstRow(1);
resultsMsg.setParameters(Arrays.asList(new ParameterInfo(ParameterInfo.RESULT_SET, 1), new ParameterInfo(ParameterInfo.OUT, 1), new ParameterInfo(ParameterInfo.OUT, 1)));
mmcs.createResultSet(resultsMsg);
assertEquals(1, mmcs.getInt(1));
assertEquals(2, mmcs.getInt(2));
assertEquals(1, mmcs.getInt("Out1"));
assertEquals(2, mmcs.getInt("Out2"));
}
Aggregations