fix: ignore if not prepare stmt
This commit is contained in:
parent
484d162023
commit
07d355c82d
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@ _book
|
|||||||
.idea
|
.idea
|
||||||
vendor
|
vendor
|
||||||
.vscode
|
.vscode
|
||||||
|
.DS_Store
|
||||||
|
@ -617,7 +617,9 @@ func (db *DB) Transaction(fc func(tx *DB) error, opts ...*sql.TxOptions) (err er
|
|||||||
|
|
||||||
if committer, ok := db.Statement.ConnPool.(TxCommitter); ok && committer != nil {
|
if committer, ok := db.Statement.ConnPool.(TxCommitter); ok && committer != nil {
|
||||||
// nested transaction
|
// nested transaction
|
||||||
if !db.DisableNestedTransaction && (db.PrepareStmt && !db.DisablePrepareNestedTransaction) {
|
if !db.DisableNestedTransaction && (!db.PrepareStmt ||
|
||||||
|
(db.PrepareStmt && !db.DisablePrepareNestedTransaction)) {
|
||||||
|
|
||||||
err = db.SavePoint(fmt.Sprintf("sp%p", fc)).Error
|
err = db.SavePoint(fmt.Sprintf("sp%p", fc)).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user