Modify BaseQuery to be self-building

Builder now injects itself into the query, to allow the query to write itself.

- add `getSql` and `__toString` to BaseQuery
- add `setBuilder` and `getBuilder` to BaseQuery
- GenericBuilder calls `setBuilder` to inject itself into each query it creates