Skip to content
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

Support RETURNING for MariaDB #177

Closed
mirromutth opened this issue Dec 21, 2023 · 0 comments · Fixed by #201
Closed

Support RETURNING for MariaDB #177

mirromutth opened this issue Dec 21, 2023 · 0 comments · Fixed by #201
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@mirromutth
Copy link
Contributor

mirromutth commented Dec 21, 2023

MariaDB 10.5.1+ support to use INSERT ... RETURNING col1[, col2[, col3...]] for returns a result-set of the inserted rows. The response looks like the execution result of a SELECT statement, and the last OkMessage will NOT contain the updated rows.

It will change the logic of MySqlStatement.returnGeneratedValues in MariaDB 10.5.1+ .

See also https://mariadb.com/kb/en/insertreturning/

@mirromutth mirromutth added the enhancement New feature or request label Dec 21, 2023
@mirromutth mirromutth self-assigned this Jan 15, 2024
@mirromutth mirromutth linked a pull request Jan 17, 2024 that will close this issue
jchrys pushed a commit that referenced this issue Jan 19, 2024
Motivation:

Add `RETURNING` clause support for MariaDB 10.5.1+ .

See also #177 .

Modification:

Add `RETURNING` clause in `MySqlStatement#returnGeneratedValues` and
query message packets.

Result:

For MariaDB 10.5.1 and above, `MySqlStatement#returnGeneratedValues`
will use `RETURNING` clause instead of `LAST_INSERT_ID`.

Notice:

For MariaDB 10.5.0 and below, `MySqlStatement#returnGeneratedValues`
will still use `LAST_INSERT_ID` due to these versions do not support
`RETURNING` clause.
@jchrys jchrys added this to the 1.1.0/0.10.0 milestone Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants