Db memory leak fix #5568

PR to test for and fix memory leak from issue #5568

The leak was due to a circular dependency between JoinClause and QueryBuilder, which meant neither object was eligible for garbage collection.

QueryBuilder had a dependency on JoinClause to add "on" bindings, but these can be stored internally on the JoinClause object, and added to the QueryBuilder when compiling the join in the Grammar object.

This removes the dependency and allows expected GC to take place.
Wonders if this is always going to work on every single request. `1` value different could already cause assertion to fail.