org.apache.calcite.avatica.Meta.CursorFactory Java Examples

The following examples show how to use org.apache.calcite.avatica.Meta.CursorFactory. 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: 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);
}
 
Example #2
Source File: QuicksqlConnectionImpl.java    From Quicksql with MIT License 5 votes vote down vote up
public Signature mockPreparedSignature(String sql) {
    List<AvaticaParameter> params = new ArrayList<AvaticaParameter>();
    int startIndex = 0;
    while (sql.indexOf("?", startIndex) >= 0) {
        AvaticaParameter param = new AvaticaParameter(false, 0, 0, 0, null, null, null);
        params.add(param);
        startIndex = sql.indexOf("?", startIndex) + 1;
    }

    ArrayList<ColumnMetaData> columns = new ArrayList<ColumnMetaData>();
    Map<String, Object> internalParams = Collections.<String, Object> emptyMap();

    return new Meta.Signature(columns, sql, params, internalParams, CursorFactory.ARRAY, Meta.StatementType.SELECT);
}
 
Example #3
Source File: KylinConnection.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
Signature mockPreparedSignature(String sql) {
    List<AvaticaParameter> params = new ArrayList<AvaticaParameter>();
    int startIndex = 0;
    while (sql.indexOf("?", startIndex) >= 0) {
        AvaticaParameter param = new AvaticaParameter(false, 0, 0, 0, null, null, null);
        params.add(param);
        startIndex = sql.indexOf("?", startIndex) + 1;
    }

    ArrayList<ColumnMetaData> columns = new ArrayList<ColumnMetaData>();
    Map<String, Object> internalParams = Collections.<String, Object> emptyMap();

    return new Meta.Signature(columns, sql, params, internalParams, CursorFactory.ARRAY, Meta.StatementType.SELECT);
}
 
Example #4
Source File: KylinConnection.java    From kylin with Apache License 2.0 5 votes vote down vote up
Signature mockPreparedSignature(String sql) {
    List<AvaticaParameter> params = new ArrayList<AvaticaParameter>();
    int startIndex = 0;
    while (sql.indexOf("?", startIndex) >= 0) {
        AvaticaParameter param = new AvaticaParameter(false, 0, 0, 0, null, null, null);
        params.add(param);
        startIndex = sql.indexOf("?", startIndex) + 1;
    }

    ArrayList<ColumnMetaData> columns = new ArrayList<ColumnMetaData>();
    Map<String, Object> internalParams = Collections.<String, Object> emptyMap();

    return new Meta.Signature(columns, sql, params, internalParams, CursorFactory.ARRAY, Meta.StatementType.SELECT);
}