Search in sources :

Example 1 with ResultSetMetadata

use of org.apache.ignite.internal.sql.engine.ResultSetMetadata in project ignite-3 by apache.

the class JdbcQueryEventHandlerImpl method queryMetadataAsync.

/**
 * {@inheritDoc}
 */
@Override
public CompletableFuture<JdbcMetaColumnsResult> queryMetadataAsync(JdbcQueryMetadataRequest req) {
    SqlCursor<List<?>> cur = openCursors.get(req.cursorId());
    if (cur == null) {
        return CompletableFuture.completedFuture(new JdbcMetaColumnsResult(Response.STATUS_FAILED, "Failed to find query cursor with ID: " + req.cursorId()));
    }
    ResultSetMetadata metadata = cur.metadata();
    if (metadata == null) {
        return CompletableFuture.completedFuture(new JdbcMetaColumnsResult(Response.STATUS_FAILED, "Failed to get query metadata for cursor with ID : " + req.cursorId()));
    }
    List<JdbcColumnMeta> meta = metadata.fields().stream().map(this::createColumnMetadata).collect(Collectors.toList());
    return CompletableFuture.completedFuture(new JdbcMetaColumnsResult(meta));
}
Also used : ResultSetMetadata(org.apache.ignite.internal.sql.engine.ResultSetMetadata) JdbcMetaColumnsResult(org.apache.ignite.client.proto.query.event.JdbcMetaColumnsResult) List(java.util.List) IntArrayList(it.unimi.dsi.fastutil.ints.IntArrayList) ArrayList(java.util.ArrayList) IntList(it.unimi.dsi.fastutil.ints.IntList) JdbcColumnMeta(org.apache.ignite.client.proto.query.event.JdbcColumnMeta)

Aggregations

IntArrayList (it.unimi.dsi.fastutil.ints.IntArrayList)1 IntList (it.unimi.dsi.fastutil.ints.IntList)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 JdbcColumnMeta (org.apache.ignite.client.proto.query.event.JdbcColumnMeta)1 JdbcMetaColumnsResult (org.apache.ignite.client.proto.query.event.JdbcMetaColumnsResult)1 ResultSetMetadata (org.apache.ignite.internal.sql.engine.ResultSetMetadata)1