Java Code Examples for org.apache.calcite.avatica.remote.Service#ResultSetResponse

The following examples show how to use org.apache.calcite.avatica.remote.Service#ResultSetResponse . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QuicksqlRemoteMeta.java    From Quicksql with MIT License 6 votes vote down vote up
private MetaResultSet toResultSet(Class clazz,
    Service.ResultSetResponse response) {
  if (response.updateCount != -1) {
    return MetaResultSet.count(response.connectionId, response.statementId,
        response.updateCount);
  }
  Signature signature0 = response.signature;
  if (signature0 == null) {
    final List<ColumnMetaData> columns =
        clazz == null
            ? Collections.<ColumnMetaData>emptyList()
            : fieldMetaData(clazz).columns;
    signature0 = Signature.create(columns,
        "?", Collections.<AvaticaParameter>emptyList(), CursorFactory.ARRAY,
        StatementType.SELECT);
  }
  return MetaResultSet.create(response.connectionId, response.statementId,
      response.ownStatement, signature0, response.firstFrame);
}
 
Example 2
Source File: JsonHandlerTest.java    From calcite-avatica with Apache License 2.0 6 votes vote down vote up
@Override public ExecuteResponse apply(ExecuteRequest request) {
  expectedParameterValues.addAll(request.parameterValues);

  final Meta.Signature signature =
      new Meta.Signature(Collections.<ColumnMetaData>emptyList(),
          "SELECT 1 FROM VALUE()",
          Collections.<AvaticaParameter>emptyList(),
          Collections.<String, Object>emptyMap(),
          CursorFactory.LIST, Meta.StatementType.SELECT);

  final Service.ResultSetResponse resultSetResponse =
      new Service.ResultSetResponse(UUID.randomUUID().toString(),
          RANDOM.nextInt(), false, signature, Meta.Frame.EMPTY, -1L, null);

  return new Service.ExecuteResponse(
      Collections.singletonList(resultSetResponse), false, null);
}