Menu

Commit [r9808]  Maximize  Restore  History

env: unify `get_db_cnx` with `get_read_db`.

As ''transaction-safe'' usage of db connection require the use of `with_transaction`, the legacy `get_db_cnx` which was used to indifferently get connections for reading or for writing should not be used anymore. However, as we continue to support it for 0.12.x, it can nevertheless be made aware of the new mechanism by doing the same thing as `get_read_db`:
- when used for reading, it can therefore benefit from the immediate reuse of the thread-local Connection used for the transaction in progress, if there is one
- when used for writing, what happens is not worse than before, the "explicit" transaction management (i.e. the `commit` pairing the `get_db_cnx`) may terminate a transaction sooner than wanted, in the case this was a nested transaction

cboos 2010-06-01

changed /trunk/trac/admin/tests/console.py
changed /trunk/trac/db/util.py
changed /trunk/trac/env.py
changed /trunk/trac/test.py
/trunk/trac/admin/tests/console.py Diff Switch to side-by-side view
Loading...
/trunk/trac/db/util.py Diff Switch to side-by-side view
Loading...
/trunk/trac/env.py Diff Switch to side-by-side view
Loading...
/trunk/trac/test.py Diff Switch to side-by-side view
Loading...