[CONJ-284] Cannot read autoincremented IDs bigger than Short.MAX_VALUE Created: 2016-04-21 Updated: 2016-05-03 Resolved: 2016-04-22 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | Other |
| Affects Version/s: | 1.4.0, 1.4.1, 1.4.2 |
| Fix Version/s: | 1.4.3 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Christian Ciach | Assignee: | Diego Dupin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Fedora Core 23 x64, connecting to 10.1.13-MariaDB MariaDB Server |
||
| Description |
|
When inserting a new row using a PreparedStatement into a table with an auto incremented ID, the connector returns a negative ID if the actual generated ID is greater than 32767. I've nailed this down to this method: org.mariadb.jdbc.internal.util.buffer.Buffer.getLengthEncodedBinary() In version 1.3.7, where this still works, the method contains this snippet:
In version 1.4.2, where it's broken, it looks like this:
I think this bug is insanely critical. |
| Comments |
| Comment by Diego Dupin [ 2016-04-21 ] |
|
After inserting a data, server return insert ids that can be accessed with Statement.getGeneratedKeys(). Example : an insert id on 2 bytes with the 0x9c40 (40000) value will be inserted well, but driver will return a wrong value of return as id -25536. That is indeed more than critical, priority changed to blocker. A correction will be release tomorrow. |