call after-events after autoincrement id set back to struct field

This commit is contained in:
Lunny Xiao 2016-09-16 20:30:33 +08:00
parent 4c7f48fa65
commit 5ae5bc982a
3 changed files with 4 additions and 5 deletions

View File

@ -1 +1 @@
xorm v0.5.5.0907
xorm v0.5.5.0916

View File

@ -3156,7 +3156,6 @@ func (session *Session) innerInsert(bean interface{}) (int64, error) {
colPlaces)
handleAfterInsertProcessorFunc := func(bean interface{}) {
if session.IsAutoCommit {
for _, closure := range session.afterClosures {
closure(bean)
@ -3189,7 +3188,6 @@ func (session *Session) innerInsert(bean interface{}) (int64, error) {
if session.Engine.dialect.DBType() == core.ORACLE && len(table.AutoIncrement) > 0 {
//assert table.AutoIncrement != ""
res, err := session.query("select seq_atable.currval from dual", args...)
if err != nil {
return 0, err
}
@ -3281,7 +3279,8 @@ func (session *Session) innerInsert(bean interface{}) (int64, error) {
if err != nil {
return 0, err
}
handleAfterInsertProcessorFunc(bean)
defer handleAfterInsertProcessorFunc(bean)
if cacher := session.Engine.getCacher2(table); cacher != nil && session.Statement.UseCache {
session.cacheInsert(session.Statement.TableName())

View File

@ -17,7 +17,7 @@ import (
const (
// Version show the xorm's version
Version string = "0.5.5.0907"
Version string = "0.5.5.0916"
)
func regDrvsNDialects() bool {