Show the SQL when we throw a SQL exception

@tberman, @matterkkila 

I got tired of trying to guess where the SQL errors were coming from, so I would like to add some kind of logging to show the bad SQL. Let me know if you think this is too broad of a brush.