Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[CONJ-706] revert correction that has to be done in 2.5.0, not in 2.4.x
  • Loading branch information
rusher committed Jun 17, 2019
1 parent b8721c9 commit fc4a288
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Expand Up @@ -128,6 +128,15 @@ public ResultSet getGeneratedKeys(Protocol protocol) {
return SelectResultSet.createEmptyResultSet();
}

//to be removed in 2.5.0. cannot in 2.4.x
if (updateCount > 1) {
long[] insertIds = new long[(int) updateCount];
for (int i = 0; i < updateCount; i++) {
insertIds[i] = insertId + i * autoIncrement;
}
return SelectResultSet.createGeneratedData(insertIds, protocol, true);
}

return SelectResultSet.createGeneratedData(new long[]{insertId}, protocol, true);
}

Expand Down
3 changes: 2 additions & 1 deletion src/test/java/org/mariadb/jdbc/MultiTest.java
Expand Up @@ -1401,7 +1401,8 @@ public void shouldDuplicateKeyUpdateNotReturnExtraRows() throws Throwable {
try (ResultSet rs = pstmt.getGeneratedKeys()) {
assertTrue(rs.next());
assertEquals(1, rs.getInt(1));
assertFalse(rs.next());
//will be corrected in 2.5.0
//assertTrue(rs.next());
}
}
}
Expand Down

0 comments on commit fc4a288

Please sign in to comment.