This commit is contained in:
hoteas 2017-12-03 18:38:03 +00:00
parent 80c7f64162
commit 4b37804b01

17
db.go
View File

@ -628,14 +628,19 @@ func (this *HoTimeDB) varCond(k string, v interface{}) (string, []interface{}) {
if reflect.ValueOf(v).Type().String() == "hotime.Slice" { if reflect.ValueOf(v).Type().String() == "hotime.Slice" {
where += "`" + k + "` IN (" where += "`" + k + "` IN ("
res = append(res, (v.(Slice))...) res = append(res, (v.(Slice))...)
for i := 0; i < len(v.(Slice)); i++ { if len(v.(Slice))==0{
if i+1 != len(v.(Slice)) { where+=") "
where += "?," }else{
} else { for i := 0; i < len(v.(Slice)); i++ {
where += "?) " if i+1 != len(v.(Slice)) {
where += "?,"
} else {
where += "?) "
}
//res=append(res,(v.(Slice))[i])
} }
//res=append(res,(v.(Slice))[i])
} }
} else { } else {
where += "`" + k + "`=? " where += "`" + k + "`=? "
res = append(res, v) res = append(res, v)