This commit is contained in:
slene 2014-01-04 00:04:15 +08:00
parent 20cfece1ab
commit ef79a2b484
2 changed files with 10 additions and 3 deletions

View File

@ -461,6 +461,8 @@ func (d *dbBase) deleteRels(q dbQuerier, mi *modelInfo, args []interface{}, tz *
func (d *dbBase) DeleteBatch(q dbQuerier, qs *querySet, mi *modelInfo, cond *Condition, tz *time.Location) (int64, error) {
tables := newDbTables(mi, d.ins)
tables.skipEnd = true
if qs != nil {
tables.parseRelated(qs.related, qs.relDepth)
}

View File

@ -23,6 +23,7 @@ type dbTables struct {
tables []*dbTable
mi *modelInfo
base dbBaser
skipEnd bool
}
func (t *dbTables) set(names []string, mi *modelInfo, fi *fieldInfo, inner bool) *dbTable {
@ -221,9 +222,13 @@ func (t *dbTables) parseExprs(mi *modelInfo, exprs []string) (index, name string
inner = false
}
jt, _ := t.add(names, mmi, fi, inner)
jt.jtl = jtl
jtl = jt
if num == i && t.skipEnd {
} else {
jt, _ := t.add(names, mmi, fi, inner)
jt.jtl = jtl
jtl = jt
}
}
if num == i {