Skip to content

Redirect prepareStatment #123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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