forked from mirror/gorm
ToSQL should enable SkipDefaultTransaction by default
This commit is contained in:
parent
4e523499d1
commit
29a8557384
2
gorm.go
2
gorm.go
|
@ -462,7 +462,7 @@ func (db *DB) Use(plugin Plugin) error {
|
||||||
// .First(&User{})
|
// .First(&User{})
|
||||||
// })
|
// })
|
||||||
func (db *DB) ToSQL(queryFn func(tx *DB) *DB) string {
|
func (db *DB) ToSQL(queryFn func(tx *DB) *DB) string {
|
||||||
tx := queryFn(db.Session(&Session{DryRun: true}))
|
tx := queryFn(db.Session(&Session{DryRun: true, SkipDefaultTransaction: true}))
|
||||||
stmt := tx.Statement
|
stmt := tx.Statement
|
||||||
|
|
||||||
return db.Dialector.Explain(stmt.SQL.String(), stmt.Vars...)
|
return db.Dialector.Explain(stmt.SQL.String(), stmt.Vars...)
|
||||||
|
|
Loading…
Reference in New Issue