summaryrefslogtreecommitdiffstats
path: root/vendor/xorm.io/xorm/session.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2020-07-21 20:28:27 +0800
committerGitHub <noreply@github.com>2020-07-21 20:28:27 +0800
commit45631083a452534b988b2ecc583e9258216562cd (patch)
treecb0fbdb0f971a3c41567f27b4c8c1dbd7547da72 /vendor/xorm.io/xorm/session.go
parented8e064f5ea53dd4012b26cfbe7dcde681e63dc2 (diff)
downloadgitea-45631083a452534b988b2ecc583e9258216562cd.tar.gz
gitea-45631083a452534b988b2ecc583e9258216562cd.zip
Support use nvarchar for all varchar columns when using mssql (#12269)
* Support use nvarchar for all varchar columns when using mssql * fix lint * Change DEFAULT_VARCHAR to nvarchar * Remove the config for default varchar since it's unnecessary
Diffstat (limited to 'vendor/xorm.io/xorm/session.go')
-rw-r--r--vendor/xorm.io/xorm/session.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/vendor/xorm.io/xorm/session.go b/vendor/xorm.io/xorm/session.go
index 761b14152f..48b3779eff 100644
--- a/vendor/xorm.io/xorm/session.go
+++ b/vendor/xorm.io/xorm/session.go
@@ -102,12 +102,12 @@ func newSessionID() string {
func newSession(engine *Engine) *Session {
var ctx context.Context
if engine.logSessionID {
- ctx = context.WithValue(engine.defaultContext, log.SessionIDKey, newSessionID())
+ ctx = context.WithValue(engine.defaultContext, log.SessionIDKey, newSessionID())
} else {
ctx = engine.defaultContext
}
- return &Session{
+ session := &Session{
ctx: ctx,
engine: engine,
tx: nil,
@@ -136,6 +136,10 @@ func newSession(engine *Engine) *Session {
sessionType: engineSession,
}
+ if engine.logSessionID {
+ session.ctx = context.WithValue(session.ctx, log.SessionKey, session)
+ }
+ return session
}
// Close release the connection from pool
@@ -165,6 +169,10 @@ func (session *Session) db() *core.DB {
return session.engine.db
}
+func (session *Session) Engine() *Engine {
+ return session.engine
+}
+
func (session *Session) getQueryer() core.Queryer {
if session.tx != nil {
return session.tx