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

Introduce DB#InsertObtainID() function #64

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

yhabteab
Copy link
Member

This PR introduces an auxiliary DB function for inserting and retrieving the last inserted ID with both the PostreSQL and MySQL drivers. Since the MySQL driver supports/provides LastInsertId() natively, there's nothing special that this function needs to do. On the other hand, PostgreSQL doesn't provide such functionality on its own, so you have to append a special RETURNING id text to the query you want to execute and scan the result into a given dest of your own.

cherry-picked from #18

@yhabteab yhabteab added the enhancement New feature or request label Aug 14, 2024
@yhabteab yhabteab self-assigned this Aug 14, 2024
@cla-bot cla-bot bot added the cla/signed CLA is signed by all contributors of a PR label Aug 14, 2024
@yhabteab yhabteab requested review from lippserd, julianbrost and oxzi and removed request for lippserd and julianbrost August 14, 2024 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla/signed CLA is signed by all contributors of a PR enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants