-
Notifications
You must be signed in to change notification settings - Fork 19
Provide a result set object for noSQL API #211
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
Comments
After #7 we can also provide a way to extract a field from a tuple by its name, not only by an id. |
Extend an TarantoolClient API to be able to get data using type safe methods and conversions. Closes: #211
This commit introduces a new API to handle TarantoolClient result. The concept is similar to the JDBC ResultSet in terms of a getting the data using rows ans columns. Instead of a guessing-style processing the result via List<?>, TarantoolResultSet offers set of typed methods to retrieve the data or get an error if the result cannot be represented as the designated type. Latter case requires to declare formal rules of a casting between the types. In scope of this commit it is supported 11 standard types and conversions between each other. These types are byte, short, int, long, float, double, boolean, BigInteger, BigDecimal, String, and byte[]. Closes: #211
This commit introduces a new API to handle TarantoolClient result. The concept is similar to the JDBC ResultSet in terms of a getting the data using rows ans columns. Instead of a guessing-style processing the result via List<?>, TarantoolResultSet offers set of typed methods to retrieve the data or get an error if the result cannot be represented as the designated type. Latter case requires to declare formal rules of a casting between the types. In scope of this commit it is supported 11 standard types and conversions between each other. These types are byte, short, int, long, float, double, boolean, BigInteger, BigDecimal, String, and byte[]. Closes: #211
Another case, which appears from time to time: a user of the Java connector wants to get binary response data as byte[], but the connector parses msgpack string values into String and may report a unicode decoding error. |
NB: We should give a user API to unpack call / eval result in the similar way as for a value from a result set. |
There are several reasons to do so:
List<?>
and types inside are mapped from msgpack values).I think we need to support type convertions under hood at least for integers: say, 16 bits value can be acquired as 32 bits one. We should detect an overflow and raise an exception in the case.
It worth to keep in a mind ResultSet API from JDBC. I hope there are more things that are handled in related JDBC API to aware of, except type conversions.
We may catch an API from the alternative connector: https://github.com/isopov/tarantool-java-driver/blob/88485aca0895f4069517284c6e3e79caf00b0024/tarantool-driver/src/test/java/com/sopovs/moradanen/tarantool/TarantoolClientImplTest.java#L413-L418
The text was updated successfully, but these errors were encountered: