-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable the capture of metadata for empty resultsets #1341
Comments
It doesn't work very nicely as a promise, so I'm currently testing with a Handler<RowSet>: Handler<RowSet<Row>> handler = null;
RowSet<Row> rowset = ar.result();
synchronized (this) {
readInProgress = false;
RowIterator<Row> it = rowset.iterator();
if (!metadataHandlerCalled) {
metadataHandlerCalled = true;
handler = metadataHandler;
}
if (it.hasNext()) {
result = it;
}
}
if (handler != null) {
handler.handle(rowset);
} |
can't you use the stream endHandler of the stream that will always be called ? |
RowStream#endHandler(Handler endHandler) RowSet<Row> rowset = ar.result();
synchronized (this) {
readInProgress = false;
RowIterator<Row> it = rowset.iterator();
this.columnDescriptors = rowset.columnDescriptors();
if (it.hasNext()) {
result = it;
}
}
checkPending(); With a getLastColumnDescriptors on the RowStream. |
what are the metadata you are referring to ? |
ah the column descriptor :-) |
I propose we add the metadata on the rowstream interface which returns the metadata of the current rowset until end is called ? |
Works for me. |
makes sense |
Describe the feature
Currently clients using PreparedStatements get no data back from a call to createStream if the query returns no rows.
I would like to be able to report the metadata for calls like this, even if no data is provided.
The method RowStreamImpl::handle(AsyncResult<RowSet> ar) gets called when there is no data and the RowSet that it receives seems to have the information.
I propose doing something like this:
With associated scaffolding to give callers access to the metadataPromise.
I'm happy with an alternative solution that achieves the aim.
Use cases
When using the data for reporting it is useful to be able to present the empty result set, rather than just nothing.
Contribution
Happy to provide a PR.
The text was updated successfully, but these errors were encountered: