(PDB-660) Wrap old query->sql in transacted connection

The older query->sql code for resources needs an open transaction to perform
a lookup needed for array comparison.

This wraps just that code in a transaction, since its only really needed for
the older API versions this will eventually be retired.

Signed-off-by: Ken Barber <ken@bob.sh>