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

Finish savepoints #21103

Merged
merged 3 commits into from
Jun 3, 2020
Merged

Finish savepoints #21103

merged 3 commits into from
Jun 3, 2020

Conversation

roji
Copy link
Member

@roji roji commented Jun 1, 2020

Finishes off the work started in #20710, see separate commits.

Closes #20176

Note that we still have the open question of whether savepoint APIs should be exposed on IDbContextTransactionManager - this is not dealt with here.

Savepoint syntax across databases

Database Save Rollback Release
SQL Server SAVE { TRAN | TRANSACTION } ROLLBACK { TRAN | TRANSACTION } N/A
SQLite SAVEPOINT ROLLBACK [ TRANSACTION ] TO [ SAVEPOINT ] RELEASE [ SAVEPOINT ]
PostgreSQL SAVEPOINT ROLLBACK [ WORK | TRANSACTION ] TO [ SAVEPOINT ] RELEASE [ SAVEPOINT ]
MySQL SAVEPOINT ROLLBACK [ WORK ] TO [ SAVEPOINT ] RELEASE SAVEPOINT
Oracle SAVEPOINT ROLLBACK [ WORK ] TO [ SAVEPOINT ] N/A

Based on the above, this PR has the following default SQL:

  • SAVEPOINT <name> for save
  • ROLLBACK TO <name> for rollback
  • RELEASE SAVEPOINT <name> for release

@roji roji force-pushed the FinishSavepoints branch 2 times, most recently from c76b14d to d7c72d2 Compare June 2, 2020 08:00
@roji roji force-pushed the FinishSavepoints branch 2 times, most recently from eac571e to e71a834 Compare June 2, 2020 23:19
roji added 3 commits June 3, 2020 09:15
Subclasses of RelationalTransaction now only have to provide the SQL
to manage savepoints, and RelationalTransaction does the rest. Default
SQL is defined to support most databases.
Rather than aligning with the less-than-ideal ADO.NET names
(Save/Rollback/Release), switch to CreateSavepoint/RollbackToSavepoint/
ReleaseSavepoint.
@roji roji merged commit 14f13ef into master Jun 3, 2020
@roji roji deleted the FinishSavepoints branch June 3, 2020 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use savepoints to roll back to before SaveChanges for user-managed transactions
2 participants