Fix BatchSql errors

Backport of #3016 that is binary compatible, and deprecates erroneous
ways of using BatchSql.
Merge pull request #3087 from jroper/3016-anarm-batch-query-backport

Fix statement preparation in batch (No longer use SqlQuery at batch creation)