rockdai / sql-bricks

Transparent, Schemaless SQL Generation
http://csnw.github.io/sql-bricks
MIT License
213 stars 25 forks source link

Fix doubled params #80

Closed prust closed 8 years ago

prust commented 8 years ago

This addresses @Koblaid's #79.

The problem was that the Join.toString() was unnecessarily running handleTable() on both tables -- as if it was adding them to the string output as part of the JOIN clause, but it wasn't. And the side-effect of running handleTable() is that the parameters got re-added.

This fixes the symptom, but I'm not sure it fully fixes the underlying problem. I should verify whether handleTable() should have side-effects and if so, whether it's called anywhere else that it shouldn't be, whether a similar problem can still happen if the subquery is the right table in the join, etc.

But I'm going to go ahead & merge this for now, since it does fix the issue.