Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-284

Cannot read autoincremented IDs bigger than Short.MAX_VALUE

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.4.0, 1.4.1, 1.4.2
    • Fix Version/s: 1.4.3
    • Component/s: Other
    • 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:

      case (byte) 0xfc: //252
           return (long) 0xffff & readShort();
      

      In version 1.4.2, where it's broken, it looks like this:

      case 252:
          return readShort();
      

      I think this bug is insanely critical.

        Attachments

          Activity

            People

            Assignee:
            diego dupin Diego Dupin
            Reporter:
            cciach Christian Ciach
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: