Is there a way to have a query- or transaction-level hook?
I want to:
- for every transaction, before statements are run, issue a query against the database to set settings
- for every query, if not in a transaction, open a transaction and set the setting, run the query, then close the transaction