#9964: Transaction middleware closes the transaction only when it's marked as
dirty
---------------------------------------------------+------------------------
Reporter: ishirav | Owner:
mtredinnick
Status: assigned | Milestone: 1.1
Component: Database layer (models, ORM) | Version: 1.0-beta-1
Resolution: | Keywords:
transactions
Stage: Accepted | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------------+------------------------
Comment (by jdunck):
The obvious question is when set_dirty should be called; the description
of this ticket suggests that a transaction should be dirty even for a
transaction consisting only of selects. The problem with this is that
lots of transaction cycles are only selects, and committing a transaction
has overhead. I think select-only transactions should rollback by
default. If you're using triggers that munge data upon select, set_dirty
should be manually called; this can be clearly documented.
There's some overhead and fiddliness with db.connection.cursor.execute
looking at the string it receives in order to determine CUD operations.
Maybe backends.DatabaseOperations should have a .is_select(sql) hook?
Otherwise it'd be a decent compromise to just clearly document more that
only dirty transactions are committed, and that using cursor.execute does
not mark a transaction as dirty.
--
Ticket URL: <http://code.djangoproject.com/ticket/9964#comment:5>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---