mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Upgrade xorm to v1.0.4 (#12694)
This commit is contained in:
45
vendor/xorm.io/xorm/session_tx.go
generated
vendored
45
vendor/xorm.io/xorm/session_tx.go
generated
vendored
@@ -4,12 +4,6 @@
|
||||
|
||||
package xorm
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/log"
|
||||
)
|
||||
|
||||
// Begin a transaction
|
||||
func (session *Session) Begin() error {
|
||||
if session.isAutoCommit {
|
||||
@@ -33,24 +27,7 @@ func (session *Session) Rollback() error {
|
||||
session.isCommitedOrRollbacked = true
|
||||
session.isAutoCommit = true
|
||||
|
||||
start := time.Now()
|
||||
needSQL := session.DB().NeedLogSQL(session.ctx)
|
||||
if needSQL {
|
||||
session.engine.logger.BeforeSQL(log.LogContext{
|
||||
Ctx: session.ctx,
|
||||
SQL: "ROLL BACK",
|
||||
})
|
||||
}
|
||||
err := session.tx.Rollback()
|
||||
if needSQL {
|
||||
session.engine.logger.AfterSQL(log.LogContext{
|
||||
Ctx: session.ctx,
|
||||
SQL: "ROLL BACK",
|
||||
ExecuteTime: time.Now().Sub(start),
|
||||
Err: err,
|
||||
})
|
||||
}
|
||||
return err
|
||||
return session.tx.Rollback()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -62,25 +39,7 @@ func (session *Session) Commit() error {
|
||||
session.isCommitedOrRollbacked = true
|
||||
session.isAutoCommit = true
|
||||
|
||||
start := time.Now()
|
||||
needSQL := session.DB().NeedLogSQL(session.ctx)
|
||||
if needSQL {
|
||||
session.engine.logger.BeforeSQL(log.LogContext{
|
||||
Ctx: session.ctx,
|
||||
SQL: "COMMIT",
|
||||
})
|
||||
}
|
||||
err := session.tx.Commit()
|
||||
if needSQL {
|
||||
session.engine.logger.AfterSQL(log.LogContext{
|
||||
Ctx: session.ctx,
|
||||
SQL: "COMMIT",
|
||||
ExecuteTime: time.Now().Sub(start),
|
||||
Err: err,
|
||||
})
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
if err := session.tx.Commit(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user