Skip to content

Doc issue? What is the proper way of using JDBC PreparedStatement with STRUCT and/or MAP? #208

Open
@wernerdaehn

Description

@wernerdaehn

I have looked into the code and the DuckDBConnection class has methods like createMap() and createStruct(). The DuckDBPreparedStatement.setObject() does not reveal anything either.

This is what I ended up with for Map:

CREATE TABLE "commit" ("commit_id" VARCHAR, "producer_name" VARCHAR, "topic_name" VARCHAR,
  "commit_epoch_ns" BIGINT, "record_count" INTEGER, "max_offsets" MAP(VARCHAR, BIGINT));

insertstmt.setObject(fieldpos, conn.createMap("MAP(VARCHAR,BIGINT)", new HashMap<>()));

Would be good to add examples to the JDBC client documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions