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

Multi insert should return multi generated keys

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 3.0.4
    • N/A
    • documentation
    • None

    Description

      The following test fails (same for prepared statements):

        @Test
        public void executeGeneratedMulti() throws SQLException {
          Statement stmt = sharedConn.createStatement();
          assertFalse(
              stmt.execute(
                  "INSERT INTO executeGenerated(t2) values (100), (200)", Statement.RETURN_GENERATED_KEYS));
          ResultSet rs = stmt.getGeneratedKeys();
          assertTrue(rs.next());
          assertEquals(1, rs.getInt(1));
          assertTrue(rs.next());
          assertEquals(2, rs.getInt(1));
          assertFalse(rs.next());
        }
      

      I would expect it to succeed.

      As in CONJ-735, CONJ-706 it seems that returning generated keys for multiple values is implemented in the driver as the database server only reports on the first inserted id. So one could argue that the behavior is ok, then I think it would be great to have this documented.

      Attachments

        Issue Links

          Activity

            People

              diego dupin Diego Dupin
              lennartfricke Lennart Fricke
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.