Fixes some Analyzer issues and switches to using ? bind parameters on ATTACH in rekey