Skip to content

Basic support for transactions#55

Merged
pimeys merged 3 commits intomasterfrom
token-tx
Jun 12, 2020
Merged

Basic support for transactions#55
pimeys merged 3 commits intomasterfrom
token-tx

Conversation

@pimeys
Copy link
Copy Markdown
Contributor

@pimeys pimeys commented Jun 12, 2020

With this change, it is possible to start, commit and rollback
transactions using the simple_query method in the Client. Querying
BEGIN TRAN will start a new transaction and store the current
transaction descriptor, adding it to the subsequent queries until
COMMIT or ROLLBACK happens.

Please be careful on always commiting or rolling back before subsequent
queries to always keep the transaction descriptor in a correct value.

This commit is a preliminary setup for allowing to use transactions.
Transaction management and automatic rollbacks should be implemented in
a separate pull request.

@pimeys pimeys self-assigned this Jun 12, 2020
@pimeys pimeys mentioned this pull request Jun 12, 2020
@pimeys
Copy link
Copy Markdown
Contributor Author

pimeys commented Jun 12, 2020

How this works:

When querying BEGIN TRAN, the stream will have an environment change token containing an id for the transaction. All subsequent RPC and batch messages must use this descriptor. In case of COMMIT or ROLLBACK, the server responds with an environment change token that then sets the current transaction id to 0.

With this change, it is possible to start, commit and rollback
transactions using the `simple_query` method in the `Client`. Querying
`BEGIN TRAN` will start a new transaction and store the current
transaction descriptor, adding it to the subsequent queries until
`COMMIT` or `ROLLBACK` happens.

Please be careful on always commiting or rolling back before subsequent
queries to always keep the transaction descriptor in a correct value.

This commit is a preliminary setup for allowing to use transactions.
Transaction management and automatic rollbacks should be implemented in
a separate pull request.
Copy link
Copy Markdown
Contributor

@tomhoule tomhoule left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@pimeys pimeys merged commit 73df5b4 into master Jun 12, 2020
@pimeys pimeys deleted the token-tx branch June 12, 2020 17:53
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.

2 participants