Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/main/java/org/duckdb/DuckDBConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import org.duckdb.user.DuckDBUserArray;
import org.duckdb.user.DuckDBUserStruct;

import static java.sql.Statement.NO_GENERATED_KEYS;

public final class DuckDBConnection implements java.sql.Connection {

/** Name of the DuckDB default schema. */
Expand Down Expand Up @@ -294,11 +296,19 @@ public CallableStatement prepareCall(String sql, int resultSetType, int resultSe
}

public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
throw new SQLFeatureNotSupportedException("prepareStatement");
if (autoGeneratedKeys == NO_GENERATED_KEYS) {
return prepareStatement(sql);
} else {
return prepareStatement(sql, (String[]) null);
}
}

public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
throw new SQLFeatureNotSupportedException("prepareStatement");
if (columnIndexes != null && columnIndexes.length == 0) {
return prepareStatement(sql);
} else {
throw new SQLFeatureNotSupportedException("prepareStatement: returning autogenerated keys is not supported");
}
}

public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
Expand Down