use of org.teiid.client.ResultsMessage in project teiid by teiid.
the class TestAllResultsImpl method helpGetNoResults.
private ResultSetImpl helpGetNoResults(int type) throws SQLException {
ResultsMessage rsMsg = exampleResultsMsg3();
statement = TestResultSet.createMockStatement(type);
ResultSetImpl rs = new ResultSetImpl(rsMsg, statement);
return rs;
}
use of org.teiid.client.ResultsMessage in project teiid by teiid.
the class TestAllResultsImpl method testDateType.
@Test
public void testDateType() throws SQLException {
RequestMessage request = new RequestMessage();
request.setExecutionId(REQUEST_ID);
ResultsMessage resultsMsg = new ResultsMessage();
resultsMsg.setResults(new List[] { Arrays.asList(new Timestamp(0)) });
// $NON-NLS-1$
resultsMsg.setColumnNames(new String[] { "TS" });
resultsMsg.setDataTypes(new String[] { DataTypeManager.DefaultDataTypes.TIMESTAMP });
resultsMsg.setFirstRow(1);
resultsMsg.setFinalRow(1);
resultsMsg.setLastRow(1);
ResultSetImpl rs = new ResultSetImpl(resultsMsg, statement);
assertTrue(rs.next());
// assumes the mock statement is setup with GMT-5 server and GMT-6 client
// will adjust ahead one hour
assertEquals(new Timestamp(3600000), rs.getObject(1));
// will be the same as the original
// $NON-NLS-1$
assertEquals(new Timestamp(0), rs.getTimestamp(1, Calendar.getInstance(TimeZone.getTimeZone("GMT-05:00"))));
}
use of org.teiid.client.ResultsMessage in project teiid by teiid.
the class TestAllResultsImpl method helpGetResultSetImpl.
private ResultSetImpl helpGetResultSetImpl(int type) throws SQLException {
ResultsMessage rsMsg = exampleResultsMsg2();
statement = TestResultSet.createMockStatement(type);
ResultSetImpl rs = new ResultSetImpl(rsMsg, statement);
return rs;
}
use of org.teiid.client.ResultsMessage in project teiid by teiid.
the class TestAllResultsImpl method exampleResultsMsg4.
static ResultsMessage exampleResultsMsg4(int begin, int length, boolean lastBatch) {
RequestMessage request = new RequestMessage();
request.setExecutionId(REQUEST_ID);
ResultsMessage resultsMsg = new ResultsMessage();
List[] results = exampleResults1(length, begin);
resultsMsg.setResults(results);
// $NON-NLS-1$
resultsMsg.setColumnNames(new String[] { "IntKey" });
resultsMsg.setDataTypes(new String[] { DataTypeManager.DefaultDataTypes.INTEGER });
resultsMsg.setFirstRow(begin);
if (lastBatch) {
resultsMsg.setFinalRow(begin + results.length - 1);
}
resultsMsg.setLastRow(begin + results.length - 1);
return resultsMsg;
}
use of org.teiid.client.ResultsMessage in project teiid by teiid.
the class RequestWorkItem method sendError.
private void sendError() {
ResultsReceiver<ResultsMessage> receiver = null;
synchronized (this) {
receiver = this.resultsReceiver;
this.resultsReceiver = null;
if (receiver == null) {
// $NON-NLS-1$
LogManager.logDetail(LogConstants.CTX_DQP, processingException, "Unable to send error to client as results were already sent.", requestID);
return;
}
}
// $NON-NLS-1$
LogManager.logDetail(LogConstants.CTX_DQP, processingException, "Sending error to client", requestID);
ResultsMessage response = new ResultsMessage();
Throwable exception = this.processingException;
if (this.options.isSanitizeMessages() && !LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
// we still convey an exception hierarchy here because the client logic looks for certian exception types
exception = ExceptionUtil.sanitize(exception, false);
}
if (isCanceled) {
exception = addCancelCode(exception);
}
setWarnings(response);
response.setException(exception);
setAnalysisRecords(response);
receiver.receiveResults(response);
}
Aggregations