Return `null` when applicable from `getGeneratedKeys`
Currently, there is no way to check if `getGeneratedKeys` returned `null`. Instead, when trying to call `ResultSet.next()` a `NullPointerException` is thrown. This method [should return an empty `ResultSet` when there are no generated keys]( https://docs.oracle.com/javase/8/docs/api/java/sql/Statement.html#getGeneratedKeys--), but not all JDBC drivers do (like [Apache](pull/2180/head4253dcf4aa/java/org.apache.derby.client/org/apache/derby/client/am/ClientStatement.java (L271)
) [Derby](4253dcf4aa/java/org.apache.derby.client/org/apache/derby/client/am/ClientStatement.java (L1378-L1394)
)) In these cases, I think the safest option is to return `null`, which can then be checked (and is checked in popular JDBC libraries [like JOOQ.](181d838797/jOOQ/src/main/java/org/jooq/impl/AbstractDMLQuery.java (L1350-L1352)
))
parent
0a6ccdb334
commit
6bb7d8759d
Loading…
Reference in New Issue