False condition on empty IN

This commit is contained in:
Ethan Koenig 2017-01-05 21:10:42 -05:00
parent 2189b36884
commit 0f675167d0
1 changed files with 3 additions and 1 deletions

View File

@ -196,7 +196,9 @@ func (statement *Statement) Or(query interface{}, args ...interface{}) *Statemen
// In generate "Where column IN (?) " statment
func (statement *Statement) In(column string, args ...interface{}) *Statement {
if len(args) == 0 {
return statement
// use a false condition, since there isn't an easy way to have
// an empty list in SQL
return statement.And("0=1")
}
in := builder.In(column, args...)