Hacker News new | ask | show | jobs
by freilanzer 631 days ago
Php has nothing like this?

In [1]: "... WHERE " + " AND ".join(str(i) for i in range(4))

Out[1]: '... WHERE 0 AND 1 AND 2 AND 3'

Very strange.

1 comments

This will produce broken SQL on empty clauses list. Very strange.
You're quite right, but this is easily fixed. That doesn't change my question, since something like this is much easier that the other logic.
The easiest fix for this is the "WHERE 1=1" or "WHERE true"