Removing $transform param from Query::sql()

As pointed out by @markstory it was very confusing that the sql() method had two modes that could potentially return very different sql. I went back and realized it was a hack after all to workaround a bug which this PR fixes. This also has the side effect that the query is only processed once giving a small performance boost.