use of org.apache.ignite.client.proto.query.event.JdbcMetaSchemasRequest in project ignite-3 by apache.
the class JdbcDatabaseMetadata method getSchemas.
/**
* {@inheritDoc}
*/
@Override
public ResultSet getSchemas(String catalog, String schemaPtrn) throws SQLException {
conn.ensureNotClosed();
final List<JdbcColumnMeta> meta = asList(new JdbcColumnMeta("TABLE_SCHEM", String.class), new JdbcColumnMeta("TABLE_CATALOG", String.class));
if (!isValidCatalog(catalog)) {
return new JdbcResultSet(Collections.emptyList(), meta);
}
JdbcMetaSchemasResult res = conn.handler().schemasMetaAsync(new JdbcMetaSchemasRequest(schemaPtrn)).join();
if (!res.hasResults()) {
throw IgniteQueryErrorCode.createJdbcSqlException(res.err(), res.status());
}
List<List<Object>> rows = new LinkedList<>();
for (String schema : res.schemas()) {
List<Object> row = new ArrayList<>(2);
row.add(schema);
row.add(CATALOG_NAME);
rows.add(row);
}
return new JdbcResultSet(rows, meta);
}
Aggregations