Skip to content
This repository has been archived by the owner on Sep 7, 2021. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.

Commit

Permalink
bug fixed for gogs/gogs#3928 introduced by 64b3df6
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Dec 24, 2016
1 parent 3ad0b42 commit d75356f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -2240,6 +2240,7 @@ func (session *Session) Insert(beans ...interface{}) (int64, error) {
if session.IsAutoClose {
defer session.Close()
}
defer session.resetStatement()

for _, bean := range beans {
sliceValue := reflect.Indirect(reflect.ValueOf(bean))
Expand All @@ -2248,15 +2249,13 @@ func (session *Session) Insert(beans ...interface{}) (int64, error) {
if size > 0 {
if session.Engine.SupportInsertMany() {
cnt, err := session.innerInsertMulti(bean)
//session.resetStatement()
if err != nil {
return affected, err
}
affected += cnt
} else {
for i := 0; i < size; i++ {
cnt, err := session.innerInsert(sliceValue.Index(i).Interface())
//session.resetStatement()
if err != nil {
return affected, err
}
Expand All @@ -2266,7 +2265,6 @@ func (session *Session) Insert(beans ...interface{}) (int64, error) {
}
} else {
cnt, err := session.innerInsert(bean)
//session.resetStatement()
if err != nil {
return affected, err
}
Expand Down

0 comments on commit d75356f

Please sign in to comment.