PDO Prepares Optimization

Moved the prepares out of the foreach, where we were calling it
potentially several hundred times to just be called once and re-used.