This commit is contained in:
Lunny Xiao 2020-02-29 15:24:11 +08:00
parent 046c6bc7e5
commit fe45068809
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
2 changed files with 9 additions and 4 deletions

View File

@ -63,9 +63,6 @@ func (session *Session) Commit() error {
SQL: "COMMIT", SQL: "COMMIT",
}) })
err := session.tx.Commit() err := session.tx.Commit()
if err != nil {
return err
}
session.engine.logger.AfterSQL(log.LogContext{ session.engine.logger.AfterSQL(log.LogContext{
Ctx: session.ctx, Ctx: session.ctx,
SQL: "COMMIT", SQL: "COMMIT",
@ -73,6 +70,10 @@ func (session *Session) Commit() error {
Err: err, Err: err,
}) })
if err != nil {
return err
}
// handle processors after tx committed // handle processors after tx committed
closureCallFunc := func(closuresPtr *[]func(interface{}), bean interface{}) { closureCallFunc := func(closuresPtr *[]func(interface{}), bean interface{}) {
if closuresPtr != nil { if closuresPtr != nil {

View File

@ -1,4 +1,4 @@
// Copyright 2017 The Xorm Authors. All rights reserved. // Copyright 2020 The Xorm Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
@ -37,4 +37,8 @@ func TestParseTableName(t *testing.T) {
table, err = parser.Parse(reflect.ValueOf(new(ParseTableName2))) table, err = parser.Parse(reflect.ValueOf(new(ParseTableName2)))
assert.NoError(t, err) assert.NoError(t, err)
assert.EqualValues(t, "p_parseTableName", table.Name) assert.EqualValues(t, "p_parseTableName", table.Name)
table, err = parser.Parse(reflect.ValueOf(ParseTableName2{}))
assert.NoError(t, err)
assert.EqualValues(t, "p_parseTableName", table.Name)
} }