Java gRPC processing result set
After executing a query, a response returns rows that match the SELECT statement.
If there are no rows, the returned payload is unset.
The convenience function getResultSet()
is provided to help transform this
response into a result set that’s easier to work with.
QueryOuterClass.ResultSet rs = queryString.getResultSet();
for (Row row : rs.getRowsList()) {
System.out.println(""
+ "FirstName=" + row.getValues(0).getString() + ", "
+ "lastname=" + row.getValues(1).getString());
}
Since the result type is known, the getString
function transforms the value into a native string.
Additional functions also exist for other types such as int
, map
, and blob
.
The full list can be found in
Values.java.