Java Code Examples for org.apache.calcite.avatica.Meta#ConnectionHandle

The following examples show how to use org.apache.calcite.avatica.Meta#ConnectionHandle . 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: LocalService.java    From calcite-avatica with Apache License 2.0 5 votes vote down vote up
public ResultSetResponse apply(SchemasRequest request) {
  final Meta.ConnectionHandle ch =
      new Meta.ConnectionHandle(request.connectionId);
  final Meta.MetaResultSet resultSet =
      meta.getSchemas(ch, request.catalog, Meta.Pat.of(request.schemaPattern));
  return toResponse(resultSet);
}
 
Example 2
Source File: LocalService.java    From calcite-avatica with Apache License 2.0 5 votes vote down vote up
public ResultSetResponse apply(TablesRequest request) {
  final Meta.ConnectionHandle ch =
      new Meta.ConnectionHandle(request.connectionId);
  final Meta.MetaResultSet resultSet =
      meta.getTables(ch,
          request.catalog,
          Meta.Pat.of(request.schemaPattern),
          Meta.Pat.of(request.tableNamePattern),
          request.typeList);
  return toResponse(resultSet);
}
 
Example 3
Source File: LocalService.java    From calcite-avatica with Apache License 2.0 5 votes vote down vote up
public ResultSetResponse apply(ColumnsRequest request) {
  final Meta.ConnectionHandle ch =
      new Meta.ConnectionHandle(request.connectionId);
  final Meta.MetaResultSet resultSet =
      meta.getColumns(ch,
          request.catalog,
          Meta.Pat.of(request.schemaPattern),
          Meta.Pat.of(request.tableNamePattern),
          Meta.Pat.of(request.columnNamePattern));
  return toResponse(resultSet);
}
 
Example 4
Source File: LocalService.java    From calcite-avatica with Apache License 2.0 5 votes vote down vote up
public PrepareResponse apply(PrepareRequest request) {
  try (final Context ignore = prepareTimer.start()) {
    final Meta.ConnectionHandle ch =
        new Meta.ConnectionHandle(request.connectionId);
    final Meta.StatementHandle h =
        meta.prepare(ch, request.sql, request.maxRowCount);
    return new PrepareResponse(h, serverLevelRpcMetadata);
  }
}
 
Example 5
Source File: LocalService.java    From calcite-avatica with Apache License 2.0 5 votes vote down vote up
public ConnectionSyncResponse apply(ConnectionSyncRequest request) {
  try (final Context ignore = connectionSyncTimer.start()) {
    final Meta.ConnectionHandle ch =
        new Meta.ConnectionHandle(request.connectionId);
    final Meta.ConnectionProperties connProps =
        meta.connectionSync(ch, request.connProps);
    return new ConnectionSyncResponse(connProps, serverLevelRpcMetadata);
  }
}
 
Example 6
Source File: QuarkMetaImpl.java    From quark with Apache License 2.0 5 votes vote down vote up
@Override
public Meta.StatementHandle prepare(Meta.ConnectionHandle ch, String sql,
                                    long maxRowCount) {
  final Meta.StatementHandle h = createStatement(ch);
  final QuarkConnectionImpl quarkConnection = getConnection();

  QuarkJdbcStatement statement = quarkConnection.server.getStatement(h);
  statement.setSignature(h.signature);
  return h;
}
 
Example 7
Source File: LocalService.java    From calcite-avatica with Apache License 2.0 4 votes vote down vote up
public ResultSetResponse apply(CatalogsRequest request) {
  final Meta.ConnectionHandle ch =
      new Meta.ConnectionHandle(request.connectionId);
  final Meta.MetaResultSet resultSet = meta.getCatalogs(ch);
  return toResponse(resultSet);
}
 
Example 8
Source File: LocalService.java    From calcite-avatica with Apache License 2.0 4 votes vote down vote up
public ResultSetResponse apply(TableTypesRequest request) {
  final Meta.ConnectionHandle ch =
      new Meta.ConnectionHandle(request.connectionId);
  final Meta.MetaResultSet resultSet = meta.getTableTypes(ch);
  return toResponse(resultSet);
}
 
Example 9
Source File: LocalService.java    From calcite-avatica with Apache License 2.0 4 votes vote down vote up
public ResultSetResponse apply(TypeInfoRequest request) {
  final Meta.ConnectionHandle ch =
      new Meta.ConnectionHandle(request.connectionId);
  final Meta.MetaResultSet resultSet = meta.getTypeInfo(ch);
  return toResponse(resultSet);
}
 
Example 10
Source File: LocalService.java    From calcite-avatica with Apache License 2.0 4 votes vote down vote up
public CreateStatementResponse apply(CreateStatementRequest request) {
  final Meta.ConnectionHandle ch =
      new Meta.ConnectionHandle(request.connectionId);
  final Meta.StatementHandle h = meta.createStatement(ch);
  return new CreateStatementResponse(h.connectionId, h.id, serverLevelRpcMetadata);
}
 
Example 11
Source File: LocalService.java    From calcite-avatica with Apache License 2.0 4 votes vote down vote up
public OpenConnectionResponse apply(OpenConnectionRequest request) {
  final Meta.ConnectionHandle ch =
      new Meta.ConnectionHandle(request.connectionId);
  meta.openConnection(ch, request.info);
  return new OpenConnectionResponse(serverLevelRpcMetadata);
}
 
Example 12
Source File: LocalService.java    From calcite-avatica with Apache License 2.0 4 votes vote down vote up
public CloseConnectionResponse apply(CloseConnectionRequest request) {
  final Meta.ConnectionHandle ch =
      new Meta.ConnectionHandle(request.connectionId);
  meta.closeConnection(ch);
  return new CloseConnectionResponse(serverLevelRpcMetadata);
}
 
Example 13
Source File: LocalService.java    From calcite-avatica with Apache License 2.0 4 votes vote down vote up
public DatabasePropertyResponse apply(DatabasePropertyRequest request) {
  final Meta.ConnectionHandle ch =
      new Meta.ConnectionHandle(request.connectionId);
  return new DatabasePropertyResponse(meta.getDatabaseProperties(ch), serverLevelRpcMetadata);
}