On Wed, Sep 1, 2010 at 2:13 PM, Maciej Jaros egil@wp.pl wrote:
Not exactly. If you know you can and should commit transaction called for example "article_update" then it's OK. If you want to commit "image_insert_and_update" then it's OK too. If you are making a commit for everything that is started then it doesn't seem OK as pointed out by Platonides in his example.
When it comes to locks, you can't commit only some things and not others, at least not on MySQL. Locks are only released if you commit everything, so to release locks, you do need to commit everything. I don't think we can avoid this, but we can raise warnings so that we know where the places are, and see if we can figure out some way to fix them -- like by moving the sensitive queries to the very end of the transaction and removing the nested transaction.
I don't think naming is necessary. As long as begin() is always paired correctly with commit()/rollback(), we should be fine. Adding a name parameter would make sense as an error-catching measure, though.