in reply to using dbi to set database variables

You can execute arbitrary SQL statements with execute (or do if you don't need to fetch any results), so I don't understand how this is a DBI issue.