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

5
db.go
View File

@ -628,6 +628,9 @@ 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))...)
if len(v.(Slice))==0{
where+=") "
}else{
for i := 0; i < len(v.(Slice)); i++ { for i := 0; i < len(v.(Slice)); i++ {
if i+1 != len(v.(Slice)) { if i+1 != len(v.(Slice)) {
where += "?," where += "?,"
@ -636,6 +639,8 @@ func (this *HoTimeDB) varCond(k string, v interface{}) (string, []interface{}) {
} }
//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)