Make sure all db accesses use subtransaction

Fixes bug 1133253

Change-Id: If952eaa919cdc7536023525a397e7a8ce4b425aa