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

Correctly close cursors and databases, use transactions. #169

Closed
wants to merge 2 commits into from

Conversation

Xenega
Copy link

@Xenega Xenega commented Aug 5, 2015

Best practice with cursors and databases is to always close in finally clauses. It's avoid to leak opened cursors or opened databases (cause of bug).
When updating multiple tables, best practice is to use a transaction to ensure data coherence (also improve the performance).

@pocmo
Copy link
Owner

pocmo commented Sep 26, 2015

There's a typo in your code: transition <-> transaction. :)

In addition to that: We do not need to perform a transaction if we are just reading values (Beginning of AddServerActivity).

I like moving to the try/final pattern and having the transaction for adding identify and server in one atomic operation. Well done! :)

@pocmo pocmo closed this Sep 26, 2015
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.

None yet

2 participants