Skip to content

jdbc: map Tarantool/SQL types into JDBC/Java types #92

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

Closed
Totktonada opened this issue Nov 19, 2018 · 13 comments
Closed

jdbc: map Tarantool/SQL types into JDBC/Java types #92

Totktonada opened this issue Nov 19, 2018 · 13 comments
Labels
Milestone

Comments

@Totktonada
Copy link
Member

Tarantool 2.1 now support static types. Currently supported types are described on wiki. We need to map Tarantool/SQL types to JDBC types in DatabaseMetaData.getColumns, ResultSetMetaData.getColumnType and other related methods.

@Totktonada Totktonada added this to the JDBC MVP milestone Nov 19, 2018
@Totktonada
Copy link
Member Author

INTEGER Tarantool/SQL type is wider then long Java type. We need to provide (and test) ability to set prepared statement values to, say, 2^64 and read such value from result set. A community people says a user can use setString() or setObject() to provide big integer value, so we need to support (and test) such cases. I think we also can provide more natural API with a method like setBigInteger().

@Totktonada
Copy link
Member Author

Related: #27.

@Totktonada
Copy link
Member Author

See also #130 and tarantool/tarantool#4019

@Totktonada
Copy link
Member Author

Boolean was instroduced in 2.2: tarantool/tarantool#3648

@Totktonada
Copy link
Member Author

Note: A SCALAR field can hold types other then msgpack bin. We need to handle and test this appropriately.

@Totktonada
Copy link
Member Author

See #209 and #210 re integer types in tarantool-2.2.

@Totktonada
Copy link
Member Author

See #214 re VARBINARY type in tarantool-2.2.

@Totktonada
Copy link
Member Author

We should consider the commit 2.2.0-632-g36bdfbb24 ('sql: rename REAL/FLOAT/DOUBLE types to NUMBER') which is first released in tarantool-2.2.1. There is no good way to determine whether REAL/FLOAT/DOUBLE is supported or NUMBER. @kostja says we should drop support for tarantool versions below 2.2.1 in the scope of JDBC work. Maybe this is the only good way to handle this.

@Totktonada
Copy link
Member Author

We discussed a bit the problem with floating point types. I suggest to do the following:

  • Consider real/float/double as pure floating point types: as if they cannot store integral values—at least from metainfo point of view. Insert 2, select 2 should work I think. Enable tests for them on 2.1.
  • Support 'number' on 2.2.1 and above. Disable float/real/double on 2.2.0 and above.
  • State that all currently supported JDBC features should work since tarantool-2.2.1 in a next release notes for tarantool-java.

@Totktonada
Copy link
Member Author

See also tarantool/tarantool@b7d595a

nicktorwald added a commit that referenced this issue Aug 23, 2019
There are a few new types such as BOOLEAN(BOOL), UNSIGNED, and VARBINARY
in Tarantool v2.2. Moreover, Number aliases REAL, FLOAT, DOUBLE were
replaced by one NUMBER type since v2.2.1.

Support tests for old number types on version before 2.2.

Closes: #209, #210, #214
Affects: #92
@nicktorwald
Copy link

In scope of #218 the following things were done:

  1. Support BOOL / BOOLEAN type (according to sql: introduce type <Boolean> tarantool#3648)
  2. Support UNSIGNED type (jdbc: support UNSIGNED type #210, sql: support UNSIGNED type tarantool#4015)
  3. Support INTEGER values bigger than 2^63-1 up to 2^64-1 via BigInteger (jdbc: support -2^63 .. 2^64-1 integer type #209, sql: support UNSIGNED type tarantool#4015)
  4. Support VARBINARY type (jdbc: support VARBINARY type #214, Introduce VARBINARY type in SQL frontend tarantool#4206)
  5. REAL/FLOAT/DOUBLE types are supported as number aliases before v2.2
  6. Support NUMBER for decimal values since 2.2.1
  7. Test SCALAR against different msgpack types rather than msgbin.

next issues remain:
JDBC types conversion (appendix B)

Data Type Conversions
The recommended ResultSet getter method for each JDBC type is shown in B.6 on page B-198. This table also shows all of the possible conversions that a JDBC driver may support. The method DataBaseMetaData.supportsConvert(int fromType, int toType) returns true if the driver supports the given conversion.

It also includes ResultSet.getObject family methods, PreparedStatement.setObject family methods, and implicit conversions between types defined in Appendix B.

@Totktonada
Copy link
Member Author

Nice! I think we can close this issue with PR #218 and file a new one about type conversions.

nicktorwald added a commit that referenced this issue Aug 30, 2019
There are a few new types such as BOOLEAN(BOOL), UNSIGNED, and VARBINARY
in Tarantool v2.2. Moreover, Number aliases REAL, FLOAT, DOUBLE were
replaced by one NUMBER type since v2.2.1.

Support tests for old number types on version before 2.2.

Closes: #67, #92, #209, #210
nicktorwald added a commit that referenced this issue Aug 30, 2019
There are a few new types such as BOOLEAN(BOOL), UNSIGNED, and VARBINARY
in Tarantool v2.2. Moreover, Number aliases REAL, FLOAT, DOUBLE were
replaced by one NUMBER type since v2.2.1.

Support tests for old number types on version before 2.2.

Closes: #67, #92, #209, #210
@nicktorwald
Copy link

done in commit 2cc1a09

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants