aboutsummaryrefslogtreecommitdiffstats
path: root/models/db/engine.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/db/engine.go')
-rwxr-xr-xmodels/db/engine.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/models/db/engine.go b/models/db/engine.go
index 93cf5ad8bc..2c329300e3 100755
--- a/models/db/engine.go
+++ b/models/db/engine.go
@@ -287,3 +287,12 @@ func GetMaxID(beanOrTableName interface{}) (maxID int64, err error) {
_, err = x.Select("MAX(id)").Table(beanOrTableName).Get(&maxID)
return maxID, err
}
+
+func SetLogSQL(ctx context.Context, on bool) {
+ e := GetEngine(ctx)
+ if x, ok := e.(*xorm.Engine); ok {
+ x.ShowSQL(on)
+ } else if sess, ok := e.(*xorm.Session); ok {
+ sess.Engine().ShowSQL(on)
+ }
+}