Fix use SQL as table name

This commit is contained in:
Jinzhu 2015-05-19 10:43:32 +08:00
parent 371cd41204
commit dc55c59b84

View File

@ -261,6 +261,9 @@ func (scope *Scope) TableName() string {
func (scope *Scope) QuotedTableName() (name string) {
if scope.Search != nil && len(scope.Search.tableName) > 0 {
if strings.Index(scope.Search.tableName, " ") != -1 {
return scope.Search.tableName
}
return scope.Quote(scope.Search.tableName)
} else {
return scope.Quote(scope.TableName())