getGeneratedKeys execute methods should disallow empty or null arrays [JDBC567] #599
Labels
affect-version: Jaybird 2.2.12
affect-version: Jaybird 2.2.13
affect-version: Jaybird 2.2.14
affect-version: Jaybird 3.0.0
affect-version: Jaybird 3.0.1
affect-version: Jaybird 3.0.2
affect-version: Jaybird 3.0.3
affect-version: Jaybird 3.0.4
affect-version: Jaybird 3.0.5
component: jdbc driver
fix-version: Jaybird 4
priority: major
resolution: fixed
type: bug
Submitted by: @mrotteveel
Although inconsistently documented, JDBC requires that the columnIndexes and columnNames array are non-null and non-empty for statements that are capable of generating keys. For example Statement.executeUpdate(String sql, int[] columnIndexes) in Java 11 specifies:
"""
[..]
The driver will ignore the array if the SQL statement is not an INSERT statement, or an SQL statement able to return auto-generated keys (the list of such statements is vendor-specific).
[..]
Throws:
SQLException - if [..] the second argument supplied to this method is not an int array whose elements are valid column indexes
"""
Jaybird currently allows this for generated keys statement and executes as if it is a non-generated keys method if the array is null or empty, or ignores the invalid column index if there are other columns present. Instead an exception should be thrown.
The text was updated successfully, but these errors were encountered: