oracle数据库不再拼接AS (#2109)
修复 #2108 Co-authored-by: chendy <acrhwfy@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-on: https://gitea.com/xorm/xorm/pulls/2109 Co-authored-by: getsu <getsu@noreply.gitea.io> Co-committed-by: getsu <getsu@noreply.gitea.io>
This commit is contained in:
parent
d195040cb9
commit
b3f9c53d8a
|
@ -11,6 +11,7 @@ import (
|
|||
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"xorm.io/xorm/names"
|
||||
"xorm.io/xorm/schemas"
|
||||
)
|
||||
|
||||
// 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) {
|
||||
case []string:
|
||||
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]))
|
||||
} else if len(tt) == 1 {
|
||||
return quote(tt[0])
|
||||
|
@ -54,6 +58,9 @@ func TableNameNoSchema(dialect Dialect, mapper names.Mapper, tableName interface
|
|||
}
|
||||
}
|
||||
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])))
|
||||
} else if l == 1 {
|
||||
return quote(table)
|
||||
|
|
Loading…
Reference in New Issue