DuckDBConnection.prepareStatement methods could be less strict

Open
#82 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
58/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Stale
Tech stack
java, sql
Domain
database

Research direction

Start in src/main/java/org/duckdb/DuckDBConnection.java around the prepareStatement overloads near line 296, and compare their current stub behavior with the no-generated-keys call described in the issue. Done means eligible calls no longer fail solely because the overload was used, while unsupported generated-key requests retain their existing error behavior.

Written by the indexing model from the issue text.

Description

The prepareStatement methods in DuckDBConnection here:
https://github.com/duckdb/duckdb-java/blob/f7ae8cb492d5ffedec1042fbcfacc14ea3e03de5/src/main/java/org/duckdb/DuckDBConnection.java#L296

are currently all stubbed with throw new SQLFeatureNotSupportedException("prepareStatement").

Until they are fully implemented, they could be rewritten so that certain calls may proceed if generated keys are not required. For instance, the call at L296 could be rewritten to:

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

These methods as written are currently keeping me from utilizing duckdb with the Jetbrains Exposed API, because the connection wrappers call prepareStatement([sql], NO_GENERATED_KEYS) instead of prepareStatement([sql]).

Dominant language
C++
Stars
127
Forks
80
Avg merge
13h 41m
Merged PRs (30d)
44

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from duckdb/duckdb-java

All issues in duckdb/duckdb-java

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.