Skip to content

execute(...) should be extended with returning generated keys #189

Closed
@SzalkaiGabor

Description

@SzalkaiGabor

Now it is not possible to create a one-to-one relationship with the execute statement, as if you do like this (see below), the flatMap won't be invoked.

databaseClient.execute("INSERT INTO table_a (something) VALUES (:something)")
                .bind("something", "id")
                .fetch().first()
                .flatMap {
                    databaseClient.execute("INSERT INTO table_b (something, table_a_id) VALUES (:something, :table_a_id)")
                            .bind("something", entry.parameters)
                            .bind("table_a_id", it["id"].toString().toLong())
                            .fetch().rowsUpdated()
                }
                .then()

Possible solutions (@mp911de):

We could either accept a Statement customizer or expose returnGeneratedKeys(…).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions