Merge branch 'master' into lunny/fix_859
This commit is contained in:
commit
04ba00c090
|
@ -11,6 +11,7 @@ import (
|
||||||
|
|
||||||
"xorm.io/xorm/internal/utils"
|
"xorm.io/xorm/internal/utils"
|
||||||
"xorm.io/xorm/names"
|
"xorm.io/xorm/names"
|
||||||
|
"xorm.io/xorm/schemas"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TableNameWithSchema will add schema prefix on table name if possible
|
// TableNameWithSchema will add schema prefix on table name if possible
|
||||||
|
@ -29,6 +30,9 @@ func TableNameNoSchema(dialect Dialect, mapper names.Mapper, tableName interface
|
||||||
switch tt := tableName.(type) {
|
switch tt := tableName.(type) {
|
||||||
case []string:
|
case []string:
|
||||||
if len(tt) > 1 {
|
if len(tt) > 1 {
|
||||||
|
if dialect.URI().DBType == schemas.ORACLE {
|
||||||
|
return fmt.Sprintf("%v %v", quote(tt[0]), quote(tt[1]))
|
||||||
|
}
|
||||||
return fmt.Sprintf("%v AS %v", quote(tt[0]), quote(tt[1]))
|
return fmt.Sprintf("%v AS %v", quote(tt[0]), quote(tt[1]))
|
||||||
} else if len(tt) == 1 {
|
} else if len(tt) == 1 {
|
||||||
return quote(tt[0])
|
return quote(tt[0])
|
||||||
|
@ -54,6 +58,9 @@ func TableNameNoSchema(dialect Dialect, mapper names.Mapper, tableName interface
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if l > 1 {
|
if l > 1 {
|
||||||
|
if dialect.URI().DBType == schemas.ORACLE {
|
||||||
|
return fmt.Sprintf("%v %v", quote(table), quote(fmt.Sprintf("%v", tt[1])))
|
||||||
|
}
|
||||||
return fmt.Sprintf("%v AS %v", quote(table), quote(fmt.Sprintf("%v", tt[1])))
|
return fmt.Sprintf("%v AS %v", quote(table), quote(fmt.Sprintf("%v", tt[1])))
|
||||||
} else if l == 1 {
|
} else if l == 1 {
|
||||||
return quote(table)
|
return quote(table)
|
||||||
|
|
|
@ -757,7 +757,7 @@ func (session *Session) incrVersionFieldValue(fieldValue *reflect.Value) {
|
||||||
|
|
||||||
// Context sets the context on this session
|
// Context sets the context on this session
|
||||||
func (session *Session) Context(ctx context.Context) *Session {
|
func (session *Session) Context(ctx context.Context) *Session {
|
||||||
if session.ctx != nil {
|
if session.engine.logSessionID && session.ctx != nil {
|
||||||
ctx = context.WithValue(ctx, log.SessionIDKey, session.ctx.Value(log.SessionIDKey))
|
ctx = context.WithValue(ctx, log.SessionIDKey, session.ctx.Value(log.SessionIDKey))
|
||||||
ctx = context.WithValue(ctx, log.SessionKey, session.ctx.Value(log.SessionKey))
|
ctx = context.WithValue(ctx, log.SessionKey, session.ctx.Value(log.SessionKey))
|
||||||
ctx = context.WithValue(ctx, log.SessionShowSQLKey, session.ctx.Value(log.SessionShowSQLKey))
|
ctx = context.WithValue(ctx, log.SessionShowSQLKey, session.ctx.Value(log.SessionShowSQLKey))
|
||||||
|
|
Loading…
Reference in New Issue