Skip to content
This repository has been archived by the owner on Jun 24, 2020. It is now read-only.

Ability too access mappable result for executing INSERT statement #66

Closed
aboodz opened this issue Jun 23, 2020 · 1 comment
Closed

Ability too access mappable result for executing INSERT statement #66

aboodz opened this issue Jun 23, 2020 · 1 comment

Comments

@aboodz
Copy link

aboodz commented Jun 23, 2020

Feature Request

Is your feature request related to a problem? Please describe

While playing around with r2dbc, I wanted to read the returned results from an INSERT. Given the table TEST with columns ID and DESCRIPTION, when insert a row like this (postgres):

handle.execute("INSERT INTO TEST VALUES (1$, $2) RETURNING ID", 1, "bla")

I found out that that execute() always maps the result into an integer that shows the number of affected rows. I was wishing to be able to read the result of the query. I am aware that not all databases supports RETURNING in INSERT

Describe the solution you'd like

being able to access the result using .mapResult or .map

Describe alternatives you've considered

An alternative way to get the ID is to pre-set from the provided value. Another solution for sequence id is to read them using a select query before executing the INSERT statement

@mp911de
Copy link
Member

mp911de commented Jun 24, 2020

Closing this ticket as we're archiving the repository. See #63.

@mp911de mp911de closed this as completed Jun 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants