[5.0] Compile Query Builder With Bindings

Followup PR from #5974. Much of the code is from that PR.

What is new here is that compiling a Builder not only returns the sql string but also the array of bindings which were previously stored as side effects on the builder. We introduce a CompiledQuery class that holds the sql string and the bindings array. It also takes care of a lot of the complexity of the concatenating and trimming sql string so the Grammar doesn't have to care about those details or imploding arrays of strings.

All unit tests pass as is with only a minor refactoring to allow us to assert the sql string and bindings in one helper method.